From 55ed2a73653fb2fb9dee36c729c09177df2d5b4e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 8 Apr 2009 23:29:18 +0200 Subject: st: If the hw supports it do hw conversion of texture uploads --- src/mesa/state_tracker/st_cb_texture.c | 164 ++++++++++++++++++++++++++++++++- 1 file changed, 160 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 57c0544ba8..e68c3d87ee 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -110,6 +110,25 @@ compressed_num_bytes(GLuint mesaFormat) } +static GLboolean +is_compressed_mesa_format(const struct gl_texture_format *format) +{ + switch (format->MesaFormat) { + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + /** called via ctx->Driver.NewTextureImage() */ static struct gl_texture_image * st_NewTextureImage(GLcontext * ctx) @@ -378,6 +397,110 @@ strip_texture_border(GLint border, } +/** + * Try to do texture compression via rendering. If the Gallium driver + * can render into a compressed surface this will allow us to do texture + * compression. + * \return GL_TRUE for success, GL_FALSE for failure + */ +static GLboolean +compress_with_blit(GLcontext * ctx, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *unpack, + struct gl_texture_image *texImage) +{ + const GLuint dstImageOffsets[1] = {0}; + struct st_texture_image *stImage = st_texture_image(texImage); + struct pipe_screen *screen = ctx->st->pipe->screen; + const GLuint face = _mesa_tex_target_to_face(target); + const struct gl_texture_format *mesa_format; + struct pipe_texture templ; + struct pipe_texture *src_tex; + struct pipe_surface *dst_surface; + struct pipe_transfer *tex_xfer; + void *map; + + + if (!stImage->pt) { + /* XXX: Can this happen? Should we assert? */ + return GL_FALSE; + } + + /* get destination surface (in the compressed texture) */ + dst_surface = screen->get_tex_surface(screen, stImage->pt, + stImage->face, stImage->level, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + if (!dst_surface) { + /* can't render into this format (or other problem) */ + return GL_FALSE; + } + + /* Choose format for the temporary RGBA texture image. + */ + mesa_format = st_ChooseTextureFormat(ctx, GL_RGBA, format, type); + assert(mesa_format); + if (!mesa_format) + return GL_FALSE; + + /* Create the temporary source texture + */ + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.format = st_mesa_format_to_pipe_format(mesa_format->MesaFormat); + pf_get_block(templ.format, &templ.block); + templ.width[0] = width; + templ.height[0] = height; + templ.depth[0] = 1; + templ.last_level = 0; + templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + src_tex = screen->texture_create(screen, &templ); + + if (!src_tex) + return GL_FALSE; + + /* Put user's tex data into the temporary texture + */ + tex_xfer = screen->get_tex_transfer(screen, src_tex, + face, level, 0, + PIPE_TRANSFER_WRITE, + 0, 0, width, height); /* x, y, w, h */ + map = screen->transfer_map(screen, tex_xfer); + + mesa_format->StoreImage(ctx, 2, GL_RGBA, mesa_format, + map, /* dest ptr */ + 0, 0, 0, /* dest x/y/z offset */ + tex_xfer->stride, /* dest row stride (bytes) */ + dstImageOffsets, /* image offsets (for 3D only) */ + width, height, 1, /* size */ + format, type, /* source format/type */ + pixels, /* source data */ + unpack); /* source data packing */ + + screen->transfer_unmap(screen, tex_xfer); + screen->tex_transfer_destroy(tex_xfer); + + /* copy / compress image */ + util_blit_pixels_tex(ctx->st->blit, + src_tex, /* pipe_texture (src) */ + 0, 0, /* src x0, y0 */ + width, height, /* src x1, y1 */ + dst_surface, /* pipe_surface (dst) */ + xoffset, yoffset, /* dst x0, y0 */ + xoffset + width, /* dst x1 */ + yoffset + height, /* dst y1 */ + 0.0, /* z */ + PIPE_TEX_MIPFILTER_NEAREST); + + pipe_surface_reference(&dst_surface, NULL); + pipe_texture_reference(&src_tex, NULL); + + return GL_TRUE; +} + + /** * Do glTexImage1/2/3D(). */ @@ -392,8 +515,9 @@ st_TexImage(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, struct gl_texture_object *texObj, struct gl_texture_image *texImage, - GLsizei imageSize, GLboolean compressed) + GLsizei imageSize, GLboolean compressed_src) { + struct pipe_screen *screen = ctx->st->pipe->screen; struct st_texture_object *stObj = st_texture_object(texObj); struct st_texture_image *stImage = st_texture_image(texImage); GLint postConvWidth, postConvHeight; @@ -522,7 +646,7 @@ st_TexImage(GLcontext * ctx, * the expectation that the texture will be set up but nothing * more will be done. This is where those calls return: */ - if (compressed) { + if (compressed_src) { pixels = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, pixels, unpack, "glCompressedTexImage"); @@ -535,6 +659,21 @@ st_TexImage(GLcontext * ctx, if (!pixels) return; + /* See if we can do texture compression with a blit/render. + */ + if (!compressed_src && + !ctx->Mesa_DXTn && + is_compressed_mesa_format(texImage->TexFormat) && + screen->is_format_supported(screen, + stImage->pt->format, + stImage->pt->target, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth, + format, type, pixels, unpack, texImage)) { + return; + } + } + if (stImage->pt) { texImage->Data = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE, 0, 0, @@ -570,7 +709,7 @@ st_TexImage(GLcontext * ctx, * the blitter to copy. Or, use the hardware to do the format * conversion and copy: */ - if (compressed) { + if (compressed_src) { memcpy(texImage->Data, pixels, imageSize); } else { @@ -607,7 +746,7 @@ st_TexImage(GLcontext * ctx, _mesa_unmap_teximage_pbo(ctx, unpack); - if (stImage->pt) { + if (stImage->pt && texImage->Data) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; } @@ -787,6 +926,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { + struct pipe_screen *screen = ctx->st->pipe->screen; struct st_texture_image *stImage = st_texture_image(texImage); GLuint dstRowStride; const GLuint srcImageStride = @@ -804,6 +944,22 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, if (!pixels) return; + /* See if we can do texture compression with a blit/render. + */ + if (!ctx->Mesa_DXTn && + is_compressed_mesa_format(texImage->TexFormat) && + screen->is_format_supported(screen, + stImage->pt->format, + stImage->pt->target, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + if (compress_with_blit(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, packing, texImage)) { + return; + } + } + /* Map buffer if necessary. Need to lock to prevent other contexts * from uploading the buffer under us. */ -- cgit v1.2.3 From b3c1c5cf2c5848d794a5690c7296b9b927412353 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 9 Apr 2009 00:12:17 +0200 Subject: mesa: Report name for missing s3tc functions --- src/mesa/main/texcompress_s3tc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index d17e18da6b..a1c0f18f36 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -205,7 +205,7 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS) dst, dstRowStride); } else { - _mesa_warning(ctx, "external dxt library not available"); + _mesa_warning(ctx, "external dxt library not available: texstore_rgb_dxt1"); } if (tempImage) @@ -267,7 +267,7 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS) dst, dstRowStride); } else { - _mesa_warning(ctx, "external dxt library not available"); + _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt1"); } if (tempImage) @@ -328,7 +328,7 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS) dst, dstRowStride); } else { - _mesa_warning(ctx, "external dxt library not available"); + _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt3"); } if (tempImage) @@ -389,7 +389,7 @@ texstore_rgba_dxt5(TEXSTORE_PARAMS) dst, dstRowStride); } else { - _mesa_warning(ctx, "external dxt library not available"); + _mesa_warning(ctx, "external dxt library not available: texstore_rgba_dxt5"); } if (tempImage) @@ -410,7 +410,7 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage, (GLubyte *)(texImage)->Data, i, j, texel); } else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); + _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1"); } @@ -438,7 +438,7 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage, (GLubyte *)(texImage)->Data, i, j, texel); } else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); + _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n"); } @@ -467,7 +467,7 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage, i, j, texel); } else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); + _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n"); } @@ -495,7 +495,7 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage, i, j, texel); } else - _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); + _mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n"); } -- cgit v1.2.3 From 0da2781f2faff51afc888cb6c91c0ea5a895f9ca Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 9 Apr 2009 11:36:28 +1000 Subject: nv50: adapt for new clear interface this is so much nicer :) --- src/gallium/drivers/nv50/nv50_clear.c | 71 ++++++++++++----------------------- 1 file changed, 23 insertions(+), 48 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c index db44a9da0e..eca65a88c1 100644 --- a/src/gallium/drivers/nv50/nv50_clear.c +++ b/src/gallium/drivers/nv50/nv50_clear.c @@ -27,64 +27,39 @@ #include "nv50_context.h" void -nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) +nv50_clear(struct pipe_context *pipe, unsigned buffers, + const float *rgba, double depth, unsigned stencil) { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->nvws->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; - struct pipe_framebuffer_state fb, s_fb = nv50->framebuffer; - struct pipe_scissor_state sc, s_sc = nv50->scissor; - unsigned dirty = nv50->dirty; + struct pipe_framebuffer_state *fb = &nv50->framebuffer; + unsigned mode = 0, i; - nv50->dirty = 0; + if (!nv50_state_validate(nv50)) + return; - if (ps->format == PIPE_FORMAT_Z24S8_UNORM || - ps->format == PIPE_FORMAT_Z16_UNORM) { - fb.nr_cbufs = 0; - fb.zsbuf = ps; - } else { - fb.nr_cbufs = 1; - fb.cbufs[0] = ps; - fb.zsbuf = NULL; + if (buffers & PIPE_CLEAR_COLOR) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_COLOR(0), 4*fb->nr_cbufs); + for (i = 0; i < fb->nr_cbufs; i++) { + OUT_RING (chan, fui(rgba[0])); + OUT_RING (chan, fui(rgba[1])); + OUT_RING (chan, fui(rgba[2])); + OUT_RING (chan, fui(rgba[3])); + } + mode |= 0x3c; } - fb.width = ps->width; - fb.height = ps->height; - pipe->set_framebuffer_state(pipe, &fb); - sc.minx = sc.miny = 0; - sc.maxx = fb.width; - sc.maxy = fb.height; - pipe->set_scissor_state(pipe, &sc); + if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_DEPTH, 1); + OUT_RING (chan, fui(depth)); + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_STENCIL, 1); + OUT_RING (chan, stencil & 0xff); - nv50_state_validate(nv50); - - switch (ps->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - BEGIN_RING(chan, tesla, 0x0d80, 4); - OUT_RINGf (chan, ubyte_to_float((clearValue >> 16) & 0xff)); - OUT_RINGf (chan, ubyte_to_float((clearValue >> 8) & 0xff)); - OUT_RINGf (chan, ubyte_to_float((clearValue >> 0) & 0xff)); - OUT_RINGf (chan, ubyte_to_float((clearValue >> 24) & 0xff)); - BEGIN_RING(chan, tesla, 0x19d0, 1); - OUT_RING (chan, 0x3c); - break; - case PIPE_FORMAT_Z24S8_UNORM: - BEGIN_RING(chan, tesla, 0x0d90, 1); - OUT_RINGf (chan, (float)(clearValue >> 8) * (1.0 / 16777215.0)); - BEGIN_RING(chan, tesla, 0x0da0, 1); - OUT_RING (chan, clearValue & 0xff); - BEGIN_RING(chan, tesla, 0x19d0, 1); - OUT_RING (chan, 0x03); - break; - default: - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, - clearValue); - break; + mode |= 0x03; } - pipe->set_framebuffer_state(pipe, &s_fb); - pipe->set_scissor_state(pipe, &s_sc); - nv50->dirty |= dirty; + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); + OUT_RING (chan, mode); } -- cgit v1.2.3 From f4468384b6caf2aa5cfc7546c08f349af93d928e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Apr 2009 11:15:27 -0600 Subject: mesa: minor datatype changes in optimization code --- src/mesa/shader/prog_optimize.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 5f35dbf128..6ba2e76ff9 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -660,7 +660,8 @@ find_live_intervals(struct gl_program *prog, } -static GLuint +/** Scan the array of used register flags to find free entry */ +static GLint alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS]) { GLuint k; @@ -670,7 +671,7 @@ alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS]) return k; } } - return MAX_PROGRAM_TEMPS; + return -1; } @@ -689,7 +690,7 @@ _mesa_reallocate_registers(struct gl_program *prog) GLint registerMap[MAX_PROGRAM_TEMPS]; GLboolean usedRegs[MAX_PROGRAM_TEMPS]; GLuint i; - GLuint maxTemp = 0; + GLint maxTemp = -1; if (dbg) { _mesa_printf("Optimize: Begin live-interval register reallocation\n"); @@ -754,15 +755,15 @@ _mesa_reallocate_registers(struct gl_program *prog) /* find a free register for this live interval */ { - const GLuint k = alloc_register(usedRegs); - if (k == MAX_PROGRAM_TEMPS) { + const GLint k = alloc_register(usedRegs); + if (k < 0) { /* out of registers, give up */ return; } registerMap[live->Reg] = k; maxTemp = MAX2(maxTemp, k); if (dbg) - _mesa_printf(" remap register %d -> %d\n", live->Reg, k); + _mesa_printf(" remap register %u -> %d\n", live->Reg, k); } /* Insert this live interval into the active list which is sorted -- cgit v1.2.3 From ed9ba19bbbcdbf864b39da21c314073c1b5462db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Apr 2009 13:48:34 -0600 Subject: i965: move the fetch_constants() call before setting conditional mod state Before, the instruction's CondUpdate field was mistakenly effecting the constant-fetch operation. Fixes progs/glsl/bump.c demo. But there are some other issues related to condition flags and IF/ELSE that need investigation... --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 575cd45d57..3d360d58d5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2620,6 +2620,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) for (i = 0; i < c->nr_fp_insns; i++) { struct prog_instruction *inst = &c->prog_instructions[i]; + /* fetch any constants that this instruction needs */ + if (c->use_const_buffer) + fetch_constants(c, inst); + if (inst->CondUpdate) brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); else @@ -2630,10 +2634,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) _mesa_print_instruction(inst); */ - /* fetch any constants that this instruction needs */ - if (c->use_const_buffer) - fetch_constants(c, inst); - switch (inst->Opcode) { case WM_PIXELXY: emit_pixel_xy(c, inst); -- cgit v1.2.3 From 42cd3014f86e19e8156bea3439839dc0ed34aa83 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Apr 2009 19:29:37 -0600 Subject: i965: init current_const[i].index = -1 --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 3d360d58d5..c609256b6f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -254,9 +254,10 @@ static void prealloc_reg(struct brw_wm_compile *c) * XXX alloc these on demand! */ if (c->use_const_buffer) { - c->current_const[0].reg = alloc_tmp(c); - c->current_const[1].reg = alloc_tmp(c); - c->current_const[2].reg = alloc_tmp(c); + for (i = 0; i < 3; i++) { + c->current_const[i].index = -1; + c->current_const[i].reg = alloc_tmp(c); + } } /* printf("USE CONST BUFFER? %d\n", c->use_const_buffer); -- cgit v1.2.3 From 43fc20e4e1165e1ba864f5d25d75e4087a02315d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Apr 2009 19:31:49 -0600 Subject: i965: clean-ups, debug code in brw_wm_glsl.c --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 49 ++++++++++----------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index c609256b6f..f935e81ab7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -259,10 +259,10 @@ static void prealloc_reg(struct brw_wm_compile *c) c->current_const[i].reg = alloc_tmp(c); } } - /* +#if 0 printf("USE CONST BUFFER? %d\n", c->use_const_buffer); printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); - */ +#endif } @@ -284,14 +284,12 @@ static void fetch_constants(struct brw_wm_compile *c, src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM) { if (c->current_const[i].index != src->Index) { - c->current_const[i].index = src->Index; - /*c->current_const[i].reg = alloc_tmp(c);*/ - /* +#if 0 printf(" fetch const[%d] for arg %d into reg %d\n", src->Index, i, c->current_const[i].reg.nr); - */ +#endif /* need to fetch the constant now */ brw_dp_READ_4(p, @@ -301,26 +299,6 @@ static void fetch_constants(struct brw_wm_compile *c, 16 * src->Index, /* byte offset */ BRW_WM_MAX_SURF - 1 /* binding table index */ ); - -#if 0 - /* dependency stall */ - { - int response_length = 1; - int mark = mark_tmps( c ); - struct brw_reg src = c->current_const[i].reg; - struct brw_reg tmp = alloc_tmp(c); - - /* mov (8) r9.0<1>:f r9.0<8;8,1>:f { Align1 } - */ - brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, tmp, src); - brw_MOV(p, src, tmp); - brw_pop_insn_state(p); - - release_tmps( c, mark ); - } -#endif } } } @@ -367,13 +345,13 @@ get_src_reg_const(struct brw_wm_compile *c, if (src->Abs) const_reg = brw_abs(const_reg); - /* +#if 0 printf(" form const[%d] for arg %d, comp %d, reg %d\n", c->current_const[srcRegIndex].index, srcRegIndex, component, const_reg.nr); - */ +#endif return const_reg; } @@ -428,7 +406,9 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, value = -value; if (src->Abs) value = FABSF(value); - /*printf(" form imm reg %f\n", value);*/ +#if 0 + printf(" form imm reg %f\n", value); +#endif return brw_imm_f(value); } else { @@ -2621,6 +2601,11 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) for (i = 0; i < c->nr_fp_insns; i++) { struct prog_instruction *inst = &c->prog_instructions[i]; +#if 0 + _mesa_printf("Inst %d: ", i); + _mesa_print_instruction(inst); +#endif + /* fetch any constants that this instruction needs */ if (c->use_const_buffer) fetch_constants(c, inst); @@ -2630,11 +2615,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) else brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); - /* - _mesa_printf("Inst %d: ", i); - _mesa_print_instruction(inst); - */ - switch (inst->Opcode) { case WM_PIXELXY: emit_pixel_xy(c, inst); @@ -2820,6 +2800,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) break; case OPCODE_BGNLOOP: + /* XXX may need to invalidate the current_constant regs */ loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8); break; case OPCODE_BRK: -- cgit v1.2.3 From 8131123effd2124b8ca2aad04bf543e2fe82c7b0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Apr 2009 19:35:24 -0600 Subject: i965: set BRW_MASK_DISABLE flag in "send" instruction in brw_dp_READ_4() This fixes the random results that were seen when fetching a constant inside an IF/ELSE clause. Disabling the execution mask ensures that all the components of the register are written. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 21ce8369db..220c3afb15 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -978,9 +978,10 @@ void brw_dp_READ_4( struct brw_compile *p, { struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - insn->header.predicate_control = 0; /* XXX */ + insn->header.predicate_control = BRW_PREDICATE_NONE; insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.destreg__conditonalmod = msg_reg_nr; + insn->header.mask_control = BRW_MASK_DISABLE; /* cast dest to a uword[8] vector */ dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW); -- cgit v1.2.3 From 7e563200b88edd50e0bbd00ada27f3988146ee9c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 10:54:00 +0100 Subject: wgl: Add const qualifier to global constant data. --- src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c | 4 ++-- src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index f563635420..ead2c8aa59 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -285,7 +285,7 @@ struct attrib_match_info BOOL exact; }; -static struct attrib_match_info attrib_match[] = { +static const struct attrib_match_info attrib_match[] = { /* WGL_ARB_pixel_format */ { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE }, @@ -338,7 +338,7 @@ score_pixelformats( int expected_value ) { uint i; - struct attrib_match_info *ami = NULL; + const struct attrib_match_info *ami = NULL; uint index; /* Find out if a given attribute should be considered for score calculation. diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index ac2d6fc260..f15b950bf0 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -40,7 +40,7 @@ struct extension_entry #define EXTENTRY(P) { #P, (PROC) P } -static struct extension_entry extension_entries[] = { +static const struct extension_entry extension_entries[] = { /* WGL_ARB_extensions_string */ EXTENTRY( wglGetExtensionsStringARB ), @@ -57,9 +57,9 @@ PROC stw_get_proc_address( LPCSTR lpszProc ) { - struct extension_entry *entry; + const struct extension_entry *entry; - PROC p = (PROC) _glapi_get_proc_address( (const char *) lpszProc ); + PROC p = (PROC) _glapi_get_proc_address( lpszProc ); if (p) return p; -- cgit v1.2.3 From 19068d93c8f0f1d2b8809248266bf6da3dc6abd7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 11:09:42 +0100 Subject: stw: Normalize symbols prefix. --- .../wgl/shared/stw_arbextensionsstring.h | 6 +-- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 18 +++---- .../state_trackers/wgl/shared/stw_arbpixelformat.h | 6 +-- .../state_trackers/wgl/shared/stw_context.c | 20 ++++---- src/gallium/state_trackers/wgl/shared/stw_device.c | 2 +- .../state_trackers/wgl/shared/stw_framebuffer.c | 16 +++--- .../state_trackers/wgl/shared/stw_framebuffer.h | 11 ++-- .../state_trackers/wgl/shared/stw_getprocaddress.c | 18 +++---- .../state_trackers/wgl/shared/stw_pixelformat.c | 58 +++++++++++----------- .../state_trackers/wgl/shared/stw_pixelformat.h | 24 ++++----- 10 files changed, 90 insertions(+), 89 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h index a0e4c5d98e..41421a0d3a 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h +++ b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h @@ -25,11 +25,11 @@ * **************************************************************************/ -#ifndef WGL_ARBEXTENSIONSSTRING_H -#define WGL_ARBEXTENSIONSSTRING_H +#ifndef STW_ARBEXTENSIONSSTRING_H +#define STW_ARBEXTENSIONSSTRING_H WINGDIAPI const char * APIENTRY wglGetExtensionsStringARB( HDC hdc ); -#endif /* WGL_ARBEXTENSIONSSTRING_H */ +#endif /* STW_ARBEXTENSIONSSTRING_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index ead2c8aa59..6030cb1ef2 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -101,9 +101,9 @@ query_attrib( { uint count; uint index; - const struct pixelformat_info *pf; + const struct stw_pixelformat_info *pf; - count = pixelformat_get_extended_count(); + count = stw_pixelformat_get_extended_count(); if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) { *pvalue = (int) count; @@ -114,7 +114,7 @@ query_attrib( if (index >= count) return FALSE; - pf = pixelformat_get_info( index ); + pf = stw_pixelformat_get_info( index ); switch (attrib) { case WGL_DRAW_TO_WINDOW_ARB: @@ -324,7 +324,7 @@ static const struct attrib_match_info attrib_match[] = { { WGL_SAMPLES_ARB, 2, FALSE } }; -struct pixelformat_score +struct stw_pixelformat_score { int points; uint index; @@ -332,7 +332,7 @@ struct pixelformat_score static BOOL score_pixelformats( - struct pixelformat_score *scores, + struct stw_pixelformat_score *scores, uint count, int attribute, int expected_value ) @@ -395,7 +395,7 @@ wglChoosePixelFormatARB( UINT *nNumFormats ) { uint count; - struct pixelformat_score *scores; + struct stw_pixelformat_score *scores; uint i; *nNumFormats = 0; @@ -405,8 +405,8 @@ wglChoosePixelFormatARB( * points for a mismatch when the match does not have to be exact. * Set a score to 0 if there is a mismatch for an exact match criteria. */ - count = pixelformat_get_extended_count(); - scores = (struct pixelformat_score *) MALLOC( count * sizeof( struct pixelformat_score ) ); + count = stw_pixelformat_get_extended_count(); + scores = (struct stw_pixelformat_score *) MALLOC( count * sizeof( struct stw_pixelformat_score ) ); if (scores == NULL) return FALSE; for (i = 0; i < count; i++) { @@ -446,7 +446,7 @@ wglChoosePixelFormatARB( swapped = FALSE; for (i = 1; i < n; i++) { if (scores[i - 1].points < scores[i].points) { - struct pixelformat_score score = scores[i - 1]; + struct stw_pixelformat_score score = scores[i - 1]; scores[i - 1] = scores[i]; scores[i] = score; diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h index a6c4259942..36847d2ca9 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h @@ -25,8 +25,8 @@ * **************************************************************************/ -#ifndef WGL_ARBPIXELFORMAT_H -#define WGL_ARBPIXELFORMAT_H +#ifndef STW_ARBPIXELFORMAT_H +#define STW_ARBPIXELFORMAT_H /* Extension functions for get_proc_address: @@ -58,4 +58,4 @@ wglGetPixelFormatAttribivARB( const int *piAttributes, int *piValues ); -#endif /* WGL_ARBPIXELFORMAT_H */ +#endif /* STW_ARBPIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index f890225242..5c9f7c8971 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -80,7 +80,7 @@ stw_create_layer_context( int iLayerPlane ) { uint pfi; - const struct pixelformat_info *pf = NULL; + const struct stw_pixelformat_info *pf = NULL; struct stw_context *ctx = NULL; GLvisual *visual = NULL; struct pipe_screen *screen = NULL; @@ -97,7 +97,7 @@ stw_create_layer_context( if (pfi == 0) return 0; - pf = pixelformat_get_info( pfi - 1 ); + pf = stw_pixelformat_get_info( pfi - 1 ); ctx = CALLOC_STRUCT( stw_context ); if (ctx == NULL) @@ -199,9 +199,9 @@ stw_delete_context( if (glcurctx == glctx) st_make_current( NULL, NULL, NULL ); - fb = framebuffer_from_hdc( ctx->hdc ); + fb = stw_framebuffer_from_hdc( ctx->hdc ); if (fb) - framebuffer_destroy( fb ); + stw_framebuffer_destroy( fb ); if (WindowFromDC( ctx->hdc ) != NULL) ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc ); @@ -257,7 +257,7 @@ done: /* Find the width and height of the window named by hdc. */ static void -get_window_size( HDC hdc, GLuint *width, GLuint *height ) +stw_get_window_size( HDC hdc, GLuint *width, GLuint *height ) { if (WindowFromDC( hdc )) { RECT rect; @@ -325,24 +325,24 @@ stw_make_current( return TRUE; } - fb = framebuffer_from_hdc( hdc ); + fb = stw_framebuffer_from_hdc( hdc ); if (hdc != NULL) - get_window_size( hdc, &width, &height ); + stw_get_window_size( hdc, &width, &height ); - /* Lazy creation of framebuffers. + /* Lazy creation of stw_framebuffers. */ if (fb == NULL && ctx != NULL && hdc != NULL) { GLvisual *visual = &ctx->st->ctx->Visual; - fb = framebuffer_create( hdc, visual, width, height ); + fb = stw_framebuffer_create( hdc, visual, width, height ); if (fb == NULL) return FALSE; } if (ctx && fb) { st_make_current( ctx->st, fb->stfb, fb->stfb ); - framebuffer_resize( fb, width, height ); + stw_framebuffer_resize( fb, width, height ); ctx->hdc = hdc; ctx->st->pipe->priv = hdc; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 51936c2bdd..78d3ac8313 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -119,7 +119,7 @@ st_init(const struct stw_winsys *stw_winsys) goto error1; } - pixelformat_init(); + stw_pixelformat_init(); return TRUE; diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index c96c4b8dfa..a1202ab14d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -45,7 +45,7 @@ void -framebuffer_resize( +stw_framebuffer_resize( struct stw_framebuffer *fb, GLuint width, GLuint height ) @@ -56,7 +56,7 @@ framebuffer_resize( static struct stw_framebuffer *fb_head = NULL; static LRESULT CALLBACK -window_proc( +stw_window_proc( HWND hWnd, UINT uMsg, WPARAM wParam, @@ -70,7 +70,7 @@ window_proc( assert( fb != NULL ); if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED) - framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) ); + stw_framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) ); return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam ); } @@ -94,7 +94,7 @@ stw_is_supported_depth_stencil(enum pipe_format format) /* Create a new framebuffer object which will correspond to the given HDC. */ struct stw_framebuffer * -framebuffer_create( +stw_framebuffer_create( HDC hdc, GLvisual *visual, GLuint width, @@ -198,7 +198,7 @@ framebuffer_create( fb->WndProc = (WNDPROC) SetWindowLongPtr( fb->hWnd, GWLP_WNDPROC, - (LONG_PTR) window_proc ); + (LONG_PTR) stw_window_proc ); } fb->next = fb_head; @@ -207,7 +207,7 @@ framebuffer_create( } void -framebuffer_destroy( +stw_framebuffer_destroy( struct stw_framebuffer *fb ) { struct stw_framebuffer **link = &fb_head; @@ -235,7 +235,7 @@ framebuffer_destroy( /* Given an hdc, return the corresponding stw_framebuffer. */ struct stw_framebuffer * -framebuffer_from_hdc( +stw_framebuffer_from_hdc( HDC hdc ) { struct stw_framebuffer *fb; @@ -255,7 +255,7 @@ stw_swap_buffers( struct pipe_screen *screen; struct pipe_surface *surface; - fb = framebuffer_from_hdc( hdc ); + fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) return FALSE; diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index 5abdf18997..c2822f6d6d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -30,7 +30,8 @@ #include "main/mtypes.h" -/* Windows framebuffer, derived from gl_framebuffer. +/** + * Windows framebuffer, derived from gl_framebuffer. */ struct stw_framebuffer { @@ -43,24 +44,24 @@ struct stw_framebuffer }; struct stw_framebuffer * -framebuffer_create( +stw_framebuffer_create( HDC hdc, GLvisual *visual, GLuint width, GLuint height ); void -framebuffer_destroy( +stw_framebuffer_destroy( struct stw_framebuffer *fb ); void -framebuffer_resize( +stw_framebuffer_resize( struct stw_framebuffer *fb, GLuint width, GLuint height ); struct stw_framebuffer * -framebuffer_from_hdc( +stw_framebuffer_from_hdc( HDC hdc ); #endif /* STW_FRAMEBUFFER_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index f15b950bf0..9131dd77e7 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -32,23 +32,23 @@ #include "stw_arbpixelformat.h" #include "stw_public.h" -struct extension_entry +struct stw_extension_entry { const char *name; PROC proc; }; -#define EXTENTRY(P) { #P, (PROC) P } +#define STW_EXTENSION_ENTRY(P) { #P, (PROC) P } -static const struct extension_entry extension_entries[] = { +static const struct stw_extension_entry stw_extension_entries[] = { /* WGL_ARB_extensions_string */ - EXTENTRY( wglGetExtensionsStringARB ), + STW_EXTENSION_ENTRY( wglGetExtensionsStringARB ), /* WGL_ARB_pixel_format */ - EXTENTRY( wglChoosePixelFormatARB ), - EXTENTRY( wglGetPixelFormatAttribfvARB ), - EXTENTRY( wglGetPixelFormatAttribivARB ), + STW_EXTENSION_ENTRY( wglChoosePixelFormatARB ), + STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ), + STW_EXTENSION_ENTRY( wglGetPixelFormatAttribivARB ), { NULL, NULL } }; @@ -57,13 +57,13 @@ PROC stw_get_proc_address( LPCSTR lpszProc ) { - const struct extension_entry *entry; + const struct stw_extension_entry *entry; PROC p = (PROC) _glapi_get_proc_address( lpszProc ); if (p) return p; - for (entry = extension_entries; entry->name; entry++) + for (entry = stw_extension_entries; entry->name; entry++) if (strcmp( lpszProc, entry->name ) == 0) return entry->proc; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index b216ca5c82..a7e8363d59 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -30,24 +30,24 @@ #include "stw_public.h" #include "stw_tls.h" -#define MAX_PIXELFORMATS 16 +#define STW_MAX_PIXELFORMATS 16 -static struct pixelformat_info pixelformats[MAX_PIXELFORMATS]; -static uint pixelformat_count = 0; -static uint pixelformat_extended_count = 0; +static struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; +static uint stw_pixelformat_count = 0; +static uint stw_pixelformat_extended_count = 0; static void add_standard_pixelformats( - struct pixelformat_info **ppf, + struct stw_pixelformat_info **ppf, uint flags ) { - struct pixelformat_info *pf = *ppf; - struct pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 }; - struct pixelformat_alpha_info alpha8 = { 8, 24 }; - struct pixelformat_alpha_info noalpha = { 0, 0 }; - struct pixelformat_depth_info depth24s8 = { 24, 8 }; - struct pixelformat_depth_info depth16 = { 16, 0 }; + struct stw_pixelformat_info *pf = *ppf; + struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 }; + struct stw_pixelformat_alpha_info alpha8 = { 8, 24 }; + struct stw_pixelformat_alpha_info noalpha = { 0, 0 }; + struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; + struct stw_pixelformat_depth_info depth16 = { 16, 0 }; pf->flags = PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; @@ -101,35 +101,35 @@ add_standard_pixelformats( } void -pixelformat_init( void ) +stw_pixelformat_init( void ) { - struct pixelformat_info *pf = pixelformats; + struct stw_pixelformat_info *pf = pixelformats; add_standard_pixelformats( &pf, 0 ); - pixelformat_count = pf - pixelformats; + stw_pixelformat_count = pf - pixelformats; add_standard_pixelformats( &pf, PF_FLAG_MULTISAMPLED ); - pixelformat_extended_count = pf - pixelformats; + stw_pixelformat_extended_count = pf - pixelformats; - assert( pixelformat_extended_count <= MAX_PIXELFORMATS ); + assert( stw_pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } uint -pixelformat_get_count( void ) +stw_pixelformat_get_count( void ) { - return pixelformat_count; + return stw_pixelformat_count; } uint -pixelformat_get_extended_count( void ) +stw_pixelformat_get_extended_count( void ) { - return pixelformat_extended_count; + return stw_pixelformat_extended_count; } -const struct pixelformat_info * -pixelformat_get_info( uint index ) +const struct stw_pixelformat_info * +stw_pixelformat_get_info( uint index ) { - assert( index < pixelformat_extended_count ); + assert( index < stw_pixelformat_extended_count ); return &pixelformats[index]; } @@ -144,11 +144,11 @@ stw_pixelformat_describe( { uint count; uint index; - const struct pixelformat_info *pf; + const struct stw_pixelformat_info *pf; (void) hdc; - count = pixelformat_get_extended_count(); + count = stw_pixelformat_get_extended_count(); index = (uint) iPixelFormat - 1; if (ppfd == NULL) @@ -156,7 +156,7 @@ stw_pixelformat_describe( if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) return 0; - pf = pixelformat_get_info( index ); + pf = stw_pixelformat_get_info( index ); ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); ppfd->nVersion = 1; @@ -203,13 +203,13 @@ int stw_pixelformat_choose( HDC hdc, (void) hdc; - count = pixelformat_get_count(); + count = stw_pixelformat_get_count(); bestindex = count; bestdelta = 0xffffffff; for (index = 0; index < count; index++) { uint delta = 0; - const struct pixelformat_info *pf = pixelformat_get_info( index ); + const struct stw_pixelformat_info *pf = stw_pixelformat_get_info( index ); if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && !!(ppfd->dwFlags & PFD_DOUBLEBUFFER) != @@ -262,7 +262,7 @@ stw_pixelformat_set( (void) hdc; index = (uint) iPixelFormat - 1; - count = pixelformat_get_extended_count(); + count = stw_pixelformat_get_extended_count(); if (index >= count) return FALSE; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index 7ca4194a2a..926c9c9aab 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -34,7 +34,7 @@ #define PF_FLAG_DOUBLEBUFFER 0x00000001 #define PF_FLAG_MULTISAMPLED 0x00000002 -struct pixelformat_color_info +struct stw_pixelformat_color_info { uint redbits; uint redshift; @@ -44,37 +44,37 @@ struct pixelformat_color_info uint blueshift; }; -struct pixelformat_alpha_info +struct stw_pixelformat_alpha_info { uint alphabits; uint alphashift; }; -struct pixelformat_depth_info +struct stw_pixelformat_depth_info { uint depthbits; uint stencilbits; }; -struct pixelformat_info +struct stw_pixelformat_info { uint flags; - struct pixelformat_color_info color; - struct pixelformat_alpha_info alpha; - struct pixelformat_depth_info depth; + struct stw_pixelformat_color_info color; + struct stw_pixelformat_alpha_info alpha; + struct stw_pixelformat_depth_info depth; }; void -pixelformat_init( void ); +stw_pixelformat_init( void ); uint -pixelformat_get_count( void ); +stw_pixelformat_get_count( void ); uint -pixelformat_get_extended_count( void ); +stw_pixelformat_get_extended_count( void ); -const struct pixelformat_info * -pixelformat_get_info( uint index ); +const struct stw_pixelformat_info * +stw_pixelformat_get_info( uint index ); int stw_query_sample_buffers( void ); int stw_query_samples( void ); -- cgit v1.2.3 From d8ffccc80b5835ff458facbe84d0dd9cda754a30 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 11:28:23 +0100 Subject: stw: Use wglext.h's defines and prototypes. --- .../wgl/shared/stw_arbextensionsstring.c | 6 +- .../wgl/shared/stw_arbextensionsstring.h | 35 ---------- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 81 +++++----------------- .../state_trackers/wgl/shared/stw_arbpixelformat.h | 61 ---------------- .../state_trackers/wgl/shared/stw_getprocaddress.c | 7 +- 5 files changed, 28 insertions(+), 162 deletions(-) delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c index b3934cb464..cd9fe93eee 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c @@ -27,7 +27,11 @@ #include -#include "stw_arbextensionsstring.h" +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + WINGDIAPI const char * APIENTRY wglGetExtensionsStringARB( diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h deleted file mode 100644 index 41421a0d3a..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef STW_ARBEXTENSIONSSTRING_H -#define STW_ARBEXTENSIONSSTRING_H - -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringARB( - HDC hdc ); - -#endif /* STW_ARBEXTENSIONSSTRING_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index 6030cb1ef2..c4795ce2a4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -25,75 +25,30 @@ * **************************************************************************/ +/** + * @file + * + * WGL_ARB_pixel_format extension implementation. + * + * @sa http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt + */ + + #include +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + #include "pipe/p_compiler.h" #include "util/u_memory.h" #include "stw_public.h" #include "stw_pixelformat.h" -#include "stw_arbpixelformat.h" - -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 - -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 - -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A - -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C - -/* From arb_multisample: - */ -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 static boolean -query_attrib( +stw_query_attrib( int iPixelFormat, int iLayerPlane, int attrib, @@ -358,7 +313,7 @@ score_pixelformats( for (index = 0; index < count; index++) { int actual_value; - if (!query_attrib( index + 1, 0, attribute, &actual_value )) + if (!stw_query_attrib( index + 1, 0, attribute, &actual_value )) return FALSE; if (ami->exact) { @@ -489,7 +444,7 @@ wglGetPixelFormatAttribfvARB( for (i = 0; i < nAttributes; i++) { int value; - if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value )) + if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value )) return FALSE; pfValues[i] = (FLOAT) value; } @@ -511,7 +466,7 @@ wglGetPixelFormatAttribivARB( (void) hdc; for (i = 0; i < nAttributes; i++) { - if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] )) + if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] )) return FALSE; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h deleted file mode 100644 index 36847d2ca9..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.h +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef STW_ARBPIXELFORMAT_H -#define STW_ARBPIXELFORMAT_H - - -/* Extension functions for get_proc_address: - */ -WINGDIAPI BOOL APIENTRY -wglChoosePixelFormatARB( - HDC hdc, - const int *piAttribIList, - const FLOAT *pfAttribFList, - UINT nMaxFormats, - int *piFormats, - UINT *nNumFormats ); - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribfvARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - FLOAT *pfValues ); - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribivARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - int *piValues ); - -#endif /* STW_ARBPIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index 9131dd77e7..aa43120955 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -27,9 +27,12 @@ #include +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + #include "glapi/glapi.h" -#include "stw_arbextensionsstring.h" -#include "stw_arbpixelformat.h" #include "stw_public.h" struct stw_extension_entry -- cgit v1.2.3 From 8ef412900363aa6338351001574867866ebcae89 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 11:44:33 +0100 Subject: wgl: More symbol naming normalization. --- src/gallium/state_trackers/wgl/icd/stw_icd.h | 6 ++--- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 8 +++---- .../state_trackers/wgl/shared/stw_context.c | 4 ++-- .../state_trackers/wgl/shared/stw_pixelformat.c | 28 +++++++++++----------- .../state_trackers/wgl/shared/stw_pixelformat.h | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.h b/src/gallium/state_trackers/wgl/icd/stw_icd.h index 8e676fb5b7..cbc1a66548 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.h +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.h @@ -25,8 +25,8 @@ * **************************************************************************/ -#ifndef DRV_H -#define DRV_H +#ifndef STW_ICD_H +#define STW_ICD_H #include @@ -486,4 +486,4 @@ BOOL APIENTRY DrvValidateVersion( ULONG ulVersion ); -#endif /* DRV_H */ +#endif /* STW_ICD_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index c4795ce2a4..a4f78cb293 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -89,7 +89,7 @@ stw_query_attrib( return TRUE; case WGL_SWAP_METHOD_ARB: - if (pf->flags & PF_FLAG_DOUBLEBUFFER) + if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) *pvalue = WGL_SWAP_COPY_ARB; else *pvalue = WGL_SWAP_UNDEFINED_ARB; @@ -142,7 +142,7 @@ stw_query_attrib( break; case WGL_DOUBLE_BUFFER_ARB: - if (pf->flags & PF_FLAG_DOUBLEBUFFER) + if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) *pvalue = TRUE; else *pvalue = FALSE; @@ -213,14 +213,14 @@ stw_query_attrib( break; case WGL_SAMPLE_BUFFERS_ARB: - if (pf->flags & PF_FLAG_MULTISAMPLED) + if (pf->flags & STW_PF_FLAG_MULTISAMPLED) *pvalue = stw_query_sample_buffers(); else *pvalue = 0; break; case WGL_SAMPLES_ARB: - if (pf->flags & PF_FLAG_MULTISAMPLED) + if (pf->flags & STW_PF_FLAG_MULTISAMPLED) *pvalue = stw_query_samples(); else *pvalue = 0; diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 5c9f7c8971..f01151ba53 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -110,7 +110,7 @@ stw_create_layer_context( */ visual = _mesa_create_visual( GL_TRUE, - (pf->flags & PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, + (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, GL_FALSE, pf->color.redbits, pf->color.greenbits, @@ -123,7 +123,7 @@ stw_create_layer_context( 0, 0, 0, - (pf->flags & PF_FLAG_MULTISAMPLED) ? stw_query_samples() : 0 ); + (pf->flags & STW_PF_FLAG_MULTISAMPLED) ? stw_query_samples() : 0 ); if (visual == NULL) goto fail; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index a7e8363d59..7e49889a92 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -32,13 +32,13 @@ #define STW_MAX_PIXELFORMATS 16 -static struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; +static struct stw_pixelformat_info stw_pixelformats[STW_MAX_PIXELFORMATS]; static uint stw_pixelformat_count = 0; static uint stw_pixelformat_extended_count = 0; static void -add_standard_pixelformats( +stw_add_standard_pixelformats( struct stw_pixelformat_info **ppf, uint flags ) { @@ -49,25 +49,25 @@ add_standard_pixelformats( struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; struct stw_pixelformat_depth_info depth16 = { 16, 0 }; - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; + pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; pf->alpha = alpha8; pf->depth = depth16; pf++; - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; + pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; pf->alpha = alpha8; pf->depth = depth24s8; pf++; - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; + pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; pf->alpha = noalpha; pf->depth = depth16; pf++; - pf->flags = PF_FLAG_DOUBLEBUFFER | flags; + pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; pf->alpha = noalpha; pf->depth = depth24s8; @@ -103,13 +103,13 @@ add_standard_pixelformats( void stw_pixelformat_init( void ) { - struct stw_pixelformat_info *pf = pixelformats; + struct stw_pixelformat_info *pf = stw_pixelformats; - add_standard_pixelformats( &pf, 0 ); - stw_pixelformat_count = pf - pixelformats; + stw_add_standard_pixelformats( &pf, 0 ); + stw_pixelformat_count = pf - stw_pixelformats; - add_standard_pixelformats( &pf, PF_FLAG_MULTISAMPLED ); - stw_pixelformat_extended_count = pf - pixelformats; + stw_add_standard_pixelformats( &pf, STW_PF_FLAG_MULTISAMPLED ); + stw_pixelformat_extended_count = pf - stw_pixelformats; assert( stw_pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } @@ -131,7 +131,7 @@ stw_pixelformat_get_info( uint index ) { assert( index < stw_pixelformat_extended_count ); - return &pixelformats[index]; + return &stw_pixelformats[index]; } @@ -161,7 +161,7 @@ stw_pixelformat_describe( ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); ppfd->nVersion = 1; ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; - if (pf->flags & PF_FLAG_DOUBLEBUFFER) + if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; ppfd->iPixelType = PFD_TYPE_RGBA; ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits; @@ -213,7 +213,7 @@ int stw_pixelformat_choose( HDC hdc, if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && !!(ppfd->dwFlags & PFD_DOUBLEBUFFER) != - !!(pf->flags & PF_FLAG_DOUBLEBUFFER)) + !!(pf->flags & STW_PF_FLAG_DOUBLEBUFFER)) continue; if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index 926c9c9aab..cdf687c472 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -31,8 +31,8 @@ #include #include "pipe/p_compiler.h" -#define PF_FLAG_DOUBLEBUFFER 0x00000001 -#define PF_FLAG_MULTISAMPLED 0x00000002 +#define STW_PF_FLAG_DOUBLEBUFFER 0x00000001 +#define STW_PF_FLAG_MULTISAMPLED 0x00000002 struct stw_pixelformat_color_info { -- cgit v1.2.3 From 858d3da441d3548eae23c91b3bc888c3b0233797 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 14:58:17 +0100 Subject: wgl: Move the framebuffer list to the device. Avoid recursive locking. --- .../state_trackers/wgl/shared/stw_context.c | 58 ++++++++------------ src/gallium/state_trackers/wgl/shared/stw_device.c | 2 +- src/gallium/state_trackers/wgl/shared/stw_device.h | 5 +- .../state_trackers/wgl/shared/stw_framebuffer.c | 63 ++++++++++++---------- 4 files changed, 62 insertions(+), 66 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index f01151ba53..07d7452eb5 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -59,8 +59,8 @@ stw_copy_context( pipe_mutex_lock( stw_dev->mutex ); - src = stw_lookup_context( hglrcSrc ); - dst = stw_lookup_context( hglrcDst ); + src = stw_lookup_context_locked( hglrcSrc ); + dst = stw_lookup_context_locked( hglrcDst ); if (src && dst) { /* FIXME */ @@ -155,9 +155,7 @@ stw_create_layer_context( ctx->st->ctx->DriverCtx = ctx; pipe_mutex_lock( stw_dev->mutex ); - { - hglrc = handle_table_add(stw_dev->ctx_table, ctx); - } + hglrc = handle_table_add(stw_dev->ctx_table, ctx); pipe_mutex_unlock( stw_dev->mutex ); /* Success? @@ -187,8 +185,10 @@ stw_delete_context( return FALSE; pipe_mutex_lock( stw_dev->mutex ); + ctx = stw_lookup_context_locked(hglrc); + handle_table_remove(stw_dev->ctx_table, hglrc); + pipe_mutex_unlock( stw_dev->mutex ); - ctx = stw_lookup_context(hglrc); if (ctx) { GLcontext *glctx = ctx->st->ctx; GET_CURRENT_CONTEXT( glcurctx ); @@ -206,19 +206,12 @@ stw_delete_context( if (WindowFromDC( ctx->hdc ) != NULL) ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc ); - pipe_mutex_lock(stw_dev->mutex); - { - st_destroy_context(ctx->st); - FREE(ctx); - handle_table_remove(stw_dev->ctx_table, hglrc); - } - pipe_mutex_unlock(stw_dev->mutex); + st_destroy_context(ctx->st); + FREE(ctx); ret = TRUE; } - pipe_mutex_unlock( stw_dev->mutex ); - return ret; } @@ -226,32 +219,27 @@ BOOL stw_release_context( UINT_PTR hglrc ) { - BOOL ret = FALSE; + struct stw_context *ctx; if (!stw_dev) - return ret; + return FALSE; pipe_mutex_lock( stw_dev->mutex ); - { - struct stw_context *ctx; - - /* XXX: The expectation is that ctx is the same context which is - * current for this thread. We should check that and return False - * if not the case. - */ - ctx = stw_lookup_context( hglrc ); - if (ctx == NULL) - goto done; + ctx = stw_lookup_context_locked( hglrc ); + pipe_mutex_unlock( stw_dev->mutex ); - if (stw_make_current( NULL, 0 ) == FALSE) - goto done; + if (!ctx) + return FALSE; + + /* XXX: The expectation is that ctx is the same context which is + * current for this thread. We should check that and return False + * if not the case. + */ - ret = TRUE; - } -done: - pipe_mutex_unlock( stw_dev->mutex ); + if (stw_make_current( NULL, 0 ) == FALSE) + return FALSE; - return ret; + return TRUE; } /* Find the width and height of the window named by hdc. @@ -300,7 +288,7 @@ stw_make_current( return FALSE; pipe_mutex_lock( stw_dev->mutex ); - ctx = stw_lookup_context( hglrc ); + ctx = stw_lookup_context_locked( hglrc ); pipe_mutex_unlock( stw_dev->mutex ); stw_tls_get_data()->currentDC = hdc; diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 78d3ac8313..c6d59afa03 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -189,7 +189,7 @@ st_cleanup(void) struct stw_context * -stw_lookup_context( UINT_PTR dhglrc ) +stw_lookup_context_locked( UINT_PTR dhglrc ) { if (dhglrc == 0) return NULL; diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 703cb67081..0ce0d54cac 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -35,6 +35,7 @@ struct pipe_screen; +struct stw_framebuffer; struct stw_device { @@ -50,13 +51,15 @@ struct stw_device struct handle_table *ctx_table; + struct stw_framebuffer *fb_head; + #ifdef DEBUG unsigned long memdbg_no; #endif }; struct stw_context * -stw_lookup_context( UINT_PTR hglrc ); +stw_lookup_context_locked( UINT_PTR hglrc ); extern struct stw_device *stw_dev; diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index a1202ab14d..d6cf6fb534 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -53,8 +53,6 @@ stw_framebuffer_resize( st_resize_framebuffer( fb->stfb, width, height ); } -static struct stw_framebuffer *fb_head = NULL; - static LRESULT CALLBACK stw_window_proc( HWND hWnd, @@ -64,9 +62,11 @@ stw_window_proc( { struct stw_framebuffer *fb; - for (fb = fb_head; fb != NULL; fb = fb->next) + pipe_mutex_lock( stw_dev->mutex ); + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) if (fb->hWnd == hWnd) break; + pipe_mutex_unlock( stw_dev->mutex ); assert( fb != NULL ); if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED) @@ -201,8 +201,11 @@ stw_framebuffer_create( (LONG_PTR) stw_window_proc ); } - fb->next = fb_head; - fb_head = fb; + pipe_mutex_lock( stw_dev->mutex ); + fb->next = stw_dev->fb_head; + stw_dev->fb_head = fb; + pipe_mutex_unlock( stw_dev->mutex ); + return fb; } @@ -210,29 +213,28 @@ void stw_framebuffer_destroy( struct stw_framebuffer *fb ) { - struct stw_framebuffer **link = &fb_head; - struct stw_framebuffer *pfb = fb_head; - - while (pfb != NULL) { - if (pfb == fb) { - if (fb->hWnd != NULL) { - SetWindowLongPtr( - fb->hWnd, - GWLP_WNDPROC, - (LONG_PTR) fb->WndProc ); - } - - *link = fb->next; - FREE( fb ); - return; - } - - link = &pfb->next; - pfb = pfb->next; - } + struct stw_framebuffer **link; + + pipe_mutex_lock( stw_dev->mutex ); + + link = &stw_dev->fb_head; + while (link && *link != fb) + link = &(*link)->next; + assert(*link); + if (link) + *link = fb->next; + fb->next = NULL; + + pipe_mutex_unlock( stw_dev->mutex ); + + if (fb->hWnd) + SetWindowLongPtr( fb->hWnd, GWLP_WNDPROC, (LONG_PTR)fb->WndProc ); + + FREE( fb ); } -/* Given an hdc, return the corresponding stw_framebuffer. +/** + * Given an hdc, return the corresponding stw_framebuffer. */ struct stw_framebuffer * stw_framebuffer_from_hdc( @@ -240,10 +242,13 @@ stw_framebuffer_from_hdc( { struct stw_framebuffer *fb; - for (fb = fb_head; fb != NULL; fb = fb->next) + pipe_mutex_lock( stw_dev->mutex ); + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) if (fb->hDC == hdc) - return fb; - return NULL; + break; + pipe_mutex_unlock( stw_dev->mutex ); + + return fb; } -- cgit v1.2.3 From 564ba2538691bd15df21da9fc378f0070235e286 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 15:15:12 +0100 Subject: wgl: Catch the attempt of releasing a context which is not current. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 07d7452eb5..6eb1bd08d5 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -231,10 +231,17 @@ stw_release_context( if (!ctx) return FALSE; - /* XXX: The expectation is that ctx is the same context which is + /* The expectation is that ctx is the same context which is * current for this thread. We should check that and return False * if not the case. */ + { + GLcontext *glctx = ctx->st->ctx; + GET_CURRENT_CONTEXT( glcurctx ); + + if (glcurctx != glctx) + return FALSE; + } if (stw_make_current( NULL, 0 ) == FALSE) return FALSE; -- cgit v1.2.3 From 3163ea145309f1f8e103cc880ea40c61af5fb5cd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 10:33:08 -0600 Subject: i965: free shader's constant buffer in brwDeleteProgram() Fixes mem leak observed with texcombine test. --- src/mesa/drivers/dri/i965/brw_program.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 457bc2fc7f..fbf1ddd1e3 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -95,6 +95,12 @@ static struct gl_program *brwNewProgram( GLcontext *ctx, static void brwDeleteProgram( GLcontext *ctx, struct gl_program *prog ) { + if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { + struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; + struct brw_fragment_program *brw_fprog = brw_fragment_program(fprog); + dri_bo_unreference(brw_fprog->const_buffer); + } + _mesa_delete_program( ctx, prog ); } -- cgit v1.2.3 From deff09921563419a77bd1aad0054afa34214ed1a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 10:53:01 -0600 Subject: mesa: fix potential recursive locking deadlock in _mesa_HashWalk() If the walk callback called _mesa_HashRemove() we'd deadlock. --- src/mesa/main/hash.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 976f9d999b..08c64568c8 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -63,6 +63,7 @@ struct _mesa_HashTable { struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */ GLuint MaxKey; /**< highest key inserted so far */ _glthread_Mutex Mutex; /**< mutual exclusion lock */ + _glthread_Mutex WalkMutex; /**< for _mesa_HashWalk() */ GLboolean InDeleteAll; /**< Debug check */ }; @@ -79,6 +80,7 @@ _mesa_NewHashTable(void) struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); if (table) { _glthread_INIT_MUTEX(table->Mutex); + _glthread_INIT_MUTEX(table->WalkMutex); } return table; } @@ -111,6 +113,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table) } } _glthread_DESTROY_MUTEX(table->Mutex); + _glthread_DESTROY_MUTEX(table->WalkMutex); _mesa_free(table); } @@ -285,6 +288,11 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, /** * Walk over all entries in a hash table, calling callback function for each. + * Note: we use a separate mutex in this function to avoid a recursive + * locking deadlock (in case the callback calls _mesa_HashRemove()) and to + * prevent multiple threads/contexts from getting tangled up. + * A lock-less version of this function could be used when the table will + * not be modified. * \param table the hash table to walk * \param callback the callback function * \param userData arbitrary pointer to pass along to the callback @@ -300,14 +308,16 @@ _mesa_HashWalk(const struct _mesa_HashTable *table, GLuint pos; ASSERT(table); ASSERT(callback); - _glthread_LOCK_MUTEX(table2->Mutex); + _glthread_LOCK_MUTEX(table2->WalkMutex); for (pos = 0; pos < TABLE_SIZE; pos++) { - struct HashEntry *entry; - for (entry = table->Table[pos]; entry; entry = entry->Next) { + struct HashEntry *entry, *next; + for (entry = table->Table[pos]; entry; entry = next) { + /* save 'next' pointer now in case the callback deletes the entry */ + next = entry->Next; callback(entry->Key, entry->Data, userData); } } - _glthread_UNLOCK_MUTEX(table2->Mutex); + _glthread_UNLOCK_MUTEX(table2->WalkMutex); } -- cgit v1.2.3 From 4bbb5eb96ad9f2e5b6e064854eeb5f5cb1498f9d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 20:35:55 +0100 Subject: wgl: Use hooks instead of subclassing the window. Subclassing the window is invasive: we might call an old window proc even after it was removed. Glut and another bug just in the wrong time was provoking this. Hooks don't have this problem. --- src/gallium/state_trackers/wgl/shared/stw_device.c | 8 +- .../state_trackers/wgl/shared/stw_framebuffer.c | 95 ++++++++++++++++------ .../state_trackers/wgl/shared/stw_framebuffer.h | 7 +- src/gallium/state_trackers/wgl/shared/stw_tls.h | 3 + 4 files changed, 83 insertions(+), 30 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index c6d59afa03..8e0193d7be 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -41,6 +41,7 @@ #include "shared/stw_pixelformat.h" #include "shared/stw_public.h" #include "shared/stw_tls.h" +#include "shared/stw_framebuffer.h" #ifdef WIN32_THREADS extern _glthread_Mutex OneTimeLock; @@ -132,9 +133,11 @@ error1: boolean st_init_thread(void) { - if (!stw_tls_init_thread()) { + if (!stw_tls_init_thread()) + return FALSE; + + if (!stw_framebuffer_init_thread()) return FALSE; - } return TRUE; } @@ -143,6 +146,7 @@ st_init_thread(void) void st_cleanup_thread(void) { + stw_framebuffer_cleanup_thread(); stw_tls_cleanup_thread(); } diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index d6cf6fb534..053f741e7b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -42,6 +42,7 @@ #include "stw_device.h" #include "stw_public.h" #include "stw_winsys.h" +#include "stw_tls.h" void @@ -53,26 +54,43 @@ stw_framebuffer_resize( st_resize_framebuffer( fb->stfb, width, height ); } +/** + * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx + * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx + */ static LRESULT CALLBACK -stw_window_proc( - HWND hWnd, - UINT uMsg, +stw_call_window_proc( + int nCode, WPARAM wParam, LPARAM lParam ) { - struct stw_framebuffer *fb; - - pipe_mutex_lock( stw_dev->mutex ); - for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hWnd == hWnd) - break; - pipe_mutex_unlock( stw_dev->mutex ); - assert( fb != NULL ); - - if (uMsg == WM_SIZE && wParam != SIZE_MINIMIZED) - stw_framebuffer_resize( fb, LOWORD( lParam ), HIWORD( lParam ) ); + struct stw_tls_data *tls_data; + PCWPSTRUCT pParams = (PCWPSTRUCT)lParam; + + tls_data = stw_tls_get_data(); + if(!tls_data) + return 0; + + if (nCode < 0) + return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); + + if (pParams->message == WM_SIZE && pParams->wParam != SIZE_MINIMIZED) { + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->mutex ); + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) + if (fb->hWnd == pParams->hwnd) + break; + pipe_mutex_unlock( stw_dev->mutex ); + + if(fb) { + unsigned width = LOWORD( pParams->lParam ); + unsigned height = HIWORD( pParams->lParam ); + stw_framebuffer_resize( fb, width, height ); + } + } - return CallWindowProc( fb->WndProc, hWnd, uMsg, wParam, lParam ); + return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); } static INLINE boolean @@ -190,16 +208,7 @@ stw_framebuffer_create( fb->cColorBits = GetDeviceCaps( hdc, BITSPIXEL ); fb->hDC = hdc; - - /* Subclass a window associated with the device context. - */ fb->hWnd = WindowFromDC( hdc ); - if (fb->hWnd != NULL) { - fb->WndProc = (WNDPROC) SetWindowLongPtr( - fb->hWnd, - GWLP_WNDPROC, - (LONG_PTR) stw_window_proc ); - } pipe_mutex_lock( stw_dev->mutex ); fb->next = stw_dev->fb_head; @@ -227,9 +236,6 @@ stw_framebuffer_destroy( pipe_mutex_unlock( stw_dev->mutex ); - if (fb->hWnd) - SetWindowLongPtr( fb->hWnd, GWLP_WNDPROC, (LONG_PTR)fb->WndProc ); - FREE( fb ); } @@ -286,3 +292,38 @@ stw_swap_buffers( return TRUE; } + + +boolean +stw_framebuffer_init_thread(void) +{ + struct stw_tls_data *tls_data; + + tls_data = stw_tls_get_data(); + if(!tls_data) + return FALSE; + + tls_data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, + stw_call_window_proc, + NULL, + GetCurrentThreadId()); + if(tls_data->hCallWndProcHook == NULL) + return FALSE; + + return TRUE; +} + +void +stw_framebuffer_cleanup_thread(void) +{ + struct stw_tls_data *tls_data; + + tls_data = stw_tls_get_data(); + if(!tls_data) + return; + + if(tls_data->hCallWndProcHook) { + UnhookWindowsHookEx(tls_data->hCallWndProcHook); + tls_data->hCallWndProcHook = NULL; + } +} diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index c2822f6d6d..245fdc5fc9 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -39,7 +39,6 @@ struct stw_framebuffer HDC hDC; BYTE cColorBits; HWND hWnd; - WNDPROC WndProc; struct stw_framebuffer *next; }; @@ -64,4 +63,10 @@ struct stw_framebuffer * stw_framebuffer_from_hdc( HDC hdc ); +boolean +stw_framebuffer_init_thread(void); + +void +stw_framebuffer_cleanup_thread(void); + #endif /* STW_FRAMEBUFFER_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h index 23b61e68ff..f5a6bdf4b1 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.h +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.h @@ -28,11 +28,14 @@ #ifndef STW_TLS_H #define STW_TLS_H +#include + struct stw_tls_data { uint currentPixelFormat; HDC currentDC; UINT_PTR currentGLRC; + HHOOK hCallWndProcHook; }; boolean -- cgit v1.2.3 From 81660a44dc25648659ac590a37854103c36f9ce4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 20:41:59 +0100 Subject: wgl: Use more stw_* names. --- src/gallium/state_trackers/wgl/shared/stw_device.c | 8 ++++---- src/gallium/state_trackers/wgl/shared/stw_winsys.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index 8e0193d7be..eef848988c 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -76,7 +76,7 @@ st_flush_frontbuffer(struct pipe_screen *screen, boolean -st_init(const struct stw_winsys *stw_winsys) +stw_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; struct pipe_screen *screen; @@ -131,7 +131,7 @@ error1: boolean -st_init_thread(void) +stw_init_thread(void) { if (!stw_tls_init_thread()) return FALSE; @@ -144,7 +144,7 @@ st_init_thread(void) void -st_cleanup_thread(void) +stw_cleanup_thread(void) { stw_framebuffer_cleanup_thread(); stw_tls_cleanup_thread(); @@ -152,7 +152,7 @@ st_cleanup_thread(void) void -st_cleanup(void) +stw_cleanup(void) { unsigned i; diff --git a/src/gallium/state_trackers/wgl/shared/stw_winsys.h b/src/gallium/state_trackers/wgl/shared/stw_winsys.h index e4a1d4f979..c0bf82c9ed 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_winsys.h +++ b/src/gallium/state_trackers/wgl/shared/stw_winsys.h @@ -51,15 +51,15 @@ struct stw_winsys }; boolean -st_init(const struct stw_winsys *stw_winsys); +stw_init(const struct stw_winsys *stw_winsys); boolean -st_init_thread(void); +stw_init_thread(void); void -st_cleanup_thread(void); +stw_cleanup_thread(void); void -st_cleanup(void); +stw_cleanup(void); #endif /* STW_WINSYS_H */ -- cgit v1.2.3 From fa2b9e43067298bc67f7787b6ab886eb7992abaf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 20:42:09 +0100 Subject: gdi: Use stw_* names. --- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index d5d9431865..df7e43d56b 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -312,21 +312,21 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: - if (!st_init(&stw_winsys)) { + if (!stw_init(&stw_winsys)) { return FALSE; } - return st_init_thread(); + return stw_init_thread(); case DLL_THREAD_ATTACH: - return st_init_thread(); + return stw_init_thread(); case DLL_THREAD_DETACH: - st_cleanup_thread(); + stw_cleanup_thread(); break; case DLL_PROCESS_DETACH: - st_cleanup_thread(); - st_cleanup(); + stw_cleanup_thread(); + stw_cleanup(); break; } return TRUE; -- cgit v1.2.3 From 7ea265888f19bcbc1771f6c671ce08855b80bf0a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 21:26:15 +0100 Subject: gallium: Use "flags" consistently. --- src/gallium/include/pipe/p_screen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index ceac755e71..5046febcf6 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -264,7 +264,7 @@ struct pipe_screen { */ int (*fence_signalled)( struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flag ); + unsigned flags ); /** * Wait for the fence to finish. @@ -273,7 +273,7 @@ struct pipe_screen { */ int (*fence_finish)( struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flag ); + unsigned flags ); }; -- cgit v1.2.3 From 0da3a13d6a9314cc1e8616a13f28db0afc0735f6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 21:27:03 +0100 Subject: trace: Use 'flags' name consistently. --- src/gallium/drivers/trace/tr_screen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 6792505383..ecffee4ab4 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -755,7 +755,7 @@ trace_screen_fence_reference(struct pipe_screen *_screen, static int trace_screen_fence_signalled(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flag) + unsigned flags) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; @@ -765,9 +765,9 @@ trace_screen_fence_signalled(struct pipe_screen *_screen, trace_dump_arg(ptr, screen); trace_dump_arg(ptr, fence); - trace_dump_arg(uint, flag); + trace_dump_arg(uint, flags); - result = screen->fence_signalled(screen, fence, flag); + result = screen->fence_signalled(screen, fence, flags); trace_dump_ret(int, result); @@ -780,7 +780,7 @@ trace_screen_fence_signalled(struct pipe_screen *_screen, static int trace_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, - unsigned flag) + unsigned flags) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; @@ -790,9 +790,9 @@ trace_screen_fence_finish(struct pipe_screen *_screen, trace_dump_arg(ptr, screen); trace_dump_arg(ptr, fence); - trace_dump_arg(uint, flag); + trace_dump_arg(uint, flags); - result = screen->fence_finish(screen, fence, flag); + result = screen->fence_finish(screen, fence, flags); trace_dump_ret(int, result); -- cgit v1.2.3 From 16c9bb81fd9ab3052f8790e5999d519c0f9bffea Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 21:27:43 +0100 Subject: wgl: Remove unused member. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 1 - src/gallium/state_trackers/wgl/shared/stw_framebuffer.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 053f741e7b..fcfd44e399 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -206,7 +206,6 @@ stw_framebuffer_create( height, (void *) fb ); - fb->cColorBits = GetDeviceCaps( hdc, BITSPIXEL ); fb->hDC = hdc; fb->hWnd = WindowFromDC( hdc ); diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index 245fdc5fc9..ea3bf6f8fc 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -37,7 +37,6 @@ struct stw_framebuffer { struct st_framebuffer *stfb; HDC hDC; - BYTE cColorBits; HWND hWnd; struct stw_framebuffer *next; }; -- cgit v1.2.3 From 7cfd3b3bdfa4fb9a45d5fffab719c1d8a441d602 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 21:28:31 +0100 Subject: trace: Dump the fence, not its pointer. --- src/gallium/drivers/trace/tr_screen.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index ecffee4ab4..28506da4dc 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -734,19 +734,23 @@ trace_screen_buffer_destroy(struct pipe_buffer *_buffer) static void trace_screen_fence_reference(struct pipe_screen *_screen, - struct pipe_fence_handle **dst, + struct pipe_fence_handle **pdst, struct pipe_fence_handle *src) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; + struct pipe_fence_handle *dst; + assert(pdst); + dst = *pdst; + trace_dump_call_begin("pipe_screen", "fence_reference"); trace_dump_arg(ptr, screen); trace_dump_arg(ptr, dst); trace_dump_arg(ptr, src); - screen->fence_reference(screen, dst, src); + screen->fence_reference(screen, pdst, src); trace_dump_call_end(); } -- cgit v1.2.3 From c54b2199759e688ae89530f39106557c762b2fa4 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 9 Apr 2009 22:38:07 +0200 Subject: tgsi/sse2: Fix LIT instruction. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index d70bcd03c5..e399b9b9d5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1553,7 +1553,7 @@ emit_instruction( func, make_xmm( 2 ), make_xmm( 0 ), - cc_LessThanEqual ); + cc_LessThan ); sse_andps( func, make_xmm( 2 ), -- cgit v1.2.3 From 790a18f2c2a4df78cf4b4f88e55036d54324497a Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 9 Apr 2009 22:47:06 +0200 Subject: tgsi/sse2: Fix ARL instruction. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index e399b9b9d5..98994d8494 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1477,6 +1477,7 @@ emit_instruction( case TGSI_OPCODE_ARL: FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( func, *inst, 0, 0, chan_index ); + emit_flr(func, 0); emit_f2it( func, 0 ); STORE( func, *inst, 0, 0, chan_index ); } -- cgit v1.2.3 From 5facd7986ace899673499f396897469720476799 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:27:36 -0600 Subject: st: reformatting and clean-ups in texture code --- src/mesa/state_tracker/st_cb_texture.c | 162 ++++++++++++++------------------- 1 file changed, 67 insertions(+), 95 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8013e69e8e..942f4a5575 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -381,7 +381,7 @@ st_TexImage(GLcontext * ctx, const struct gl_pixelstore_attrib *unpack, struct gl_texture_object *texObj, struct gl_texture_image *texImage, - GLsizei imageSize, int compressed) + GLsizei imageSize, GLboolean compressed) { struct st_texture_object *stObj = st_texture_object(texObj); struct st_texture_image *stImage = st_texture_image(texImage); @@ -395,8 +395,7 @@ st_TexImage(GLcontext * ctx, /* gallium does not support texture borders, strip it off */ if (border) { - strip_texture_border(border, &width, &height, &depth, - unpack, &unpackNB); + strip_texture_border(border, &width, &height, &depth, unpack, &unpackNB); unpack = &unpackNB; texImage->Width = width; texImage->Height = height; @@ -516,7 +515,8 @@ st_TexImage(GLcontext * ctx, pixels = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, pixels, unpack, "glCompressedTexImage"); - } else { + } + else { pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, 1, format, type, pixels, unpack, "glTexImage"); @@ -565,7 +565,7 @@ st_TexImage(GLcontext * ctx, else { GLuint srcImageStride = _mesa_image_image_stride(unpack, width, height, format, type); - int i; + GLint i; const GLubyte *src = (const GLubyte *) pixels; for (i = 0; i++ < depth;) { @@ -616,9 +616,9 @@ st_TexImage3D(GLcontext * ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_TexImage(ctx, 3, target, level, - internalFormat, width, height, depth, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + st_TexImage(ctx, 3, target, level, internalFormat, width, height, depth, + border, format, type, pixels, unpack, texObj, texImage, + 0, GL_FALSE); } @@ -632,9 +632,8 @@ st_TexImage2D(GLcontext * ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_TexImage(ctx, 2, target, level, - internalFormat, width, height, 1, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border, + format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE); } @@ -648,9 +647,8 @@ st_TexImage1D(GLcontext * ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_TexImage(ctx, 1, target, level, - internalFormat, width, 1, 1, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + st_TexImage(ctx, 1, target, level, internalFormat, width, 1, 1, border, + format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE); } @@ -662,9 +660,8 @@ st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_TexImage(ctx, 2, target, level, - internalFormat, width, height, 1, border, - 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, 1); + st_TexImage(ctx, 2, target, level, internalFormat, width, height, 1, border, + 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, GL_TRUE); } @@ -676,15 +673,14 @@ static void st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, - struct gl_texture_image *texImage, int compressed) + struct gl_texture_image *texImage, GLboolean compressed) { struct st_texture_image *stImage = st_texture_image(texImage); GLuint dstImageStride = _mesa_image_image_stride(&ctx->Pack, texImage->Width, texImage->Height, format, type); - GLuint depth; - GLuint i; + GLuint depth, i; GLubyte *dest; /* Map */ @@ -719,7 +715,8 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, if (compressed) { _mesa_get_compressed_teximage(ctx, target, level, dest, texObj, texImage); - } else { + } + else { _mesa_get_teximage(ctx, target, level, format, type, dest, texObj, texImage); } @@ -750,8 +747,8 @@ st_GetTexImage(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_get_tex_image(ctx, target, level, format, type, pixels, - texObj, texImage, 0); + st_get_tex_image(ctx, target, level, format, type, pixels, texObj, texImage, + GL_FALSE); } @@ -761,17 +758,14 @@ st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - st_get_tex_image(ctx, target, level, 0, 0, pixels, - (struct gl_texture_object *) texObj, - (struct gl_texture_image *) texImage, 1); + st_get_tex_image(ctx, target, level, 0, 0, pixels, texObj, texImage, + GL_TRUE); } static void -st_TexSubimage(GLcontext * ctx, - GLint dims, - GLenum target, GLint level, +st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, @@ -783,7 +777,7 @@ st_TexSubimage(GLcontext * ctx, GLuint dstRowStride; GLuint srcImageStride = _mesa_image_image_stride(packing, width, height, format, type); - int i; + GLint i; const GLubyte *src; DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, @@ -852,73 +846,58 @@ st_TexSubimage(GLcontext * ctx, static void -st_TexSubImage3D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +st_TexSubImage3D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { - st_TexSubimage(ctx, 3, target, level, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, packing, texObj, texImage); + st_TexSubimage(ctx, 3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, + pixels, packing, texObj, texImage); } static void -st_TexSubImage2D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +st_TexSubImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid * pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { - st_TexSubimage(ctx, 2, target, level, - xoffset, yoffset, 0, - width, height, 1, - format, type, pixels, packing, texObj, texImage); + st_TexSubimage(ctx, 2, target, level, xoffset, yoffset, 0, + width, height, 1, format, type, + pixels, packing, texObj, texImage); } static void -st_TexSubImage1D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, - GLsizei width, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, GLenum format, GLenum type, + const GLvoid * pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { - st_TexSubimage(ctx, 1, target, level, - xoffset, 0, 0, - width, 1, 1, + st_TexSubimage(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, type, pixels, packing, texObj, texImage); } /** - * Do a CopyTexSubImage operation using a read transfer from the source, a write - * transfer to the destination and get_tile()/put_tile() to access the pixels/texels. + * Do a CopyTexSubImage operation using a read transfer from the source, + * a write transfer to the destination and get_tile()/put_tile() to access + * the pixels/texels. * * Note: srcY=0=TOP of renderbuffer */ static void -fallback_copy_texsubimage(GLcontext *ctx, - GLenum target, - GLint level, +fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, struct st_renderbuffer *strb, struct st_texture_image *stImage, GLenum baseFormat, @@ -980,8 +959,8 @@ fallback_copy_texsubimage(GLcontext *ctx, if (tempSrc && texDest) { const GLint dims = 2; + const GLint dstRowStride = stImage->transfer->stride; struct gl_texture_image *texImage = &stImage->base; - GLint dstRowStride = stImage->transfer->stride; struct gl_pixelstore_attrib unpack = ctx->DefaultPacking; if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { @@ -1095,7 +1074,6 @@ st_copy_texsubimage(GLcontext *ctx, if (src_format == dest_format && !do_flip) { /* use surface_copy() / blit */ - dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face, stImage->level, destZ, @@ -1179,11 +1157,6 @@ st_CopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); -#if 0 - if (border) - goto fail; -#endif - /* Setup or redefine the texture object, texture and texture * image. Don't populate yet. */ @@ -1274,8 +1247,8 @@ calculate_first_last_level(struct st_texture_object *stObj) * and having firstLevel and lastLevel as signed prevents the need for * extra sign checks. */ - int firstLevel; - int lastLevel; + GLint firstLevel; + GLint lastLevel; /* Yes, this looks overly complicated, but it's all needed. */ @@ -1330,15 +1303,15 @@ copy_image_data_to_texture(struct st_context *st, /* More straightforward upload. */ st_texture_image_data(st->pipe, - stObj->pt, - stImage->face, - dstLevel, - stImage->base.Data, - stImage->base.RowStride * - stObj->pt->block.size, - stImage->base.RowStride * - stImage->base.Height * - stObj->pt->block.size); + stObj->pt, + stImage->face, + dstLevel, + stImage->base.Data, + stImage->base.RowStride * + stObj->pt->block.size, + stImage->base.RowStride * + stImage->base.Height * + stObj->pt->block.size); _mesa_align_free(stImage->base.Data); stImage->base.Data = NULL; } @@ -1384,7 +1357,6 @@ st_finalize_texture(GLcontext *ctx, if (firstImage->pt && firstImage->pt != stObj->pt && firstImage->pt->last_level >= stObj->lastLevel) { - pipe_texture_reference(&stObj->pt, firstImage->pt); } -- cgit v1.2.3 From d11d903c1b81000d04f859dcc2da41dae024f146 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:32:42 -0600 Subject: st: make loops over 3D texture slices a litte more intuitive --- src/mesa/state_tracker/st_cb_texture.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 942f4a5575..405af024b7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -568,7 +568,7 @@ st_TexImage(GLcontext * ctx, GLint i; const GLubyte *src = (const GLubyte *) pixels; - for (i = 0; i++ < depth;) { + for (i = 0; i < depth; i++) { if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, @@ -581,9 +581,11 @@ st_TexImage(GLcontext * ctx, _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } - if (stImage->pt && i < depth) { + if (stImage->pt && i + 1 < depth) { + /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); - texImage->Data = st_texture_image_map(ctx->st, stImage, i, + /* map next slice of 3D texture */ + texImage->Data = st_texture_image_map(ctx->st, stImage, i + 1, PIPE_TRANSFER_WRITE, 0, 0, stImage->base.Width, stImage->base.Height); @@ -711,7 +713,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, dest = (GLubyte *) pixels; - for (i = 0; i++ < depth;) { + for (i = 0; i < depth; i++) { if (compressed) { _mesa_get_compressed_teximage(ctx, target, level, dest, texObj, texImage); @@ -721,9 +723,11 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, texObj, texImage); } - if (stImage->pt && i < depth) { + if (stImage->pt && i + 1 < depth) { + /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); - texImage->Data = st_texture_image_map(ctx->st, stImage, i, + /* map next slice of 3D texture */ + texImage->Data = st_texture_image_map(ctx->st, stImage, i + 1, PIPE_TRANSFER_READ, 0, 0, stImage->base.Width, stImage->base.Height); @@ -808,7 +812,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, src = (const GLubyte *) pixels; dstRowStride = stImage->transfer->stride; - for (i = 0; i++ < depth;) { + for (i = 0; i < depth; i++) { if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, @@ -820,10 +824,12 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } - if (stImage->pt && i < depth) { - /* map next slice of 3D texture */ + if (stImage->pt && i + 1 < depth) { + /* unmap this slice */ st_texture_image_unmap(ctx->st, stImage); - texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset + i, + /* map next slice of 3D texture */ + texImage->Data = st_texture_image_map(ctx->st, stImage, + zoffset + i + 1, PIPE_TRANSFER_WRITE, xoffset, yoffset, width, height); -- cgit v1.2.3 From eaca19edbbe7876079aa33d7f75d93601677081b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:35:36 -0600 Subject: st: add const qualifiers, use GL types --- src/mesa/state_tracker/st_cb_texture.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 405af024b7..c9f57510c0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -88,7 +88,7 @@ gl_target_to_pipe(GLenum target) * Return nominal bytes per texel for a compressed format, 0 for non-compressed * format. */ -static int +static GLuint compressed_num_bytes(GLuint mesaFormat) { switch(mesaFormat) { @@ -563,8 +563,8 @@ st_TexImage(GLcontext * ctx, memcpy(texImage->Data, pixels, imageSize); } else { - GLuint srcImageStride = _mesa_image_image_stride(unpack, width, height, - format, type); + const GLuint srcImageStride = + _mesa_image_image_stride(unpack, width, height, format, type); GLint i; const GLubyte *src = (const GLubyte *) pixels; @@ -678,10 +678,9 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_image *texImage, GLboolean compressed) { struct st_texture_image *stImage = st_texture_image(texImage); - GLuint dstImageStride = _mesa_image_image_stride(&ctx->Pack, - texImage->Width, - texImage->Height, - format, type); + const GLuint dstImageStride = + _mesa_image_image_stride(&ctx->Pack, texImage->Width, texImage->Height, + format, type); GLuint depth, i; GLubyte *dest; @@ -779,8 +778,8 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, { struct st_texture_image *stImage = st_texture_image(texImage); GLuint dstRowStride; - GLuint srcImageStride = _mesa_image_image_stride(packing, width, height, - format, type); + const GLuint srcImageStride = + _mesa_image_image_stride(packing, width, height, format, type); GLint i; const GLubyte *src; @@ -1106,7 +1105,7 @@ st_copy_texsubimage(GLcontext *ctx, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { /* draw textured quad to do the copy */ - int srcY0, srcY1; + GLint srcY0, srcY1; dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face, stImage->level, @@ -1339,9 +1338,7 @@ st_finalize_texture(GLcontext *ctx, { struct st_texture_object *stObj = st_texture_object(tObj); const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - int comp_byte = 0; - int cpp; - GLuint face; + GLuint comp_byte = 0, cpp, face; struct st_texture_image *firstImage; *needFlush = GL_FALSE; -- cgit v1.2.3 From 1ad2484f03cbe9ae6bd4ebe50d6894e570d65952 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:41:49 -0600 Subject: st: consolidate format->usage computation --- src/mesa/state_tracker/st_cb_texture.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index c9f57510c0..197ded70c0 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -226,6 +226,21 @@ logbase2(int n) } +/** + * Return default texture usage bitmask for the given texture format. + */ +static GLuint +default_usage(enum pipe_format fmt) +{ + GLuint usage = PIPE_TEXTURE_USAGE_SAMPLER; + if (pf_is_depth_stencil(fmt)) + usage |= PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + else + usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; + return usage; +} + + /** * Allocate a pipe_texture object for the given st_texture_object using * the given st_texture_image to guess the mipmap size/levels. @@ -250,7 +265,7 @@ guess_and_alloc_texture(struct st_context *st, GLuint width = stImage->base.Width2; /* size w/out border */ GLuint height = stImage->base.Height2; GLuint depth = stImage->base.Depth2; - GLuint i, comp_byte = 0; + GLuint i, comp_byte = 0, usage; enum pipe_format fmt; DBG("%s\n", __FUNCTION__); @@ -312,6 +327,9 @@ guess_and_alloc_texture(struct st_context *st, comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat); fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat); + + usage = default_usage(fmt); + stObj->pt = st_texture_create(st, gl_target_to_pipe(stObj->base.Target), fmt, @@ -320,10 +338,7 @@ guess_and_alloc_texture(struct st_context *st, height, depth, comp_byte, - ( (pf_is_depth_stencil(fmt) ? - PIPE_TEXTURE_USAGE_DEPTH_STENCIL : - PIPE_TEXTURE_USAGE_RENDER_TARGET) | - PIPE_TEXTURE_USAGE_SAMPLER )); + usage); DBG("%s - success\n", __FUNCTION__); } @@ -1396,6 +1411,8 @@ st_finalize_texture(GLcontext *ctx, if (!stObj->pt) { const enum pipe_format fmt = st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + GLuint usage = default_usage(fmt); + stObj->pt = st_texture_create(ctx->st, gl_target_to_pipe(stObj->base.Target), fmt, @@ -1404,10 +1421,7 @@ st_finalize_texture(GLcontext *ctx, firstImage->base.Height2, firstImage->base.Depth2, comp_byte, - ( (pf_is_depth_stencil(fmt) ? - PIPE_TEXTURE_USAGE_DEPTH_STENCIL : - PIPE_TEXTURE_USAGE_RENDER_TARGET) | - PIPE_TEXTURE_USAGE_SAMPLER )); + usage); if (!stObj->pt) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); -- cgit v1.2.3 From f12201567463c7aeb9b76c32f000d577a82e7f92 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:48:21 -0600 Subject: st: remove comp_byte parameter to st_texture_create() We can determine if the texture is compressed by checking the format. --- src/mesa/state_tracker/st_atom_pixeltransfer.c | 3 +-- src/mesa/state_tracker/st_cb_bitmap.c | 5 ++--- src/mesa/state_tracker/st_cb_drawpixels.c | 5 ++--- src/mesa/state_tracker/st_cb_texture.c | 12 +++--------- src/mesa/state_tracker/st_texture.c | 3 +-- src/mesa/state_tracker/st_texture.h | 1 - 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 8d0029dde5..e0bbf7f3be 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -125,8 +125,7 @@ create_color_map_texture(GLcontext *ctx) /* create texture for color map/table */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, - texSize, texSize, 1, 0, - PIPE_TEXTURE_USAGE_SAMPLER); + texSize, texSize, 1, PIPE_TEXTURE_USAGE_SAMPLER); return pt; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 2d547dd072..3b2ad00f5c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -330,7 +330,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, * Create texture to hold bitmap pattern. */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format, - 0, width, height, 1, 0, + 0, width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) { _mesa_unmap_bitmap_pbo(ctx, unpack); @@ -579,8 +579,7 @@ reset_cache(struct st_context *st) cache->texture = st_texture_create(st, PIPE_TEXTURE_2D, st->bitmap.tex_format, 0, BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, - 1, 0, - PIPE_TEXTURE_USAGE_SAMPLER); + 1, PIPE_TEXTURE_USAGE_SAMPLER); /* Map the texture transfer. * Subsequent glBitmap calls will write into the texture image. diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index ebb1d1142a..0a4430501f 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -351,8 +351,7 @@ make_texture(struct st_context *st, if (!pixels) return NULL; - pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height, - 1, 0, + pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) { _mesa_unmap_drawpix_pbo(ctx, unpack); @@ -951,7 +950,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, } pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, texFormat, 0, - width, height, 1, 0, + width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) return; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 197ded70c0..bd023e0018 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -265,7 +265,7 @@ guess_and_alloc_texture(struct st_context *st, GLuint width = stImage->base.Width2; /* size w/out border */ GLuint height = stImage->base.Height2; GLuint depth = stImage->base.Depth2; - GLuint i, comp_byte = 0, usage; + GLuint i, usage; enum pipe_format fmt; DBG("%s\n", __FUNCTION__); @@ -323,9 +323,6 @@ guess_and_alloc_texture(struct st_context *st, lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); } - if (stImage->base.IsCompressed) - comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat); - fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat); usage = default_usage(fmt); @@ -337,7 +334,6 @@ guess_and_alloc_texture(struct st_context *st, width, height, depth, - comp_byte, usage); DBG("%s - success\n", __FUNCTION__); @@ -1353,7 +1349,7 @@ st_finalize_texture(GLcontext *ctx, { struct st_texture_object *stObj = st_texture_object(tObj); const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - GLuint comp_byte = 0, cpp, face; + GLuint cpp, face; struct st_texture_image *firstImage; *needFlush = GL_FALSE; @@ -1380,8 +1376,7 @@ st_finalize_texture(GLcontext *ctx, /* FIXME: determine format block instead of cpp */ if (firstImage->base.IsCompressed) { - comp_byte = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); - cpp = comp_byte; + cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); } else { cpp = firstImage->base.TexFormat->TexelBytes; @@ -1420,7 +1415,6 @@ st_finalize_texture(GLcontext *ctx, firstImage->base.Width2, firstImage->base.Height2, firstImage->base.Depth2, - comp_byte, usage); if (!stObj->pt) { diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 3f90ad502c..12ceac1091 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -78,7 +78,6 @@ st_texture_create(struct st_context *st, GLuint width0, GLuint height0, GLuint depth0, - GLuint compress_byte, GLuint usage ) { struct pipe_texture pt, *newtex; @@ -101,7 +100,7 @@ st_texture_create(struct st_context *st, pt.width[0] = width0; pt.height[0] = height0; pt.depth[0] = depth0; - pt.compressed = compress_byte ? 1 : 0; + pt.compressed = pf_is_compressed(format); pf_get_block(format, &pt.block); pt.tex_usage = usage; diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 28c2f580f6..60c000115e 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -108,7 +108,6 @@ st_texture_create(struct st_context *st, GLuint width0, GLuint height0, GLuint depth0, - GLuint compress_byte, GLuint tex_usage ); -- cgit v1.2.3 From f97df61d26af658f9ffdabfc268ce31bbca6f17f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:55:19 -0600 Subject: gallium: remove unneeded compressed=0 assignment --- src/gallium/auxiliary/util/u_blit.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index deb68c43a6..29c3f85194 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -337,7 +337,6 @@ util_blit_pixels(struct blit_state *ctx, texTemp.width[0] = srcW; texTemp.height[0] = srcH; texTemp.depth[0] = 1; - texTemp.compressed = 0; pf_get_block(src->format, &texTemp.block); tex = screen->texture_create(screen, &texTemp); -- cgit v1.2.3 From 227aa0070d3b13baaa87270fd1a45fa5904ae3dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:55:32 -0600 Subject: gallium: remove unneeded compressed=0 assignment --- src/mesa/state_tracker/st_cb_fbo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index f74d0d46d0..92d53da4db 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -111,7 +111,6 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, init_renderbuffer_bits(strb, template.format); template.target = PIPE_TEXTURE_2D; - template.compressed = 0; pf_get_block(template.format, &template.block); template.width[0] = width; template.height[0] = height; -- cgit v1.2.3 From e53d6ab39bf04b2bb39ad23d5990494321ee77ce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:57:41 -0600 Subject: st: rearrange some code to be a little more clear --- src/mesa/state_tracker/st_cb_fbo.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 92d53da4db..1590f275e2 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -96,28 +96,22 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, pipe_surface_reference( &strb->surface, NULL ); pipe_texture_reference( &strb->texture, NULL ); - + /* Setup new texture template. + */ memset(&template, 0, sizeof(template)); - + template.target = PIPE_TEXTURE_2D; if (strb->format != PIPE_FORMAT_NONE) { template.format = strb->format; } else { template.format = st_choose_renderbuffer_format(pipe, internalFormat); } - - strb->Base.Width = width; - strb->Base.Height = height; - init_renderbuffer_bits(strb, template.format); - - template.target = PIPE_TEXTURE_2D; pf_get_block(template.format, &template.block); template.width[0] = width; template.height[0] = height; template.depth[0] = 1; template.last_level = 0; template.nr_samples = rb->NumSamples; - if (pf_is_depth_stencil(template.format)) { template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; } @@ -126,6 +120,10 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, PIPE_TEXTURE_USAGE_RENDER_TARGET); } + /* init renderbuffer fields */ + strb->Base.Width = width; + strb->Base.Height = height; + init_renderbuffer_bits(strb, template.format); /* Probably need dedicated flags for surface usage too: */ -- cgit v1.2.3 From 1f4a7f3a2eafd99906105ff74b26ea3ae0f19030 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 14:58:40 -0600 Subject: st: remove unneeded "is compressed" check The format indicates compressed vs. uncompressed. --- src/mesa/state_tracker/st_texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 12ceac1091..fad513a556 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -127,8 +127,7 @@ st_texture_match_image(const struct pipe_texture *pt, /* Check if this image's format matches the established texture's format. */ - if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format || - image->IsCompressed != pt->compressed) + if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format) return GL_FALSE; /* Test if this image's size matches what's expected in the -- cgit v1.2.3 From 311f77198e171e9ce8ddcce91fd6a894fff1f14f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 15:00:54 -0600 Subject: st: remove another unneeded 'is compressed' comparison --- src/mesa/state_tracker/st_cb_texture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index bd023e0018..57c0544ba8 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1394,8 +1394,9 @@ st_finalize_texture(GLcontext *ctx, stObj->pt->width[0] != firstImage->base.Width2 || stObj->pt->height[0] != firstImage->base.Height2 || stObj->pt->depth[0] != firstImage->base.Depth2 || - stObj->pt->block.size/stObj->pt->block.width != cpp || /* Nominal bytes per pixel */ - stObj->pt->compressed != firstImage->base.IsCompressed) { + /* Nominal bytes per pixel: */ + stObj->pt->block.size / stObj->pt->block.width != cpp) + { pipe_texture_reference(&stObj->pt, NULL); ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; } -- cgit v1.2.3 From c09ef3e747fe1e6a7689ae6277365f749f4de19f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 9 Apr 2009 22:10:45 +0100 Subject: python: Fix bad pointer. --- src/gallium/state_trackers/python/p_texture.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index f41a95e6eb..1d513abf3c 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -426,7 +426,7 @@ struct st_surface if(!*STRING) return; - pipe_buffer_read(screen, $self, 0, $self->size, STRING); + pipe_buffer_read(screen, $self, 0, $self->size, *STRING); } %cstring_input_binary(const char *STRING, unsigned LENGTH); -- cgit v1.2.3 From 82634ee8df7328b9235abd8352d33b0b3d953600 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Apr 2009 12:44:18 -0700 Subject: DRI2: Provide an interface for drivers to flush front-buffer rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- include/GL/internal/dri_interface.h | 15 ++++++++++++++- src/glx/x11/dri2_glx.c | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index a83602bfd8..335bf62a80 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -659,7 +659,7 @@ struct __DRIbufferRec { }; #define __DRI_DRI2_LOADER "DRI_DRI2Loader" -#define __DRI_DRI2_LOADER_VERSION 1 +#define __DRI_DRI2_LOADER_VERSION 2 struct __DRIdri2LoaderExtensionRec { __DRIextension base; @@ -667,6 +667,19 @@ struct __DRIdri2LoaderExtensionRec { int *width, int *height, unsigned int *attachments, int count, int *out_count, void *loaderPrivate); + + /** + * Flush pending front-buffer rendering + * + * Any rendering that has been performed to the + * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the + * \c __DRI_BUFFER_FRONT_LEFT. + * + * \param driDrawable Drawable whose front-buffer is to be flushed + * \param loaderPrivate Loader's private data that was previously passed + * into __DRIdri2ExtensionRec::createNewDrawable + */ + void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); }; /** diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index 9c8f1101b9..aa21a97023 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -273,6 +273,15 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw) XFixesDestroyRegion(pdraw->psc->dpy, region); } + +static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable, + void *loaderPrivate) +{ + (void) driDrawable; + dri2WaitGL((__GLXDRIdrawable *) loaderPrivate); +} + + static void dri2DestroyScreen(__GLXscreenConfigs *psc) { /* Free the direct rendering per screen data */ @@ -327,6 +336,7 @@ dri2GetBuffers(__DRIdrawable *driDrawable, static const __DRIdri2LoaderExtension dri2LoaderExtension = { { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION }, dri2GetBuffers, + dri2FlushFrontBuffer }; static const __DRIextension *loader_extensions[] = { -- cgit v1.2.3 From 43cf0d1eebb9f425e1a0e176394b64e2cb406709 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Apr 2009 13:15:54 -0700 Subject: intel / DRI2: Track and flush front-buffer rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Track two flags: whether or not front-buffer rendering is currently enabled and whether or not front-buffer rendering has been enabled since the last glFlush. If the second flag is set, the front-buffer is flushed via a loader call back. If the first flag is cleared, the second flag is cleared at this time. Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- src/mesa/drivers/dri/intel/intel_buffers.c | 8 ++++++++ src/mesa/drivers/dri/intel/intel_context.c | 20 ++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_context.h | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 0929a2c223..f1249f7635 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -202,6 +202,8 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) intel_batchbuffer_flush(intel->batch); intel->front_cliprects = GL_TRUE; colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); + + intel->front_buffer_dirty = GL_TRUE; } else { if (!intel->constant_cliprect && intel->front_cliprects) @@ -319,6 +321,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) static void intelDrawBuffer(GLcontext * ctx, GLenum mode) { + if (ctx->DrawBuffer->Name == 0) { + struct intel_context *const intel = intel_context(ctx); + + intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT); + } + intel_draw_buffer(ctx, ctx->DrawBuffer); } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index a664e74936..797bfa8c4b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -391,6 +391,26 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) if (intel->batch->map != intel->batch->ptr) intel_batchbuffer_flush(intel->batch); + + if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) { + __DRIscreen *const screen = intel->intelScreen->driScrnPriv; + + if ((screen->dri2.loader->base.version >= 2) + && (screen->dri2.loader->flushFrontBuffer != NULL)) { + (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable, + intel->driDrawable->loaderPrivate); + + /* Only clear the dirty bit if front-buffer rendering is no longer + * enabled. This is done so that the dirty bit can only be set in + * glDrawBuffer. Otherwise the dirty bit would have to be set at + * each of N places that do rendering. This has worse performances, + * but it is much easier to get correct. + */ + if (intel->is_front_buffer_rendering) { + intel->front_buffer_dirty = GL_FALSE; + } + } + } } void diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index d635f3f50d..bd3810549a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -262,11 +262,29 @@ struct intel_context * flush time while the lock is held. */ GLboolean constant_cliprect; + /** * In !constant_cliprect mode, set to true if the front cliprects should be * used instead of back. */ GLboolean front_cliprects; + + /** + * Set if rendering has occured to the drawable's front buffer. + * + * This is used in the DRI2 case to detect that glFlush should also copy + * the contents of the fake front buffer to the real front buffer. + */ + GLboolean front_buffer_dirty; + + /** + * Track whether front-buffer rendering is currently enabled + * + * A separate flag is used to track this in order to support MRT more + * easily. + */ + GLboolean is_front_buffer_rendering; + drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */ int perf_boxes; -- cgit v1.2.3 From e6386e0d9a461e7bc96ae7137de9c0a33f24c1a4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 6 Apr 2009 15:35:37 -0700 Subject: DRI2: Assume that there is always a front buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assume that the front-buffer exists even if the server didn't tell the client that it exists. Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- src/glx/x11/dri2_glx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index aa21a97023..b6eeb913b6 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -74,7 +74,6 @@ struct __GLXDRIdrawablePrivateRec { int bufferCount; int width, height; int have_back; - int have_front; int have_fake_front; }; @@ -195,7 +194,7 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw, XserverRegion region; /* Check we have the right attachments */ - if (!(priv->have_front && priv->have_back)) + if (!priv->have_back) return; xrect.x = x; @@ -229,7 +228,7 @@ static void dri2WaitX(__GLXDRIdrawable *pdraw) XserverRegion region; /* Check we have the right attachments */ - if (!(priv->have_fake_front && priv->have_front)) + if (!priv->have_fake_front) return; xrect.x = 0; @@ -254,7 +253,7 @@ static void dri2WaitGL(__GLXDRIdrawable *pdraw) XRectangle xrect; XserverRegion region; - if (!(priv->have_fake_front && priv->have_front)) + if (!priv->have_fake_front) return; xrect.x = 0; @@ -308,7 +307,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable, pdraw->width = *width; pdraw->height = *height; pdraw->bufferCount = *out_count; - pdraw->have_front = 0; pdraw->have_fake_front = 0; pdraw->have_back = 0; @@ -320,8 +318,6 @@ dri2GetBuffers(__DRIdrawable *driDrawable, pdraw->buffers[i].pitch = buffers[i].pitch; pdraw->buffers[i].cpp = buffers[i].cpp; pdraw->buffers[i].flags = buffers[i].flags; - if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT) - pdraw->have_front = 1; if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) pdraw->have_fake_front = 1; if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT) -- cgit v1.2.3 From 6a6e478e5555714226c6f15c63c393f5c0d74de4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 7 Apr 2009 11:23:10 -0700 Subject: intel / DRI2: Accept fake front-buffer from loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle the loader returning a fake front-buffer. Since the driver never specifically requests a fake front-buffer, the driver assumes that it will never receive both a fake and a real front-buffer. Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- src/mesa/drivers/dri/intel/intel_context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 797bfa8c4b..56d03c1e78 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -235,6 +235,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) region_name = "dri2 front buffer"; break; + case __DRI_BUFFER_FAKE_FRONT_LEFT: + rb = intel_fb->color_rb[0]; + region_name = "dri2 fake front buffer"; + break; + case __DRI_BUFFER_BACK_LEFT: rb = intel_fb->color_rb[1]; region_name = "dri2 back buffer"; -- cgit v1.2.3 From 5f31890861981d431607b2361ecde04e19726f1e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 9 Apr 2009 23:17:02 +0200 Subject: draw: Fix LIT instruction. --- src/gallium/auxiliary/draw/draw_vs_aos_machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c index b358bd2df4..3240e3745d 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c @@ -74,7 +74,7 @@ void PIPE_CDECL aos_do_lit( struct aos_machine *machine, { result[0] = 1.0F; result[1] = in[0]; - result[2] = 1.0; + result[2] = 0.0F; result[3] = 1.0F; } else @@ -108,7 +108,7 @@ static void PIPE_CDECL do_lit_lut( struct aos_machine *machine, { result[0] = 1.0F; result[1] = in[0]; - result[2] = 1.0; + result[2] = 0.0F; result[3] = 1.0F; return; } -- cgit v1.2.3 From c27c670ad8fc9f8276caeaff69eeb75e929dac9a Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 9 Apr 2009 23:24:57 +0200 Subject: tgsi/sse2: Fix build. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 98994d8494..31225ba430 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1477,7 +1477,7 @@ emit_instruction( case TGSI_OPCODE_ARL: FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( func, *inst, 0, 0, chan_index ); - emit_flr(func, 0); + emit_flr(func, 0, 0); emit_f2it( func, 0 ); STORE( func, *inst, 0, 0, chan_index ); } -- cgit v1.2.3 From a35e7458264fe6f0c2f200904779516f64953c33 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 15:09:42 -0600 Subject: i965simple: remove pipe_texture::compressed reference --- src/gallium/drivers/i965simple/brw_tex_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c index f44bd17451..8aea8c0558 100644 --- a/src/gallium/drivers/i965simple/brw_tex_layout.c +++ b/src/gallium/drivers/i965simple/brw_tex_layout.c @@ -240,7 +240,7 @@ static boolean brw_miptree_layout(struct brw_texture *tex) nblocksx = pf_get_nblocksx(&pt->block, width); nblocksy = pf_get_nblocksy(&pt->block, height); - if (pt->compressed) { + if (pf_is_compressed(pt->format)) { pack_y_pitch = (height + 3) / 4; if (pack_x_pitch > align(width, align_w)) { -- cgit v1.2.3 From 985e71866a9eb4c6f18ff8766eb278e58bf09830 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 16:02:41 -0600 Subject: gallium: updated comments in p_screen.h --- src/gallium/include/pipe/p_screen.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 5046febcf6..b449522fac 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -87,7 +87,7 @@ struct pipe_screen { * Check if the given pipe_format is supported as a texture or * drawing surface. * \param tex_usage bitmask of PIPE_TEXTURE_USAGE_* - * \param flags bitmask of PIPE_TEXTURE_GEOM_* + * \param geom_flags bitmask of PIPE_TEXTURE_GEOM_* */ boolean (*is_format_supported)( struct pipe_screen *, enum pipe_format format, @@ -102,7 +102,7 @@ struct pipe_screen { const struct pipe_texture *templat); /** - * Create a new texture object, using the given template info, but on top of + * Create a new texture object, using the given template info, but on top of * existing memory. * * It is assumed that the buffer data is layed out according to the expected @@ -144,8 +144,10 @@ struct pipe_screen { /** - * Buffer management. Buffer attributes are mostly fixed over its lifetime. - * + * Create a new buffer. + * \param alignment buffer start address alignment in bytes + * \param usage bitmask of PIPE_BUFFER_USAGE_x + * \param size size in bytes */ struct pipe_buffer *(*buffer_create)( struct pipe_screen *screen, unsigned alignment, -- cgit v1.2.3 From 7e0d4598fb7d2d7dd150870debeb102b5ce664bf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 16:10:43 -0600 Subject: gallium: change // comment to /* */ style --- src/gallium/include/pipe/p_defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 81defa445b..1d2aa10949 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -200,7 +200,7 @@ enum pipe_texture_target { enum pipe_transfer_usage { PIPE_TRANSFER_READ, PIPE_TRANSFER_WRITE, - PIPE_TRANSFER_READ_WRITE //< Read/modify/write + PIPE_TRANSFER_READ_WRITE /**< Read/modify/write */ }; -- cgit v1.2.3 From 2078e6cf55e3068454df9d843618b412b6abb811 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 17:04:09 -0600 Subject: i965: new SURF_INDEX_ macros Used to map drawables, textures and constant buffers to surface binding table indexes. --- src/mesa/drivers/dri/i965/brw_context.h | 13 ++++- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_emit.c | 4 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +-- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 64 ++++++++++++------------ 5 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 01e07c967f..c6e15c8914 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -247,9 +247,18 @@ struct brw_vs_ouput_sizes { /** * Size of our surface binding table. * This contains pointers to the drawing surfaces and current texture - * objects and shader constant buffer (+1). + * objects and shader constant buffers (+2). */ -#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1) +#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 2) + +/** + * Helpers to convert drawing buffers, textures and constant buffers + * to surface binding table indexes. + */ +#define SURF_INDEX_DRAW(d) (d) +#define SURF_INDEX_FRAG_CONST_BUFFER (MAX_DRAW_BUFFERS + 0) +#define SURF_INDEX_VERT_CONST_BUFFER (MAX_DRAW_BUFFERS + 1) +#define SURF_INDEX_TEXTURE(t) (MAX_DRAW_BUFFERS + 2 + t) enum brw_cache_id { diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 220c3afb15..ec4d7fa76f 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -990,7 +990,7 @@ void brw_dp_READ_4( struct brw_compile *p, brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); brw_set_dp_read_message(insn, - bind_table_index, /* binding table index (255=stateless) */ + bind_table_index, 0, /* msg_control (0 means 1 Oword) */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ 0, /* source cache = data cache */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index d65b1332c6..72fc21d2eb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -742,7 +742,7 @@ static void emit_tex( struct brw_wm_compile *c, retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), 1, retype(c->payload.depth[0].hw_reg, BRW_REGISTER_TYPE_UW), - inst->tex_unit + MAX_DRAW_BUFFERS, /* surface */ + SURF_INDEX_TEXTURE(inst->tex_unit), inst->tex_unit, /* sampler */ inst->writemask, (inst->tex_shadow ? @@ -791,7 +791,7 @@ static void emit_txb( struct brw_wm_compile *c, retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), 1, retype(c->payload.depth[0].hw_reg, BRW_REGISTER_TYPE_UW), - inst->tex_unit + MAX_DRAW_BUFFERS, /* surface */ + SURF_INDEX_TEXTURE(inst->tex_unit), inst->tex_unit, /* sampler */ inst->writemask, BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f935e81ab7..49fea2e41a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -297,7 +297,7 @@ static void fetch_constants(struct brw_wm_compile *c, 1, /* msg_reg */ src->RelAddr, /* relative indexing? */ 16 * src->Index, /* byte offset */ - BRW_WM_MAX_SURF - 1 /* binding table index */ + SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */ ); } } @@ -2498,7 +2498,7 @@ static void emit_txb(struct brw_wm_compile *c, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ 1, /* msg_reg_nr */ retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ - unit + MAX_DRAW_BUFFERS, /* surface */ + SURF_INDEX_TEXTURE(unit), unit, /* sampler */ inst->DstReg.WriteMask, /* writemask */ BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, /* msg_type */ @@ -2562,7 +2562,7 @@ static void emit_tex(struct brw_wm_compile *c, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ 1, /* msg_reg_nr */ retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ - unit + MAX_DRAW_BUFFERS, /* surface */ + SURF_INDEX_TEXTURE(unit), unit, /* sampler */ inst->DstReg.WriteMask, /* writemask */ BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, /* msg_type */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index e7d55d5dbd..0fb2bdacef 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -288,7 +288,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel]; struct brw_wm_surface_key key; - const GLuint j = MAX_DRAW_BUFFERS + unit; + const GLuint surf = SURF_INDEX_TEXTURE(unit); memset(&key, 0, sizeof(key)); @@ -315,13 +315,13 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) key.cpp = intelObj->mt->cpp; key.tiling = intelObj->mt->region->tiling; - dri_bo_unreference(brw->wm.surf_bo[j]); - brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + dri_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, &key, sizeof(key), &key.bo, key.bo ? 1 : 0, NULL); - if (brw->wm.surf_bo[j] == NULL) { - brw->wm.surf_bo[j] = brw_create_texture_surface(brw, &key); + if (brw->wm.surf_bo[surf] == NULL) { + brw->wm.surf_bo[surf] = brw_create_texture_surface(brw, &key); } } @@ -387,7 +387,7 @@ brw_update_constant_surface( GLcontext *ctx, { struct brw_context *brw = brw_context(ctx); struct brw_wm_surface_key key; - const GLuint j = BRW_WM_MAX_SURF - 1; + const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; const GLuint numParams = fp->program.Base.Parameters->NumParameters; memset(&key, 0, sizeof(key)); @@ -409,13 +409,13 @@ brw_update_constant_surface( GLcontext *ctx, key.width, key.height, key.depth, key.cpp, key.pitch); */ - dri_bo_unreference(brw->wm.surf_bo[j]); - brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, - &key, sizeof(key), - &key.bo, key.bo ? 1 : 0, - NULL); - if (brw->wm.surf_bo[j] == NULL) { - brw->wm.surf_bo[j] = brw_create_constant_surface(brw, &key); + dri_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); + if (brw->wm.surf_bo[surf] == NULL) { + brw->wm.surf_bo[surf] = brw_create_constant_surface(brw, &key); } } @@ -587,41 +587,41 @@ static void prepare_wm_surfaces(struct brw_context *brw ) old_nr_surfaces = brw->wm.nr_surfaces; brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; + /* Update surface for fragment shader constant buffer */ + { + const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER + 1; + const struct brw_fragment_program *fp = + brw_fragment_program_const(brw->fragment_program); + + brw_update_constant_surface(ctx, fp); + brw->wm.nr_surfaces = surf + 1; + } + + /* Update surfaces for textures */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - const GLuint j = MAX_DRAW_BUFFERS + i; + const GLuint surf = SURF_INDEX_TEXTURE(i); /* _NEW_TEXTURE, BRW_NEW_TEXDATA */ if (texUnit->_ReallyEnabled) { if (texUnit->_Current == intel->frame_buffer_texobj) { /* render to texture */ - dri_bo_unreference(brw->wm.surf_bo[j]); - brw->wm.surf_bo[j] = brw->wm.surf_bo[0]; - dri_bo_reference(brw->wm.surf_bo[j]); - brw->wm.nr_surfaces = j + 1; + dri_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = brw->wm.surf_bo[0]; + dri_bo_reference(brw->wm.surf_bo[surf]); + brw->wm.nr_surfaces = surf + 1; } else { /* regular texture */ brw_update_texture_surface(ctx, i); - brw->wm.nr_surfaces = j + 1; + brw->wm.nr_surfaces = surf + 1; } } else { - dri_bo_unreference(brw->wm.surf_bo[j]); - brw->wm.surf_bo[j] = NULL; + dri_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = NULL; } } - /* Update surface for fragment shader constant buffer */ - { - const GLuint j = BRW_WM_MAX_SURF - 1; - const struct brw_fragment_program *fp = - brw_fragment_program_const(brw->fragment_program); - - brw_update_constant_surface(ctx, fp); - brw->wm.nr_surfaces = j + 1; - } - - dri_bo_unreference(brw->wm.bind_bo); brw->wm.bind_bo = brw_wm_get_binding_table(brw); -- cgit v1.2.3 From 08a1e1ebcb612dfa9172f04e4644b34d95ec7dac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 17:04:58 -0600 Subject: demos: fix aspect ratio in Reshape() --- progs/glsl/bump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/progs/glsl/bump.c b/progs/glsl/bump.c index b93ab44b5b..0ea1f8331f 100644 --- a/progs/glsl/bump.c +++ b/progs/glsl/bump.c @@ -150,10 +150,11 @@ Redisplay(void) static void Reshape(int width, int height) { + float ar = (float) width / (float) height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f, 0.0f, -15.0f); -- cgit v1.2.3 From 20f3497e4b6756e330f7b3f54e8acaa1d6c92052 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 18:37:03 -0600 Subject: i965: re-org of some of the new constant buffer code Plus, begin the new code for vertex shader const buffers. --- src/mesa/drivers/dri/i965/brw_context.h | 4 +- src/mesa/drivers/dri/i965/brw_curbe.c | 46 ++++++++++++------ src/mesa/drivers/dri/i965/brw_program.c | 18 ------- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 61 ++++++++++++++++++------ 4 files changed, 81 insertions(+), 48 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index c6e15c8914..6a9252d037 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -159,6 +159,7 @@ struct brw_state_flags { struct brw_vertex_program { struct gl_vertex_program program; GLuint id; + dri_bo *const_buffer; /** Program constant buffer/surface */ }; @@ -168,8 +169,7 @@ struct brw_fragment_program { GLuint id; /**< serial no. to identify frag progs, never re-used */ GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */ - /** Program constant buffer/surface */ - dri_bo *const_buffer; + dri_bo *const_buffer; /** Program constant buffer/surface */ }; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index a6bfb7507e..08b602a5ab 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -333,37 +333,55 @@ static void prepare_constant_buffer(struct brw_context *brw) /** - * Vertex/fragment shader constants are stored in a pseudo 1D texture. - * This function updates the constants in that buffer. + * Copy Mesa program parameters into given constant buffer. */ static void -update_texture_constant_buffer(struct brw_context *brw) +update_constant_buffer(struct brw_context *brw, + const struct gl_program_parameter_list *params, + dri_bo *const_buffer) { - struct brw_fragment_program *fp = - (struct brw_fragment_program *) brw->fragment_program; - const struct gl_program_parameter_list *params = fp->program.Base.Parameters; const int size = params->NumParameters * 4 * sizeof(GLfloat); - assert(fp->const_buffer); - assert(fp->const_buffer->size >= size); - - /* copy constants into the buffer */ + /* copy Mesa program constants into the buffer */ if (size > 0) { GLubyte *map; - dri_bo_map(fp->const_buffer, GL_TRUE); - map = fp->const_buffer->virtual; + + assert(const_buffer); + assert(const_buffer->size >= size); + + dri_bo_map(const_buffer, GL_TRUE); + map = const_buffer->virtual; memcpy(map, params->ParameterValues, size); - dri_bo_unmap(fp->const_buffer); + dri_bo_unmap(const_buffer); } } +static void +update_vertex_constant_buffer(struct brw_context *brw) +{ + struct brw_vertex_program *vp = + (struct brw_vertex_program *) brw->vertex_program; + update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); +} + + +static void +update_fragment_constant_buffer(struct brw_context *brw) +{ + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); +} + + static void emit_constant_buffer(struct brw_context *brw) { struct intel_context *intel = &brw->intel; GLuint sz = brw->curbe.total_size; - update_texture_constant_buffer(brw); + update_vertex_constant_buffer(brw); + update_fragment_constant_buffer(brw); BEGIN_BATCH(2, IGNORE_CLIPRECTS); if (sz == 0) { diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index fbf1ddd1e3..cc65157259 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -134,24 +134,6 @@ static void brwProgramStringNotify( GLcontext *ctx, brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; newFP->id = brw->program_id++; newFP->isGLSL = brw_wm_is_glsl(fprog); - - /* alloc constant buffer/surface */ - { - const struct gl_program_parameter_list *params = prog->Parameters; - const int size = params->NumParameters * 4 * sizeof(GLfloat); - - /* free old const buffer if too small */ - if (newFP->const_buffer && newFP->const_buffer->size < size) { - dri_bo_unreference(newFP->const_buffer); - newFP->const_buffer = NULL; - } - - if (!newFP->const_buffer) { - newFP->const_buffer = drm_intel_bo_alloc(intel->bufmgr, - "fp_const_buffer", - size, 64); - } - } } else if (target == GL_VERTEX_PROGRAM_ARB) { struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 0fb2bdacef..40d6c38f4f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -379,26 +379,40 @@ brw_create_constant_surface( struct brw_context *brw, /** - * Update the constant buffer surface. + * Update the surface state for a constant buffer. + * The constant buffer will be (re)allocated here if needed. */ -static void +static dri_bo * brw_update_constant_surface( GLcontext *ctx, - const struct brw_fragment_program *fp ) + GLuint surf, + dri_bo *const_buffer, + const struct gl_program_parameter_list *params) { struct brw_context *brw = brw_context(ctx); struct brw_wm_surface_key key; - const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; - const GLuint numParams = fp->program.Base.Parameters->NumParameters; + struct intel_context *intel = &brw->intel; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + + /* free old const buffer if too small */ + if (const_buffer && const_buffer->size < size) { + dri_bo_unreference(const_buffer); + const_buffer = NULL; + } + + /* alloc new buffer if needed */ + if (!const_buffer) { + const_buffer = + drm_intel_bo_alloc(intel->bufmgr, "vp/fp_const_buffer", size, 64); + } memset(&key, 0, sizeof(key)); key.format = MESA_FORMAT_RGBA_FLOAT32; key.internal_format = GL_RGBA; - key.bo = fp->const_buffer; - + key.bo = const_buffer; key.depthmode = GL_NONE; - key.pitch = numParams; - key.width = numParams; + key.pitch = params->NumParameters; + key.width = params->NumParameters; key.height = 1; key.depth = 1; key.cpp = 16; @@ -417,6 +431,8 @@ brw_update_constant_surface( GLcontext *ctx, if (brw->wm.surf_bo[surf] == NULL) { brw->wm.surf_bo[surf] = brw_create_constant_surface(brw, &key); } + + return const_buffer; } @@ -587,16 +603,33 @@ static void prepare_wm_surfaces(struct brw_context *brw ) old_nr_surfaces = brw->wm.nr_surfaces; brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; - /* Update surface for fragment shader constant buffer */ + /* Update surface / buffer for vertex shader constant buffer */ { - const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER + 1; - const struct brw_fragment_program *fp = - brw_fragment_program_const(brw->fragment_program); + const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER + 1; + struct brw_vertex_program *vp = + (struct brw_vertex_program *) brw->vertex_program; + vp->const_buffer = + brw_update_constant_surface(ctx, + SURF_INDEX_VERT_CONST_BUFFER, + vp->const_buffer, + vp->program.Base.Parameters); - brw_update_constant_surface(ctx, fp); brw->wm.nr_surfaces = surf + 1; } + /* Update surface / buffer for fragment shader constant buffer */ + { + const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER + 1; + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + fp->const_buffer = + brw_update_constant_surface(ctx, + SURF_INDEX_FRAG_CONST_BUFFER, + fp->const_buffer, + fp->program.Base.Parameters); + + brw->wm.nr_surfaces = surf + 1; + } /* Update surfaces for textures */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { -- cgit v1.2.3 From 92d3b2a4da914a64bf0de4be4843a8524b1a8af6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 18:40:24 -0600 Subject: gallium: comments for surface_copy(), surface_fill() in p_context.h --- src/gallium/include/pipe/p_context.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 29095dcdc3..c5c839799e 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -192,14 +192,21 @@ struct pipe_context { * Surface functions */ /*@{*/ + + /** + * Copy a block of pixels from one surface to another. + * The surfaces must be of the same format. + */ void (*surface_copy)(struct pipe_context *pipe, struct pipe_surface *dest, unsigned destx, unsigned desty, - struct pipe_surface *src, /* don't make this const - - need to map/unmap */ + struct pipe_surface *src, unsigned srcx, unsigned srcy, unsigned width, unsigned height); + /** + * Fill a region of a surface with a constant value. + */ void (*surface_fill)(struct pipe_context *pipe, struct pipe_surface *dst, unsigned dstx, unsigned dsty, -- cgit v1.2.3 From 6c2d1e68395da7fd7f1bd8b777e075388d6964f4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Apr 2009 15:31:48 -0600 Subject: swrast: remove some unneeded CHAN_TYPE!=GL_FLOAT code --- src/mesa/swrast/s_texcombine.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index fae7280efb..08c49f5f2c 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -408,17 +408,10 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n, /* this produces a fixed rgba color, and the coord calc is done elsewhere */ for (i = 0; i < n; i++) { /* rgba result is 0,0,0,1 */ -#if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = 0.0; rgba[i][GCOMP] = 0.0; rgba[i][BCOMP] = 0.0; rgba[i][ACOMP] = 1.0; -#else - rgba[i][RCOMP] = 0; - rgba[i][GCOMP] = 0; - rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = CHAN_MAX; -#endif } return; /* no alpha processing */ default: -- cgit v1.2.3 From f4cc0692e6f285515e6a86367cf771be30665797 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 10 Apr 2009 08:54:47 +0200 Subject: draw: Fix vertex_header initialisation. --- src/gallium/auxiliary/draw/draw_pt_fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 058caf7dcc..505d32f2c3 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -114,7 +114,7 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, fetch->translate = translate_cache_find(fetch->cache, &key); { - static struct vertex_header vh = { 0, 1, 0, 0xffff }; + static struct vertex_header vh = { 0, 1, 0, UNDEFINED_VERTEX_ID, { .0f, .0f, .0f, .0f } }; fetch->translate->set_buffer(fetch->translate, draw->pt.nr_vertex_buffers, &vh, -- cgit v1.2.3 From 13be57df3ac00a4bdfdafb10605c3be7056a21a5 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 10 Apr 2009 08:59:20 +0200 Subject: draw: Silence pointer-to-integer cast warning. --- src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h index 55a8e6521d..010c7a18a7 100644 --- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h +++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h @@ -9,7 +9,7 @@ static void FUNC(struct draw_pt_front_end *frontend, unsigned count) { struct varray_frontend *varray = (struct varray_frontend *)frontend; - unsigned start = (unsigned)elts; + unsigned start = (unsigned) ((char *) elts - (char *) NULL); unsigned j; unsigned first, incr; -- cgit v1.2.3 From 05c70f8f5d95708cb4564946effb5c49d09068ec Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 10 Apr 2009 09:00:57 +0200 Subject: rtasm: Silence `static function not used' warning. --- src/gallium/auxiliary/rtasm/rtasm_cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/rtasm/rtasm_cpu.c b/src/gallium/auxiliary/rtasm/rtasm_cpu.c index 03bdd47238..2e15751e50 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_cpu.c +++ b/src/gallium/auxiliary/rtasm/rtasm_cpu.c @@ -30,6 +30,7 @@ #include "rtasm_cpu.h" +#if defined(PIPE_ARCH_X86) static boolean rtasm_sse_enabled(void) { static boolean firsttime = 1; @@ -43,6 +44,7 @@ static boolean rtasm_sse_enabled(void) } return enabled; } +#endif int rtasm_cpu_has_sse(void) { -- cgit v1.2.3 From 5fae9514c235cc5590f15fd802bd762107fc689d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 10 Apr 2009 11:58:49 +0200 Subject: tgsi/sse2: Cleanup NRM/NRM4 implementation. Fix comments. Make sure .w is set to 1.0 for NRM. Optimise for non-.xyzw writemasks. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 101 +++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 31225ba430..4b4e34b29e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2178,32 +2178,83 @@ emit_instruction( /* 3 or 4-component normalization */ { uint dims = (inst->Instruction.Opcode == TGSI_OPCODE_NRM) ? 3 : 4; - /* note: cannot use xmm regs 2/3 here (see emit_rsqrt() above) */ - FETCH( func, *inst, 4, 0, CHAN_X ); /* xmm4 = src[0].x */ - FETCH( func, *inst, 5, 0, CHAN_Y ); /* xmm5 = src[0].y */ - FETCH( func, *inst, 6, 0, CHAN_Z ); /* xmm6 = src[0].z */ - if (dims == 4) { - FETCH( func, *inst, 7, 0, CHAN_W ); /* xmm7 = src[0].w */ - } - emit_MOV( func, 0, 4 ); /* xmm0 = xmm3 */ - emit_mul( func, 0, 4 ); /* xmm0 *= xmm3 */ - emit_MOV( func, 1, 5 ); /* xmm1 = xmm4 */ - emit_mul( func, 1, 5 ); /* xmm1 *= xmm4 */ - emit_add( func, 0, 1 ); /* xmm0 += xmm1 */ - emit_MOV( func, 1, 6 ); /* xmm1 = xmm5 */ - emit_mul( func, 1, 6 ); /* xmm1 *= xmm5 */ - emit_add( func, 0, 1 ); /* xmm0 += xmm1 */ - if (dims == 4) { - emit_MOV( func, 1, 7 ); /* xmm1 = xmm7 */ - emit_mul( func, 1, 7 ); /* xmm1 *= xmm7 */ - emit_add( func, 0, 0 ); /* xmm0 += xmm1 */ - } - emit_rsqrt( func, 1, 0 ); /* xmm1 = 1/sqrt(xmm0) */ - FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { - if (chan_index < dims) { - emit_mul( func, 4+chan_index, 1); /* xmm[4+ch] *= xmm1 */ - STORE( func, *inst, 4+chan_index, 0, chan_index ); + + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) || + IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y) || + IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z) || + (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W) && dims == 4)) { + + /* NOTE: Cannot use xmm regs 2/3 here (see emit_rsqrt() above). */ + + /* xmm4 = src.x */ + /* xmm0 = src.x * src.x */ + FETCH(func, *inst, 0, 0, CHAN_X); + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X)) { + emit_MOV(func, 4, 0); } + emit_mul(func, 0, 0); + + /* xmm5 = src.y */ + /* xmm0 = xmm0 + src.y * src.y */ + FETCH(func, *inst, 1, 0, CHAN_Y); + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) { + emit_MOV(func, 5, 1); + } + emit_mul(func, 1, 1); + emit_add(func, 0, 1); + + /* xmm6 = src.z */ + /* xmm0 = xmm0 + src.z * src.z */ + FETCH(func, *inst, 1, 0, CHAN_Z); + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) { + emit_MOV(func, 6, 1); + } + emit_mul(func, 1, 1); + emit_add(func, 0, 1); + + if (dims == 4) { + /* xmm7 = src.w */ + /* xmm0 = xmm0 + src.w * src.w */ + FETCH(func, *inst, 1, 0, CHAN_W); + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W)) { + emit_MOV(func, 7, 1); + } + emit_mul(func, 1, 1); + emit_add(func, 0, 1); + } + + /* xmm1 = 1 / sqrt(xmm0) */ + emit_rsqrt(func, 1, 0); + + /* dst.x = xmm1 * src.x */ + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X)) { + emit_mul(func, 4, 1); + STORE(func, *inst, 4, 0, CHAN_X); + } + + /* dst.y = xmm1 * src.y */ + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Y)) { + emit_mul(func, 5, 1); + STORE(func, *inst, 5, 0, CHAN_Y); + } + + /* dst.z = xmm1 * src.z */ + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_Z)) { + emit_mul(func, 6, 1); + STORE(func, *inst, 6, 0, CHAN_Z); + } + + /* dst.w = xmm1 * src.w */ + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_X) && dims == 4) { + emit_mul(func, 7, 1); + STORE(func, *inst, 7, 0, CHAN_W); + } + } + + /* dst0.w = 1.0 */ + if (IS_DST0_CHANNEL_ENABLED(*inst, CHAN_W) && dims == 3) { + emit_tempf(func, 0, TEMP_ONE_I, TEMP_ONE_C); + STORE(func, *inst, 0, 0, CHAN_W); } } break; -- cgit v1.2.3 From f14497a9cd160106bd69ed37a89e24c77050a394 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:02:29 +0100 Subject: stw: Free the mesa framebuffer. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index fcfd44e399..55dc9d678c 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -235,6 +235,8 @@ stw_framebuffer_destroy( pipe_mutex_unlock( stw_dev->mutex ); + st_unreference_framebuffer(fb->stfb); + FREE( fb ); } -- cgit v1.2.3 From 0dd81ec97b4fd88fa9267f409a115a98344bc2fe Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:02:58 +0100 Subject: stw: Don't make assumptions about integer size. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 7e49889a92..543ed3d54d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -205,7 +205,7 @@ int stw_pixelformat_choose( HDC hdc, count = stw_pixelformat_get_count(); bestindex = count; - bestdelta = 0xffffffff; + bestdelta = ~0U; for (index = 0; index < count; index++) { uint delta = 0; -- cgit v1.2.3 From 2921a4903378e2bfc461322a5443cc013e7414c9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:04:31 +0100 Subject: stw: Reorder the pixelformats, so that no alpha pixelformats get chosen before alpha. Some applications might not handle a alpha visual when when they did not request for one. --- .../state_trackers/wgl/shared/stw_pixelformat.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 543ed3d54d..bb4009f1b4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -44,15 +44,15 @@ stw_add_standard_pixelformats( { struct stw_pixelformat_info *pf = *ppf; struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 }; - struct stw_pixelformat_alpha_info alpha8 = { 8, 24 }; struct stw_pixelformat_alpha_info noalpha = { 0, 0 }; + struct stw_pixelformat_alpha_info alpha8 = { 8, 24 }; struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; struct stw_pixelformat_depth_info depth16 = { 16, 0 }; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; - pf->alpha = alpha8; - pf->depth = depth16; + pf->alpha = noalpha; + pf->depth = depth24s8; pf++; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; @@ -69,14 +69,14 @@ stw_add_standard_pixelformats( pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth24s8; + pf->alpha = alpha8; + pf->depth = depth16; pf++; pf->flags = flags; pf->color = color24; - pf->alpha = alpha8; - pf->depth = depth16; + pf->alpha = noalpha; + pf->depth = depth24s8; pf++; pf->flags = flags; @@ -93,8 +93,8 @@ stw_add_standard_pixelformats( pf->flags = flags; pf->color = color24; - pf->alpha = noalpha; - pf->depth = depth24s8; + pf->alpha = alpha8; + pf->depth = depth16; pf++; *ppf = pf; -- cgit v1.2.3 From 3f2420e2e07b7ae0d2feec81178f998a1e46d631 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:14:13 +0100 Subject: wgl: Combine alpha pixelformat info in color. --- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 4 ++-- .../state_trackers/wgl/shared/stw_context.c | 2 +- .../state_trackers/wgl/shared/stw_pixelformat.c | 27 ++++++++-------------- .../state_trackers/wgl/shared/stw_pixelformat.h | 5 ---- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index a4f78cb293..140bb43caa 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -185,11 +185,11 @@ stw_query_attrib( break; case WGL_ALPHA_BITS_ARB: - *pvalue = (int) pf->alpha.alphabits; + *pvalue = (int) pf->color.alphabits; break; case WGL_ALPHA_SHIFT_ARB: - *pvalue = (int) pf->alpha.alphashift; + *pvalue = (int) pf->color.alphashift; break; case WGL_ACCUM_BITS_ARB: diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 6eb1bd08d5..f7098198c0 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -115,7 +115,7 @@ stw_create_layer_context( pf->color.redbits, pf->color.greenbits, pf->color.bluebits, - pf->alpha.alphabits, + pf->color.alphabits, 0, pf->depth.depthbits, pf->depth.stencilbits, diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index bb4009f1b4..92f668433f 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -43,57 +43,48 @@ stw_add_standard_pixelformats( uint flags ) { struct stw_pixelformat_info *pf = *ppf; - struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16 }; - struct stw_pixelformat_alpha_info noalpha = { 0, 0 }; - struct stw_pixelformat_alpha_info alpha8 = { 8, 24 }; + struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16, 0, 0 }; + struct stw_pixelformat_color_info color24a8 = { 8, 0, 8, 8, 8, 16, 8, 24 }; struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; struct stw_pixelformat_depth_info depth16 = { 16, 0 }; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; - pf->alpha = noalpha; pf->depth = depth24s8; pf++; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = alpha8; + pf->color = color24a8; pf->depth = depth24s8; pf++; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; pf->color = color24; - pf->alpha = noalpha; pf->depth = depth16; pf++; pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->alpha = alpha8; + pf->color = color24a8; pf->depth = depth16; pf++; pf->flags = flags; pf->color = color24; - pf->alpha = noalpha; pf->depth = depth24s8; pf++; pf->flags = flags; - pf->color = color24; - pf->alpha = alpha8; + pf->color = color24a8; pf->depth = depth24s8; pf++; pf->flags = flags; pf->color = color24; - pf->alpha = noalpha; pf->depth = depth16; pf++; pf->flags = flags; - pf->color = color24; - pf->alpha = alpha8; + pf->color = color24a8; pf->depth = depth16; pf++; @@ -171,8 +162,8 @@ stw_pixelformat_describe( ppfd->cGreenShift = pf->color.greenshift; ppfd->cBlueBits = pf->color.bluebits; ppfd->cBlueShift = pf->color.blueshift; - ppfd->cAlphaBits = pf->alpha.alphabits; - ppfd->cAlphaShift = pf->alpha.alphashift; + ppfd->cAlphaBits = pf->color.alphabits; + ppfd->cAlphaShift = pf->color.alphashift; ppfd->cAccumBits = 0; ppfd->cAccumRedBits = 0; ppfd->cAccumGreenBits = 0; @@ -225,7 +216,7 @@ int stw_pixelformat_choose( HDC hdc, if (ppfd->cStencilBits != pf->depth.stencilbits) delta += 2; - if (ppfd->cAlphaBits != pf->alpha.alphabits) + if (ppfd->cAlphaBits != pf->color.alphabits) delta++; if (delta < bestdelta) { diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index cdf687c472..b7807f712b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -42,10 +42,6 @@ struct stw_pixelformat_color_info uint greenshift; uint bluebits; uint blueshift; -}; - -struct stw_pixelformat_alpha_info -{ uint alphabits; uint alphashift; }; @@ -60,7 +56,6 @@ struct stw_pixelformat_info { uint flags; struct stw_pixelformat_color_info color; - struct stw_pixelformat_alpha_info alpha; struct stw_pixelformat_depth_info depth; }; -- cgit v1.2.3 From 87b04ce59b3ed26988b54ca182fab2e9dce03c38 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 10:30:14 +0100 Subject: wgl: Move pixel format information into device structure. --- src/gallium/state_trackers/wgl/shared/stw_device.h | 12 ++++++++++- .../state_trackers/wgl/shared/stw_pixelformat.c | 24 +++++++++------------- .../state_trackers/wgl/shared/stw_pixelformat.h | 7 ++++--- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 0ce0d54cac..66f0047232 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -29,9 +29,15 @@ #define STW_DEVICE_H_ +#include + #include "pipe/p_compiler.h" #include "pipe/p_thread.h" #include "util/u_handle_table.h" +#include "stw_pixelformat.h" + + +#define STW_MAX_PIXELFORMATS 16 struct pipe_screen; @@ -46,7 +52,11 @@ struct stw_device #ifdef DEBUG boolean trace_running; #endif - + + struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; + unsigned pixelformat_count; + unsigned pixelformat_extended_count; + pipe_mutex mutex; struct handle_table *ctx_table; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 92f668433f..68291bd4bb 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -26,16 +26,12 @@ **************************************************************************/ #include "util/u_debug.h" + +#include "stw_device.h" #include "stw_pixelformat.h" #include "stw_public.h" #include "stw_tls.h" -#define STW_MAX_PIXELFORMATS 16 - -static struct stw_pixelformat_info stw_pixelformats[STW_MAX_PIXELFORMATS]; -static uint stw_pixelformat_count = 0; -static uint stw_pixelformat_extended_count = 0; - static void stw_add_standard_pixelformats( @@ -94,35 +90,35 @@ stw_add_standard_pixelformats( void stw_pixelformat_init( void ) { - struct stw_pixelformat_info *pf = stw_pixelformats; + struct stw_pixelformat_info *pf = stw_dev->pixelformats; stw_add_standard_pixelformats( &pf, 0 ); - stw_pixelformat_count = pf - stw_pixelformats; + stw_dev->pixelformat_count = pf - stw_dev->pixelformats; stw_add_standard_pixelformats( &pf, STW_PF_FLAG_MULTISAMPLED ); - stw_pixelformat_extended_count = pf - stw_pixelformats; + stw_dev->pixelformat_extended_count = pf - stw_dev->pixelformats; - assert( stw_pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); + assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } uint stw_pixelformat_get_count( void ) { - return stw_pixelformat_count; + return stw_dev->pixelformat_count; } uint stw_pixelformat_get_extended_count( void ) { - return stw_pixelformat_extended_count; + return stw_dev->pixelformat_extended_count; } const struct stw_pixelformat_info * stw_pixelformat_get_info( uint index ) { - assert( index < stw_pixelformat_extended_count ); + assert( index < stw_dev->pixelformat_extended_count ); - return &stw_pixelformats[index]; + return &stw_dev->pixelformats[index]; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index b7807f712b..b33a688f5a 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -25,10 +25,11 @@ * **************************************************************************/ -#ifndef PIXELFORMAT_H -#define PIXELFORMAT_H +#ifndef STW_PIXELFORMAT_H +#define STW_PIXELFORMAT_H #include + #include "pipe/p_compiler.h" #define STW_PF_FLAG_DOUBLEBUFFER 0x00000001 @@ -75,4 +76,4 @@ int stw_query_sample_buffers( void ); int stw_query_samples( void ); -#endif /* PIXELFORMAT_H */ +#endif /* STW_PIXELFORMAT_H */ -- cgit v1.2.3 From 46857f3c66b9007157a866d13608bc37bdaab10f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 12:58:05 +0100 Subject: mesa: Don't define WGL_ARB_extensions_string in mesa_wgl.h. It breaks wglext.h as it doesn't define PFNWGLGETEXTENSIONSSTRINGARBPROC. --- include/GL/mesa_wgl.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/include/GL/mesa_wgl.h b/include/GL/mesa_wgl.h index 57147232b7..ca2e1b875e 100644 --- a/include/GL/mesa_wgl.h +++ b/include/GL/mesa_wgl.h @@ -108,13 +108,6 @@ WGLAPI int GLAPIENTRY GetPixelFormat(HDC); WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); #endif -#ifndef WGL_ARB_extensions_string -#define WGL_ARB_extensions_string 1 - -WGLAPI const char * GLAPIENTRY wglGetExtensionsStringARB(HDC hdc); - -#endif /* WGL_ARB_extensions_string */ - #ifdef _MSC_VER # pragma warning( pop ) -- cgit v1.2.3 From f8f4b03442fea4f159d2a536bf2311ecb305cd51 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 13:08:57 +0100 Subject: progs: Port glxinfo to wgl. --- progs/wgl/SConscript | 2 + progs/wgl/wglinfo.c | 737 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 739 insertions(+) create mode 100644 progs/wgl/wglinfo.c diff --git a/progs/wgl/SConscript b/progs/wgl/SConscript index b7cf35b7fc..31f61676de 100644 --- a/progs/wgl/SConscript +++ b/progs/wgl/SConscript @@ -21,3 +21,5 @@ for prog in progs: target = prog, source = prog + '/' + prog + '.c', ) + +env.Program('wglinfo', ['wglinfo.c']) diff --git a/progs/wgl/wglinfo.c b/progs/wgl/wglinfo.c new file mode 100644 index 0000000000..5cf0e8bb25 --- /dev/null +++ b/progs/wgl/wglinfo.c @@ -0,0 +1,737 @@ +/* + * Copyright (C) 2009 VMware, Inc. + * Copyright (C) 1999-2006 Brian Paul + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * This program is a work-alike of the GLX glxinfo program. + * Command line options: + * -t print wide table + * -v print verbose information + * -b only print ID of "best" visual on screen 0 + * -l print interesting OpenGL limits (added 5 Sep 2002) + */ + +#include + +#include +#include +#include +#include +#include +#include + + +typedef enum +{ + Normal, + Wide, + Verbose +} InfoMode; + + +/* + * Print a list of extensions, with word-wrapping. + */ +static void +print_extension_list(const char *ext) +{ + const char *indentString = " "; + const int indent = 4; + const int max = 79; + int width, i, j; + + if (!ext || !ext[0]) + return; + + width = indent; + printf(indentString); + i = j = 0; + while (1) { + if (ext[j] == ' ' || ext[j] == 0) { + /* found end of an extension name */ + const int len = j - i; + if (width + len > max) { + /* start a new line */ + printf("\n"); + width = indent; + printf(indentString); + } + /* print the extension name between ext[i] and ext[j] */ + while (i < j) { + printf("%c", ext[i]); + i++; + } + /* either we're all done, or we'll continue with next extension */ + width += len + 1; + if (ext[j] == 0) { + break; + } + else { + i++; + j++; + if (ext[j] == 0) + break; + printf(", "); + width += 2; + } + } + j++; + } + printf("\n"); +} + + +/** + * Print interesting limits for vertex/fragment programs. + */ +static void +print_program_limits(GLenum target) +{ +#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program) + struct token_name { + GLenum token; + const char *name; + }; + static const struct token_name limits[] = { + { GL_MAX_PROGRAM_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_TEMPORARIES_ARB, "GL_MAX_PROGRAM_TEMPORARIES_ARB" }, + { GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB" }, + { GL_MAX_PROGRAM_PARAMETERS_ARB, "GL_MAX_PROGRAM_PARAMETERS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB" }, + { GL_MAX_PROGRAM_ATTRIBS_ARB, "GL_MAX_PROGRAM_ATTRIBS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB" }, + { GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB" }, + { GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB" }, + { GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB" }, + { GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB" }, + { GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB" }, + { (GLenum) 0, NULL } + }; + PFNGLGETPROGRAMIVARBPROC GetProgramivARB_func = (PFNGLGETPROGRAMIVARBPROC) + wglGetProcAddress("glGetProgramivARB"); + GLint max[1]; + int i; + + if (target == GL_VERTEX_PROGRAM_ARB) { + printf(" GL_VERTEX_PROGRAM_ARB:\n"); + } + else if (target == GL_FRAGMENT_PROGRAM_ARB) { + printf(" GL_FRAGMENT_PROGRAM_ARB:\n"); + } + else { + return; /* something's wrong */ + } + + for (i = 0; limits[i].token; i++) { + GetProgramivARB_func(target, limits[i].token, max); + if (glGetError() == GL_NO_ERROR) { + printf(" %s = %d\n", limits[i].name, max[0]); + } + } +#endif /* GL_ARB_vertex_program / GL_ARB_fragment_program */ +} + + +/** + * Print interesting limits for vertex/fragment shaders. + */ +static void +print_shader_limits(GLenum target) +{ + struct token_name { + GLenum token; + const char *name; + }; +#if defined(GL_ARB_vertex_shader) + static const struct token_name vertex_limits[] = { + { GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB" }, + { GL_MAX_VARYING_FLOATS_ARB, "GL_MAX_VARYING_FLOATS_ARB" }, + { GL_MAX_VERTEX_ATTRIBS_ARB, "GL_MAX_VERTEX_ATTRIBS_ARB" }, + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_TEXTURE_IMAGE_UNITS_ARB" }, + { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB" }, + { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB" }, + { GL_MAX_TEXTURE_COORDS_ARB, "GL_MAX_TEXTURE_COORDS_ARB" }, + { (GLenum) 0, NULL } + }; +#endif +#if defined(GL_ARB_fragment_shader) + static const struct token_name fragment_limits[] = { + { GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB" }, + { GL_MAX_TEXTURE_COORDS_ARB, "GL_MAX_TEXTURE_COORDS_ARB" }, + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, "GL_MAX_TEXTURE_IMAGE_UNITS_ARB" }, + { (GLenum) 0, NULL } + }; +#endif + GLint max[1]; + int i; + +#if defined(GL_ARB_vertex_shader) + if (target == GL_VERTEX_SHADER_ARB) { + printf(" GL_VERTEX_SHADER_ARB:\n"); + for (i = 0; vertex_limits[i].token; i++) { + glGetIntegerv(vertex_limits[i].token, max); + if (glGetError() == GL_NO_ERROR) { + printf(" %s = %d\n", vertex_limits[i].name, max[0]); + } + } + } +#endif +#if defined(GL_ARB_fragment_shader) + if (target == GL_FRAGMENT_SHADER_ARB) { + printf(" GL_FRAGMENT_SHADER_ARB:\n"); + for (i = 0; fragment_limits[i].token; i++) { + glGetIntegerv(fragment_limits[i].token, max); + if (glGetError() == GL_NO_ERROR) { + printf(" %s = %d\n", fragment_limits[i].name, max[0]); + } + } + } +#endif +} + + +/** + * Print interesting OpenGL implementation limits. + */ +static void +print_limits(const char *extensions) +{ + struct token_name { + GLuint count; + GLenum token; + const char *name; + }; + static const struct token_name limits[] = { + { 1, GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH" }, + { 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH" }, + { 1, GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES" }, + { 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH, "GL_MAX_COLOR_MATRIX_STACK_DEPTH" }, + { 1, GL_MAX_ELEMENTS_VERTICES, "GL_MAX_ELEMENTS_VERTICES" }, + { 1, GL_MAX_ELEMENTS_INDICES, "GL_MAX_ELEMENTS_INDICES" }, + { 1, GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER" }, + { 1, GL_MAX_LIGHTS, "GL_MAX_LIGHTS" }, + { 1, GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING" }, + { 1, GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH" }, + { 1, GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH" }, + { 1, GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE" }, + { 1, GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" }, + { 1, GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH" }, + { 1, GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE" }, + { 1, GL_MAX_3D_TEXTURE_SIZE, "GL_MAX_3D_TEXTURE_SIZE" }, + { 2, GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS" }, + { 2, GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE" }, + { 2, GL_SMOOTH_LINE_WIDTH_RANGE, "GL_SMOOTH_LINE_WIDTH_RANGE" }, + { 2, GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE" }, + { 2, GL_SMOOTH_POINT_SIZE_RANGE, "GL_SMOOTH_POINT_SIZE_RANGE" }, +#if defined(GL_ARB_texture_cube_map) + { 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB" }, +#endif +#if defined(GLX_NV_texture_rectangle) + { 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV" }, +#endif +#if defined(GL_ARB_texture_compression) + { 1, GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB" }, +#endif +#if defined(GL_ARB_multitexture) + { 1, GL_MAX_TEXTURE_UNITS_ARB, "GL_MAX_TEXTURE_UNITS_ARB" }, +#endif +#if defined(GL_EXT_texture_lod_bias) + { 1, GL_MAX_TEXTURE_LOD_BIAS_EXT, "GL_MAX_TEXTURE_LOD_BIAS_EXT" }, +#endif +#if defined(GL_EXT_texture_filter_anisotropic) + { 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" }, +#endif +#if defined(GL_ARB_draw_buffers) + { 1, GL_MAX_DRAW_BUFFERS_ARB, "GL_MAX_DRAW_BUFFERS_ARB" }, +#endif + { 0, (GLenum) 0, NULL } + }; + GLint i, max[2]; + + printf("OpenGL limits:\n"); + for (i = 0; limits[i].count; i++) { + glGetIntegerv(limits[i].token, max); + if (glGetError() == GL_NO_ERROR) { + if (limits[i].count == 1) + printf(" %s = %d\n", limits[i].name, max[0]); + else /* XXX fix if we ever query something with more than 2 values */ + printf(" %s = %d, %d\n", limits[i].name, max[0], max[1]); + } + } + +#if defined(GL_EXT_convolution) + { + PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC glGetConvolutionParameterivEXT_func = + (PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC)wglGetProcAddress("glGetConvolutionParameterivEXT"); + if(glGetConvolutionParameterivEXT_func) { + /* these don't fit into the above mechanism, unfortunately */ + glGetConvolutionParameterivEXT_func(GL_CONVOLUTION_2D, GL_MAX_CONVOLUTION_WIDTH, max); + glGetConvolutionParameterivEXT_func(GL_CONVOLUTION_2D, GL_MAX_CONVOLUTION_HEIGHT, max+1); + if (glGetError() == GL_NONE) { + printf(" GL_MAX_CONVOLUTION_WIDTH/HEIGHT = %d, %d\n", max[0], max[1]); + } + } + } +#endif + +#if defined(GL_ARB_vertex_program) + if (strstr(extensions, "GL_ARB_vertex_program")) { + print_program_limits(GL_VERTEX_PROGRAM_ARB); + } +#endif +#if defined(GL_ARB_fragment_program) + if (strstr(extensions, "GL_ARB_fragment_program")) { + print_program_limits(GL_FRAGMENT_PROGRAM_ARB); + } +#endif +#if defined(GL_ARB_vertex_shader) + if (strstr(extensions, "GL_ARB_vertex_shader")) { + print_shader_limits(GL_VERTEX_SHADER_ARB); + } +#endif +#if defined(GL_ARB_fragment_shader) + if (strstr(extensions, "GL_ARB_fragment_shader")) { + print_shader_limits(GL_FRAGMENT_SHADER_ARB); + } +#endif +} + + +static LRESULT CALLBACK +WndProc(HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam ) +{ + switch (uMsg) { + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + + return 0; +} + + +static void +print_screen_info(HDC _hdc, GLboolean limits) +{ + WNDCLASS wc; + HWND win; + HGLRC ctx; + int visinfo; + int width = 100, height = 100; + HDC hdc; + PIXELFORMATDESCRIPTOR pfd; + + memset(&wc, 0, sizeof wc); + wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.lpfnWndProc = WndProc; + wc.lpszClassName = "wglinfo"; + wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; + RegisterClass(&wc); + + win = CreateWindowEx(0, + wc.lpszClassName, + "wglinfo", + WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + CW_USEDEFAULT, + CW_USEDEFAULT, + width, + height, + NULL, + NULL, + wc.hInstance, + NULL); + if (!win) { + fprintf(stderr, "Couldn't create window"); + exit(1); + } + + hdc = GetDC(win); + if (!hdc) { + fprintf(stderr, "Couldn't obtain HDC"); + return; + } + + pfd.cColorBits = 3; + pfd.cRedBits = 1; + pfd.cGreenBits = 1; + pfd.cBlueBits = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iLayerType = PFD_MAIN_PLANE; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + + visinfo = ChoosePixelFormat(hdc, &pfd); + if (!visinfo) { + pfd.dwFlags |= PFD_DOUBLEBUFFER; + visinfo = ChoosePixelFormat(hdc, &pfd); + } + + if (!visinfo) { + fprintf(stderr, "Error: couldn't find RGB WGL visual\n"); + return; + } + + SetPixelFormat(hdc, visinfo, &pfd); + ctx = wglCreateContext(hdc); + if (!ctx) { + fprintf(stderr, "Error: wglCreateContext failed\n"); + return; + } + + if (wglMakeCurrent(hdc, ctx)) { +#if defined(WGL_ARB_extensions_string) + PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB_func = + (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB"); +#endif + const char *glVendor = (const char *) glGetString(GL_VENDOR); + const char *glRenderer = (const char *) glGetString(GL_RENDERER); + const char *glVersion = (const char *) glGetString(GL_VERSION); + const char *glExtensions = (const char *) glGetString(GL_EXTENSIONS); + +#if defined(WGL_ARB_extensions_string) + if(wglGetExtensionsStringARB_func) { + const char *wglExtensions = wglGetExtensionsStringARB_func(hdc); + if(wglExtensions) { + printf("WGL extensions:\n"); + print_extension_list(wglExtensions); + } + } +#endif + printf("OpenGL vendor string: %s\n", glVendor); + printf("OpenGL renderer string: %s\n", glRenderer); + printf("OpenGL version string: %s\n", glVersion); +#ifdef GL_VERSION_2_0 + if (glVersion[0] >= '2' && glVersion[1] == '.') { + char *v = (char *) glGetString(GL_SHADING_LANGUAGE_VERSION); + printf("OpenGL shading language version string: %s\n", v); + } +#endif + + printf("OpenGL extensions:\n"); + print_extension_list(glExtensions); + if (limits) + print_limits(glExtensions); + } + else { + fprintf(stderr, "Error: wglMakeCurrent failed\n"); + } + + DestroyWindow(win); +} + + +static const char * +visual_render_type_name(BYTE iPixelType) +{ + switch (iPixelType) { + case PFD_TYPE_RGBA: + return "rgba"; + case PFD_TYPE_COLORINDEX: + return "ci"; + default: + return ""; + } +} + +static void +print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd) +{ + printf("Visual ID: %x generic=%d native=%d\n", + iPixelFormat, + ppfd->dwFlags & PFD_GENERIC_FORMAT ? 1 : 0, + ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0); + printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n", + 0 /* ppfd->bufferSize */, 0 /* ppfd->level */, + visual_render_type_name(ppfd->dwFlags), + ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0, + ppfd->dwFlags & PFD_STEREO ? 1 : 0); + printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n", + ppfd->cRedBits, ppfd->cGreenBits, + ppfd->cBlueBits, ppfd->cAlphaBits); + printf(" cAuxBuffers=%d cDepthBits=%d cStencilBits=%d\n", + ppfd->cAuxBuffers, ppfd->cDepthBits, ppfd->cStencilBits); + printf(" accum: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n", + ppfd->cAccumRedBits, ppfd->cAccumGreenBits, + ppfd->cAccumBlueBits, ppfd->cAccumAlphaBits); + printf(" multiSample=%d multiSampleBuffers=%d\n", + 0 /* ppfd->numSamples */, 0 /* ppfd->numMultisample */); +} + + +static void +print_visual_attribs_short_header(void) +{ + printf(" visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav\n"); + printf(" id gen nat sp sz l ci b ro r g b a bf th cl r g b a ns b eat\n"); + printf("-----------------------------------------------------------------------\n"); +} + + +static void +print_visual_attribs_short(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd) +{ + char *caveat = "None"; + + printf("0x%02x %2d %2d %2d %2d %2d %c%c %c %c %2d %2d %2d %2d %2d %2d %2d", + iPixelFormat, + ppfd->dwFlags & PFD_GENERIC_FORMAT ? 1 : 0, + ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0, + 0, + 0 /* ppfd->bufferSize */, + 0 /* ppfd->level */, + ppfd->iPixelType == PFD_TYPE_RGBA ? 'r' : ' ', + ppfd->iPixelType == PFD_TYPE_COLORINDEX ? 'c' : ' ', + ppfd->dwFlags & PFD_DOUBLEBUFFER ? 'y' : '.', + ppfd->dwFlags & PFD_STEREO ? 'y' : '.', + ppfd->cRedBits, ppfd->cGreenBits, + ppfd->cBlueBits, ppfd->cAlphaBits, + ppfd->cAuxBuffers, + ppfd->cDepthBits, + ppfd->cStencilBits + ); + + printf(" %2d %2d %2d %2d %2d %1d %s\n", + ppfd->cAccumRedBits, ppfd->cAccumGreenBits, + ppfd->cAccumBlueBits, ppfd->cAccumAlphaBits, + 0 /* ppfd->numSamples */, 0 /* ppfd->numMultisample */, + caveat + ); +} + + +static void +print_visual_attribs_long_header(void) +{ + printf("Vis Vis Visual Trans buff lev render DB ste r g b a aux dep ste accum buffers MS MS\n"); + printf(" ID Depth Type parent size el type reo sz sz sz sz buf th ncl r g b a num bufs\n"); + printf("----------------------------------------------------------------------------------------------------\n"); +} + + +static void +print_visual_attribs_long(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd) +{ + printf("0x%2x %2d %11d %2d %2d %2d %4s %3d %3d %3d %3d %3d %3d", + iPixelFormat, + ppfd->dwFlags & PFD_GENERIC_FORMAT ? 1 : 0, + ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0, + 0, + 0 /* ppfd->bufferSize */, + 0 /* ppfd->level */, + visual_render_type_name(ppfd->iPixelType), + ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0, + ppfd->dwFlags & PFD_STEREO ? 1 : 0, + ppfd->cRedBits, ppfd->cGreenBits, + ppfd->cBlueBits, ppfd->cAlphaBits + ); + + printf(" %3d %4d %2d %3d %3d %3d %3d %2d %2d\n", + ppfd->cAuxBuffers, + ppfd->cDepthBits, + ppfd->cStencilBits, + ppfd->cAccumRedBits, ppfd->cAccumGreenBits, + ppfd->cAccumBlueBits, ppfd->cAccumAlphaBits, + 0 /* ppfd->numSamples */, 0 /* ppfd->numMultisample */ + ); +} + + +static void +print_visual_info(HDC hdc, InfoMode mode) +{ + PIXELFORMATDESCRIPTOR pfd; + int numVisuals, numWglVisuals; + int i; + + numVisuals = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL); + if (numVisuals == 0) + return; + + numWglVisuals = 0; + for (i = 0; i < numVisuals; i++) { + if(!DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) + continue; + + if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) + continue; + + ++numWglVisuals; + } + + printf("%d WGL Visuals\n", numWglVisuals); + + if (mode == Normal) + print_visual_attribs_short_header(); + else if (mode == Wide) + print_visual_attribs_long_header(); + + for (i = 0; i < numVisuals; i++) { + if(!DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) + continue; + + if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) + continue; + + if (mode == Verbose) + print_visual_attribs_verbose(i, &pfd); + else if (mode == Normal) + print_visual_attribs_short(i, &pfd); + else if (mode == Wide) + print_visual_attribs_long(i, &pfd); + } + printf("\n"); +} + + +/* + * Examine all visuals to find the so-called best one. + * We prefer deepest RGBA buffer with depth, stencil and accum + * that has no caveats. + */ +static int +find_best_visual(HDC hdc) +{ +#if 0 + XVisualInfo theTemplate; + XVisualInfo *visuals; + int numVisuals; + long mask; + int i; + struct visual_attribs bestVis; + + /* get list of all visuals on this screen */ + theTemplate.screen = scrnum; + mask = VisualScreenMask; + visuals = XGetVisualInfo(hdc, mask, &theTemplate, &numVisuals); + + /* init bestVis with first visual info */ + get_visual_attribs(hdc, &visuals[0], &bestVis); + + /* try to find a "better" visual */ + for (i = 1; i < numVisuals; i++) { + struct visual_attribs vis; + + get_visual_attribs(hdc, &visuals[i], &vis); + + /* always skip visuals with caveats */ + if (vis.visualCaveat != GLX_NONE_EXT) + continue; + + /* see if this vis is better than bestVis */ + if ((!bestVis.supportsGL && vis.supportsGL) || + (bestVis.visualCaveat != GLX_NONE_EXT) || + (bestVis.iPixelType != vis.iPixelType) || + (!bestVis.doubleBuffer && vis.doubleBuffer) || + (bestVis.cRedBits < vis.cRedBits) || + (bestVis.cGreenBits < vis.cGreenBits) || + (bestVis.cBlueBits < vis.cBlueBits) || + (bestVis.cAlphaBits < vis.cAlphaBits) || + (bestVis.cDepthBits < vis.cDepthBits) || + (bestVis.cStencilBits < vis.cStencilBits) || + (bestVis.cAccumRedBits < vis.cAccumRedBits)) { + /* found a better visual */ + bestVis = vis; + } + } + + return bestVis.id; +#else + return 0; +#endif +} + + +static void +usage(void) +{ + printf("Usage: glxinfo [-v] [-t] [-h] [-i] [-b] [-display ]\n"); + printf("\t-v: Print visuals info in verbose form.\n"); + printf("\t-t: Print verbose table.\n"); + printf("\t-h: This information.\n"); + printf("\t-b: Find the 'best' visual and print it's number.\n"); + printf("\t-l: Print interesting OpenGL limits.\n"); +} + + +int +main(int argc, char *argv[]) +{ + HDC hdc; + InfoMode mode = Normal; + GLboolean findBest = GL_FALSE; + GLboolean limits = GL_FALSE; + int i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-t") == 0) { + mode = Wide; + } + else if (strcmp(argv[i], "-v") == 0) { + mode = Verbose; + } + else if (strcmp(argv[i], "-b") == 0) { + findBest = GL_TRUE; + } + else if (strcmp(argv[i], "-l") == 0) { + limits = GL_TRUE; + } + else if (strcmp(argv[i], "-h") == 0) { + usage(); + return 0; + } + else { + printf("Unknown option `%s'\n", argv[i]); + usage(); + return 0; + } + } + + hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); + + if (findBest) { + int b; + b = find_best_visual(hdc); + printf("%d\n", b); + } + else { + print_screen_info(hdc, limits); + printf("\n"); + print_visual_info(hdc, mode); + } + + return 0; +} -- cgit v1.2.3 From 0a2269703c2398d81d8cde439527f883f6fbc502 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 13:18:14 +0100 Subject: wgl: Slightly simplify pixelformat creation. --- .../state_trackers/wgl/shared/stw_pixelformat.c | 96 ++++++++++------------ 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 68291bd4bb..daf42c02fe 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -34,70 +34,62 @@ static void -stw_add_standard_pixelformats( - struct stw_pixelformat_info **ppf, - uint flags ) +stw_pixelformat_add( + struct stw_device *stw_dev, + unsigned flags, + const struct stw_pixelformat_color_info *color, + const struct stw_pixelformat_depth_info *depth, + boolean extended ) { - struct stw_pixelformat_info *pf = *ppf; - struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16, 0, 0 }; - struct stw_pixelformat_color_info color24a8 = { 8, 0, 8, 8, 8, 16, 8, 24 }; - struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; - struct stw_pixelformat_depth_info depth16 = { 16, 0 }; - - pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->depth = depth24s8; - pf++; - - pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24a8; - pf->depth = depth24s8; - pf++; - - pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24; - pf->depth = depth16; - pf++; - - pf->flags = STW_PF_FLAG_DOUBLEBUFFER | flags; - pf->color = color24a8; - pf->depth = depth16; - pf++; - + struct stw_pixelformat_info *pf; + + assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); + if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) + return; + + pf = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; + pf->flags = flags; - pf->color = color24; - pf->depth = depth24s8; - pf++; + pf->color = *color; + pf->depth = *depth; - pf->flags = flags; - pf->color = color24a8; - pf->depth = depth24s8; - pf++; + ++stw_dev->pixelformat_extended_count; + + if(!extended) { + ++stw_dev->pixelformat_count; + assert(stw_dev->pixelformat_count == stw_dev->pixelformat_extended_count); + } +} - pf->flags = flags; - pf->color = color24; - pf->depth = depth16; - pf++; +static void +stw_add_standard_pixelformats( + struct stw_device *stw_dev, + uint flags, + boolean extended ) +{ + const struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16, 0, 0 }; + const struct stw_pixelformat_color_info color24a8 = { 8, 0, 8, 8, 8, 16, 8, 24 }; + const struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; + const struct stw_pixelformat_depth_info depth16 = { 16, 0 }; - pf->flags = flags; - pf->color = color24a8; - pf->depth = depth16; - pf++; + stw_pixelformat_add( stw_dev, flags, &color24, &depth24s8, extended ); - *ppf = pf; + stw_pixelformat_add( stw_dev, flags, &color24a8, &depth24s8, extended ); + + stw_pixelformat_add( stw_dev, flags, &color24, &depth16, extended ); + + stw_pixelformat_add( stw_dev, flags, &color24a8, &depth16, extended ); } void stw_pixelformat_init( void ) { - struct stw_pixelformat_info *pf = stw_dev->pixelformats; - - stw_add_standard_pixelformats( &pf, 0 ); - stw_dev->pixelformat_count = pf - stw_dev->pixelformats; - - stw_add_standard_pixelformats( &pf, STW_PF_FLAG_MULTISAMPLED ); - stw_dev->pixelformat_extended_count = pf - stw_dev->pixelformats; + stw_add_standard_pixelformats( stw_dev, STW_PF_FLAG_DOUBLEBUFFER | 0 , FALSE ); + stw_add_standard_pixelformats( stw_dev, 0 | 0, FALSE ); + stw_add_standard_pixelformats( stw_dev, STW_PF_FLAG_DOUBLEBUFFER | STW_PF_FLAG_MULTISAMPLED, TRUE ); + stw_add_standard_pixelformats( stw_dev, 0 | STW_PF_FLAG_MULTISAMPLED, TRUE ); + assert( stw_dev->pixelformat_count <= STW_MAX_PIXELFORMATS ); assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } -- cgit v1.2.3 From 88999de8b70d1e170f5bbcadd07132d382c560cf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 08:05:10 -0600 Subject: gallium: remove pipe_texture::compressed field The format field encodes compressed vs. uncompressed already. We can easily check if a texture is compressed with pf_is_compressed(texture->format). --- src/gallium/drivers/nv04/nv04_transfer.c | 1 - src/gallium/drivers/nv10/nv10_transfer.c | 1 - src/gallium/drivers/nv20/nv20_transfer.c | 1 - src/gallium/drivers/nv30/nv30_transfer.c | 1 - src/gallium/drivers/nv40/nv40_transfer.c | 1 - src/gallium/include/pipe/p_state.h | 1 - src/mesa/state_tracker/st_texture.c | 1 - 7 files changed, 7 deletions(-) diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index e925a44e29..854b855d64 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -43,7 +43,6 @@ nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; - template->compressed = pt->compressed; template->nr_samples = pt->nr_samples; template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index 5a99225409..c06b8d34c7 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -43,7 +43,6 @@ nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; - template->compressed = pt->compressed; template->nr_samples = pt->nr_samples; template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index e5255296aa..5018995596 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -43,7 +43,6 @@ nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; - template->compressed = pt->compressed; template->nr_samples = pt->nr_samples; template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 8b915b35bd..2367571878 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -43,7 +43,6 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; - template->compressed = pt->compressed; template->nr_samples = pt->nr_samples; template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 728e8b5674..ce45055fe8 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -43,7 +43,6 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; - template->compressed = pt->compressed; template->nr_samples = pt->nr_samples; template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC | diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 705ae68ec6..4b590bdc90 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -336,7 +336,6 @@ struct pipe_texture unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */ unsigned last_level:8; /**< Index of last mipmap level present/defined */ - unsigned compressed:1; unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index fad513a556..19eb7e2f69 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -100,7 +100,6 @@ st_texture_create(struct st_context *st, pt.width[0] = width0; pt.height[0] = height0; pt.depth[0] = depth0; - pt.compressed = pf_is_compressed(format); pf_get_block(format, &pt.block); pt.tex_usage = usage; -- cgit v1.2.3 From ded05d32d5f948770ece088ea0ed6363c0055a4c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 08:35:21 -0600 Subject: intel: added screen->dri2.loader null pointer check in intel_flush() Fixes segfaults when rendering to front buffer. --- src/mesa/drivers/dri/intel/intel_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 56d03c1e78..3436b8ecd3 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -400,7 +400,8 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) { __DRIscreen *const screen = intel->intelScreen->driScrnPriv; - if ((screen->dri2.loader->base.version >= 2) + if (screen->dri2.loader && + (screen->dri2.loader->base.version >= 2) && (screen->dri2.loader->flushFrontBuffer != NULL)) { (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable, intel->driDrawable->loaderPrivate); -- cgit v1.2.3 From 23a911b4a66914883ece70c1e621dfc082661a28 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 08:36:04 -0600 Subject: i965: added null const_buffer pointer check in update_constant_buffer() --- src/mesa/drivers/dri/i965/brw_curbe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 08b602a5ab..94bf2c0d67 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -343,7 +343,7 @@ update_constant_buffer(struct brw_context *brw, const int size = params->NumParameters * 4 * sizeof(GLfloat); /* copy Mesa program constants into the buffer */ - if (size > 0) { + if (const_buffer && size > 0) { GLubyte *map; assert(const_buffer); -- cgit v1.2.3 From d60b4f7885d88fc868c3af2ba661cd79c907af7f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 08:56:03 -0600 Subject: mesa: asst. progs/test/Makefile files --- progs/tests/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 58ea5690df..90c41a327e 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -201,10 +201,10 @@ fillrate.o: fillrate.c readtex.h floattex: floattex.o readtex.o shaderutil.o - $(CC) $(CFLAGS) $(LDFLAGS) floattex.o readtex.o shaderutil.o $(LIBS) -o $@ + $(APP_CC) $(CFLAGS) $(LDFLAGS) floattex.o readtex.o shaderutil.o $(LIBS) -o $@ floattex.o: floattex.c readtex.h shaderutil.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) floattex.c -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) floattex.c -o $@ readtex.o: readtex.c @@ -230,7 +230,7 @@ shaderutil.h: $(TOP)/progs/util/shaderutil.h cp $< . shaderutil.o: shaderutil.c shaderutil.h - $(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c + $(APP_CC) -c -I$(INCDIR) $(INCLUDES) $(CFLAGS) shaderutil.c -- cgit v1.2.3 From 48f0543b39969694626bbeeca0b69b184db315f6 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Fri, 10 Apr 2009 11:41:27 -0500 Subject: Build dri drivers for powerpc and sparc on FreeBSD. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 67994274f3..ce7507fd29 100644 --- a/configure.ac +++ b/configure.ac @@ -389,7 +389,7 @@ linux*) ;; *freebsd* | dragonfly*) case "$host_cpu" in - i*86|x86_64) default_driver="dri";; + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; esac ;; esac -- cgit v1.2.3 From e5d700721b05910f935c873ebb23d23f49961ebf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 16:37:15 +0100 Subject: wgl: Keep copies of the PIXELFORMATDESCRIPTOR structures. --- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 87 +++++++------ .../state_trackers/wgl/shared/stw_context.c | 30 ++--- .../state_trackers/wgl/shared/stw_pixelformat.c | 142 +++++++++++---------- .../state_trackers/wgl/shared/stw_pixelformat.h | 13 +- 4 files changed, 139 insertions(+), 133 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c index 140bb43caa..0e2d407699 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c @@ -56,7 +56,7 @@ stw_query_attrib( { uint count; uint index; - const struct stw_pixelformat_info *pf; + const struct stw_pixelformat_info *pfi; count = stw_pixelformat_get_extended_count(); @@ -69,30 +69,27 @@ stw_query_attrib( if (index >= count) return FALSE; - pf = stw_pixelformat_get_info( index ); + pfi = stw_pixelformat_get_info( index ); switch (attrib) { case WGL_DRAW_TO_WINDOW_ARB: - *pvalue = TRUE; + *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_WINDOW ? TRUE : FALSE; return TRUE; case WGL_DRAW_TO_BITMAP_ARB: - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_BITMAP ? TRUE : FALSE; return TRUE; case WGL_NEED_PALETTE_ARB: - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_NEED_PALETTE ? TRUE : FALSE; return TRUE; case WGL_NEED_SYSTEM_PALETTE_ARB: - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE; return TRUE; case WGL_SWAP_METHOD_ARB: - if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) - *pvalue = WGL_SWAP_COPY_ARB; - else - *pvalue = WGL_SWAP_UNDEFINED_ARB; + *pvalue = pfi->pfd.dwFlags & PFD_SWAP_COPY ? WGL_SWAP_COPY_ARB : WGL_SWAP_UNDEFINED_ARB; return TRUE; case WGL_SWAP_LAYER_BUFFERS_ARB: @@ -134,96 +131,108 @@ stw_query_attrib( break; case WGL_SUPPORT_GDI_ARB: - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_GDI ? TRUE : FALSE; break; case WGL_SUPPORT_OPENGL_ARB: - *pvalue = TRUE; + *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_OPENGL ? TRUE : FALSE; break; case WGL_DOUBLE_BUFFER_ARB: - if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) - *pvalue = TRUE; - else - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_DOUBLEBUFFER ? TRUE : FALSE; break; case WGL_STEREO_ARB: - *pvalue = FALSE; + *pvalue = pfi->pfd.dwFlags & PFD_STEREO ? TRUE : FALSE; break; case WGL_PIXEL_TYPE_ARB: - *pvalue = WGL_TYPE_RGBA_ARB; + switch (pfi->pfd.iPixelType) { + case PFD_TYPE_RGBA: + *pvalue = WGL_TYPE_RGBA_ARB; + break; + case PFD_TYPE_COLORINDEX: + *pvalue = WGL_TYPE_COLORINDEX_ARB; + break; + default: + return FALSE; + } break; case WGL_COLOR_BITS_ARB: - *pvalue = (int) (pf->color.redbits + pf->color.greenbits + pf->color.bluebits); + *pvalue = pfi->pfd.cColorBits; break; case WGL_RED_BITS_ARB: - *pvalue = (int) pf->color.redbits; + *pvalue = pfi->pfd.cRedBits; break; case WGL_RED_SHIFT_ARB: - *pvalue = (int) pf->color.redshift; + *pvalue = pfi->pfd.cRedShift; break; case WGL_GREEN_BITS_ARB: - *pvalue = (int) pf->color.greenbits; + *pvalue = pfi->pfd.cGreenBits; break; case WGL_GREEN_SHIFT_ARB: - *pvalue = (int) pf->color.greenshift; + *pvalue = pfi->pfd.cGreenShift; break; case WGL_BLUE_BITS_ARB: - *pvalue = (int) pf->color.bluebits; + *pvalue = pfi->pfd.cBlueBits; break; case WGL_BLUE_SHIFT_ARB: - *pvalue = (int) pf->color.blueshift; + *pvalue = pfi->pfd.cBlueShift; break; case WGL_ALPHA_BITS_ARB: - *pvalue = (int) pf->color.alphabits; + *pvalue = pfi->pfd.cAlphaBits; break; case WGL_ALPHA_SHIFT_ARB: - *pvalue = (int) pf->color.alphashift; + *pvalue = pfi->pfd.cAlphaShift; break; case WGL_ACCUM_BITS_ARB: + *pvalue = pfi->pfd.cAccumBits; + break; + case WGL_ACCUM_RED_BITS_ARB: + *pvalue = pfi->pfd.cAccumRedBits; + break; + case WGL_ACCUM_GREEN_BITS_ARB: + *pvalue = pfi->pfd.cAccumGreenBits; + break; + case WGL_ACCUM_BLUE_BITS_ARB: + *pvalue = pfi->pfd.cAccumBlueBits; + break; + case WGL_ACCUM_ALPHA_BITS_ARB: - *pvalue = 0; + *pvalue = pfi->pfd.cAccumAlphaBits; break; case WGL_DEPTH_BITS_ARB: - *pvalue = (int) pf->depth.depthbits; + *pvalue = pfi->pfd.cDepthBits; break; case WGL_STENCIL_BITS_ARB: - *pvalue = (int) pf->depth.stencilbits; + *pvalue = pfi->pfd.cStencilBits; break; case WGL_AUX_BUFFERS_ARB: - *pvalue = 0; + *pvalue = pfi->pfd.cAuxBuffers; break; case WGL_SAMPLE_BUFFERS_ARB: - if (pf->flags & STW_PF_FLAG_MULTISAMPLED) - *pvalue = stw_query_sample_buffers(); - else - *pvalue = 0; + *pvalue = pfi->numSampleBuffers; break; case WGL_SAMPLES_ARB: - if (pf->flags & STW_PF_FLAG_MULTISAMPLED) - *pvalue = stw_query_samples(); - else - *pvalue = 0; + *pvalue = pfi->numSamples; break; default: diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index f7098198c0..e6bb8e1847 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -109,21 +109,21 @@ stw_create_layer_context( /* Create visual based on flags */ visual = _mesa_create_visual( - GL_TRUE, - (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, - GL_FALSE, - pf->color.redbits, - pf->color.greenbits, - pf->color.bluebits, - pf->color.alphabits, - 0, - pf->depth.depthbits, - pf->depth.stencilbits, - 0, - 0, - 0, - 0, - (pf->flags & STW_PF_FLAG_MULTISAMPLED) ? stw_query_samples() : 0 ); + (pf->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE, + (pf->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, + (pf->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE, + pf->pfd.cRedBits, + pf->pfd.cGreenBits, + pf->pfd.cBlueBits, + pf->pfd.cAlphaBits, + (pf->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pf->pfd.cColorBits : 0, + pf->pfd.cDepthBits, + pf->pfd.cStencilBits, + pf->pfd.cAccumRedBits, + pf->pfd.cAccumGreenBits, + pf->pfd.cAccumBlueBits, + pf->pfd.cAccumAlphaBits, + pf->numSamples ); if (visual == NULL) goto fail; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index daf42c02fe..7bbab0e972 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -36,23 +36,68 @@ static void stw_pixelformat_add( struct stw_device *stw_dev, - unsigned flags, const struct stw_pixelformat_color_info *color, const struct stw_pixelformat_depth_info *depth, + boolean doublebuffer, + boolean multisampled, boolean extended ) { - struct stw_pixelformat_info *pf; + struct stw_pixelformat_info *pfi; assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) return; - pf = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; + pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; - pf->flags = flags; - pf->color = *color; - pf->depth = *depth; + memset(pfi, 0, sizeof *pfi); + + pfi->pfd.nSize = sizeof pfi->pfd; + pfi->pfd.nVersion = 1; + pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL; + + /* TODO: also support non-native pixel formats */ + pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW ; + + if (doublebuffer) + pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; + + pfi->pfd.iPixelType = PFD_TYPE_RGBA; + + pfi->pfd.cColorBits = color->redbits + color->greenbits + color->bluebits; + pfi->pfd.cRedBits = color->redbits; + pfi->pfd.cRedShift = color->redshift; + pfi->pfd.cGreenBits = color->greenbits; + pfi->pfd.cGreenShift = color->greenshift; + pfi->pfd.cBlueBits = color->bluebits; + pfi->pfd.cBlueShift = color->blueshift; + pfi->pfd.cAlphaBits = color->alphabits; + pfi->pfd.cAlphaShift = color->alphashift; + pfi->pfd.cAccumBits = 0; + pfi->pfd.cAccumRedBits = 0; + pfi->pfd.cAccumGreenBits = 0; + pfi->pfd.cAccumBlueBits = 0; + pfi->pfd.cAccumAlphaBits = 0; + pfi->pfd.cDepthBits = depth->depthbits; + pfi->pfd.cStencilBits = depth->stencilbits; + pfi->pfd.cAuxBuffers = 0; + pfi->pfd.iLayerType = 0; + pfi->pfd.bReserved = 0; + pfi->pfd.dwLayerMask = 0; + pfi->pfd.dwVisibleMask = 0; + pfi->pfd.dwDamageMask = 0; + + if(multisampled) { + /* FIXME: re-enable when we can query this */ +#if 0 + pfi->numSampleBuffers = 1; + pfi->numSamples = 4; +#else + return; +#endif + } + ++stw_dev->pixelformat_extended_count; if(!extended) { @@ -64,7 +109,8 @@ stw_pixelformat_add( static void stw_add_standard_pixelformats( struct stw_device *stw_dev, - uint flags, + boolean doublebuffer, + boolean multisampled, boolean extended ) { const struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16, 0, 0 }; @@ -72,22 +118,22 @@ stw_add_standard_pixelformats( const struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; const struct stw_pixelformat_depth_info depth16 = { 16, 0 }; - stw_pixelformat_add( stw_dev, flags, &color24, &depth24s8, extended ); + stw_pixelformat_add( stw_dev, &color24, &depth24s8, doublebuffer, multisampled, extended ); - stw_pixelformat_add( stw_dev, flags, &color24a8, &depth24s8, extended ); + stw_pixelformat_add( stw_dev, &color24a8, &depth24s8, doublebuffer, multisampled, extended ); - stw_pixelformat_add( stw_dev, flags, &color24, &depth16, extended ); + stw_pixelformat_add( stw_dev, &color24, &depth16, doublebuffer, multisampled, extended ); - stw_pixelformat_add( stw_dev, flags, &color24a8, &depth16, extended ); + stw_pixelformat_add( stw_dev, &color24a8, &depth16, doublebuffer, multisampled, extended ); } void stw_pixelformat_init( void ) { - stw_add_standard_pixelformats( stw_dev, STW_PF_FLAG_DOUBLEBUFFER | 0 , FALSE ); - stw_add_standard_pixelformats( stw_dev, 0 | 0, FALSE ); - stw_add_standard_pixelformats( stw_dev, STW_PF_FLAG_DOUBLEBUFFER | STW_PF_FLAG_MULTISAMPLED, TRUE ); - stw_add_standard_pixelformats( stw_dev, 0 | STW_PF_FLAG_MULTISAMPLED, TRUE ); + stw_add_standard_pixelformats( stw_dev, FALSE, FALSE, FALSE ); + stw_add_standard_pixelformats( stw_dev, TRUE, FALSE, FALSE ); + stw_add_standard_pixelformats( stw_dev, FALSE, TRUE, TRUE ); + stw_add_standard_pixelformats( stw_dev, TRUE, TRUE, TRUE ); assert( stw_dev->pixelformat_count <= STW_MAX_PIXELFORMATS ); assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); @@ -123,7 +169,7 @@ stw_pixelformat_describe( { uint count; uint index; - const struct stw_pixelformat_info *pf; + const struct stw_pixelformat_info *pfi; (void) hdc; @@ -135,36 +181,9 @@ stw_pixelformat_describe( if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) return 0; - pf = stw_pixelformat_get_info( index ); - - ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); - ppfd->nVersion = 1; - ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; - if (pf->flags & STW_PF_FLAG_DOUBLEBUFFER) - ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; - ppfd->iPixelType = PFD_TYPE_RGBA; - ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits; - ppfd->cRedBits = pf->color.redbits; - ppfd->cRedShift = pf->color.redshift; - ppfd->cGreenBits = pf->color.greenbits; - ppfd->cGreenShift = pf->color.greenshift; - ppfd->cBlueBits = pf->color.bluebits; - ppfd->cBlueShift = pf->color.blueshift; - ppfd->cAlphaBits = pf->color.alphabits; - ppfd->cAlphaShift = pf->color.alphashift; - ppfd->cAccumBits = 0; - ppfd->cAccumRedBits = 0; - ppfd->cAccumGreenBits = 0; - ppfd->cAccumBlueBits = 0; - ppfd->cAccumAlphaBits = 0; - ppfd->cDepthBits = pf->depth.depthbits; - ppfd->cStencilBits = pf->depth.stencilbits; - ppfd->cAuxBuffers = 0; - ppfd->iLayerType = 0; - ppfd->bReserved = 0; - ppfd->dwLayerMask = 0; - ppfd->dwVisibleMask = 0; - ppfd->dwDamageMask = 0; + pfi = stw_pixelformat_get_info( index ); + + memcpy(ppfd, &pfi->pfd, sizeof( PIXELFORMATDESCRIPTOR )); return count; } @@ -188,23 +207,24 @@ int stw_pixelformat_choose( HDC hdc, for (index = 0; index < count; index++) { uint delta = 0; - const struct stw_pixelformat_info *pf = stw_pixelformat_get_info( index ); + const struct stw_pixelformat_info *pfi = stw_pixelformat_get_info( index ); if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && !!(ppfd->dwFlags & PFD_DOUBLEBUFFER) != - !!(pf->flags & STW_PF_FLAG_DOUBLEBUFFER)) + !!(pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) continue; - if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits) + /* FIXME: Take in account individual channel bits */ + if (ppfd->cColorBits != pfi->pfd.cColorBits) delta += 8; - if (ppfd->cDepthBits != pf->depth.depthbits) + if (ppfd->cDepthBits != pfi->pfd.cDepthBits) delta += 4; - if (ppfd->cStencilBits != pf->depth.stencilbits) + if (ppfd->cStencilBits != pfi->pfd.cStencilBits) delta += 2; - if (ppfd->cAlphaBits != pf->color.alphabits) + if (ppfd->cAlphaBits != pfi->pfd.cAlphaBits) delta++; if (delta < bestdelta) { @@ -256,21 +276,3 @@ stw_pixelformat_set( return TRUE; } - - - -/* XXX: this needs to be turned into queries on pipe_screen or - * stw_winsys. - */ -int -stw_query_sample_buffers( void ) -{ - return 1; -} - -int -stw_query_samples( void ) -{ - return 4; -} - diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index b33a688f5a..2cba844144 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -32,9 +32,6 @@ #include "pipe/p_compiler.h" -#define STW_PF_FLAG_DOUBLEBUFFER 0x00000001 -#define STW_PF_FLAG_MULTISAMPLED 0x00000002 - struct stw_pixelformat_color_info { uint redbits; @@ -55,9 +52,10 @@ struct stw_pixelformat_depth_info struct stw_pixelformat_info { - uint flags; - struct stw_pixelformat_color_info color; - struct stw_pixelformat_depth_info depth; + PIXELFORMATDESCRIPTOR pfd; + + unsigned numSampleBuffers; + unsigned numSamples; }; void @@ -72,8 +70,5 @@ stw_pixelformat_get_extended_count( void ); const struct stw_pixelformat_info * stw_pixelformat_get_info( uint index ); -int stw_query_sample_buffers( void ); -int stw_query_samples( void ); - #endif /* STW_PIXELFORMAT_H */ -- cgit v1.2.3 From 0bca413ce9e5aca4ecbf689fd7aa3da44bb73f4d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 17:22:21 +0100 Subject: wgl: Walk through the pixel formats combinations. --- src/gallium/state_trackers/wgl/shared/stw_device.h | 2 +- .../state_trackers/wgl/shared/stw_pixelformat.c | 142 ++++++++++++++------- .../state_trackers/wgl/shared/stw_pixelformat.h | 18 --- 3 files changed, 94 insertions(+), 68 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 66f0047232..969e3843e7 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -37,7 +37,7 @@ #include "stw_pixelformat.h" -#define STW_MAX_PIXELFORMATS 16 +#define STW_MAX_PIXELFORMATS 128 struct pipe_screen; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 7bbab0e972..187cc9661f 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_debug.h" +#include "util/u_memory.h" #include "stw_device.h" #include "stw_pixelformat.h" @@ -33,21 +34,75 @@ #include "stw_tls.h" +struct stw_pf_color_info +{ + struct { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; + } bits; + struct { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; + } shift; +}; + +struct stw_pf_depth_info +{ + struct { + unsigned char depth; + unsigned char stencil; + } bits; +}; + + +static const struct stw_pf_color_info +stw_pf_color[] = { + { {8, 8, 8, 0}, { 0, 8, 16, 0} }, + { {8, 8, 8, 8}, { 0, 8, 16, 24} } +}; + +static const struct stw_pf_depth_info +stw_pf_depth_stencil[] = { + { {16, 0} }, + { {24, 8} } +}; + +static const boolean +stw_pf_doublebuffer[] = { + FALSE, + TRUE, +}; + +const unsigned +stw_pf_multisample[] = { + 0, + 4 +}; + + static void stw_pixelformat_add( struct stw_device *stw_dev, - const struct stw_pixelformat_color_info *color, - const struct stw_pixelformat_depth_info *depth, + const struct stw_pf_color_info *color, + const struct stw_pf_depth_info *depth, boolean doublebuffer, - boolean multisampled, - boolean extended ) + unsigned samples ) { + boolean extended = FALSE; struct stw_pixelformat_info *pfi; assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) return; + /* FIXME: re-enabled MSAA when we can query it */ + if(samples) + return; + pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; memset(pfi, 0, sizeof *pfi); @@ -65,22 +120,22 @@ stw_pixelformat_add( pfi->pfd.iPixelType = PFD_TYPE_RGBA; - pfi->pfd.cColorBits = color->redbits + color->greenbits + color->bluebits; - pfi->pfd.cRedBits = color->redbits; - pfi->pfd.cRedShift = color->redshift; - pfi->pfd.cGreenBits = color->greenbits; - pfi->pfd.cGreenShift = color->greenshift; - pfi->pfd.cBlueBits = color->bluebits; - pfi->pfd.cBlueShift = color->blueshift; - pfi->pfd.cAlphaBits = color->alphabits; - pfi->pfd.cAlphaShift = color->alphashift; + pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue; + pfi->pfd.cRedBits = color->bits.red; + pfi->pfd.cRedShift = color->shift.red; + pfi->pfd.cGreenBits = color->bits.green; + pfi->pfd.cGreenShift = color->shift.green; + pfi->pfd.cBlueBits = color->bits.blue; + pfi->pfd.cBlueShift = color->shift.blue; + pfi->pfd.cAlphaBits = color->bits.alpha; + pfi->pfd.cAlphaShift = color->shift.alpha; pfi->pfd.cAccumBits = 0; pfi->pfd.cAccumRedBits = 0; pfi->pfd.cAccumGreenBits = 0; pfi->pfd.cAccumBlueBits = 0; pfi->pfd.cAccumAlphaBits = 0; - pfi->pfd.cDepthBits = depth->depthbits; - pfi->pfd.cStencilBits = depth->stencilbits; + pfi->pfd.cDepthBits = depth->bits.depth; + pfi->pfd.cStencilBits = depth->bits.stencil; pfi->pfd.cAuxBuffers = 0; pfi->pfd.iLayerType = 0; pfi->pfd.bReserved = 0; @@ -88,14 +143,10 @@ stw_pixelformat_add( pfi->pfd.dwVisibleMask = 0; pfi->pfd.dwDamageMask = 0; - if(multisampled) { - /* FIXME: re-enable when we can query this */ -#if 0 + if(samples) { pfi->numSampleBuffers = 1; - pfi->numSamples = 4; -#else - return; -#endif + pfi->numSamples = samples; + extended = TRUE; } ++stw_dev->pixelformat_extended_count; @@ -106,36 +157,29 @@ stw_pixelformat_add( } } -static void -stw_add_standard_pixelformats( - struct stw_device *stw_dev, - boolean doublebuffer, - boolean multisampled, - boolean extended ) -{ - const struct stw_pixelformat_color_info color24 = { 8, 0, 8, 8, 8, 16, 0, 0 }; - const struct stw_pixelformat_color_info color24a8 = { 8, 0, 8, 8, 8, 16, 8, 24 }; - const struct stw_pixelformat_depth_info depth24s8 = { 24, 8 }; - const struct stw_pixelformat_depth_info depth16 = { 16, 0 }; - - stw_pixelformat_add( stw_dev, &color24, &depth24s8, doublebuffer, multisampled, extended ); - - stw_pixelformat_add( stw_dev, &color24a8, &depth24s8, doublebuffer, multisampled, extended ); - - stw_pixelformat_add( stw_dev, &color24, &depth16, doublebuffer, multisampled, extended ); - - stw_pixelformat_add( stw_dev, &color24a8, &depth16, doublebuffer, multisampled, extended ); -} - void stw_pixelformat_init( void ) { - stw_add_standard_pixelformats( stw_dev, FALSE, FALSE, FALSE ); - stw_add_standard_pixelformats( stw_dev, TRUE, FALSE, FALSE ); - stw_add_standard_pixelformats( stw_dev, FALSE, TRUE, TRUE ); - stw_add_standard_pixelformats( stw_dev, TRUE, TRUE, TRUE ); - - assert( stw_dev->pixelformat_count <= STW_MAX_PIXELFORMATS ); + unsigned i, j, k, l; + + assert( !stw_dev->pixelformat_count ); + assert( !stw_dev->pixelformat_extended_count ); + + for(i = 0; i < Elements(stw_pf_multisample); ++i) { + unsigned samples = stw_pf_multisample[i]; + for(j = 0; j < Elements(stw_pf_color); ++j) { + const struct stw_pf_color_info *color = &stw_pf_color[j]; + for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) { + unsigned doublebuffer = stw_pf_doublebuffer[k]; + for(l = 0; l < Elements(stw_pf_depth_stencil); ++l) { + const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l]; + stw_pixelformat_add( stw_dev, color, depth, doublebuffer, samples ); + } + } + } + } + + assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count ); assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); } diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index 2cba844144..acfb230d9d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -32,24 +32,6 @@ #include "pipe/p_compiler.h" -struct stw_pixelformat_color_info -{ - uint redbits; - uint redshift; - uint greenbits; - uint greenshift; - uint bluebits; - uint blueshift; - uint alphabits; - uint alphashift; -}; - -struct stw_pixelformat_depth_info -{ - uint depthbits; - uint stencilbits; -}; - struct stw_pixelformat_info { PIXELFORMATDESCRIPTOR pfd; -- cgit v1.2.3 From aa405a2a77d51a4f807c5c2f63cbc76eb660e489 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 18:14:22 +0100 Subject: wgl: Query the screen for supported formats. --- .../state_trackers/wgl/shared/stw_pixelformat.c | 61 ++++++++++++++++++---- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 187cc9661f..897478e0f5 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -25,6 +25,10 @@ * **************************************************************************/ +#include "pipe/p_format.h" +#include "pipe/p_defines.h" +#include "pipe/p_screen.h" + #include "util/u_debug.h" #include "util/u_memory.h" @@ -36,6 +40,7 @@ struct stw_pf_color_info { + enum pipe_format format; struct { unsigned char red; unsigned char green; @@ -52,6 +57,7 @@ struct stw_pf_color_info struct stw_pf_depth_info { + enum pipe_format format; struct { unsigned char depth; unsigned char stencil; @@ -59,24 +65,48 @@ struct stw_pf_depth_info }; -static const struct stw_pf_color_info +/* NOTE: order matters, since in otherwise equal circunstances the first + * format listed will get chosen */ + +static const struct stw_pf_color_info stw_pf_color[] = { - { {8, 8, 8, 0}, { 0, 8, 16, 0} }, - { {8, 8, 8, 8}, { 0, 8, 16, 24} } + /* no-alpha */ + { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, + { PIPE_FORMAT_X8R8G8B8_UNORM, { 8, 8, 8, 0}, {16, 8, 0, 0} }, + { PIPE_FORMAT_B8G8R8X8_UNORM, { 8, 8, 8, 0}, { 8, 16, 24, 0} }, + /* alpha */ + { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, + { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} }, + { PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} }, + { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} } +#if 0 + { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} } +#endif }; + static const struct stw_pf_depth_info stw_pf_depth_stencil[] = { - { {16, 0} }, - { {24, 8} } + /* pure depth */ + { PIPE_FORMAT_Z16_UNORM, {16, 0} }, + { PIPE_FORMAT_Z24X8_UNORM, {24, 0} }, + { PIPE_FORMAT_X8Z24_UNORM, {24, 0} }, + { PIPE_FORMAT_Z32_UNORM, {32, 0} }, + /* pure stencil */ + { PIPE_FORMAT_S8_UNORM, { 0, 8} }, + /* combined depth-stencil */ + { PIPE_FORMAT_S8Z24_UNORM, {24, 8} }, + { PIPE_FORMAT_Z24S8_UNORM, {24, 8} } }; + static const boolean stw_pf_doublebuffer[] = { FALSE, TRUE, }; + const unsigned stw_pf_multisample[] = { 0, @@ -99,10 +129,6 @@ stw_pixelformat_add( if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) return; - /* FIXME: re-enabled MSAA when we can query it */ - if(samples) - return; - pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; memset(pfi, 0, sizeof *pfi); @@ -160,6 +186,7 @@ stw_pixelformat_add( void stw_pixelformat_init( void ) { + struct pipe_screen *screen = stw_dev->screen; unsigned i, j, k, l; assert( !stw_dev->pixelformat_count ); @@ -167,12 +194,28 @@ stw_pixelformat_init( void ) for(i = 0; i < Elements(stw_pf_multisample); ++i) { unsigned samples = stw_pf_multisample[i]; + + /* FIXME: re-enabled MSAA when we can query it */ + if(samples) + continue; + for(j = 0; j < Elements(stw_pf_color); ++j) { const struct stw_pf_color_info *color = &stw_pf_color[j]; + + if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + continue; + for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) { unsigned doublebuffer = stw_pf_doublebuffer[k]; + for(l = 0; l < Elements(stw_pf_depth_stencil); ++l) { const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l]; + + if(!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + continue; + stw_pixelformat_add( stw_dev, color, depth, doublebuffer, samples ); } } -- cgit v1.2.3 From 6fc244c68d3b3a9f89b6f752725e6c768cb08a84 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 18:43:51 +0100 Subject: wgl: Note down the gallium pixel formats, instead of re-guessing them. --- progs/wgl/wglinfo.c | 8 +- .../state_trackers/wgl/shared/stw_context.c | 3 +- .../state_trackers/wgl/shared/stw_context.h | 2 + .../state_trackers/wgl/shared/stw_framebuffer.c | 94 +++------------------- .../state_trackers/wgl/shared/stw_framebuffer.h | 3 + .../state_trackers/wgl/shared/stw_pixelformat.c | 12 +++ .../state_trackers/wgl/shared/stw_pixelformat.h | 4 + 7 files changed, 38 insertions(+), 88 deletions(-) diff --git a/progs/wgl/wglinfo.c b/progs/wgl/wglinfo.c index 5cf0e8bb25..881d35b297 100644 --- a/progs/wgl/wglinfo.c +++ b/progs/wgl/wglinfo.c @@ -586,8 +586,8 @@ print_visual_info(HDC hdc, InfoMode mode) if(!DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) continue; - if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) - continue; + //if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) + // continue; ++numWglVisuals; } @@ -603,8 +603,8 @@ print_visual_info(HDC hdc, InfoMode mode) if(!DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) continue; - if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) - continue; + //if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) + // continue; if (mode == Verbose) print_visual_attribs_verbose(i, &pfd); diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index e6bb8e1847..1e3bf10317 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -153,6 +153,7 @@ stw_create_layer_context( goto fail; ctx->st->ctx->DriverCtx = ctx; + ctx->pfi = pf; pipe_mutex_lock( stw_dev->mutex ); hglrc = handle_table_add(stw_dev->ctx_table, ctx); @@ -330,7 +331,7 @@ stw_make_current( if (fb == NULL && ctx != NULL && hdc != NULL) { GLvisual *visual = &ctx->st->ctx->Visual; - fb = stw_framebuffer_create( hdc, visual, width, height ); + fb = stw_framebuffer_create( hdc, visual, ctx->pfi, width, height ); if (fb == NULL) return FALSE; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h index b289615272..bc3b1dc880 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.h +++ b/src/gallium/state_trackers/wgl/shared/stw_context.h @@ -31,12 +31,14 @@ #include struct st_context; +struct stw_pixelformat_info; struct stw_context { struct st_context *st; HDC hdc; DWORD color_bits; + const struct stw_pixelformat_info *pfi; }; #endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 55dc9d678c..e70e20390e 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -93,21 +93,6 @@ stw_call_window_proc( return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); } -static INLINE boolean -stw_is_supported_color(enum pipe_format format) -{ - struct pipe_screen *screen = stw_dev->screen; - return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0); -} - -static INLINE boolean -stw_is_supported_depth_stencil(enum pipe_format format) -{ - struct pipe_screen *screen = stw_dev->screen; - return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); -} /* Create a new framebuffer object which will correspond to the given HDC. */ @@ -115,83 +100,26 @@ struct stw_framebuffer * stw_framebuffer_create( HDC hdc, GLvisual *visual, + const struct stw_pixelformat_info *pfi, GLuint width, GLuint height ) { - struct stw_framebuffer *fb; enum pipe_format colorFormat, depthFormat, stencilFormat; + struct stw_framebuffer *fb; - /* Determine PIPE_FORMATs for buffers. - */ - - if(visual->alphaBits <= 0 && visual->redBits <= 5 && visual->blueBits <= 6 && visual->greenBits <= 5 && - stw_is_supported_color(PIPE_FORMAT_R5G6B5_UNORM)) { - colorFormat = PIPE_FORMAT_R5G6B5_UNORM; - } - else if(visual->alphaBits <= 0 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && - stw_is_supported_color(PIPE_FORMAT_X8R8G8B8_UNORM)) { - colorFormat = PIPE_FORMAT_X8R8G8B8_UNORM; - } - else if(visual->alphaBits <= 1 && visual->redBits <= 5 && visual->blueBits <= 5 && visual->greenBits <= 5 && - stw_is_supported_color(PIPE_FORMAT_A1R5G5B5_UNORM)) { - colorFormat = PIPE_FORMAT_A1R5G5B5_UNORM; - } - else if(visual->alphaBits <= 4 && visual->redBits <= 4 && visual->blueBits <= 4 && visual->greenBits <= 4 && - stw_is_supported_color(PIPE_FORMAT_A4R4G4B4_UNORM)) { - colorFormat = PIPE_FORMAT_A4R4G4B4_UNORM; - } - else if(visual->alphaBits <= 8 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && - stw_is_supported_color(PIPE_FORMAT_A8R8G8B8_UNORM)) { - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; - } - else { - assert(0); - return NULL; - } + colorFormat = pfi->color_format; + + assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); - if (visual->depthBits == 0) - depthFormat = PIPE_FORMAT_NONE; - else if (visual->depthBits <= 16 && - stw_is_supported_depth_stencil(PIPE_FORMAT_Z16_UNORM)) - depthFormat = PIPE_FORMAT_Z16_UNORM; - else if (visual->depthBits <= 24 && visual->stencilBits != 8 && - stw_is_supported_depth_stencil(PIPE_FORMAT_X8Z24_UNORM)) { - depthFormat = PIPE_FORMAT_X8Z24_UNORM; - } - else if (visual->depthBits <= 24 && visual->stencilBits != 8 && - stw_is_supported_depth_stencil(PIPE_FORMAT_Z24X8_UNORM)) { - depthFormat = PIPE_FORMAT_Z24X8_UNORM; - } - else if (visual->depthBits <= 24 && visual->stencilBits == 8 && - stw_is_supported_depth_stencil(PIPE_FORMAT_S8Z24_UNORM)) { - depthFormat = PIPE_FORMAT_S8Z24_UNORM; - } - else if (visual->depthBits <= 24 && visual->stencilBits == 8 && - stw_is_supported_depth_stencil(PIPE_FORMAT_Z24S8_UNORM)) { - depthFormat = PIPE_FORMAT_Z24S8_UNORM; - } - else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_UNORM)) { - depthFormat = PIPE_FORMAT_Z32_UNORM; - } - else if(stw_is_supported_depth_stencil(PIPE_FORMAT_Z32_FLOAT)) { - depthFormat = PIPE_FORMAT_Z32_FLOAT; - } - else { - assert(0); + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z )) + depthFormat = pfi->depth_stencil_format; + else depthFormat = PIPE_FORMAT_NONE; - } - if (depthFormat == PIPE_FORMAT_S8Z24_UNORM || - depthFormat == PIPE_FORMAT_Z24S8_UNORM) { - stencilFormat = depthFormat; - } - else if (visual->stencilBits == 8 && - stw_is_supported_depth_stencil(PIPE_FORMAT_S8_UNORM)) { - stencilFormat = PIPE_FORMAT_S8_UNORM; - } - else { + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S )) + stencilFormat = pfi->depth_stencil_format; + else stencilFormat = PIPE_FORMAT_NONE; - } fb = CALLOC_STRUCT( stw_framebuffer ); if (fb == NULL) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index ea3bf6f8fc..607b7f0ef2 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -30,6 +30,8 @@ #include "main/mtypes.h" +struct stw_pixelformat_info; + /** * Windows framebuffer, derived from gl_framebuffer. */ @@ -45,6 +47,7 @@ struct stw_framebuffer * stw_framebuffer_create( HDC hdc, GLvisual *visual, + const struct stw_pixelformat_info *pfi, GLuint width, GLuint height ); diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 897478e0f5..67a92d3d8e 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -128,11 +128,23 @@ stw_pixelformat_add( assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) return; + + assert(pf_layout( color->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_R ) == color->bits.red ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_G ) == color->bits.green ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_B ) == color->bits.blue ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_A ) == color->bits.alpha ); + assert(pf_layout( depth->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_Z ) == depth->bits.depth ); + assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_S ) == depth->bits.stencil ); pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; memset(pfi, 0, sizeof *pfi); + pfi->color_format = color->format; + pfi->depth_stencil_format = depth->format; + pfi->pfd.nSize = sizeof pfi->pfd; pfi->pfd.nVersion = 1; diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index acfb230d9d..34522ebef3 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -31,9 +31,13 @@ #include #include "pipe/p_compiler.h" +#include "pipe/p_format.h" struct stw_pixelformat_info { + enum pipe_format color_format; + enum pipe_format depth_stencil_format; + PIXELFORMATDESCRIPTOR pfd; unsigned numSampleBuffers; -- cgit v1.2.3 From 11084d582764a916245ae92437421ac0cacdf335 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 10 Apr 2009 19:48:59 +0100 Subject: wgl: Protect the framebuffer with a lock. Unfortunately this doesn't catch all the cases, as the mesa state tracker can still use the framebuffer without giving the wgl state tracker the chance to lock it. --- .../state_trackers/wgl/shared/stw_context.c | 5 ++- .../state_trackers/wgl/shared/stw_framebuffer.c | 42 ++++++++++++++-------- .../state_trackers/wgl/shared/stw_framebuffer.h | 16 +++++---- 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 1e3bf10317..f3c7af93f5 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -337,8 +337,11 @@ stw_make_current( } if (ctx && fb) { + pipe_mutex_lock( fb->mutex ); st_make_current( ctx->st, fb->stfb, fb->stfb ); - stw_framebuffer_resize( fb, width, height ); + st_resize_framebuffer( fb->stfb, width, height ); + pipe_mutex_unlock( fb->mutex ); + ctx->hdc = hdc; ctx->st->pipe->priv = hdc; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index e70e20390e..4348b8f326 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -45,15 +45,6 @@ #include "stw_tls.h" -void -stw_framebuffer_resize( - struct stw_framebuffer *fb, - GLuint width, - GLuint height ) -{ - st_resize_framebuffer( fb->stfb, width, height ); -} - /** * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx @@ -86,7 +77,16 @@ stw_call_window_proc( if(fb) { unsigned width = LOWORD( pParams->lParam ); unsigned height = HIWORD( pParams->lParam ); - stw_framebuffer_resize( fb, width, height ); + + /* FIXME: The mesa statetracker makes the assumptions that only + * one context is using the framebuffer, and that that context is the + * current one. However neither holds true, as WGL allows more than + * one context to be bound to the same drawable, and this function can + * be called from any thread. + */ + pipe_mutex_lock( fb->mutex ); + st_resize_framebuffer( fb->stfb, width, height ); + pipe_mutex_unlock( fb->mutex ); } } @@ -125,6 +125,11 @@ stw_framebuffer_create( if (fb == NULL) return NULL; + fb->hDC = hdc; + fb->hWnd = WindowFromDC( hdc ); + + pipe_mutex_init( fb->mutex ); + fb->stfb = st_create_framebuffer( visual, colorFormat, @@ -133,9 +138,10 @@ stw_framebuffer_create( width, height, (void *) fb ); - - fb->hDC = hdc; - fb->hWnd = WindowFromDC( hdc ); + if(!fb->stfb) { + FREE(fb); + return NULL; + } pipe_mutex_lock( stw_dev->mutex ); fb->next = stw_dev->fb_head; @@ -165,6 +171,8 @@ stw_framebuffer_destroy( st_unreference_framebuffer(fb->stfb); + pipe_mutex_destroy( fb->mutex ); + FREE( fb ); } @@ -199,6 +207,8 @@ stw_swap_buffers( if (fb == NULL) return FALSE; + pipe_mutex_lock( fb->mutex ); + /* If we're swapping the buffer associated with the current context * we have to flush any pending rendering commands first. */ @@ -206,9 +216,11 @@ stw_swap_buffers( screen = stw_dev->screen; - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) { /* FIXME: this shouldn't happen, but does on glean */ + pipe_mutex_unlock( fb->mutex ); return FALSE; + } #ifdef DEBUG if(stw_dev->trace_running) { @@ -219,6 +231,8 @@ stw_swap_buffers( stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc ); + pipe_mutex_unlock( fb->mutex ); + return TRUE; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index 607b7f0ef2..f5b48db048 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -28,8 +28,12 @@ #ifndef STW_FRAMEBUFFER_H #define STW_FRAMEBUFFER_H +#include + #include "main/mtypes.h" +#include "pipe/p_thread.h" + struct stw_pixelformat_info; /** @@ -37,9 +41,13 @@ struct stw_pixelformat_info; */ struct stw_framebuffer { - struct st_framebuffer *stfb; HDC hDC; HWND hWnd; + + pipe_mutex mutex; + struct st_framebuffer *stfb; + + /** This is protected by stw_device::mutex, not the mutex above */ struct stw_framebuffer *next; }; @@ -55,12 +63,6 @@ void stw_framebuffer_destroy( struct stw_framebuffer *fb ); -void -stw_framebuffer_resize( - struct stw_framebuffer *fb, - GLuint width, - GLuint height ); - struct stw_framebuffer * stw_framebuffer_from_hdc( HDC hdc ); -- cgit v1.2.3 From 34445670503ab6d07d1de568493d62145b57a154 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 11:17:35 -0600 Subject: mesa: reduce makefile output --- src/mesa/drivers/dri/Makefile.template | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 2fa36bab3f..5c01d233c1 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -72,10 +72,11 @@ $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) - rm -f depend - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ - $(ASM_SOURCES) + @ echo "running $(MKDEP)" + @ rm -f depend + @ touch depend + @ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ + $(ASM_SOURCES) > /dev/null 2>/dev/null # Emacs tags -- cgit v1.2.3 From 60ad4b0bf0919c9dfd23aaa54271a8f1e47ab843 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 13:21:27 -0600 Subject: i965: clean-up in prepare_wm_surfaces() --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 40d6c38f4f..095759f3a2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -605,13 +605,11 @@ static void prepare_wm_surfaces(struct brw_context *brw ) /* Update surface / buffer for vertex shader constant buffer */ { - const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER + 1; + const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER; struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; vp->const_buffer = - brw_update_constant_surface(ctx, - SURF_INDEX_VERT_CONST_BUFFER, - vp->const_buffer, + brw_update_constant_surface(ctx, surf, vp->const_buffer, vp->program.Base.Parameters); brw->wm.nr_surfaces = surf + 1; @@ -619,13 +617,11 @@ static void prepare_wm_surfaces(struct brw_context *brw ) /* Update surface / buffer for fragment shader constant buffer */ { - const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER + 1; + const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; fp->const_buffer = - brw_update_constant_surface(ctx, - SURF_INDEX_FRAG_CONST_BUFFER, - fp->const_buffer, + brw_update_constant_surface(ctx, surf, fp->const_buffer, fp->program.Base.Parameters); brw->wm.nr_surfaces = surf + 1; -- cgit v1.2.3 From 4e96c8196934be4fe09f82e2fcd7e776a7553479 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Apr 2009 13:32:04 -0600 Subject: i965: remove unused var --- src/mesa/drivers/dri/i965/brw_program.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index cc65157259..bac69187c1 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -117,7 +117,6 @@ static void brwProgramStringNotify( GLcontext *ctx, struct gl_program *prog ) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = &brw->intel; if (target == GL_FRAGMENT_PROGRAM_ARB) { struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; -- cgit v1.2.3 From e825609d8161bb466ebe1be9a0cc3f492e796a43 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 10 Apr 2009 16:14:12 -0700 Subject: r300-gallium: Clean up vertex format setup. --- src/gallium/drivers/r300/r300_context.h | 11 +- src/gallium/drivers/r300/r300_state_derived.c | 173 +++++++++++++++----------- 2 files changed, 108 insertions(+), 76 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index fec2bad546..4c695c1195 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -60,7 +60,7 @@ struct r300_dsa_state { }; struct r300_rs_state { - /* XXX icky as fucking hell */ + /* Draw-specific rasterizer state */ struct pipe_rasterizer_state rs; uint32_t vap_control_status; /* R300_VAP_CNTL_STATUS: 0x2140 */ @@ -225,10 +225,11 @@ struct r300_vertex_format { uint32_t vap_prog_stream_cntl[8]; /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */ uint32_t vap_prog_stream_cntl_ext[8]; - /* This is a map of VAP/SW TCL outputs into the GA/RS. - * tab[i] is the location of input i in GA/RS input memory. - * Named tab for historical reasons. */ - int tab[16]; + /* Map of vertex attributes into PVS memory for HW TCL, + * or GA memory for SW TCL. */ + int vs_tab[16]; + /* Map of rasterizer attributes from GB through RS to US. */ + int fs_tab[16]; }; struct r300_vertex_shader { diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index f1feafbcf9..a777771930 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -25,37 +25,35 @@ /* r300_state_derived: Various bits of state which are dependent upon * currently bound CSO data. */ -/* Update the vertex_info struct in our r300_context. - * - * The vertex_info struct describes the post-TCL format of vertices. It is - * required for Draw when doing SW TCL, and also for describing the - * dreaded RS block on R300 chipsets. */ -static void r300_update_vertex_layout(struct r300_context* r300) +/* Set up the vs_tab and routes. */ +static void r300_vs_tab_routes(struct r300_context* r300, + struct r300_vertex_format* vformat) { struct r300_screen* r300screen = r300_screen(r300->context.screen); - struct r300_vertex_format vformat; - struct vertex_info vinfo; + struct vertex_info* vinfo = &vformat->vinfo; + int* tab = vformat->vs_tab; boolean pos = FALSE, psize = FALSE, fog = FALSE; int i, texs = 0, cols = 0; - int tab[16]; - - struct tgsi_shader_info* info = &r300->fs->info; + struct tgsi_shader_info* info; - memset(&vinfo, 0, sizeof(vinfo)); - for (i = 0; i < 16; i++) { - tab[i] = -1; + if (r300screen->caps->has_tcl) { + /* Use vertex shader to determine required routes. */ + info = &r300->vs->info; + } else { + /* Use fragment shader to determine required routes. */ + info = &r300->fs->info; } assert(info->num_inputs <= 16); - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { + switch (info->output_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: pos = TRUE; tab[i] = 0; break; case TGSI_SEMANTIC_COLOR: - tab[i] = 2 + cols++; + tab[i] = 2 + cols; + cols++; break; case TGSI_SEMANTIC_PSIZE: psize = TRUE; @@ -63,9 +61,10 @@ static void r300_update_vertex_layout(struct r300_context* r300) break; case TGSI_SEMANTIC_FOG: fog = TRUE; - /* Fall through... */ + /* Fall through */ case TGSI_SEMANTIC_GENERIC: - tab[i] = 6 + texs++; + tab[i] = 6 + texs; + texs++; break; default: debug_printf("r300: Unknown vertex input %d\n", @@ -75,8 +74,8 @@ static void r300_update_vertex_layout(struct r300_context* r300) } if (r300screen->caps->has_tcl) { + /* Just copy vert attribs over as-is. */ for (i = 0; i < info->num_inputs; i++) { - /* XXX should probably do real lookup with vert shader */ tab[i] = i; } } @@ -89,7 +88,7 @@ static void r300_update_vertex_layout(struct r300_context* r300) * vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0 * vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */ - vinfo.hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ + vinfo->hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ if (!pos) { debug_printf("r300: Forcing vertex position attribute emit...\n"); @@ -100,80 +99,112 @@ static void r300_update_vertex_layout(struct r300_context* r300) } tab[0] = 0; - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_POS, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); } else { - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); } - vinfo.hwfmt[1] |= R300_INPUT_CNTL_POS; - vinfo.hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; + vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; + vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; if (psize) { - draw_emit_vertex_attr(&vinfo, EMIT_1F_PSIZE, INTERP_POS, + draw_emit_vertex_attr(vinfo, EMIT_1F_PSIZE, INTERP_POS, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_PSIZE, 0)); - vinfo.hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; + vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; } for (i = 0; i < cols; i++) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_COLOR, i)); - vinfo.hwfmt[1] |= R300_INPUT_CNTL_COLOR; - vinfo.hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); + vinfo->hwfmt[1] |= R300_INPUT_CNTL_COLOR; + vinfo->hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } for (i = 0; i < texs; i++) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); - vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); - vinfo.hwfmt[3] |= (4 << (3 * i)); + vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); + vinfo->hwfmt[3] |= (4 << (3 * i)); } if (fog) { i++; - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); - vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); - vinfo.hwfmt[3] |= (4 << (3 * i)); + vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); + vinfo->hwfmt[3] |= (4 << (3 * i)); } - draw_compute_vertex_size(&vinfo); - - if (memcmp(&r300->vertex_info, &vinfo, sizeof(struct vertex_info))) { - uint32_t temp; - debug_printf("attrib count: %d, fp input count: %d\n", - vinfo.num_attribs, info->num_inputs); - for (i = 0; i < vinfo.num_attribs; i++) { - debug_printf("attrib: offset %d, interp %d, size %d," - " tab %d\n", vinfo.attrib[i].src_index, - vinfo.attrib[i].interp_mode, vinfo.attrib[i].emit, - tab[i]); - } + draw_compute_vertex_size(vinfo); +} - for (i = 0; i < vinfo.num_attribs; i++) { - /* Make sure we have a proper destination for our attribute */ - assert(tab[i] != -1); - - temp = translate_vertex_data_type(vinfo.attrib[i].emit) | - (tab[i] << R300_DST_VEC_LOC_SHIFT); - if (i & 1) { - r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0x0000ffff; - r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp << 16; - } else { - r300->vertex_info.vap_prog_stream_cntl[i >> 1] &= 0xffff0000; - r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= temp; - } +/* Update the PSC tables. */ +static void r300_vertex_psc(struct r300_context* r300, + struct r300_vertex_format* vformat) +{ + struct vertex_info* vinfo = &vformat->vinfo; + int* tab = vformat->vs_tab; + uint32_t temp; + int i; + + debug_printf("r300: attrib count: %d\n", vinfo->num_attribs); + for (i = 0; i < vinfo->num_attribs; i++) { + debug_printf("r300: attrib: offset %d, interp %d, size %d," + " tab %d\n", vinfo->attrib[i].src_index, + vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, + tab[i]); + } - r300->vertex_info.vap_prog_stream_cntl_ext[i >> 1] |= - (R300_VAP_SWIZZLE_XYZW << (i & 1 ? 16 : 0)); + for (i = 0; i < vinfo->num_attribs; i++) { + /* Make sure we have a proper destination for our attribute */ + assert(tab[i] != -1); + + /* Add the attribute to the PSC table. */ + temp = translate_vertex_data_type(vinfo->attrib[i].emit) | + (tab[i] << R300_DST_VEC_LOC_SHIFT); + if (i & 1) { + vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff; + vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16; + + vformat->vap_prog_stream_cntl_ext[i >> 1] |= + (R300_VAP_SWIZZLE_XYZW << 16); + } else { + vformat->vap_prog_stream_cntl[i >> 1] &= 0xffff0000; + vformat->vap_prog_stream_cntl[i >> 1] |= temp << 0; + + vformat->vap_prog_stream_cntl_ext[i >> 1] |= + (R300_VAP_SWIZZLE_XYZW << 0); } - /* Set the last vector. */ - i--; - r300->vertex_info.vap_prog_stream_cntl[i >> 1] |= (R300_LAST_VEC << - (i & 1 ? 16 : 0)); + } + + /* Set the last vector in the PSC. */ + i--; + vformat->vap_prog_stream_cntl[i >> 1] |= + (R300_LAST_VEC << (i & 1 ? 16 : 0)); +} + +/* Update the vertex format. */ +static void r300_update_vertex_format(struct r300_context* r300) +{ + struct r300_screen* r300screen = r300_screen(r300->context.screen); + struct r300_vertex_format vformat; + int i; + + memset(&vformat, 0, sizeof(struct r300_vertex_format)); + for (i = 0; i < 16; i++) { + vformat.vs_tab[i] = -1; + vformat.fs_tab[i] = -1; + } + + r300_vs_tab_routes(r300, &vformat); + + r300_vertex_psc(r300, &vformat); - memcpy(r300->vertex_info.tab, tab, sizeof(tab)); - memcpy(&r300->vertex_info, &vinfo, sizeof(struct vertex_info)); + if (memcmp(&r300->vertex_info, &vformat, + sizeof(struct r300_vertex_format))) { + memcpy(&r300->vertex_info, &vformat, + sizeof(struct r300_vertex_format)); r300->dirty_state |= R300_NEW_VERTEX_FORMAT; } } @@ -185,7 +216,7 @@ static void r300_update_rs_block(struct r300_context* r300) { struct r300_rs_block* rs = r300->rs_block; struct vertex_info* vinfo = &r300->vertex_info.vinfo; - int* tab = r300->vertex_info.tab; + int* tab = r300->vertex_info.vs_tab; int col_count = 0, fp_offset = 0, i, memory_pos, tex_count = 0; memset(rs, 0, sizeof(struct r300_rs_block)); @@ -307,7 +338,7 @@ void r300_update_derived_state(struct r300_context* r300) { if (r300->dirty_state & (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { - r300_update_vertex_layout(r300); + r300_update_vertex_format(r300); } if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) { -- cgit v1.2.3 From 1b5b083d5ccaeeca29375072d978d32a258f606f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 10 Apr 2009 18:15:46 -0700 Subject: r300-gallium: Finish up cleanup of vertex format state. This makes texcoords route properly, and also fixes a few asserts. --- src/gallium/drivers/r300/r300_state_derived.c | 101 ++++++++++++++++++++------ 1 file changed, 80 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index a777771930..d628373a0c 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -46,7 +46,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, assert(info->num_inputs <= 16); for (i = 0; i < info->num_inputs; i++) { - switch (info->output_semantic_name[i]) { + switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: pos = TRUE; tab[i] = 0; @@ -98,13 +98,9 @@ static void r300_vs_tab_routes(struct r300_context* r300, tab[i] = tab[i-1]; } tab[0] = 0; - - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); - } else { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); } + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; @@ -209,30 +205,92 @@ static void r300_update_vertex_format(struct r300_context* r300) } } +/* Set up the mappings from GB to US, for RS block. */ +static void r300_update_fs_tab(struct r300_context* r300) +{ + struct r300_vertex_format* vformat = &r300->vertex_info; + struct tgsi_shader_info* info = &r300->fs->info; + int i, cols = 0, texs = 0, cols_emitted = 0; + int* tab = vformat->fs_tab; + + for (i = 0; i < 16; i++) { + tab[i] = -1; + } + + assert(info->num_inputs <= 16); + for (i = 0; i < info->num_inputs; i++) { + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_COLOR: + tab[i] = INTERP_LINEAR; + cols++; + break; + case TGSI_SEMANTIC_POSITION: + case TGSI_SEMANTIC_PSIZE: + debug_printf("r300: Implementation error: Can't use " + "pos attribs in fragshader yet!\n"); + /* Pass through for now */ + case TGSI_SEMANTIC_FOG: + case TGSI_SEMANTIC_GENERIC: + tab[i] = INTERP_PERSPECTIVE; + break; + default: + debug_printf("r300: Unknown vertex input %d\n", + info->input_semantic_name[i]); + break; + } + } + + /* Now that we know where everything is... */ + debug_printf("r300: fp input count: %d\n", info->num_inputs); + for (i = 0; i < info->num_inputs; i++) { + switch (tab[i]) { + case INTERP_LINEAR: + debug_printf("r300: attrib: " + "stack offset %d, color, tab %d\n", + i, cols_emitted); + tab[i] = cols_emitted; + cols_emitted++; + break; + case INTERP_PERSPECTIVE: + debug_printf("r300: attrib: " + "stack offset %d, texcoord, tab %d\n", + i, cols + texs); + tab[i] = cols + texs; + texs++; + break; + case -1: + debug_printf("r300: Implementation error: Bad fp interp!\n"); + default: + break; + } + } + +} + /* Set up the RS block. This is the part of the chipset that actually does * the rasterization of vertices into fragments. This is also the part of the * chipset that locks up if any part of it is even slightly wrong. */ static void r300_update_rs_block(struct r300_context* r300) { struct r300_rs_block* rs = r300->rs_block; - struct vertex_info* vinfo = &r300->vertex_info.vinfo; - int* tab = r300->vertex_info.vs_tab; + struct tgsi_shader_info* info = &r300->fs->info; + int* tab = r300->vertex_info.fs_tab; int col_count = 0, fp_offset = 0, i, memory_pos, tex_count = 0; memset(rs, 0, sizeof(struct r300_rs_block)); if (r300_screen(r300->context.screen)->caps->is_r500) { - for (i = 0; i < vinfo->num_attribs; i++) { - assert(tab[vinfo->attrib[i].src_index] != -1); - memory_pos = tab[vinfo->attrib[i].src_index] * 4; - switch (vinfo->attrib[i].interp_mode) { - case INTERP_LINEAR: + for (i = 0; i < info->num_inputs; i++) { + assert(tab[i] != -1); + memory_pos = tab[i] * 4; + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= R500_RS_COL_PTR(memory_pos) | R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); col_count++; break; - case INTERP_PERSPECTIVE: + case TGSI_SEMANTIC_GENERIC: rs->ip[tex_count] |= R500_RS_SEL_S(memory_pos) | R500_RS_SEL_T(memory_pos + 1) | @@ -274,17 +332,17 @@ static void r300_update_rs_block(struct r300_context* r300) fp_offset++; } } else { - for (i = 0; i < vinfo->num_attribs; i++) { - memory_pos = tab[vinfo->attrib[i].src_index] * 4; - assert(tab[vinfo->attrib[i].src_index] != -1); - switch (vinfo->attrib[i].interp_mode) { - case INTERP_LINEAR: + for (i = 0; i < info->num_inputs; i++) { + assert(tab[i] != -1); + memory_pos = tab[i] * 4; + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= R300_RS_COL_PTR(memory_pos) | R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); col_count++; break; - case INTERP_PERSPECTIVE: + case TGSI_SEMANTIC_GENERIC: rs->ip[tex_count] |= R300_RS_TEX_PTR(memory_pos) | R300_RS_SEL_S(R300_RS_SEL_C0) | @@ -342,6 +400,7 @@ void r300_update_derived_state(struct r300_context* r300) } if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) { + r300_update_fs_tab(r300); r300_update_rs_block(r300); } } -- cgit v1.2.3 From 9340c994b78d15253326b83cfcb15c7349c0403a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 10 Apr 2009 18:34:55 -0700 Subject: r300-gallium: Split up vertex format tallying for HW and SW TCL. This makes things draw (again) with HW TCL. Yay? --- src/gallium/drivers/r300/r300_state_derived.c | 77 +++++++++++++++++---------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index d628373a0c..ce7ab6f16a 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -45,39 +45,62 @@ static void r300_vs_tab_routes(struct r300_context* r300, } assert(info->num_inputs <= 16); - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_POSITION: - pos = TRUE; - tab[i] = 0; - break; - case TGSI_SEMANTIC_COLOR: - tab[i] = 2 + cols; - cols++; - break; - case TGSI_SEMANTIC_PSIZE: - psize = TRUE; - tab[i] = 1; - break; - case TGSI_SEMANTIC_FOG: - fog = TRUE; - /* Fall through */ - case TGSI_SEMANTIC_GENERIC: - tab[i] = 6 + texs; - texs++; - break; - default: - debug_printf("r300: Unknown vertex input %d\n", - info->input_semantic_name[i]); - break; - } - } if (r300screen->caps->has_tcl) { /* Just copy vert attribs over as-is. */ for (i = 0; i < info->num_inputs; i++) { tab[i] = i; } + for (i = 0; i < info->num_outputs; i++) { + switch (info->output_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + pos = TRUE; + break; + case TGSI_SEMANTIC_COLOR: + cols++; + break; + case TGSI_SEMANTIC_PSIZE: + psize = TRUE; + break; + case TGSI_SEMANTIC_FOG: + fog = TRUE; + case TGSI_SEMANTIC_GENERIC: + texs++; + break; + default: + debug_printf("r300: Unknown vertex output %d\n", + info->output_semantic_name[i]); + break; + } + } + } else { + for (i = 0; i < info->num_inputs; i++) { + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + pos = TRUE; + tab[i] = 0; + break; + case TGSI_SEMANTIC_COLOR: + tab[i] = 2 + cols; + cols++; + break; + case TGSI_SEMANTIC_PSIZE: + psize = TRUE; + tab[i] = 1; + break; + case TGSI_SEMANTIC_FOG: + fog = TRUE; + /* Fall through */ + case TGSI_SEMANTIC_GENERIC: + tab[i] = 6 + texs; + texs++; + break; + default: + debug_printf("r300: Unknown vertex input %d\n", + info->input_semantic_name[i]); + break; + } + } } /* Do the actual vertex_info setup. -- cgit v1.2.3 From 8181f8fbf9c3d0f60191ee874248b8113b215e30 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 12 Apr 2009 13:11:06 +0200 Subject: radeon: emit scissor when using cs path --- src/mesa/drivers/dri/radeon/radeon_state_init.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 174a7e1862..c00f59f7ad 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -448,6 +448,17 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) // } END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(4); + OUT_BATCH(CP_PACKET0(RADEON_RE_TOP_LEFT, 0)); + OUT_BATCH(0); + OUT_BATCH(CP_PACKET0(RADEON_RE_WIDTH_HEIGHT, 0)); + if (rrb) { + OUT_BATCH(((rrb->width - 1) << RADEON_RE_WIDTH_SHIFT) | + ((rrb->height - 1) << RADEON_RE_HEIGHT_SHIFT)); + } else { + OUT_BATCH(0); + } + END_BATCH(); } static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) -- cgit v1.2.3 From 02b130fd4b1c4c35ed256fc345eead010db09205 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 12 Apr 2009 14:25:36 +0200 Subject: r200: validate vertex buffer --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 3a11a448ec..e34ea9655e 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -209,6 +209,11 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa, rmesa->radeon.tcl.elt_dma_offset = 0; rmesa->tcl.elt_used = min_nr * 2; + radeon_validate_bo(&rmesa->radeon, rmesa->radeon.tcl.elt_dma_bo, + RADEON_GEM_DOMAIN_GTT, 0); + if (radeon_revalidate_bos(rmesa->radeon.glCtx) == GL_FALSE) + fprintf(stderr,"failure to revalidate BOs - badness\n"); + radeon_bo_map(rmesa->radeon.tcl.elt_dma_bo, 1); retval = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset; -- cgit v1.2.3 From 1fd76ae930d20a241d534a86c489d92df9b051d3 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 12 Apr 2009 15:51:31 +0200 Subject: r200: fix texture level for compiz case --- src/mesa/drivers/dri/r200/r200_texstate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 9797f77ec4..15758d767c 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1422,8 +1422,8 @@ void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ) */ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) { - const struct gl_texture_image *firstImage = - t->base.Image[0][t->mt->firstLevel]; + int firstlevel = t->mt ? t->mt->firstLevel : 0; + const struct gl_texture_image *firstImage = t->base.Image[0][firstlevel]; GLint log2Width, log2Height, log2Depth, texelBytes; if ( t->bo ) { -- cgit v1.2.3 From 352de305bd2b03b0a8d079dbbcb29ae812cc6028 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 13 Apr 2009 14:41:06 +1000 Subject: nv50: fix mrt clear --- src/gallium/drivers/nv50/nv50_clear.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c index eca65a88c1..33427a15a5 100644 --- a/src/gallium/drivers/nv50/nv50_clear.c +++ b/src/gallium/drivers/nv50/nv50_clear.c @@ -39,14 +39,12 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, if (!nv50_state_validate(nv50)) return; - if (buffers & PIPE_CLEAR_COLOR) { - BEGIN_RING(chan, tesla, NV50TCL_CLEAR_COLOR(0), 4*fb->nr_cbufs); - for (i = 0; i < fb->nr_cbufs; i++) { - OUT_RING (chan, fui(rgba[0])); - OUT_RING (chan, fui(rgba[1])); - OUT_RING (chan, fui(rgba[2])); - OUT_RING (chan, fui(rgba[3])); - } + if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_COLOR(0), 4); + OUT_RING (chan, fui(rgba[0])); + OUT_RING (chan, fui(rgba[1])); + OUT_RING (chan, fui(rgba[2])); + OUT_RING (chan, fui(rgba[3])); mode |= 0x3c; } @@ -61,5 +59,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); OUT_RING (chan, mode); + + for (i = 1; i < fb->nr_cbufs; i++) { + BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); + OUT_RING (chan, (i << 6) | 0x3c); + } } -- cgit v1.2.3 From 43c7ffaea635f949fd4803c4f594cf53e4b98f24 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Mon, 13 Apr 2009 21:24:44 -0400 Subject: dri glx: Swap before checking for cliprects. We don't update drawables anymore unless they are completely uninitialized, so we need to swap even if we don't have cliprects yet, otherwise we never end up calling the driver's SwapBuffers(). The driver should update the drawable in its SwapBuffers() anyway. See 8e753d04045a82062ac34d3b2622eb9dba8af374, "dri glx: Fix dri_util::driBindContext" for the change that exposed it. --- src/mesa/drivers/dri/common/dri_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 38c2e7b00d..f620c26000 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -311,12 +311,12 @@ static void driSwapBuffers(__DRIdrawable *dPriv) __DRIscreen *psp = dPriv->driScreenPriv; drm_clip_rect_t *rects; int i; - - if (!dPriv->numClipRects) - return; psp->DriverAPI.SwapBuffers(dPriv); + if (!dPriv->numClipRects) + return; + rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects); if (!rects) -- cgit v1.2.3 From cafea7528052624c8d3e4cd1c5b26a61bf04d1d0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 11:08:42 -0600 Subject: i965: checkpoint commit: VS constant buffers Hook up a constant buffer, binding table, etc for the VS unit. This will allow using large constant buffers with vertex shaders. The new code is disabled at this time (use_const_buffer=FALSE). --- src/mesa/drivers/dri/i965/brw_context.h | 30 ++- src/mesa/drivers/dri/i965/brw_curbe.c | 2 + src/mesa/drivers/dri/i965/brw_eu.h | 11 +- src/mesa/drivers/dri/i965/brw_eu_emit.c | 66 ++++++- src/mesa/drivers/dri/i965/brw_misc_state.c | 7 +- src/mesa/drivers/dri/i965/brw_vs.h | 7 + src/mesa/drivers/dri/i965/brw_vs_emit.c | 229 ++++++++++++++++++----- src/mesa/drivers/dri/i965/brw_vs_state.c | 8 + src/mesa/drivers/dri/i965/brw_vtbl.c | 1 + src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 205 ++++++++++++++++---- 11 files changed, 477 insertions(+), 91 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 6a9252d037..4c2d3af8ae 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -141,7 +141,8 @@ struct brw_context; #define BRW_NEW_BATCH 0x10000 /** brw->depth_region updated */ #define BRW_NEW_DEPTH_BUFFER 0x20000 -#define BRW_NEW_NR_SURFACES 0x40000 +#define BRW_NEW_NR_WM_SURFACES 0x40000 +#define BRW_NEW_NR_VS_SURFACES 0x80000 struct brw_state_flags { /** State update flags signalled by mesa internals */ @@ -245,20 +246,30 @@ struct brw_vs_ouput_sizes { #define BRW_MAX_TEX_UNIT 16 /** - * Size of our surface binding table. + * Size of our surface binding table for the WM. * This contains pointers to the drawing surfaces and current texture * objects and shader constant buffers (+2). */ -#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 2) +#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1) /** * Helpers to convert drawing buffers, textures and constant buffers - * to surface binding table indexes. + * to surface binding table indexes, for WM. */ #define SURF_INDEX_DRAW(d) (d) -#define SURF_INDEX_FRAG_CONST_BUFFER (MAX_DRAW_BUFFERS + 0) -#define SURF_INDEX_VERT_CONST_BUFFER (MAX_DRAW_BUFFERS + 1) -#define SURF_INDEX_TEXTURE(t) (MAX_DRAW_BUFFERS + 2 + t) +#define SURF_INDEX_FRAG_CONST_BUFFER (MAX_DRAW_BUFFERS) +#define SURF_INDEX_TEXTURE(t) (MAX_DRAW_BUFFERS + 1 + (t)) + +/** + * Size of surface binding table for the VS. + * Only one constant buffer for now. + */ +#define BRW_VS_MAX_SURF 1 + +/** + * Only a VS constant buffer + */ +#define SURF_INDEX_VERT_CONST_BUFFER 0 enum brw_cache_id { @@ -566,6 +577,11 @@ struct brw_context dri_bo *prog_bo; dri_bo *state_bo; + + /** Binding table of pointers to surf_bo entries */ + dri_bo *bind_bo; + dri_bo *surf_bo[BRW_VS_MAX_SURF]; + GLuint nr_surfaces; } vs; struct { diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 94bf2c0d67..dfab14aa74 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -357,6 +357,7 @@ update_constant_buffer(struct brw_context *brw, } +/** Copy current vertex program's parameters into the constant buffer */ static void update_vertex_constant_buffer(struct brw_context *brw) { @@ -366,6 +367,7 @@ update_vertex_constant_buffer(struct brw_context *brw) } +/** Copy current fragment program's parameters into the constant buffer */ static void update_fragment_constant_buffer(struct brw_context *brw) { diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index d05f2e6c41..e492ce162c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -862,9 +862,18 @@ void brw_dp_READ_4( struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, GLboolean relAddr, - GLuint scratch_offset, + GLuint location, GLuint bind_table_index ); +/* XXX this function is temporary - merge with brw_dp_READ_4() above. */ +void brw_dp_READ_4_vs( struct brw_compile *p, + struct brw_reg dest, + struct brw_reg src, + GLuint msg_reg_nr, + GLboolean relAddr, + GLuint location, + GLuint bind_table_index ); + void brw_dp_WRITE_16( struct brw_compile *p, struct brw_reg src, GLuint msg_reg_nr, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index ec4d7fa76f..bb7ea5c049 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -952,7 +952,7 @@ void brw_dp_READ_16( struct brw_compile *p, /** * Read a float[4] vector from the data port Data Cache (const buffer). - * Scratch offset should be a multiple of 16. + * Location (in buffer) should be a multiple of 16. * Used for fetching shader constants. * If relAddr is true, we'll do an indirect fetch using the address register. */ @@ -960,7 +960,7 @@ void brw_dp_READ_4( struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, GLboolean relAddr, - GLuint scratch_offset, + GLuint location, GLuint bind_table_index ) { { @@ -971,7 +971,7 @@ void brw_dp_READ_4( struct brw_compile *p, /* set message header global offset field (reg 0, element 2) */ brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), - brw_imm_d(scratch_offset)); + brw_imm_d(location)); brw_pop_insn_state(p); } @@ -1001,6 +1001,66 @@ void brw_dp_READ_4( struct brw_compile *p, } +/* XXX this function is temporary - merge with brw_dp_READ_4() above. */ +void brw_dp_READ_4_vs(struct brw_compile *p, + struct brw_reg dest, + struct brw_reg src, + GLuint msg_reg_nr, + GLboolean relAddr, + GLuint location, + GLuint bind_table_index) +{ + { + brw_push_insn_state(p); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_set_mask_control(p, BRW_MASK_DISABLE); + + /*src.nr = 0;*/ + + /* set message header global offset field (reg 0, element 2) */ + brw_MOV(p, +#if 1 + retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), +#elif 0 + retype(brw_vec1_grf(src.nr, 2), BRW_REGISTER_TYPE_UD), +#endif + brw_imm_d(location)); + + brw_pop_insn_state(p); + } + + { + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + + insn->header.predicate_control = BRW_PREDICATE_NONE; + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.destreg__conditonalmod = msg_reg_nr; + insn->header.mask_control = BRW_MASK_DISABLE; + + /* cast dest to a uword[8] vector */ + // dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW); + + brw_set_dest(insn, dest); +#if 1 + brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); +#elif 0 + brw_set_src0(insn, retype(brw_vec8_grf(src.nr, 0), BRW_REGISTER_TYPE_UW)); +#endif + + printf("vs const read msg, location %u, msg_reg_nr %d\n", location, msg_reg_nr); + brw_set_dp_read_message(insn, + bind_table_index, + 0, /* msg_control (0 means 1 Oword) */ + BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ + 0, /* source cache = data cache */ + 1, /* msg_length */ + 1, /* response_length (1 Oword) */ + 0); /* eot */ + } +} + + + void brw_fb_WRITE(struct brw_compile *p, struct brw_reg dest, GLuint msg_reg_nr, diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 5c94a49f60..9bc5c35139 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -101,6 +101,7 @@ const struct brw_tracked_state brw_drawing_rect = { static void prepare_binding_table_pointers(struct brw_context *brw) { + brw_add_validated_bo(brw, brw->vs.bind_bo); brw_add_validated_bo(brw, brw->wm.bind_bo); } @@ -117,13 +118,11 @@ static void upload_binding_table_pointers(struct brw_context *brw) BEGIN_BATCH(6, IGNORE_CLIPRECTS); OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 | (6 - 2)); - OUT_BATCH(0); /* vs */ + OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */ OUT_BATCH(0); /* gs */ OUT_BATCH(0); /* clip */ OUT_BATCH(0); /* sf */ - OUT_RELOC(brw->wm.bind_bo, - I915_GEM_DOMAIN_SAMPLER, 0, - 0); + OUT_RELOC(brw->wm.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* wm/ps */ ADVANCE_BATCH(); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 99d0e93722..d20cf78b8a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -75,6 +75,13 @@ struct brw_vs_compile { struct brw_reg userplane[6]; + /** using a real constant buffer? */ + GLboolean use_const_buffer; + /** we may need up to 3 constants per instruction (if use_const_buffer) */ + struct { + GLint index; + struct brw_reg reg; + } current_const[3]; }; void brw_vs_emit( struct brw_vs_compile *c ); diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 0d6c6ab9a8..d21f2792af 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -38,8 +38,31 @@ #include "brw_vs.h" +static struct brw_reg get_tmp( struct brw_vs_compile *c ) +{ + struct brw_reg tmp = brw_vec8_grf(c->last_tmp, 0); + + if (++c->last_tmp > c->prog_data.total_grf) + c->prog_data.total_grf = c->last_tmp; -/* Do things as simply as possible. Allocate and populate all regs + return tmp; +} + +static void release_tmp( struct brw_vs_compile *c, struct brw_reg tmp ) +{ + if (tmp.nr == c->last_tmp-1) + c->last_tmp--; +} + +static void release_tmps( struct brw_vs_compile *c ) +{ + c->last_tmp = c->first_tmp; +} + + +/** + * Preallocate GRF register before code emit. + * Do things as simply as possible. Allocate and populate all regs * ahead of time. */ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) @@ -47,6 +70,14 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) GLuint i, reg = 0, mrf; GLuint nr_params; +#if 0 + if (c->vp->program.Base.Parameters->NumParameters >= 6) + c->use_const_buffer = 1; + else +#endif + c->use_const_buffer = GL_FALSE; + /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ + /* r0 -- reserved as usual */ c->r0 = brw_vec8_grf(reg, 0); @@ -66,13 +97,19 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* Vertex program parameters from curbe: */ - nr_params = c->vp->program.Base.Parameters->NumParameters; - for (i = 0; i < nr_params; i++) { - c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1); - } - reg += (nr_params + 1) / 2; - - c->prog_data.curb_read_length = reg - 1; + if (c->use_const_buffer) { + /* get constants from a real constant buffer */ + c->prog_data.curb_read_length = 0; + } + else { + /* use a section of the GRF for constants */ + nr_params = c->vp->program.Base.Parameters->NumParameters; + for (i = 0; i < nr_params; i++) { + c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1); + } + reg += (nr_params + 1) / 2; + c->prog_data.curb_read_length = reg - 1; + } /* Allocate input regs: */ @@ -157,6 +194,13 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4; c->prog_data.total_grf = reg; + if (c->use_const_buffer) { + for (i = 0; i < 3; i++) { + c->current_const[i].index = -1; + c->current_const[i].reg = get_tmp(c); + } + } + if (INTEL_DEBUG & DEBUG_VS) { _mesa_printf("%s NumAddrRegs %d\n", __FUNCTION__, c->vp->program.Base.NumAddressRegs); _mesa_printf("%s NumTemps %d\n", __FUNCTION__, c->vp->program.Base.NumTemporaries); @@ -165,28 +209,6 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) } -static struct brw_reg get_tmp( struct brw_vs_compile *c ) -{ - struct brw_reg tmp = brw_vec8_grf(c->last_tmp, 0); - - if (++c->last_tmp > c->prog_data.total_grf) - c->prog_data.total_grf = c->last_tmp; - - return tmp; -} - -static void release_tmp( struct brw_vs_compile *c, struct brw_reg tmp ) -{ - if (tmp.nr == c->last_tmp-1) - c->last_tmp--; -} - -static void release_tmps( struct brw_vs_compile *c ) -{ - c->last_tmp = c->first_tmp; -} - - /** * If an instruction uses a temp reg both as a src and the dest, we * sometimes need to allocate an intermediate temporary. @@ -673,13 +695,59 @@ static void emit_nrm( struct brw_vs_compile *c, } +static struct brw_reg +get_constant(struct brw_vs_compile *c, + const struct prog_instruction *inst, + GLuint argIndex) +{ + const struct prog_src_register *src = &inst->SrcReg[argIndex]; + struct brw_compile *p = &c->func; + struct brw_reg const_reg; + + if (c->current_const[argIndex].index != src->Index) { + struct brw_reg src_reg = get_tmp(c); + struct brw_reg t = get_tmp(c); + + c->current_const[argIndex].index = src->Index; + + brw_MOV(p, t, brw_vec8_grf(0, 0));/*SAVE*/ + +#if 0 + printf(" fetch const[%d] for arg %d into reg %d\n", + src->Index, argIndex, c->current_const[argIndex].reg.nr); +#endif + + /* need to fetch the constant now */ + brw_dp_READ_4_vs(p, + c->current_const[argIndex].reg, /* writeback dest */ + src_reg, /* src reg */ + 1, /* msg_reg */ + src->RelAddr, /* relative indexing? */ + 16 * src->Index, /* byte offset */ + SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ + ); + + brw_MOV(p, brw_vec8_grf(0, 0), t);/*RESTORE*/ + release_tmp(c, src_reg); + release_tmp(c, t); + } + + /* replicate lower four floats into upper four floats (to get XYZWXYZW) */ + const_reg = c->current_const[argIndex].reg; + const_reg = stride(const_reg, 0, 4, 0); + const_reg.subnr = 0; + + return const_reg; +} + + + /* TODO: relative addressing! */ static struct brw_reg get_reg( struct brw_vs_compile *c, gl_register_file file, GLuint index ) { - switch (file) { case PROGRAM_TEMPORARY: case PROGRAM_INPUT: @@ -708,13 +776,63 @@ static struct brw_reg get_reg( struct brw_vs_compile *c, } +/** + * Get brw reg corresponding to the instruction's [argIndex] src reg. + * TODO: relative addressing! + */ +static struct brw_reg +get_src_reg( struct brw_vs_compile *c, + const struct prog_instruction *inst, + GLuint argIndex ) +{ + const GLuint file = inst->SrcReg[argIndex].File; + const GLint index = inst->SrcReg[argIndex].Index; + + switch (file) { + case PROGRAM_TEMPORARY: + case PROGRAM_INPUT: + case PROGRAM_OUTPUT: + assert(c->regs[file][index].nr != 0); + return c->regs[file][index]; + case PROGRAM_STATE_VAR: + case PROGRAM_CONSTANT: + case PROGRAM_UNIFORM: + if (c->use_const_buffer) { + return get_constant(c, inst, argIndex); + } + else { + assert(c->regs[PROGRAM_STATE_VAR][index].nr != 0); + return c->regs[PROGRAM_STATE_VAR][index]; + } + case PROGRAM_ADDRESS: + assert(index == 0); + return c->regs[file][index]; + + case PROGRAM_UNDEFINED: + /* this is a normal case since we loop over all three src args */ + return brw_null_reg(); + + case PROGRAM_LOCAL_PARAM: + case PROGRAM_ENV_PARAM: + case PROGRAM_WRITE_ONLY: + default: + assert(0); + return brw_null_reg(); + } +} + + +/** + * Indirect addressing: get reg[[arg] + offset]. + */ static struct brw_reg deref( struct brw_vs_compile *c, struct brw_reg arg, GLint offset) { struct brw_compile *p = &c->func; struct brw_reg tmp = vec4(get_tmp(c)); - struct brw_reg vp_address = retype(vec1(get_reg(c, PROGRAM_ADDRESS, 0)), BRW_REGISTER_TYPE_UW); + struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0]; + struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_UW); GLuint byte_offset = arg.nr * 32 + arg.subnr + offset * 16; struct brw_reg indirect = brw_vec4_indirect(0,0); @@ -758,22 +876,29 @@ static void emit_arl( struct brw_vs_compile *c, } -/* Will return mangled results for SWZ op. The emit_swz() function +/** + * Return the brw reg for the given instruction's src argument. + * Will return mangled results for SWZ op. The emit_swz() function * ignores this result and recalculates taking extended swizzles into * account. */ static struct brw_reg get_arg( struct brw_vs_compile *c, - struct prog_src_register *src ) + const struct prog_instruction *inst, + GLuint argIndex ) { + const struct prog_src_register *src = &inst->SrcReg[argIndex]; struct brw_reg reg; if (src->File == PROGRAM_UNDEFINED) return brw_null_reg(); - if (src->RelAddr) + if (src->RelAddr) { + /* XXX fix */ reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src->Index); - else - reg = get_reg(c, src->File, src->Index); + } + else { + reg = get_src_reg(c, inst, argIndex); + } /* Convert 3-bit swizzle to 2-bit. */ @@ -790,10 +915,28 @@ static struct brw_reg get_arg( struct brw_vs_compile *c, } +/** + * Get brw register for the given program dest register. + */ static struct brw_reg get_dst( struct brw_vs_compile *c, struct prog_dst_register dst ) { - struct brw_reg reg = get_reg(c, dst.File, dst.Index); + struct brw_reg reg; + + switch (dst.File) { + case PROGRAM_TEMPORARY: + case PROGRAM_OUTPUT: + assert(c->regs[dst.File][dst.Index].nr != 0); + reg = c->regs[dst.File][dst.Index]; + break; + case PROGRAM_UNDEFINED: + /* we may hit this for OPCODE_END, OPCODE_KIL, etc */ + reg = brw_null_reg(); + break; + default: + assert(0); + reg = brw_null_reg(); + } reg.dw1.bits.writemask = dst.WriteMask; @@ -803,8 +946,10 @@ static struct brw_reg get_dst( struct brw_vs_compile *c, static void emit_swz( struct brw_vs_compile *c, struct brw_reg dst, - struct prog_src_register src ) + const struct prog_instruction *inst) { + const GLuint argIndex = 0; + const struct prog_src_register src = inst->SrcReg[argIndex]; struct brw_compile *p = &c->func; GLuint zeros_mask = 0; GLuint ones_mask = 0; @@ -847,7 +992,7 @@ static void emit_swz( struct brw_vs_compile *c, if (src.RelAddr) arg0 = deref(c, c->regs[PROGRAM_STATE_VAR][0], src.Index); else - arg0 = get_reg(c, src.File, src.Index); + arg0 = get_src_reg(c, inst, argIndex); arg0 = brw_swizzle(arg0, src_swz[0], src_swz[1], @@ -1053,7 +1198,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src) args[i] = c->output_regs[index].reg; else - args[i] = get_arg(c, src); + args[i] = get_arg(c, inst, i); } /* Get dest regs. Note that it is possible for a reg to be both @@ -1181,7 +1326,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) /* The args[0] value can't be used here as it won't have * correctly encoded the full swizzle: */ - emit_swz(c, dst, inst->SrcReg[0] ); + emit_swz(c, dst, inst); break; case OPCODE_TRUNC: /* round toward zero */ diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 1a63766ea1..3d29538843 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -44,6 +44,8 @@ struct brw_vs_unit_key { unsigned int curbe_offset; unsigned int nr_urb_entries, urb_size; + + unsigned int nr_surfaces; }; static void @@ -62,6 +64,9 @@ vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key) key->nr_urb_entries = brw->urb.nr_vs_entries; key->urb_size = brw->urb.vsize; + /* BRW_NEW_NR_VS_SURFACES */ + key->nr_surfaces = brw->vs.nr_surfaces; + /* BRW_NEW_CURBE_OFFSETS, _NEW_TRANSFORM */ if (ctx->Transform.ClipPlanesEnabled) { /* Note that we read in the userclip planes as well, hence @@ -92,6 +97,8 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) * brw_urb_WRITE() results. */ vs.thread1.single_program_flow = 0; + vs.thread1.binding_table_entry_count = key->nr_surfaces; + vs.thread3.urb_entry_read_length = key->urb_entry_read_length; vs.thread3.const_urb_entry_read_length = key->curb_entry_read_length; vs.thread3.dispatch_grf_start_reg = 1; @@ -158,6 +165,7 @@ const struct brw_tracked_state brw_vs_unit = { .dirty = { .mesa = _NEW_TRANSFORM, .brw = (BRW_NEW_CURBE_OFFSETS | + BRW_NEW_NR_VS_SURFACES | BRW_NEW_URB_FENCE), .cache = CACHE_NEW_VS_PROG }, diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 960bbb311e..ba03afd6c1 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -79,6 +79,7 @@ static void brw_destroy_context( struct intel_context *intel ) dri_bo_release(&brw->curbe.curbe_bo); dri_bo_release(&brw->vs.prog_bo); dri_bo_release(&brw->vs.state_bo); + dri_bo_release(&brw->vs.bind_bo); dri_bo_release(&brw->gs.prog_bo); dri_bo_release(&brw->gs.state_bo); dri_bo_release(&brw->clip.prog_bo); diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 58fa6aaf8f..67b41173fb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -290,7 +290,7 @@ const struct brw_tracked_state brw_wm_unit = { .brw = (BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_CURBE_OFFSETS | - BRW_NEW_NR_SURFACES), + BRW_NEW_NR_WM_SURFACES), .cache = (CACHE_NEW_WM_PROG | CACHE_NEW_SAMPLER) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 095759f3a2..ce5dbb334b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -176,7 +176,11 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, } } -struct brw_wm_surface_key { + +/** + * Use same key for WM and VS surfaces. + */ +struct brw_surface_key { GLenum target, depthmode; dri_bo *bo; GLint format, internal_format; @@ -187,6 +191,7 @@ struct brw_wm_surface_key { GLuint offset; }; + static void brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling) { @@ -208,7 +213,7 @@ brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling) static dri_bo * brw_create_texture_surface( struct brw_context *brw, - struct brw_wm_surface_key *key ) + struct brw_surface_key *key ) { struct brw_surface_state surf; dri_bo *bo; @@ -287,7 +292,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current; struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel]; - struct brw_wm_surface_key key; + struct brw_surface_key key; const GLuint surf = SURF_INDEX_TEXTURE(unit); memset(&key, 0, sizeof(key)); @@ -328,12 +333,12 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) /** - * Create the constant buffer surface. Fragment shader constanst will be + * Create the constant buffer surface. Vertex/fragment shader constants will be * read from this buffer with Data Port Read instructions/messages. */ static dri_bo * brw_create_constant_surface( struct brw_context *brw, - struct brw_wm_surface_key *key ) + struct brw_surface_key *key ) { const GLint w = key->width - 1; struct brw_surface_state surf; @@ -345,8 +350,6 @@ brw_create_constant_surface( struct brw_context *brw, surf.ss0.surface_type = BRW_SURFACE_BUFFER; surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT; - /* This is ok for all textures with channel width 8bit or less: - */ assert(key->bo); if (key->bo) surf.ss1.base_addr = key->bo->offset; /* reloc */ @@ -356,8 +359,8 @@ brw_create_constant_surface( struct brw_context *brw, surf.ss2.width = w & 0x7f; /* bits 6:0 of size or width */ surf.ss2.height = (w >> 7) & 0x1fff; /* bits 19:7 of size or width */ surf.ss3.depth = (w >> 20) & 0x7f; /* bits 26:20 of size or width */ - surf.ss3.pitch = (key->pitch * key->cpp) - 1; - brw_set_surface_tiling(&surf, key->tiling); + surf.ss3.pitch = (key->pitch * key->cpp) - 1; /* ignored?? */ + brw_set_surface_tiling(&surf, key->tiling); /* tiling now allowed */ bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, key, sizeof(*key), @@ -379,17 +382,17 @@ brw_create_constant_surface( struct brw_context *brw, /** - * Update the surface state for a constant buffer. + * Update the surface state for a WM constant buffer. * The constant buffer will be (re)allocated here if needed. */ static dri_bo * -brw_update_constant_surface( GLcontext *ctx, - GLuint surf, - dri_bo *const_buffer, - const struct gl_program_parameter_list *params) +brw_update_wm_constant_surface( GLcontext *ctx, + GLuint surf, + dri_bo *const_buffer, + const struct gl_program_parameter_list *params) { struct brw_context *brw = brw_context(ctx); - struct brw_wm_surface_key key; + struct brw_surface_key key; struct intel_context *intel = &brw->intel; const int size = params->NumParameters * 4 * sizeof(GLfloat); @@ -402,7 +405,7 @@ brw_update_constant_surface( GLcontext *ctx, /* alloc new buffer if needed */ if (!const_buffer) { const_buffer = - drm_intel_bo_alloc(intel->bufmgr, "vp/fp_const_buffer", size, 64); + drm_intel_bo_alloc(intel->bufmgr, "fp_const_buffer", size, 64); } memset(&key, 0, sizeof(key)); @@ -436,6 +439,66 @@ brw_update_constant_surface( GLcontext *ctx, } +/** + * Update the surface state for a VS constant buffer. + * The constant buffer will be (re)allocated here if needed. + */ +static dri_bo * +brw_update_vs_constant_surface( GLcontext *ctx, + GLuint surf, + dri_bo *const_buffer, + const struct gl_program_parameter_list *params) +{ + struct brw_context *brw = brw_context(ctx); + struct brw_surface_key key; + struct intel_context *intel = &brw->intel; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + + assert(surf == 0); + + /* free old const buffer if too small */ + if (const_buffer && const_buffer->size < size) { + dri_bo_unreference(const_buffer); + const_buffer = NULL; + } + + /* alloc new buffer if needed */ + if (!const_buffer) { + const_buffer = + drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64); + } + + memset(&key, 0, sizeof(key)); + + key.format = MESA_FORMAT_RGBA_FLOAT32; + key.internal_format = GL_RGBA; + key.bo = const_buffer; + key.depthmode = GL_NONE; + key.pitch = params->NumParameters; + key.width = params->NumParameters; + key.height = 1; + key.depth = 1; + key.cpp = 16; + + /* + printf("%s:\n", __FUNCTION__); + printf(" width %d height %d depth %d cpp %d pitch %d\n", + key.width, key.height, key.depth, key.cpp, key.pitch); + */ + + dri_bo_unreference(brw->vs.surf_bo[surf]); + brw->vs.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); + if (brw->vs.surf_bo[surf] == NULL) { + brw->vs.surf_bo[surf] = brw_create_constant_surface(brw, &key); + } + + return const_buffer; +} + + /** * Sets up a surface state structure to point at the given region. * While it is only used for the front/back buffer currently, it should be @@ -515,7 +578,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region, /* Key size will never match key size for textures, so we're safe. */ brw->wm.surf_bo[unit] = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, - &key, sizeof(key), + &key, sizeof(key), ®ion_bo, 1, &surf, sizeof(surf), NULL, NULL); @@ -544,6 +607,8 @@ brw_wm_get_binding_table(struct brw_context *brw) { dri_bo *bind_bo; + assert(brw->wm.nr_surfaces <= BRW_WM_MAX_SURF); + bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND, NULL, 0, brw->wm.surf_bo, brw->wm.nr_surfaces, @@ -603,25 +668,13 @@ static void prepare_wm_surfaces(struct brw_context *brw ) old_nr_surfaces = brw->wm.nr_surfaces; brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; - /* Update surface / buffer for vertex shader constant buffer */ - { - const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER; - struct brw_vertex_program *vp = - (struct brw_vertex_program *) brw->vertex_program; - vp->const_buffer = - brw_update_constant_surface(ctx, surf, vp->const_buffer, - vp->program.Base.Parameters); - - brw->wm.nr_surfaces = surf + 1; - } - /* Update surface / buffer for fragment shader constant buffer */ { const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; fp->const_buffer = - brw_update_constant_surface(ctx, surf, fp->const_buffer, + brw_update_wm_constant_surface(ctx, surf, fp->const_buffer, fp->program.Base.Parameters); brw->wm.nr_surfaces = surf + 1; @@ -655,17 +708,103 @@ static void prepare_wm_surfaces(struct brw_context *brw ) brw->wm.bind_bo = brw_wm_get_binding_table(brw); if (brw->wm.nr_surfaces != old_nr_surfaces) - brw->state.dirty.brw |= BRW_NEW_NR_SURFACES; + brw->state.dirty.brw |= BRW_NEW_NR_WM_SURFACES; +} + + +/** + * Constructs the binding table for the VS surface state. + */ +static dri_bo * +brw_vs_get_binding_table(struct brw_context *brw) +{ + dri_bo *bind_bo; + + assert(brw->vs.nr_surfaces <= BRW_VS_MAX_SURF); + + bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND, + NULL, 0, + brw->vs.surf_bo, brw->vs.nr_surfaces, + NULL); + + if (bind_bo == NULL) { + GLuint data_size = brw->vs.nr_surfaces * sizeof(GLuint); + uint32_t *data = malloc(data_size); + int i; + + for (i = 0; i < brw->vs.nr_surfaces; i++) + if (brw->vs.surf_bo[i]) + data[i] = brw->vs.surf_bo[i]->offset; + else + data[i] = 0; + + bind_bo = brw_upload_cache( &brw->cache, BRW_SS_SURF_BIND, + NULL, 0, + brw->vs.surf_bo, brw->vs.nr_surfaces, + data, data_size, + NULL, NULL); + + /* Emit binding table relocations to surface state */ + for (i = 0; i < BRW_VS_MAX_SURF; i++) { + if (brw->vs.surf_bo[i] != NULL) { + dri_bo_emit_reloc(bind_bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + 0, + i * sizeof(GLuint), + brw->vs.surf_bo[i]); + } + } + + free(data); + } + + return bind_bo; +} + + +/** + * Vertex shader surfaces. Just constant buffer for now. Could add vertex + * shader textures in the future. + */ +static void prepare_vs_surfaces(struct brw_context *brw ) +{ + GLcontext *ctx = &brw->intel.ctx; + + /* Update surface / buffer for vertex shader constant buffer */ + { + const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER; + struct brw_vertex_program *vp = + (struct brw_vertex_program *) brw->vertex_program; + vp->const_buffer = + brw_update_vs_constant_surface(ctx, surf, vp->const_buffer, + vp->program.Base.Parameters); + + brw->vs.nr_surfaces = 1; + } + + dri_bo_unreference(brw->vs.bind_bo); + brw->vs.bind_bo = brw_vs_get_binding_table(brw); + + if (1) + brw->state.dirty.brw |= BRW_NEW_NR_VS_SURFACES; +} + + +static void +prepare_surfaces(struct brw_context *brw) +{ + prepare_wm_surfaces(brw); + prepare_vs_surfaces(brw); } const struct brw_tracked_state brw_wm_surfaces = { .dirty = { - .mesa = _NEW_COLOR | _NEW_TEXTURE | _NEW_BUFFERS, + .mesa = _NEW_COLOR | _NEW_TEXTURE | _NEW_BUFFERS | _NEW_PROGRAM, .brw = BRW_NEW_CONTEXT, .cache = 0 }, - .prepare = prepare_wm_surfaces, + .prepare = prepare_surfaces, }; -- cgit v1.2.3 From 153012b29b4f2183a1be6a01eec63e720a192718 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 11 Apr 2009 14:02:33 -0700 Subject: DRI2: Don't fault on NULL DrawBuffer It is possible for ctx->DrawBuffer to be NULL, so don't fault when that happens. This change is not being committed to master because it doesn't appear to be necessary there. Signed-off-by: Ian Romanick Cherry picked from mesa_7_4_branch, commit 49e0c74ddd91900fc4effb6d305d56e0563b456d --- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index f1249f7635..90964df355 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -321,7 +321,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) static void intelDrawBuffer(GLcontext * ctx, GLenum mode) { - if (ctx->DrawBuffer->Name == 0) { + if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT); -- cgit v1.2.3 From 1ea7f0fef055245fa18c0fbc3e54a866956c2507 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 14 Apr 2009 21:27:58 +0100 Subject: mesa: Fix gcc assembly enable logic. The i386 symbol is defined on WINDDK. --- src/mesa/state_tracker/st_cb_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 57c0544ba8..1f14b3705d 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -169,7 +169,7 @@ st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) * than COPY_DWORDS would: * XXX Put this in src/mesa/main/imports.h ??? */ -#if defined(i386) || defined(__i386__) +#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) static INLINE void * __memcpy(void *to, const void *from, size_t n) { -- cgit v1.2.3 From 5ccbccb3c17b675c4206fd1b3821cbb74997720a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 14 Apr 2009 21:31:34 +0100 Subject: scons: Recent Windows DDK do not include LIB.EXE. Have to use LINK /LIB instead. The biggest problem is when the command line is very long and all the options are included in a argument file -- link doesn't like if /LIB is included in the argument file. --- scons/mslib_sa.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/scons/mslib_sa.py b/scons/mslib_sa.py index da51c574b6..c5ebdec273 100644 --- a/scons/mslib_sa.py +++ b/scons/mslib_sa.py @@ -29,21 +29,107 @@ Based on SCons.Tool.mslib, without the MSVC detection. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +import os +import tempfile +import string + import SCons.Defaults import SCons.Tool import SCons.Util +import SCons.Errors + +class TempFileMunge: + """Same as SCons.Platform.TempFileMunge, but preserves LINK /LIB + together.""" + + def __init__(self, cmd): + self.cmd = cmd + + def __call__(self, target, source, env, for_signature): + if for_signature: + return self.cmd + cmd = env.subst_list(self.cmd, 0, target, source)[0] + try: + maxline = int(env.subst('$MAXLINELENGTH')) + except ValueError: + maxline = 2048 + + if (reduce(lambda x, y: x + len(y), cmd, 0) + len(cmd)) <= maxline: + return self.cmd + + # We do a normpath because mktemp() has what appears to be + # a bug in Windows that will use a forward slash as a path + # delimiter. Windows's link mistakes that for a command line + # switch and barfs. + # + # We use the .lnk suffix for the benefit of the Phar Lap + # linkloc linker, which likes to append an .lnk suffix if + # none is given. + tmp = os.path.normpath(tempfile.mktemp('.lnk')) + native_tmp = SCons.Util.get_native_path(tmp) + + if env['SHELL'] and env['SHELL'] == 'sh': + # The sh shell will try to escape the backslashes in the + # path, so unescape them. + native_tmp = string.replace(native_tmp, '\\', r'\\\\') + # In Cygwin, we want to use rm to delete the temporary + # file, because del does not exist in the sh shell. + rm = env.Detect('rm') or 'del' + else: + # Don't use 'rm' if the shell is not sh, because rm won't + # work with the Windows shells (cmd.exe or command.com) or + # Windows path names. + rm = 'del' + + prefix = env.subst('$TEMPFILEPREFIX') + if not prefix: + prefix = '@' + + if cmd[0:2] == ['link', '/lib']: + split = 2 + else: + split = 1 + + args = map(SCons.Subst.quote_spaces, cmd[split:]) + open(tmp, 'w').write(string.join(args, " ") + "\n") + # XXX Using the SCons.Action.print_actions value directly + # like this is bogus, but expedient. This class should + # really be rewritten as an Action that defines the + # __call__() and strfunction() methods and lets the + # normal action-execution logic handle whether or not to + # print/execute the action. The problem, though, is all + # of that is decided before we execute this method as + # part of expanding the $TEMPFILE construction variable. + # Consequently, refactoring this will have to wait until + # we get more flexible with allowing Actions to exist + # independently and get strung together arbitrarily like + # Ant tasks. In the meantime, it's going to be more + # user-friendly to not let obsession with architectural + # purity get in the way of just being helpful, so we'll + # reach into SCons.Action directly. + if SCons.Action.print_actions: + print("Using tempfile "+native_tmp+" for command line:\n"+ + " ".join(map(str,cmd))) + return cmd[:split] + [ prefix + native_tmp + '\n' + rm, native_tmp ] def generate(env): """Add Builders and construction variables for lib to an Environment.""" SCons.Tool.createStaticLibBuilder(env) - env['AR'] = 'lib' + if env.Detect('lib'): + env['AR'] = 'lib' + elif env.Detect('link'): + # Recent WINDDK versions do not ship with lib. + env['AR'] = 'link /lib' + env['TEMPFILE'] = TempFileMunge + else: + raise SCons.Errors.InternalError, "lib and link not found" env['ARFLAGS'] = SCons.Util.CLVar('/nologo') env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" env['LIBPREFIX'] = '' env['LIBSUFFIX'] = '.lib' def exists(env): - return env.Detect('lib') + return env.Detect('lib') or env.Detect('link') # vim:set ts=4 sw=4 et: -- cgit v1.2.3 From 71793e0f7907421d5bee619ae524e5178c6f3f32 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 14 Apr 2009 21:39:54 +0100 Subject: scons: Support winddk 6001.18002. --- scons/gallium.py | 20 +++----- scons/winddk.py | 137 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 77 insertions(+), 80 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index e2cd0546c1..696ddd025f 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -252,21 +252,24 @@ def generate(env): # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx, 'WIN32_LEAN_AND_MEAN', ] - if msvc: + if msvc and env['toolchain'] != 'winddk': cppdefines += [ 'VC_EXTRALEAN', '_CRT_SECURE_NO_DEPRECATE', ] if debug: cppdefines += ['_DEBUG'] - if platform == 'winddk': + if env['toolchain'] == 'winddk': # Mimic WINDDK's builtin flags. See also: # - WINDDK's bin/makefile.new i386mk.inc for more info. # - buildchk_wxp_x86.log files, generated by the WINDDK's build # - http://alter.org.ua/docs/nt_kernel/vc8_proj/ + if machine == 'x86': + cppdefines += ['_X86_', 'i386'] + if machine == 'x86_64': + cppdefines += ['_AMD64_', 'AMD64'] + if platform == 'winddk': cppdefines += [ - ('_X86_', '1'), - ('i386', '1'), 'STD_CALL', ('CONDITION_HANDLING', '1'), ('NT_INST', '0'), @@ -309,15 +312,6 @@ def generate(env): cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL'] env.Append(CPPDEFINES = cppdefines) - # C preprocessor includes - if platform == 'winddk': - env.Append(CPPPATH = [ - env['SDK_INC_PATH'], - env['DDK_INC_PATH'], - env['WDM_INC_PATH'], - env['CRT_INC_PATH'], - ]) - # C compiler options cflags = [] if gcc: diff --git a/scons/winddk.py b/scons/winddk.py index 6a99b83a83..afcea9909a 100644 --- a/scons/winddk.py +++ b/scons/winddk.py @@ -44,87 +44,90 @@ import msvc_sa import mslib_sa import mslink_sa -def get_winddk_root(env): - try: - return os.environ['BASEDIR'] - except KeyError: - pass - - version = "3790.1830" - - if SCons.Util.can_read_reg: - key = r'SOFTWARE\Microsoft\WINDDK\%s\LFNDirectory' % version - try: - path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key) - except SCons.Util.RegError: - pass - else: - return path - +versions = [ + '6001.18002', + '3790.1830', +] + +def cpu_bin(target_cpu): + if target_cpu == 'i386': + return 'x86' + else: + return target_cpu + +def get_winddk_root(env, version): default_path = os.path.join(r'C:\WINDDK', version) if os.path.exists(default_path): return default_path - return None -def get_winddk_paths(env): - """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values - of those three environment variables that should be set - in order to execute the MSVC tools properly.""" +def get_winddk_paths(env, version, root): + version_major, version_minor = map(int, version.split('.')) - WINDDKdir = None - exe_paths = [] - lib_paths = [] - include_paths = [] - - WINDDKdir = get_winddk_root(env) - if WINDDKdir is None: - raise SCons.Errors.InternalError, "WINDDK not found" - - exe_paths.append( os.path.join(WINDDKdir, 'bin') ) - exe_paths.append( os.path.join(WINDDKdir, 'bin', 'x86') ) - include_paths.append( os.path.join(WINDDKdir, 'inc', 'wxp') ) - lib_paths.append( os.path.join(WINDDKdir, 'lib') ) - - target_os = 'wxp' - target_cpu = 'i386' + if version_major >= 6000: + target_os = 'wlh' + else: + target_os = 'wxp' + + if env['machine'] in ('generic', 'x86'): + target_cpu = 'i386' + elif env['machine'] == 'x86_64': + target_cpu = 'amd64' + else: + raise SCons.Errors.InternalError, "Unsupported target machine" + + if version_major >= 6000: + # TODO: take in consideration the host cpu + bin_dir = os.path.join(root, 'bin', 'x86', cpu_bin(target_cpu)) + else: + if target_cpu == 'i386': + bin_dir = os.path.join(root, 'bin', 'x86') + else: + # TODO: take in consideration the host cpu + bin_dir = os.path.join(root, 'bin', 'win64', 'x86', cpu_bin(target_cpu)) + + env.PrependENVPath('PATH', [bin_dir]) - env['SDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', target_os) - env['CRT_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'crt') - env['DDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', target_os) - env['WDM_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', 'wdm', target_os) - - env['SDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu) - env['CRT_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', 'crt', target_cpu) - env['DDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu) - env['WDM_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu) - - include_path = string.join( include_paths, os.pathsep ) - lib_path = string.join(lib_paths, os.pathsep ) - exe_path = string.join(exe_paths, os.pathsep ) - return (include_path, lib_path, exe_path) + crt_inc_dir = os.path.join(root, 'inc', 'crt') + if version_major >= 6000: + sdk_inc_dir = os.path.join(root, 'inc', 'api') + ddk_inc_dir = os.path.join(root, 'inc', 'ddk') + wdm_inc_dir = os.path.join(root, 'inc', 'ddk') + else: + ddk_inc_dir = os.path.join(root, 'inc', 'ddk', target_os) + sdk_inc_dir = os.path.join(root, 'inc', target_os) + wdm_inc_dir = os.path.join(root, 'inc', 'ddk', 'wdm', target_os) + + env.PrependENVPath('INCLUDE', [ + wdm_inc_dir, + ddk_inc_dir, + crt_inc_dir, + sdk_inc_dir, + ]) + + env.PrependENVPath('LIB', [ + os.path.join(root, 'lib', 'crt', target_cpu), + os.path.join(root, 'lib', target_os, target_cpu), + ]) def generate(env): + if not env.has_key('ENV'): + env['ENV'] = {} + + for version in versions: + root = get_winddk_root(env, version) + if root is not None: + get_winddk_paths(env, version, root) + break msvc_sa.generate(env) mslib_sa.generate(env) mslink_sa.generate(env) - if not env.has_key('ENV'): - env['ENV'] = {} - - try: - include_path, lib_path, exe_path = get_winddk_paths(env) - - # since other tools can set these, we just make sure that the - # relevant stuff from WINDDK is in there somewhere. - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) - except (SCons.Util.RegError, SCons.Errors.InternalError): - pass - def exists(env): - return get_winddk_root(env) is not None + for version in versions: + if get_winddk_root(env, version) is not None: + return True + return False # vim:set ts=4 sw=4 et: -- cgit v1.2.3 From a3c3c1f1437de0186d70de9017a6a8e404ecf482 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 14 Apr 2009 17:56:29 -0400 Subject: glx: Make glXGetScreenDriver() work for DRI2 --- src/glx/x11/dri_glx.c | 56 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 3089aa1728..87d62ad846 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -40,6 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glxclient.h" #include "glcontextmodes.h" #include "xf86dri.h" +#include "dri2.h" #include "sarea.h" #include #include @@ -75,32 +76,45 @@ struct __GLXDRIcontextPrivateRec { */ static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName) { - int directCapable; - Bool b; - int driverMajor, driverMinor, driverPatch; + int directCapable; + Bool b; + int event, error; + int driverMajor, driverMinor, driverPatch; - *driverName = NULL; + *driverName = NULL; - if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); - return False; - } - if (!directCapable) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); - return False; - } + if (XF86DRIQueryExtension(dpy, &event, &error)) { /* DRI1 */ + if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); + return False; + } + if (!directCapable) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); + return False; + } - b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, - &driverPatch, driverName); - if (!b) { - ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); - return False; - } + b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, + &driverPatch, driverName); + if (!b) { + ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); + return False; + } + + InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", + driverMajor, driverMinor, driverPatch, *driverName, scrNum); + + return True; + } else if (DRI2QueryExtension(dpy, &event, &error)) { /* DRI2 */ + char *dev; + Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev); - InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", - driverMajor, driverMinor, driverPatch, *driverName, scrNum); + if (ret) + Xfree(dev); + + return ret; + } - return True; + return False; } /* -- cgit v1.2.3 From 92cc9970039d9c9385dc472fbfac58b93799f5ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 16:05:28 -0600 Subject: i965: fix VS constant buffer reads This mostly came down to finding the right MRF incantation in the brw_dp_READ_4_vs() function. Note: this feature is still disabled (but getting close to done). --- src/mesa/drivers/dri/i965/brw_eu.h | 3 --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 47 ++++++++++++++++++--------------- src/mesa/drivers/dri/i965/brw_vs_emit.c | 10 ------- 3 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index e492ce162c..66f8eb840c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -865,11 +865,8 @@ void brw_dp_READ_4( struct brw_compile *p, GLuint location, GLuint bind_table_index ); -/* XXX this function is temporary - merge with brw_dp_READ_4() above. */ void brw_dp_READ_4_vs( struct brw_compile *p, struct brw_reg dest, - struct brw_reg src, - GLuint msg_reg_nr, GLboolean relAddr, GLuint location, GLuint bind_table_index ); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index bb7ea5c049..c731a93a8d 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -969,6 +969,7 @@ void brw_dp_READ_4( struct brw_compile *p, brw_set_mask_control(p, BRW_MASK_DISABLE); /* set message header global offset field (reg 0, element 2) */ + /* Note that grf[0] will be copied to mrf[1] implicitly by the SEND instr */ brw_MOV(p, retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), brw_imm_d(location)); @@ -1001,30 +1002,39 @@ void brw_dp_READ_4( struct brw_compile *p, } -/* XXX this function is temporary - merge with brw_dp_READ_4() above. */ +/** + * Read float[4] constant from VS constant buffer. + */ void brw_dp_READ_4_vs(struct brw_compile *p, struct brw_reg dest, - struct brw_reg src, - GLuint msg_reg_nr, GLboolean relAddr, GLuint location, GLuint bind_table_index) { + const GLuint msg_reg_nr = 1; + + /* + printf("vs const read msg, location %u, msg_reg_nr %d\n", + location, msg_reg_nr); + */ + + /* Setup MRF[1] with location/offset into const buffer */ { + struct brw_reg b; + brw_push_insn_state(p); brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + /*brw_set_access_mode(p, BRW_ALIGN_16);*/ - /*src.nr = 0;*/ - - /* set message header global offset field (reg 0, element 2) */ - brw_MOV(p, -#if 1 - retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD), -#elif 0 - retype(brw_vec1_grf(src.nr, 2), BRW_REGISTER_TYPE_UD), -#endif - brw_imm_d(location)); + /* XXX I think we're setting all the dwords of MRF[1] to 'location'. + * when the docs say only dword[2] should be set. Hmmm. But it works. + */ + b = brw_message_reg(msg_reg_nr); + b = retype(b, BRW_REGISTER_TYPE_UD); + /*b = get_element_ud(b, 2);*/ + brw_MOV(p, b, brw_imm_ud(location)); brw_pop_insn_state(p); } @@ -1036,18 +1046,11 @@ void brw_dp_READ_4_vs(struct brw_compile *p, insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.destreg__conditonalmod = msg_reg_nr; insn->header.mask_control = BRW_MASK_DISABLE; + /*insn->header.access_mode = BRW_ALIGN_16;*/ - /* cast dest to a uword[8] vector */ - // dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW); - brw_set_dest(insn, dest); -#if 1 - brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); -#elif 0 - brw_set_src0(insn, retype(brw_vec8_grf(src.nr, 0), BRW_REGISTER_TYPE_UW)); -#endif + brw_set_src0(insn, brw_null_reg()); - printf("vs const read msg, location %u, msg_reg_nr %d\n", location, msg_reg_nr); brw_set_dp_read_message(insn, bind_table_index, 0, /* msg_control (0 means 1 Oword) */ diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index d21f2792af..2ee63129bc 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -705,13 +705,9 @@ get_constant(struct brw_vs_compile *c, struct brw_reg const_reg; if (c->current_const[argIndex].index != src->Index) { - struct brw_reg src_reg = get_tmp(c); - struct brw_reg t = get_tmp(c); c->current_const[argIndex].index = src->Index; - brw_MOV(p, t, brw_vec8_grf(0, 0));/*SAVE*/ - #if 0 printf(" fetch const[%d] for arg %d into reg %d\n", src->Index, argIndex, c->current_const[argIndex].reg.nr); @@ -720,16 +716,10 @@ get_constant(struct brw_vs_compile *c, /* need to fetch the constant now */ brw_dp_READ_4_vs(p, c->current_const[argIndex].reg, /* writeback dest */ - src_reg, /* src reg */ - 1, /* msg_reg */ src->RelAddr, /* relative indexing? */ 16 * src->Index, /* byte offset */ SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ ); - - brw_MOV(p, brw_vec8_grf(0, 0), t);/*RESTORE*/ - release_tmp(c, src_reg); - release_tmp(c, t); } /* replicate lower four floats into upper four floats (to get XYZWXYZW) */ -- cgit v1.2.3 From cdc7f681c87b0b6379de04066c25fdeb6de96405 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 19:44:16 -0600 Subject: mesa: use standard offsetof() macro --- src/mesa/main/extensions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 147d923e64..5c4bea9cf6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -31,7 +31,7 @@ #include "mtypes.h" -#define F(x) (int)(uintptr_t)&(((struct gl_extensions *)0)->x) +#define F(x) offsetof(struct gl_extensions, x) #define ON GL_TRUE #define OFF GL_FALSE -- cgit v1.2.3 From fe278f1e600058af18c6ba5fe77bfc5a772bf9f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 19:53:37 -0600 Subject: mesa: remove NV vertex/fragment program print/debug code The code in prog_print.c can be used instead. --- src/mesa/shader/nvfragparse.c | 244 +----------------------------------------- src/mesa/shader/nvfragparse.h | 4 - src/mesa/shader/nvvertparse.c | 158 +-------------------------- src/mesa/shader/nvvertparse.h | 5 - 4 files changed, 4 insertions(+), 407 deletions(-) diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index b935cb562a..56b7c29bea 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -43,6 +43,7 @@ #include "main/macros.h" #include "program.h" #include "prog_parameter.h" +#include "prog_print.h" #include "prog_instruction.h" #include "nvfragparse.h" @@ -385,10 +386,6 @@ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = { }; -static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { - "DEPR", "COLR", "DATA0", NULL -}; - /**********************************************************************/ @@ -1559,7 +1556,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, #ifdef DEBUG_foo _mesa_printf("--- glLoadProgramNV(%d) result ---\n", program->Base.Id); - _mesa_print_nv_fragment_program(program); + _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0); _mesa_printf("----------------------------------\n"); #endif } @@ -1571,243 +1568,6 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, } -static void -PrintSrcReg(const struct gl_fragment_program *program, - const struct prog_src_register *src) -{ - static const char comps[5] = "xyzw"; - - if (src->NegateAbs) { - _mesa_printf("-"); - } - if (src->Abs) { - _mesa_printf("|"); - } - if (src->NegateBase) { - _mesa_printf("-"); - } - if (src->File == PROGRAM_NAMED_PARAM) { - if (program->Base.Parameters->Parameters[src->Index].Type - == PROGRAM_CONSTANT) { - const GLfloat *v; - v = program->Base.Parameters->ParameterValues[src->Index]; - _mesa_printf("{%g, %g, %g, %g}", v[0], v[1], v[2], v[3]); - } - else { - ASSERT(program->Base.Parameters->Parameters[src->Index].Type - == PROGRAM_NAMED_PARAM); - _mesa_printf("%s", program->Base.Parameters->Parameters[src->Index].Name); - } - } - else if (src->File == PROGRAM_OUTPUT) { - _mesa_printf("o[%s]", OutputRegisters[src->Index]); - } - else if (src->File == PROGRAM_INPUT) { - _mesa_printf("f[%s]", InputRegisters[src->Index]); - } - else if (src->File == PROGRAM_LOCAL_PARAM) { - _mesa_printf("p[%d]", src->Index); - } - else if (src->File == PROGRAM_TEMPORARY) { - if (src->Index >= 32) - _mesa_printf("H%d", src->Index); - else - _mesa_printf("R%d", src->Index); - } - else if (src->File == PROGRAM_WRITE_ONLY) { - _mesa_printf("%cC", "HR"[src->Index]); - } - else { - _mesa_problem(NULL, "Invalid fragment register %d", src->Index); - return; - } - if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && - GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && - GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { - _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); - } - else if (src->Swizzle != SWIZZLE_NOOP) { - _mesa_printf(".%c%c%c%c", - comps[GET_SWZ(src->Swizzle, 0)], - comps[GET_SWZ(src->Swizzle, 1)], - comps[GET_SWZ(src->Swizzle, 2)], - comps[GET_SWZ(src->Swizzle, 3)]); - } - if (src->Abs) { - _mesa_printf("|"); - } -} - -static void -PrintTextureSrc(const struct prog_instruction *inst) -{ - _mesa_printf("TEX%d, ", inst->TexSrcUnit); - switch (inst->TexSrcTarget) { - case TEXTURE_1D_INDEX: - _mesa_printf("1D"); - break; - case TEXTURE_2D_INDEX: - _mesa_printf("2D"); - break; - case TEXTURE_3D_INDEX: - _mesa_printf("3D"); - break; - case TEXTURE_RECT_INDEX: - _mesa_printf("RECT"); - break; - case TEXTURE_CUBE_INDEX: - _mesa_printf("CUBE"); - break; - default: - _mesa_problem(NULL, "Invalid textue target in PrintTextureSrc"); - } -} - -static void -PrintCondCode(const struct prog_dst_register *dst) -{ - static const char *comps = "xyzw"; - static const char *ccString[] = { - "??", "GT", "EQ", "LT", "UN", "GE", "LE", "NE", "TR", "FL", "??" - }; - - _mesa_printf("%s", ccString[dst->CondMask]); - if (GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 1) && - GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 2) && - GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 3)) { - _mesa_printf(".%c", comps[GET_SWZ(dst->CondSwizzle, 0)]); - } - else if (dst->CondSwizzle != SWIZZLE_NOOP) { - _mesa_printf(".%c%c%c%c", - comps[GET_SWZ(dst->CondSwizzle, 0)], - comps[GET_SWZ(dst->CondSwizzle, 1)], - comps[GET_SWZ(dst->CondSwizzle, 2)], - comps[GET_SWZ(dst->CondSwizzle, 3)]); - } -} - - -static void -PrintDstReg(const struct prog_dst_register *dst) -{ - if (dst->File == PROGRAM_OUTPUT) { - _mesa_printf("o[%s]", OutputRegisters[dst->Index]); - } - else if (dst->File == PROGRAM_TEMPORARY) { - if (dst->Index >= 32) - _mesa_printf("H%d", dst->Index); - else - _mesa_printf("R%d", dst->Index); - } - else if (dst->File == PROGRAM_LOCAL_PARAM) { - _mesa_printf("p[%d]", dst->Index); - } - else if (dst->File == PROGRAM_WRITE_ONLY) { - _mesa_printf("%cC", "HR"[dst->Index]); - } - else { - _mesa_printf("???"); - } - - if (dst->WriteMask != 0 && dst->WriteMask != WRITEMASK_XYZW) { - _mesa_printf("."); - if (dst->WriteMask & WRITEMASK_X) - _mesa_printf("x"); - if (dst->WriteMask & WRITEMASK_Y) - _mesa_printf("y"); - if (dst->WriteMask & WRITEMASK_Z) - _mesa_printf("z"); - if (dst->WriteMask & WRITEMASK_W) - _mesa_printf("w"); - } - - if (dst->CondMask != COND_TR || - dst->CondSwizzle != SWIZZLE_NOOP) { - _mesa_printf(" ("); - PrintCondCode(dst); - _mesa_printf(")"); - } -} - - -/** - * Print (unparse) the given vertex program. Just for debugging. - */ -void -_mesa_print_nv_fragment_program(const struct gl_fragment_program *program) -{ - const struct prog_instruction *inst; - - for (inst = program->Base.Instructions; inst->Opcode != OPCODE_END; inst++) { - int i; - for (i = 0; Instructions[i].name; i++) { - if (inst->Opcode == Instructions[i].opcode) { - /* print instruction name */ - _mesa_printf("%s", Instructions[i].name); - if (inst->Precision == FLOAT16) - _mesa_printf("H"); - else if (inst->Precision == FIXED12) - _mesa_printf("X"); - if (inst->CondUpdate) - _mesa_printf("C"); - if (inst->SaturateMode == SATURATE_ZERO_ONE) - _mesa_printf("_SAT"); - _mesa_printf(" "); - - if (Instructions[i].inputs == INPUT_CC) { - PrintCondCode(&inst->DstReg); - } - else if (Instructions[i].outputs == OUTPUT_V || - Instructions[i].outputs == OUTPUT_S) { - /* print dest register */ - PrintDstReg(&inst->DstReg); - _mesa_printf(", "); - } - - /* print source register(s) */ - if (Instructions[i].inputs == INPUT_1V || - Instructions[i].inputs == INPUT_1S) { - PrintSrcReg(program, &inst->SrcReg[0]); - } - else if (Instructions[i].inputs == INPUT_2V || - Instructions[i].inputs == INPUT_2S) { - PrintSrcReg(program, &inst->SrcReg[0]); - _mesa_printf(", "); - PrintSrcReg(program, &inst->SrcReg[1]); - } - else if (Instructions[i].inputs == INPUT_3V) { - PrintSrcReg(program, &inst->SrcReg[0]); - _mesa_printf(", "); - PrintSrcReg(program, &inst->SrcReg[1]); - _mesa_printf(", "); - PrintSrcReg(program, &inst->SrcReg[2]); - } - else if (Instructions[i].inputs == INPUT_1V_T) { - PrintSrcReg(program, &inst->SrcReg[0]); - _mesa_printf(", "); - PrintTextureSrc(inst); - } - else if (Instructions[i].inputs == INPUT_3V_T) { - PrintSrcReg(program, &inst->SrcReg[0]); - _mesa_printf(", "); - PrintSrcReg(program, &inst->SrcReg[1]); - _mesa_printf(", "); - PrintSrcReg(program, &inst->SrcReg[2]); - _mesa_printf(", "); - PrintTextureSrc(inst); - } - _mesa_printf(";\n"); - break; - } - } - if (!Instructions[i].name) { - _mesa_printf("Invalid opcode %d\n", inst->Opcode); - } - } - _mesa_printf("END\n"); -} - - const char * _mesa_nv_fragment_input_register_name(GLuint i) { diff --git a/src/mesa/shader/nvfragparse.h b/src/mesa/shader/nvfragparse.h index ac97921080..544ab80c56 100644 --- a/src/mesa/shader/nvfragparse.h +++ b/src/mesa/shader/nvfragparse.h @@ -37,10 +37,6 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, struct gl_fragment_program *program); -extern void -_mesa_print_nv_fragment_program(const struct gl_fragment_program *program); - - extern const char * _mesa_nv_fragment_input_register_name(GLuint i); diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 268b577aec..624262395b 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -44,6 +44,7 @@ #include "nvprogram.h" #include "nvvertparse.h" #include "prog_instruction.h" +#include "prog_print.h" #include "program.h" @@ -1394,7 +1395,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, #ifdef DEBUG_foo _mesa_printf("--- glLoadProgramNV result ---\n"); - _mesa_print_nv_vertex_program(program); + _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0); _mesa_printf("------------------------------\n"); #endif } @@ -1410,161 +1411,6 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, } -static void -PrintSrcReg(const struct prog_src_register *src) -{ - static const char comps[5] = "xyzw"; - if (src->NegateBase) - _mesa_printf("-"); - if (src->RelAddr) { - if (src->Index > 0) - _mesa_printf("c[A0.x + %d]", src->Index); - else if (src->Index < 0) - _mesa_printf("c[A0.x - %d]", -src->Index); - else - _mesa_printf("c[A0.x]"); - } - else if (src->File == PROGRAM_OUTPUT) { - _mesa_printf("o[%s]", OutputRegisters[src->Index]); - } - else if (src->File == PROGRAM_INPUT) { - _mesa_printf("v[%s]", InputRegisters[src->Index]); - } - else if (src->File == PROGRAM_ENV_PARAM) { - _mesa_printf("c[%d]", src->Index); - } - else { - ASSERT(src->File == PROGRAM_TEMPORARY); - _mesa_printf("R%d", src->Index); - } - - if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && - GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && - GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { - _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); - } - else if (src->Swizzle != SWIZZLE_NOOP) { - _mesa_printf(".%c%c%c%c", - comps[GET_SWZ(src->Swizzle, 0)], - comps[GET_SWZ(src->Swizzle, 1)], - comps[GET_SWZ(src->Swizzle, 2)], - comps[GET_SWZ(src->Swizzle, 3)]); - } -} - - -static void -PrintDstReg(const struct prog_dst_register *dst) -{ - if (dst->File == PROGRAM_OUTPUT) { - _mesa_printf("o[%s]", OutputRegisters[dst->Index]); - } - else if (dst->File == PROGRAM_INPUT) { - _mesa_printf("v[%s]", InputRegisters[dst->Index]); - } - else if (dst->File == PROGRAM_ENV_PARAM) { - _mesa_printf("c[%d]", dst->Index); - } - else { - ASSERT(dst->File == PROGRAM_TEMPORARY); - _mesa_printf("R%d", dst->Index); - } - - if (dst->WriteMask != 0 && dst->WriteMask != WRITEMASK_XYZW) { - _mesa_printf("."); - if (dst->WriteMask & WRITEMASK_X) - _mesa_printf("x"); - if (dst->WriteMask & WRITEMASK_Y) - _mesa_printf("y"); - if (dst->WriteMask & WRITEMASK_Z) - _mesa_printf("z"); - if (dst->WriteMask & WRITEMASK_W) - _mesa_printf("w"); - } -} - - -/** - * Print a single NVIDIA vertex program instruction. - */ -void -_mesa_print_nv_vertex_instruction(const struct prog_instruction *inst) -{ - GLuint i, n; - - switch (inst->Opcode) { - case OPCODE_MOV: - case OPCODE_LIT: - case OPCODE_RCP: - case OPCODE_RSQ: - case OPCODE_EXP: - case OPCODE_LOG: - case OPCODE_RCC: - case OPCODE_ABS: - case OPCODE_MUL: - case OPCODE_ADD: - case OPCODE_DP3: - case OPCODE_DP4: - case OPCODE_DST: - case OPCODE_MIN: - case OPCODE_MAX: - case OPCODE_SLT: - case OPCODE_SGE: - case OPCODE_DPH: - case OPCODE_SUB: - case OPCODE_MAD: - _mesa_printf("%s ", _mesa_opcode_string(inst->Opcode)); - PrintDstReg(&inst->DstReg); - _mesa_printf(", "); - n = _mesa_num_inst_src_regs(inst->Opcode); - for (i = 0; i < n; i++) { - PrintSrcReg(&inst->SrcReg[i]); - if (i + 1 < n) - _mesa_printf(", "); - } - _mesa_printf(";\n"); - break; - case OPCODE_ARL: - _mesa_printf("ARL A0.x, "); - PrintSrcReg(&inst->SrcReg[0]); - _mesa_printf(";\n"); - break; - case OPCODE_PRINT: - _mesa_printf("PRINT '%s'", inst->Data); - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - _mesa_printf(", "); - PrintSrcReg(&inst->SrcReg[0]); - _mesa_printf(";\n"); - } - else { - _mesa_printf("\n"); - } - break; - case OPCODE_END: - _mesa_printf("END\n"); - break; - default: - _mesa_printf("BAD INSTRUCTION\n"); - } -} - - -/** - * Print (unparse) the given vertex program. Just for debugging. - */ -void -_mesa_print_nv_vertex_program(const struct gl_vertex_program *program) -{ - const struct prog_instruction *inst; - - for (inst = program->Base.Instructions; ; inst++) { - _mesa_print_nv_vertex_instruction(inst); - if (inst->Opcode == OPCODE_END) - return; - } -} - - const char * _mesa_nv_vertex_input_register_name(GLuint i) { diff --git a/src/mesa/shader/nvvertparse.h b/src/mesa/shader/nvvertparse.h index 15fb03cd4e..9919e22388 100644 --- a/src/mesa/shader/nvvertparse.h +++ b/src/mesa/shader/nvvertparse.h @@ -35,11 +35,6 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, const GLubyte *str, GLsizei len, struct gl_vertex_program *program); -extern void -_mesa_print_nv_vertex_instruction(const struct prog_instruction *inst); - -extern void -_mesa_print_nv_vertex_program(const struct gl_vertex_program *program); extern const char * _mesa_nv_vertex_input_register_name(GLuint i); -- cgit v1.2.3 From 62c45ec951829563b92a95cce5b9621e70c971a4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 19:56:59 -0600 Subject: mesa: move #define for GL_PROGRAM_BINARY_LENGTH_OES --- src/mesa/main/glheader.h | 5 +++++ src/mesa/shader/shader_api.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index ad095321e3..81d4ccf919 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -74,6 +74,11 @@ #endif +#ifndef GL_PROGRAM_BINARY_LENGTH_OES +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#endif + + /** * Special, internal token */ diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 61289db2d2..75e38960e9 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -51,11 +51,6 @@ #include "glapi/dispatch.h" -#ifndef GL_PROGRAM_BINARY_LENGTH_OES -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#endif - - /** * Allocate a new gl_shader_program object, initialize it. */ -- cgit v1.2.3 From 0115a4f8f1952b166eaad09f317ff8bc465e0f28 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 20:00:28 -0600 Subject: mesa: remove unused matrixType param from ctx->Driver.UniformMatrix() functions --- src/mesa/main/dd.h | 2 +- src/mesa/main/shaders.c | 27 +++++++++------------------ src/mesa/shader/shader_api.c | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index d994401e55..32b1d4e9fa 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -911,7 +911,7 @@ struct dd_function_table { void (*Uniform)(GLcontext *ctx, GLint location, GLsizei count, const GLvoid *values, GLenum type); void (*UniformMatrix)(GLcontext *ctx, GLint cols, GLint rows, - GLenum matrixType, GLint location, GLsizei count, + GLint location, GLsizei count, GLboolean transpose, const GLfloat *values); void (*UseProgram)(GLcontext *ctx, GLuint program); void (*ValidateProgram)(GLcontext *ctx, GLuint program); diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index be93b45a7d..bc76b91291 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -638,8 +638,7 @@ _mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 2, GL_FLOAT_MAT2, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 2, 2, location, count, transpose, value); } void GLAPIENTRY @@ -647,8 +646,7 @@ _mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 3, GL_FLOAT_MAT3, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 3, 3, location, count, transpose, value); } void GLAPIENTRY @@ -656,8 +654,7 @@ _mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 4, GL_FLOAT_MAT4, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 4, 4, location, count, transpose, value); } @@ -669,8 +666,7 @@ _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 3, GL_FLOAT_MAT2x3, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 2, 3, location, count, transpose, value); } void GLAPIENTRY @@ -678,8 +674,7 @@ _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 2, GL_FLOAT_MAT3x2, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 3, 2, location, count, transpose, value); } void GLAPIENTRY @@ -687,8 +682,7 @@ _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 4, GL_FLOAT_MAT2x4, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 2, 4, location, count, transpose, value); } void GLAPIENTRY @@ -696,8 +690,7 @@ _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 2, GL_FLOAT_MAT4x2, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 4, 2, location, count, transpose, value); } void GLAPIENTRY @@ -705,8 +698,7 @@ _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 4, GL_FLOAT_MAT3x4, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 3, 4, location, count, transpose, value); } void GLAPIENTRY @@ -714,8 +706,7 @@ _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 3, GL_FLOAT_MAT4x3, - location, count, transpose, value); + ctx->Driver.UniformMatrix(ctx, 4, 3, location, count, transpose, value); } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 75e38960e9..9038f7d1de 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1897,7 +1897,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, */ static void _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, - GLenum matrixType, GLint location, GLsizei count, + GLint location, GLsizei count, GLboolean transpose, const GLfloat *values) { struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; -- cgit v1.2.3 From 7db7ff878d3e5a6b345228e6eaee4797bb68b360 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Apr 2009 22:14:30 -0600 Subject: mesa: merge the prog_src_register::NegateBase and NegateAbs fields There's really no need for two negation fields. This came from the GL_NV_fragment_program extension. The new, unified Negate bitfield applies after the absolute value step. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 10 ++--- src/mesa/drivers/dri/i965/brw_vs_constval.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_emit.c | 8 ++-- src/mesa/drivers/dri/i965/brw_wm_fp.c | 13 +++--- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +-- src/mesa/drivers/dri/i965/brw_wm_pass0.c | 2 +- src/mesa/drivers/dri/r200/r200_vertprog.c | 34 ++++++++-------- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +- src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c | 17 ++++---- src/mesa/drivers/dri/r300/r300_vertprog.c | 49 +++++++++-------------- src/mesa/drivers/dri/r300/r500_fragprog.c | 19 +++++---- src/mesa/drivers/dri/r300/radeon_nqssadce.c | 7 ++-- src/mesa/drivers/dri/r300/radeon_program_alu.c | 20 +++++---- src/mesa/drivers/dri/r300/radeon_program_pair.c | 11 +++-- src/mesa/main/ffvertex_prog.c | 3 +- src/mesa/main/texenvprogram.c | 3 +- src/mesa/shader/arbprogparse.c | 8 ++-- src/mesa/shader/nvfragparse.c | 33 ++++++++------- src/mesa/shader/nvvertparse.c | 10 ++--- src/mesa/shader/prog_execute.c | 27 ++++--------- src/mesa/shader/prog_instruction.h | 32 +++------------ src/mesa/shader/prog_print.c | 20 ++++----- src/mesa/shader/programopt.c | 2 +- src/mesa/shader/slang/slang_emit.c | 2 +- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- src/mesa/state_tracker/st_mesa_to_tgsi.c | 20 ++++----- 26 files changed, 156 insertions(+), 208 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 52f09a4b1b..a5158de945 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -162,12 +162,12 @@ src_vector(struct i915_fragment_program *p, GET_SWZ(source->Swizzle, 1), GET_SWZ(source->Swizzle, 2), GET_SWZ(source->Swizzle, 3)); - if (source->NegateBase) + if (source->Negate) src = negate(src, - GET_BIT(source->NegateBase, 0), - GET_BIT(source->NegateBase, 1), - GET_BIT(source->NegateBase, 2), - GET_BIT(source->NegateBase, 3)); + GET_BIT(source->Negate, 0), + GET_BIT(source->Negate, 1), + GET_BIT(source->Negate, 2), + GET_BIT(source->Negate, 3)); return src; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index d29eb17f8c..2637344b48 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -96,7 +96,7 @@ static GLubyte get_active( struct tracker *t, struct prog_src_register src ) { GLuint i; - GLubyte active = src.NegateBase; /* NOTE! */ + GLubyte active = src.Negate; /* NOTE! */ if (src.RelAddr) return 0xf; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 2ee63129bc..42f6a99142 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -899,7 +899,7 @@ static struct brw_reg get_arg( struct brw_vs_compile *c, /* Note this is ok for non-swizzle instructions: */ - reg.negate = src->NegateBase ? 1 : 0; + reg.negate = src->Negate ? 1 : 0; return reg; } @@ -945,7 +945,7 @@ static void emit_swz( struct brw_vs_compile *c, GLuint ones_mask = 0; GLuint src_mask = 0; GLubyte src_swz[4]; - GLboolean need_tmp = (src.NegateBase && + GLboolean need_tmp = (src.Negate && dst.file != BRW_GENERAL_REGISTER_FILE); struct brw_reg tmp = dst; GLuint i; @@ -997,8 +997,8 @@ static void emit_swz( struct brw_vs_compile *c, if (ones_mask) brw_MOV(p, brw_writemask(tmp, ones_mask), brw_imm_f(1)); - if (src.NegateBase) - brw_MOV(p, brw_writemask(tmp, src.NegateBase), negate(tmp)); + if (src.Negate) + brw_MOV(p, brw_writemask(tmp, src.Negate), negate(tmp)); if (need_tmp) { brw_MOV(p, dst, tmp); diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index a7f5f1b9a2..1798d842c7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -80,9 +80,8 @@ static struct prog_src_register src_reg(GLuint file, GLuint idx) reg.Index = idx; reg.Swizzle = SWIZZLE_NOOP; reg.RelAddr = 0; - reg.NegateBase = 0; + reg.Negate = NEGATE_NONE; reg.Abs = 0; - reg.NegateAbs = 0; return reg; } @@ -569,7 +568,7 @@ static void precalc_dst( struct brw_wm_compile *c, src_undef(), src_undef()); /* Avoid letting negation flag of src0 affect our 1 constant. */ - swz->SrcReg[0].NegateBase &= ~NEGATE_X; + swz->SrcReg[0].Negate &= ~NEGATE_X; } if (dst.WriteMask & WRITEMASK_W) { /* dst.w = mov src1.w @@ -604,7 +603,7 @@ static void precalc_lit( struct brw_wm_compile *c, src_undef(), src_undef()); /* Avoid letting the negation flag of src0 affect our 1 constant. */ - swz->SrcReg[0].NegateBase = 0; + swz->SrcReg[0].Negate = NEGATE_NONE; } if (dst.WriteMask & WRITEMASK_YZ) { @@ -651,7 +650,7 @@ static void precalc_tex( struct brw_wm_compile *c, src0, src_undef(), src_undef()); - out->SrcReg[0].NegateBase = 0; + out->SrcReg[0].Negate = NEGATE_NONE; out->SrcReg[0].Abs = 1; /* tmp0 = MAX(coord.X, coord.Y) */ @@ -1050,14 +1049,14 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) case OPCODE_ABS: out = emit_insn(c, inst); out->Opcode = OPCODE_MOV; - out->SrcReg[0].NegateBase = 0; + out->SrcReg[0].Negate = NEGATE_NONE; out->SrcReg[0].Abs = 1; break; case OPCODE_SUB: out = emit_insn(c, inst); out->Opcode = OPCODE_ADD; - out->SrcReg[1].NegateBase ^= 0xf; + out->SrcReg[1].Negate ^= NEGATE_XYZW; break; case OPCODE_SCS: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 49fea2e41a..385efd2dd3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -340,7 +340,7 @@ get_src_reg_const(struct brw_wm_compile *c, const_reg = stride(const_reg, 0, 1, 0); const_reg.subnr = component * 4; - if (src->NegateBase) + if (src->Negate & (1 << component)) const_reg = negate(const_reg); if (src->Abs) const_reg = brw_abs(const_reg); @@ -377,7 +377,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, else { /* other type of source register */ return get_reg(c, src->File, src->Index, component, nr, - src->NegateBase, src->Abs); + src->Negate, src->Abs); } } @@ -402,7 +402,7 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, const GLfloat *param = c->fp->program.Base.Parameters->ParameterValues[src->Index]; GLfloat value = param[component]; - if (src->NegateBase) + if (src->Negate & (1 << channel)) value = -value; if (src->Abs) value = FABSF(value); diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 2debd0678a..92142764f5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -322,7 +322,7 @@ static struct brw_wm_ref *get_new_ref( struct brw_wm_compile *c, newref->value->lastuse = newref; } - if (src.NegateBase & (1<hw_reg.negate ^= 1; if (src.Abs) { diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index a2561df579..4ce93b5145 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -290,7 +290,7 @@ static unsigned long t_src(struct r200_vertex_program *vp, struct prog_src_regis t_swizzle(GET_SWZ(src->Swizzle, 2)), t_swizzle(GET_SWZ(src->Swizzle, 3)), t_src_class(src->File), - src->NegateBase) | (src->RelAddr << 4); + src->Negate) | (src->RelAddr << 4); } static unsigned long t_src_scalar(struct r200_vertex_program *vp, struct prog_src_register *src) @@ -302,7 +302,7 @@ static unsigned long t_src_scalar(struct r200_vertex_program *vp, struct prog_sr t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_src_class(src->File), - src->NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src->RelAddr << 4); + src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src->RelAddr << 4); } static unsigned long t_opcode(enum prog_opcode opcode) @@ -700,7 +700,7 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte t_swizzle(GET_SWZ(src[1].Swizzle, 0)), SWIZZLE_ZERO, t_src_class(src[0].File), - src[0].NegateBase) | (src[0].RelAddr << 4); + src[0].Negate) | (src[0].RelAddr << 4); o_inst->src1 = UNUSED_SRC_0; o_inst->src2 = UNUSED_SRC_0; } @@ -712,12 +712,12 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte t_swizzle(GET_SWZ(src[0].Swizzle, 0)), SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, t_src_class(src[0].File), - src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); o_inst->src1 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), SWIZZLE_ZERO, SWIZZLE_ZERO, t_swizzle(GET_SWZ(src[1].Swizzle, 0)), SWIZZLE_ZERO, t_src_class(src[1].File), - src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); o_inst->src2 = UNUSED_SRC_1; o_inst++; @@ -766,11 +766,11 @@ if ((o_inst - vp->instr) == 31) { o_inst->src1 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, t_src_class(src[1].File), - src[1].NegateBase) | (src[1].RelAddr << 4); + src[1].Negate) | (src[1].RelAddr << 4); o_inst->src2 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, t_src_class(src[1].File), - src[1].NegateBase) | (src[1].RelAddr << 4); + src[1].Negate) | (src[1].RelAddr << 4); } else { o_inst->src1 = t_src(vp, &src[1]); @@ -792,7 +792,7 @@ else { t_swizzle(GET_SWZ(src[0].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[0].File), - src[0].NegateBase) | (src[0].RelAddr << 4); + src[0].Negate) | (src[0].RelAddr << 4); o_inst->src1 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 0)), @@ -800,7 +800,7 @@ else { t_swizzle(GET_SWZ(src[1].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[1].File), - src[1].NegateBase) | (src[1].RelAddr << 4); + src[1].Negate) | (src[1].RelAddr << 4); o_inst->src2 = UNUSED_SRC_1; goto next; @@ -815,7 +815,7 @@ else { t_swizzle(GET_SWZ(src[0].Swizzle, 2)), VSF_IN_COMPONENT_ONE, t_src_class(src[0].File), - src[0].NegateBase) | (src[0].RelAddr << 4); + src[0].Negate) | (src[0].RelAddr << 4); o_inst->src1 = t_src(vp, &src[1]); o_inst->src2 = UNUSED_SRC_1; goto next; @@ -831,7 +831,7 @@ else { t_swizzle(GET_SWZ(src[1].Swizzle, 2)), t_swizzle(GET_SWZ(src[1].Swizzle, 3)), t_src_class(src[1].File), - (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); o_inst->src2 = UNUSED_SRC_1; goto next; @@ -846,7 +846,7 @@ else { t_swizzle(GET_SWZ(src[0].Swizzle, 2)), t_swizzle(GET_SWZ(src[0].Swizzle, 3)), t_src_class(src[0].File), - (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); + (!src[0].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); o_inst->src2 = UNUSED_SRC_1; goto next; @@ -874,7 +874,7 @@ else { VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP, /* Not 100% sure about this */ - (!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/); + (!src[0].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE/*VSF_FLAG_ALL*/); o_inst->src2 = UNUSED_SRC_0; u_temp_i--; @@ -899,7 +899,7 @@ else { t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w t_src_class(src[0].File), - src[0].NegateBase) | (src[0].RelAddr << 4); + src[0].Negate) | (src[0].RelAddr << 4); o_inst->src1 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z @@ -907,7 +907,7 @@ else { t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w t_src_class(src[1].File), - src[1].NegateBase) | (src[1].RelAddr << 4); + src[1].Negate) | (src[1].RelAddr << 4); o_inst->src2 = UNUSED_SRC_1; o_inst++; @@ -922,7 +922,7 @@ else { t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w t_src_class(src[1].File), - (!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); + (!src[1].Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); o_inst->src1 = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z @@ -930,7 +930,7 @@ else { t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w t_src_class(src[0].File), - src[0].NegateBase) | (src[0].RelAddr << 4); + src[0].Negate) | (src[0].RelAddr << 4); o_inst->src2 = MAKE_VSF_SOURCE(u_temp_i+1, VSF_IN_COMPONENT_X, diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 32182bb667..873cde4414 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -214,9 +214,9 @@ static GLboolean transform_TEX( * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ if (comparefunc == GL_LESS || comparefunc == GL_GEQUAL) - tgt[1].SrcReg[2].NegateBase = tgt[0].SrcReg[2].NegateBase ^ NEGATE_XYZW; + tgt[1].SrcReg[2].Negate = tgt[0].SrcReg[2].Negate ^ NEGATE_XYZW; else - tgt[1].SrcReg[0].NegateBase = tgt[0].SrcReg[0].NegateBase ^ NEGATE_XYZW; + tgt[1].SrcReg[0].Negate = tgt[0].SrcReg[0].Negate ^ NEGATE_XYZW; tgt[2].Opcode = OPCODE_CMP; tgt[2].DstReg = orig_inst->DstReg; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c index a86d2bd471..191853ac1f 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c @@ -92,7 +92,7 @@ static const struct swizzle_data* lookup_native_swizzle(GLuint swizzle) GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) { if (reg.Abs) - reg.NegateBase = 0; + reg.Negate = NEGATE_NONE; if (opcode == OPCODE_KIL || opcode == OPCODE_TEX || @@ -100,7 +100,8 @@ GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) opcode == OPCODE_TXP) { int j; - if (reg.Abs || reg.NegateBase != (15*reg.NegateAbs)) + if (reg.Abs || (reg.Negate != NEGATE_XYZW && + reg.Negate != NEGATE_NONE)) return GL_FALSE; for(j = 0; j < 4; ++j) { @@ -121,7 +122,7 @@ GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) if (GET_SWZ(reg.Swizzle, j) != SWIZZLE_NIL) relevant |= 1 << j; - if ((reg.NegateBase & relevant) && (reg.NegateBase & relevant) != relevant) + if ((reg.Negate & relevant) && (reg.Negate & relevant) != relevant) return GL_FALSE; if (!lookup_native_swizzle(reg.Swizzle)) @@ -137,7 +138,7 @@ GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src) { if (src.Abs) - src.NegateBase = 0; + src.Negate = NEGATE_NONE; while(dst.WriteMask) { const struct swizzle_data *best_swizzle = 0; @@ -170,11 +171,11 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, } } - if ((src.NegateBase & best_matchmask) != 0) { - best_matchmask &= src.NegateBase; - rgbnegate = !src.NegateAbs; + if ((src.Negate & best_matchmask) != 0) { + best_matchmask &= src.Negate; + rgbnegate = !src.Negate; } else { - rgbnegate = src.NegateAbs; + rgbnegate = src.Negate; } struct prog_instruction *inst; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 50806575ce..146daa367c 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -245,7 +245,7 @@ static unsigned long t_src_index(struct r300_vertex_program *vp, static unsigned long t_src(struct r300_vertex_program *vp, struct prog_src_register *src) { - /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, + /* src->Negate uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), @@ -254,13 +254,13 @@ static unsigned long t_src(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src->Swizzle, 2)), t_swizzle(GET_SWZ(src->Swizzle, 3)), t_src_class(src->File), - src->NegateBase) | (src->RelAddr << 4); + src->Negate) | (src->RelAddr << 4); } static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct prog_src_register *src) { - /* src->NegateBase uses the NEGATE_ flags from program_instruction.h, + /* src->Negate uses the NEGATE_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), @@ -269,8 +269,7 @@ static unsigned long t_src_scalar(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_src_class(src->File), - src-> - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src->RelAddr << 4); } @@ -307,7 +306,7 @@ static GLuint *r300TranslateOpcodeABS(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 3)), t_src_class(src[0].File), (!src[0]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = 0; @@ -369,8 +368,7 @@ static GLuint *r300TranslateOpcodeDP3(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), @@ -378,8 +376,7 @@ static GLuint *r300TranslateOpcodeDP3(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[1].Swizzle, 1)), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), SWIZZLE_ZERO, t_src_class(src[1].File), - src[1]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + src[1].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -422,8 +419,7 @@ static GLuint *r300TranslateOpcodeDPH(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 2)), PVS_SRC_SELECT_FORCE_1, t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = t_src(vp, &src[1]); inst[3] = __CONST(1, SWIZZLE_ZERO); @@ -519,7 +515,7 @@ static GLuint *r300TranslateOpcodeFLR(struct r300_vertex_program *vp, PVS_SRC_SELECT_W, PVS_SRC_REG_TEMPORARY, /* Not 100% sure about this */ (!src[0]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE + Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE /*VSF_FLAG_ALL */ ); inst[3] = __CONST(0, SWIZZLE_ZERO); (*u_temp_i)--; @@ -564,8 +560,7 @@ static GLuint *r300TranslateOpcodeLG2(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_swizzle(GET_SWZ(src[0].Swizzle, 0)), t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = __CONST(0, SWIZZLE_ZERO); inst[3] = __CONST(0, SWIZZLE_ZERO); @@ -592,24 +587,21 @@ static GLuint *r300TranslateOpcodeLIT(struct r300_vertex_program *vp, PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); return inst; @@ -837,7 +829,7 @@ static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[1].Swizzle, 3)), t_src_class(src[1].File), (!src[1]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = 0; #else @@ -857,7 +849,7 @@ static GLuint *r300TranslateOpcodeSUB(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[1].Swizzle, 3)), t_src_class(src[1].File), (!src[1]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); #endif @@ -905,16 +897,14 @@ static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W t_src_class(src[1].File), - src[1]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[1].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[3] = __CONST(1, SWIZZLE_ZERO); inst += 4; @@ -931,15 +921,14 @@ static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // W t_src_class(src[1].File), (!src[1]. - NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + Negate) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // Z t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // W t_src_class(src[0].File), - src[0]. - NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | + src[0].Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4); inst[3] = PVS_SRC_OPERAND(*u_temp_i, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 07a2a7b17c..292573de89 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -156,9 +156,9 @@ static GLboolean transform_TEX( * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ if (comparefunc == GL_LESS || comparefunc == GL_GEQUAL) - tgt[1].SrcReg[2].NegateBase = tgt[0].SrcReg[2].NegateBase ^ NEGATE_XYZW; + tgt[1].SrcReg[2].Negate = tgt[0].SrcReg[2].Negate ^ NEGATE_XYZW; else - tgt[1].SrcReg[0].NegateBase = tgt[0].SrcReg[0].NegateBase ^ NEGATE_XYZW; + tgt[1].SrcReg[0].Negate = tgt[0].SrcReg[0].Negate ^ NEGATE_XYZW; tgt[2].Opcode = OPCODE_CMP; tgt[2].DstReg = orig_inst->DstReg; @@ -314,8 +314,8 @@ static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) if (reg.Abs) return GL_FALSE; - if (reg.NegateAbs) - reg.NegateBase ^= 15; + if (reg.Negate) + reg.Negate ^= NEGATE_XYZW; if (opcode == OPCODE_KIL) { if (reg.Swizzle != SWIZZLE_NOOP) @@ -324,7 +324,7 @@ static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) for(i = 0; i < 4; ++i) { GLuint swz = GET_SWZ(reg.Swizzle, i); if (swz == SWIZZLE_NIL) { - reg.NegateBase &= ~(1 << i); + reg.Negate &= ~(1 << i); continue; } if (swz >= 4) @@ -332,15 +332,14 @@ static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) } } - if (reg.NegateBase) + if (reg.Negate) return GL_FALSE; return GL_TRUE; } else if (opcode == OPCODE_DDX || opcode == OPCODE_DDY) { /* DDX/MDH and DDY/MDV explicitly ignore incoming swizzles; * if it doesn't fit perfectly into a .xyzw case... */ - if (reg.Swizzle == SWIZZLE_NOOP && !reg.Abs - && !reg.NegateBase && !reg.NegateAbs) + if (reg.Swizzle == SWIZZLE_NOOP && !reg.Abs && !reg.Negate) return GL_TRUE; return GL_FALSE; @@ -355,7 +354,7 @@ static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) if (swz != SWIZZLE_NIL && swz != SWIZZLE_ZERO) relevant |= 1 << i; } - if ((reg.NegateBase & relevant) && ((reg.NegateBase & relevant) != relevant)) + if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant)) return GL_FALSE; return GL_TRUE; @@ -379,7 +378,7 @@ static void nqssadce_build_swizzle(struct nqssadce_state *s, GLuint swz = GET_SWZ(src.Swizzle, i); if (swz == SWIZZLE_NIL) continue; - negatebase[GET_BIT(src.NegateBase, i)] |= 1 << i; + negatebase[GET_BIT(src.Negate, i)] |= 1 << i; } _mesa_insert_instructions(s->Program, s->IP, (negatebase[0] ? 1 : 0) + (negatebase[1] ? 1 : 0)); diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c index a083c3d243..4a2e1cba40 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c @@ -61,12 +61,12 @@ static struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_reg struct prog_src_register tmp = srcreg; int i; tmp.Swizzle = 0; - tmp.NegateBase = 0; + tmp.Negate = NEGATE_NONE; for(i = 0; i < 4; ++i) { GLuint swz = GET_SWZ(swizzle, i); if (swz < 4) { tmp.Swizzle |= GET_SWZ(srcreg.Swizzle, swz) << (i*3); - tmp.NegateBase |= GET_BIT(srcreg.NegateBase, swz) << i; + tmp.Negate |= GET_BIT(srcreg.Negate, swz) << i; } else { tmp.Swizzle |= swz << (i*3); } @@ -103,9 +103,8 @@ static struct prog_instruction* track_used_srcreg(struct nqssadce_state* s, inst->SrcReg[src].File = PROGRAM_TEMPORARY; inst->SrcReg[src].Index = dstreg.Index; inst->SrcReg[src].Swizzle = 0; - inst->SrcReg[src].NegateBase = 0; + inst->SrcReg[src].Negate = NEGATE_NONE; inst->SrcReg[src].Abs = 0; - inst->SrcReg[src].NegateAbs = 0; for(i = 0; i < 4; ++i) { if (GET_BIT(sourced, i)) inst->SrcReg[src].Swizzle |= i << (3*i); diff --git a/src/mesa/drivers/dri/r300/radeon_program_alu.c b/src/mesa/drivers/dri/r300/radeon_program_alu.c index 1ef71e74dc..ebc5c913b2 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/radeon_program_alu.c @@ -89,8 +89,9 @@ static void set_swizzle(struct prog_src_register *SrcReg, int coordinate, int sw static void set_negate_base(struct prog_src_register *SrcReg, int coordinate, int negate) { - SrcReg->NegateBase &= ~(1 << coordinate); - SrcReg->NegateBase |= (negate << coordinate); + /* XXX note sure about this negation logic here */ + SrcReg->Negate &= ~(1 << coordinate); + SrcReg->Negate |= (negate << coordinate); } static struct prog_dst_register dstreg(int file, int index) @@ -156,15 +157,14 @@ static struct prog_src_register absolute(struct prog_src_register reg) { struct prog_src_register newreg = reg; newreg.Abs = 1; - newreg.NegateBase = 0; - newreg.NegateAbs = 0; + newreg.Negate = NEGATE_NONE; return newreg; } static struct prog_src_register negate(struct prog_src_register reg) { struct prog_src_register newreg = reg; - newreg.NegateAbs = !newreg.NegateAbs; + newreg.Negate = newreg.Negate ^ NEGATE_XYZW; return newreg; } @@ -189,8 +189,7 @@ static void transform_ABS(struct radeon_transform_context* t, { struct prog_src_register src = inst->SrcReg[0]; src.Abs = 1; - src.NegateBase = 0; - src.NegateAbs = 0; + src.Negate = NEGATE_NONE; emit1(t->Program, OPCODE_MOV, inst->SaturateMode, inst->DstReg, src); } @@ -198,14 +197,13 @@ static void transform_DPH(struct radeon_transform_context* t, struct prog_instruction* inst) { struct prog_src_register src0 = inst->SrcReg[0]; - if (src0.NegateAbs) { + if (src0.Negate) { if (src0.Abs) { int tempreg = radeonFindFreeTemporary(t); emit1(t->Program, OPCODE_MOV, 0, dstreg(PROGRAM_TEMPORARY, tempreg), src0); src0 = srcreg(src0.File, src0.Index); } else { - src0.NegateAbs = 0; - src0.NegateBase ^= NEGATE_XYZW; + src0.Negate ^= NEGATE_XYZW; } } set_swizzle(&src0, 3, SWIZZLE_ONE); @@ -649,7 +647,7 @@ GLboolean radeonTransformDeriv(struct radeon_transform_context* t, B.Swizzle = MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE); - B.NegateBase = NEGATE_XYZW; + B.Negate = NEGATE_XYZW; emit2(t->Program, inst->Opcode, inst->SaturateMode, inst->DstReg, inst->SrcReg[0], B); diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index f398404f9f..ecc82ff8a8 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -255,8 +255,7 @@ static void final_rewrite(struct pair_state *s, struct prog_instruction *inst) inst->SrcReg[2] = inst->SrcReg[1]; inst->SrcReg[1].File = PROGRAM_BUILTIN; inst->SrcReg[1].Swizzle = SWIZZLE_1111; - inst->SrcReg[1].NegateBase = 0; - inst->SrcReg[1].NegateAbs = 0; + inst->SrcReg[1].Negate = NEGATE_NONE; inst->Opcode = OPCODE_MAD; break; case OPCODE_CMP: @@ -730,7 +729,7 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ srcrgb = GL_TRUE; else if (swz < 4) srcalpha = GL_TRUE; - if (swz != SWIZZLE_NIL && GET_BIT(inst->SrcReg[i].NegateBase, j)) + if (swz != SWIZZLE_NIL && GET_BIT(inst->SrcReg[i].Negate, j)) negatebase = 1; } source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); @@ -739,12 +738,12 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ pair->RGB.Arg[i].Source = source; pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].NegateAbs; + pair->RGB.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].Negate; } if (pairinst->NeedAlpha) { GLboolean srcrgb = GL_FALSE; GLboolean srcalpha = GL_FALSE; - GLuint negatebase = GET_BIT(inst->SrcReg[i].NegateBase, pairinst->IsTranscendent ? 0 : 3); + GLuint negatebase = GET_BIT(inst->SrcReg[i].Negate, pairinst->IsTranscendent ? 0 : 3); GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, pairinst->IsTranscendent ? 0 : 3); if (swz < 3) srcrgb = GL_TRUE; @@ -756,7 +755,7 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ pair->Alpha.Arg[i].Source = source; pair->Alpha.Arg[i].Swizzle = swz; pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->Alpha.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].NegateAbs; + pair->Alpha.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].Negate; } } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 03f42704a7..1ce5685af4 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -570,9 +570,8 @@ static void emit_arg( struct prog_src_register *src, src->File = reg.file; src->Index = reg.idx; src->Swizzle = reg.swz; - src->NegateBase = reg.negate ? NEGATE_XYZW : 0; + src->Negate = reg.negate ? NEGATE_XYZW : NEGATE_NONE; src->Abs = 0; - src->NegateAbs = 0; src->RelAddr = 0; /* Check that bitfield sizes aren't exceeded */ ASSERT(src->Index == reg.idx); diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 4a124bf27e..a70d069bd9 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -663,9 +663,8 @@ static void emit_arg( struct prog_src_register *reg, reg->File = ureg.file; reg->Index = ureg.idx; reg->Swizzle = ureg.swz; - reg->NegateBase = ureg.negatebase ? 0xf : 0x0; + reg->Negate = ureg.negatebase ? NEGATE_XYZW : NEGATE_NONE; reg->Abs = ureg.abs; - reg->NegateAbs = ureg.negateabs; } static void emit_dst( struct prog_dst_register *dst, diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 35253daa2e..b47bf360cf 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2669,7 +2669,7 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, reg->File = file; reg->Index = index; reg->Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]); - reg->NegateBase = negateMask; + reg->Negate = negateMask; reg->RelAddr = isRelOffset; return 0; } @@ -2703,7 +2703,7 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, reg->File = file; reg->Index = index; reg->Swizzle = (swizzle[0] << 0); - reg->NegateBase = negateMask; + reg->Negate = negateMask; reg->RelAddr = isRelOffset; return 0; } @@ -3019,7 +3019,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, parse_extended_swizzle_mask(inst, swizzle, &negateMask); fp->SrcReg[0].File = file; fp->SrcReg[0].Index = index; - fp->SrcReg[0].NegateBase = negateMask; + fp->SrcReg[0].Negate = negateMask; fp->SrcReg[0].Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], @@ -3363,7 +3363,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, parse_extended_swizzle_mask (inst, swizzle, &negateMask); vp->SrcReg[0].File = file; vp->SrcReg[0].Index = index; - vp->SrcReg[0].NegateBase = negateMask; + vp->SrcReg[0].Negate = negateMask; vp->SrcReg[0].Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 56b7c29bea..0fd55524ab 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -957,6 +957,7 @@ Parse_VectorSrc(struct parse_state *parseState, GLfloat sign = 1.0F; GLubyte token[100]; GLint idx; + GLuint negateBase, negateAbs; /* * First, take care of +/- and absolute value stuff. @@ -968,21 +969,23 @@ Parse_VectorSrc(struct parse_state *parseState, if (Parse_String(parseState, "|")) { srcReg->Abs = GL_TRUE; - srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; if (Parse_String(parseState, "-")) - srcReg->NegateBase = NEGATE_XYZW; + negateBase = NEGATE_XYZW; else if (Parse_String(parseState, "+")) - srcReg->NegateBase = NEGATE_NONE; + negateBase = NEGATE_NONE; else - srcReg->NegateBase = NEGATE_NONE; + negateBase = NEGATE_NONE; } else { srcReg->Abs = GL_FALSE; - srcReg->NegateAbs = GL_FALSE; - srcReg->NegateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; + negateAbs = NEGATE_NONE; + negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; } + srcReg->Negate = srcReg->Abs ? negateAbs : negateBase; + /* This should be the real src vector/register name */ if (!Peek_Token(parseState, token)) RETURN_ERROR; @@ -1083,6 +1086,7 @@ Parse_ScalarSrcReg(struct parse_state *parseState, GLfloat sign = 1.0F; GLboolean needSuffix = GL_TRUE; GLint idx; + GLuint negateBase, negateAbs; /* * First, take care of +/- and absolute value stuff. @@ -1094,21 +1098,23 @@ Parse_ScalarSrcReg(struct parse_state *parseState, if (Parse_String(parseState, "|")) { srcReg->Abs = GL_TRUE; - srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; + negateAbs = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; if (Parse_String(parseState, "-")) - srcReg->NegateBase = NEGATE_XYZW; + negateBase = NEGATE_XYZW; else if (Parse_String(parseState, "+")) - srcReg->NegateBase = NEGATE_NONE; + negateBase = NEGATE_NONE; else - srcReg->NegateBase = NEGATE_NONE; + negateBase = NEGATE_NONE; } else { srcReg->Abs = GL_FALSE; - srcReg->NegateAbs = GL_FALSE; - srcReg->NegateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; + negateAbs = NEGATE_NONE; + negateBase = (sign < 0.0F) ? NEGATE_XYZW : NEGATE_NONE; } + srcReg->Negate = srcReg->Abs ? negateAbs : negateBase; + if (!Peek_Token(parseState, token)) RETURN_ERROR; @@ -1247,9 +1253,8 @@ Parse_PrintInstruction(struct parse_state *parseState, } inst->SrcReg[0].Swizzle = SWIZZLE_NOOP; - inst->SrcReg[0].NegateBase = NEGATE_NONE; inst->SrcReg[0].Abs = GL_FALSE; - inst->SrcReg[0].NegateAbs = GL_FALSE; + inst->SrcReg[0].Negate = NEGATE_NONE; return GL_TRUE; } diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 624262395b..f5e2df2670 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -641,12 +641,12 @@ Parse_SwizzleSrcReg(struct parse_state *parseState, struct prog_src_register *sr RETURN_ERROR; if (token[0] == '-') { (void) Parse_String(parseState, "-"); - srcReg->NegateBase = NEGATE_XYZW; + srcReg->Negate = NEGATE_XYZW; if (!Peek_Token(parseState, token)) RETURN_ERROR; } else { - srcReg->NegateBase = NEGATE_NONE; + srcReg->Negate = NEGATE_NONE; } /* Src reg can be R, c[n], c[n +/- offset], or a named vertex attrib */ @@ -734,13 +734,13 @@ Parse_ScalarSrcReg(struct parse_state *parseState, struct prog_src_register *src if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '-') { - srcReg->NegateBase = NEGATE_XYZW; + srcReg->Negate = NEGATE_XYZW; (void) Parse_String(parseState, "-"); /* consume '-' */ if (!Peek_Token(parseState, token)) RETURN_ERROR; } else { - srcReg->NegateBase = NEGATE_NONE; + srcReg->Negate = NEGATE_NONE; } /* Src reg can be R, c[n], c[n +/- offset], or a named vertex attrib */ @@ -1062,7 +1062,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction * RETURN_ERROR; srcReg->RelAddr = GL_FALSE; - srcReg->NegateBase = NEGATE_NONE; + srcReg->Negate = NEGATE_NONE; srcReg->Swizzle = SWIZZLE_NOOP; /* Register can be R, c[n], c[n +/- offset], a named vertex attrib, diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index bdac1d4f8a..68a59350a1 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -212,19 +212,14 @@ fetch_vector4(const struct prog_src_register *source, result[3] = src[GET_SWZ(source->Swizzle, 3)]; } - if (source->NegateBase) { - result[0] = -result[0]; - result[1] = -result[1]; - result[2] = -result[2]; - result[3] = -result[3]; - } if (source->Abs) { result[0] = FABSF(result[0]); result[1] = FABSF(result[1]); result[2] = FABSF(result[2]); result[3] = FABSF(result[3]); } - if (source->NegateAbs) { + if (source->Negate) { + ASSERT(source->Negate == NEGATE_XYZW); result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; @@ -259,7 +254,7 @@ fetch_vector4ui(const struct prog_src_register *source, result[3] = src[GET_SWZ(source->Swizzle, 3)]; } - /* Note: no NegateBase, Abs, NegateAbs here */ + /* Note: no Negate or Abs here */ } @@ -299,19 +294,14 @@ fetch_vector4_deriv(GLcontext * ctx, result[2] = deriv[GET_SWZ(source->Swizzle, 2)]; result[3] = deriv[GET_SWZ(source->Swizzle, 3)]; - if (source->NegateBase) { - result[0] = -result[0]; - result[1] = -result[1]; - result[2] = -result[2]; - result[3] = -result[3]; - } if (source->Abs) { result[0] = FABSF(result[0]); result[1] = FABSF(result[1]); result[2] = FABSF(result[2]); result[3] = FABSF(result[3]); } - if (source->NegateAbs) { + if (source->Negate) { + ASSERT(source->Negate == NEGATE_XYZW); result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; @@ -336,13 +326,10 @@ fetch_vector1(const struct prog_src_register *source, result[0] = src[GET_SWZ(source->Swizzle, 0)]; - if (source->NegateBase) { - result[0] = -result[0]; - } if (source->Abs) { result[0] = FABSF(result[0]); } - if (source->NegateAbs) { + if (source->Negate) { result[0] = -result[0]; } } @@ -1514,7 +1501,7 @@ _mesa_execute_program(GLcontext * ctx, ASSERT(swz <= 3); result[i] = src[swz]; } - if (source->NegateBase & (1 << i)) + if (source->Negate & (1 << i)) result[i] = -result[i]; } store_vector4(inst, machine, result); diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 4adce11f95..3109f6cbae 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -261,37 +261,15 @@ struct prog_src_register GLuint Swizzle:12; GLuint RelAddr:1; - /** - * \name Source register "sign" control. - * - * The ARB and NV extensions allow varrying degrees of control over the - * sign of the source vector components. These values allow enough control - * for all flavors of the extensions. - */ - /*@{*/ - /** - * Per-component negation for the SWZ instruction. For non-SWZ - * instructions the only possible values are NEGATE_XYZW and NEGATE_NONE. - * - * \since - * ARB_vertex_program, ARB_fragment_program - */ - GLuint NegateBase:4; - - /** - * Take the component-wise absolute value. - * - * \since - * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, - * NV_vertex_program2_option. - */ + /** Take the component-wise absolute value */ GLuint Abs:1; /** - * Post-absolute value negation (all components). + * Post-Abs negation. + * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ + * instruction which allows per-component negation. */ - GLuint NegateAbs:1; - /*@}*/ + GLuint Negate:4; }; diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index b832ddb477..d73c619fea 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -325,19 +325,19 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, * \param extended if true, also allow 0, 1 values */ const char * -_mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) +_mesa_swizzle_string(GLuint swizzle, GLuint negateMask, GLboolean extended) { static const char swz[] = "xyzw01!?"; /* See SWIZZLE_x definitions */ static char s[20]; GLuint i = 0; - if (!extended && swizzle == SWIZZLE_NOOP && negateBase == 0) + if (!extended && swizzle == SWIZZLE_NOOP && negateMask == 0) return ""; /* no swizzle/negation */ if (!extended) s[i++] = '.'; - if (negateBase & NEGATE_X) + if (negateMask & NEGATE_X) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 0)]; @@ -345,7 +345,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & NEGATE_Y) + if (negateMask & NEGATE_Y) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 1)]; @@ -353,7 +353,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & NEGATE_Z) + if (negateMask & NEGATE_Z) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 2)]; @@ -361,7 +361,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & NEGATE_W) + if (negateMask & NEGATE_W) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 3)]; @@ -465,14 +465,14 @@ fprint_src_reg(FILE *f, reg_string((gl_register_file) srcReg->File, srcReg->Index, mode, srcReg->RelAddr, prog), _mesa_swizzle_string(srcReg->Swizzle, - srcReg->NegateBase, GL_FALSE), + srcReg->Negate, GL_FALSE), abs); #if 0 _mesa_fprintf(f, "%s[%d]%s", file_string((gl_register_file) srcReg->File, mode), srcReg->Index, _mesa_swizzle_string(srcReg->Swizzle, - srcReg->NegateBase, GL_FALSE)); + srcReg->Negate, GL_FALSE)); #endif } @@ -566,7 +566,7 @@ _mesa_fprint_instruction_opt(FILE *f, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].NegateBase, GL_FALSE)); + inst->SrcReg[0].Negate, GL_FALSE)); } if (inst->Comment) _mesa_fprintf(f, " # %s", inst->Comment); @@ -583,7 +583,7 @@ _mesa_fprint_instruction_opt(FILE *f, mode), inst->SrcReg[0].Index, _mesa_swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].NegateBase, GL_TRUE)); + inst->SrcReg[0].Negate, GL_TRUE)); fprint_comment(f, inst); break; case OPCODE_TEX: diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index e283f8933b..ecd98dc85c 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -241,7 +241,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].NegateBase = NEGATE_XYZW; + inst->SrcReg[0].Negate = NEGATE_XYZW; inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SaturateMode = SATURATE_ZERO_ONE; inst++; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 8493c490fb..3f455e0640 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1135,7 +1135,7 @@ emit_negation(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, NULL, NULL); - inst->SrcReg[0].NegateBase = NEGATE_XYZW; + inst->SrcReg[0].Negate = NEGATE_XYZW; return inst; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 3b2ad00f5c..fa4f4082a7 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -147,7 +147,7 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) p->Instructions[ic].SrcReg[0].Swizzle = SWIZZLE_XXXX; p->Instructions[ic].SrcReg[0].Index = 0; - p->Instructions[ic].SrcReg[0].NegateBase = NEGATE_XYZW; + p->Instructions[ic].SrcReg[0].Negate = NEGATE_XYZW; ic++; /* END; */ diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index ffa607dd87..43c9afccc3 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -275,8 +275,8 @@ compile_instruction( /* swizzle (ext swizzle also depends on negation) */ { GLuint swz[4]; - GLboolean extended = (inst->SrcReg[i].NegateBase != NEGATE_NONE && - inst->SrcReg[i].NegateBase != NEGATE_XYZW); + GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE && + inst->SrcReg[i].Negate != NEGATE_XYZW); for( j = 0; j < 4; j++ ) { swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j ); if (swz[j] > SWIZZLE_W) @@ -296,20 +296,20 @@ compile_instruction( } } - if( inst->SrcReg[i].NegateBase == NEGATE_XYZW ) { + if( inst->SrcReg[i].Negate == NEGATE_XYZW ) { fullsrc->SrcRegister.Negate = 1; } - else if( inst->SrcReg[i].NegateBase != NEGATE_NONE ) { - if( inst->SrcReg[i].NegateBase & NEGATE_X ) { + else if( inst->SrcReg[i].Negate != NEGATE_NONE ) { + if( inst->SrcReg[i].Negate & NEGATE_X ) { fullsrc->SrcRegisterExtSwz.NegateX = 1; } - if( inst->SrcReg[i].NegateBase & NEGATE_Y ) { + if( inst->SrcReg[i].Negate & NEGATE_Y ) { fullsrc->SrcRegisterExtSwz.NegateY = 1; } - if( inst->SrcReg[i].NegateBase & NEGATE_Z ) { + if( inst->SrcReg[i].Negate & NEGATE_Z ) { fullsrc->SrcRegisterExtSwz.NegateZ = 1; } - if( inst->SrcReg[i].NegateBase & NEGATE_W ) { + if( inst->SrcReg[i].Negate & NEGATE_W ) { fullsrc->SrcRegisterExtSwz.NegateW = 1; } } @@ -318,10 +318,6 @@ compile_instruction( fullsrc->SrcRegisterExtMod.Absolute = 1; } - if( inst->SrcReg[i].NegateAbs ) { - fullsrc->SrcRegisterExtMod.Negate = 1; - } - if( inst->SrcReg[i].RelAddr ) { fullsrc->SrcRegister.Indirect = 1; -- cgit v1.2.3 From 05471828dc8dd4a184d4467b66e9c08449d1d4c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 08:01:01 -0600 Subject: glx: added null pointer check in glXGetFBConfigs() Fixes segfault seen with glxinfo with NVIDIA OpenGL. --- src/glx/x11/glxcmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index e5c0db4c96..b9e0706d31 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1702,7 +1702,8 @@ PUBLIC GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) int i; *nelements = 0; - if ( (priv->screenConfigs != NULL) + if ( priv + && (priv->screenConfigs != NULL) && (screen >= 0) && (screen <= ScreenCount(dpy)) && (priv->screenConfigs[screen].configs != NULL) && (priv->screenConfigs[screen].configs->fbconfigID != GLX_DONT_CARE) ) { -- cgit v1.2.3 From af9d202b26f75555b653dbe1c2ebaf6a2cf14d28 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 15 Apr 2009 20:07:48 +0100 Subject: mesa: TGSI translation of multiple render targets. --- src/mesa/state_tracker/st_program.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6348e83d8a..2795570cf1 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -484,14 +484,14 @@ st_translate_fragment_program(struct st_context *st, /* handled above */ assert(0); break; - case FRAG_RESULT_COLOR: + default: + assert(attr == FRAG_RESULT_COLOR || + (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; fs_output_semantic_index[fs_num_outputs] = numColors; outputMapping[attr] = fs_num_outputs; numColors++; break; - default: - assert(0); } output_flags[fs_num_outputs] = stfp->Base.Base.OutputFlags[attr]; -- cgit v1.2.3 From 8bc3a6eb1918710eadecb9b8d28a4afa2150a257 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Apr 2009 11:03:03 -0700 Subject: intel: Fix segfault when doing SW mipmap generation with a PBO texture upload. Triggered in test-fbo from clutter since 37fb2d9b23eab5dbbb43a212c3475cb8016837d8. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 71561cf85c..c81f230984 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -316,7 +316,7 @@ intelTexImage(GLcontext * ctx, GLint postConvHeight = height; GLint texelBytes, sizeInBytes; GLuint dstRowStride, srcRowStride = texImage->RowStride; - + GLboolean needs_map; DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); @@ -482,8 +482,15 @@ intelTexImage(GLcontext * ctx, LOCK_HARDWARE(intel); + /* Two cases where we need a mapping of the miptree: when the user supplied + * data is mapped as well (non-PBO, memcpy upload) or when we're going to do + * (software) mipmap generation. + */ + needs_map = (pixels != NULL) || (level == texObj->BaseLevel && + texObj->GenerateMipmap); + if (intelImage->mt) { - if (pixels) + if (needs_map) texImage->Data = intel_miptree_image_map(intel, intelImage->mt, intelImage->face, @@ -549,7 +556,7 @@ intelTexImage(GLcontext * ctx, _mesa_unmap_teximage_pbo(ctx, unpack); if (intelImage->mt) { - if (pixels) + if (needs_map) intel_miptree_image_unmap(intel, intelImage->mt); texImage->Data = NULL; } -- cgit v1.2.3 From c710430f3ac05c0c6a528bb7b4f82383a26103d1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 10 Apr 2009 16:47:14 -0700 Subject: mesa: Update texenv program when _NEW_ARRAYS is updated as well. This fixes a regression in fbotest1 on 915, where a transition from color+vertex array enabled to texcoord0+vertex array enabled wouldn't trigger program update on the second _mesa_update_state of DrawArrays, and we'd sample a constant texcoord of 0,0,0,1 instead of the array. The double state update in DrawArrays from 1680ef869625dc1fe9cf481b180382a34e0738e7 still needs fixing. --- src/mesa/main/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index cc37d63636..4f9088dd22 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -470,7 +470,8 @@ _mesa_update_state_locked( GLcontext *ctx ) /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); + prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR | + _NEW_ARRAY); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | -- cgit v1.2.3 From 0af7e9170fd7c0d906652378b9f78fe2ba9725ad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Apr 2009 18:31:28 -0700 Subject: i915: Add decode of dest buffer variables (destination format) --- src/mesa/drivers/dri/intel/intel_decode.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_decode.c b/src/mesa/drivers/dri/intel/intel_decode.c index f04638206d..a9dfe281cb 100644 --- a/src/mesa/drivers/dri/intel/intel_decode.c +++ b/src/mesa/drivers/dri/intel/intel_decode.c @@ -800,6 +800,7 @@ static int decode_3d_1d(uint32_t *data, int count, uint32_t hw_offset, int *failures, int i830) { unsigned int len, i, c, opcode, word, map, sampler, instr; + char *format; struct { uint32_t opcode; @@ -1001,6 +1002,35 @@ decode_3d_1d(uint32_t *data, int count, uint32_t hw_offset, int *failures, int i (*failures)++; } return len; + case 0x85: + len = (data[0] & 0x0000000f) + 2; + + if (len != 2) + fprintf(out, "Bad count in 3DSTATE_DEST_BUFFER_VARIABLES\n"); + if (count < 2) + BUFFER_FAIL(count, len, "3DSTATE_DEST_BUFFER_VARIABLES"); + + instr_out(data, hw_offset, 0, + "3DSTATE_DEST_BUFFER_VARIABLES\n"); + + switch ((data[1] >> 8) & 0xf) { + case 0x0: format = "g8"; break; + case 0x1: format = "x1r5g5b5"; break; + case 0x2: format = "r5g6b5"; break; + case 0x3: format = "a8r8g8b8"; break; + case 0x4: format = "ycrcb_swapy"; break; + case 0x5: format = "ycrcb_normal"; break; + case 0x6: format = "ycrcb_swapuv"; break; + case 0x7: format = "ycrcb_swapuvy"; break; + case 0x8: format = "a4r4g4b4"; break; + case 0x9: format = "a1r5g5b5"; break; + case 0xa: format = "a2r10g10b10"; break; + default: format = "BAD"; break; + } + instr_out(data, hw_offset, 1, "%s format, early Z %sabled\n", + format, + (data[1] & (1 << 31)) ? "en" : "dis"); + return len; } for (opcode = 0; opcode < sizeof(opcodes_3d_1d) / sizeof(opcodes_3d_1d[0]); -- cgit v1.2.3 From bbae8791d148d275632dfc8e105aa2df52820468 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Apr 2009 18:31:59 -0700 Subject: i915: Use DEBUG_WM (like 965) for printing the fragment program out. This is nice when paired with INTEL_DEBUG=batch for debugging what's going out to the hardware. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 52f09a4b1b..0cf4707565 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -323,7 +323,8 @@ upload_program(struct i915_fragment_program *p) p->ctx->FragmentProgram._Current; const struct prog_instruction *inst = program->Base.Instructions; -/* _mesa_debug_fp_inst(program->Base.NumInstructions, inst); */ + if (INTEL_DEBUG & DEBUG_WM) + _mesa_print_program(&program->Base); /* Is this a parse-failed program? Ensure a valid program is * loaded, as the flagging of an error isn't sufficient to stop @@ -1049,9 +1050,6 @@ i915ProgramStringNotify(GLcontext * ctx, _mesa_append_fog_code(ctx, &p->FragProg); p->FragProg.FogOption = GL_NONE; } - - if (INTEL_DEBUG & DEBUG_STATE) - _mesa_print_program(prog); } _tnl_program_string(ctx, target, prog); -- cgit v1.2.3 From 43257c14700fd5a62d6180ac6e493bf515d281a0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 14 Apr 2009 16:31:26 -0700 Subject: i965: Clean up output of WM SS state dump, and add format output. --- src/mesa/drivers/dri/i965/brw_state_dump.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index 5d332d010c..a713262269 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -84,6 +84,19 @@ get_965_surfacetype(unsigned int surfacetype) } } +static const char * +get_965_surface_format(unsigned int surface_format) +{ + switch (surface_format) { + case 0x000: return "r32g32b32a32_float"; + case 0x0c1: return "b8g8r8a8_unorm"; + case 0x100: return "b5g6r5_unorm"; + case 0x102: return "b5g5r5a1_unorm"; + case 0x104: return "b4g4r4a4_unorm"; + default: return "unknown"; + } +} + static void dump_wm_surface_state(struct brw_context *brw) { int i; @@ -95,7 +108,7 @@ static void dump_wm_surface_state(struct brw_context *brw) char name[20]; if (surf_bo == NULL) { - fprintf(stderr, "WM SS%d: NULL\n", i); + fprintf(stderr, " WM SS%d: NULL\n", i); continue; } dri_bo_map(surf_bo, GL_FALSE); @@ -103,8 +116,9 @@ static void dump_wm_surface_state(struct brw_context *brw) surf = (struct brw_surface_state *)(surf_bo->virtual); sprintf(name, "WM SS%d", i); - state_out(name, surf, surfoff, 0, "%s\n", - get_965_surfacetype(surf->ss0.surface_type)); + state_out(name, surf, surfoff, 0, "%s %s\n", + get_965_surfacetype(surf->ss0.surface_type), + get_965_surface_format(surf->ss0.surface_format)); state_out(name, surf, surfoff, 1, "offset\n"); state_out(name, surf, surfoff, 2, "%dx%d size, %d mips\n", surf->ss2.width + 1, surf->ss2.height + 1, surf->ss2.mip_count); -- cgit v1.2.3 From ada7ced1890c7d657f14a9af2caa72bad3af879f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 15 Apr 2009 13:23:25 -0700 Subject: r300-gallium: vs: Dot products. --- src/gallium/drivers/r300/r300_state_tcl.c | 33 +++++++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_state_tcl.h | 1 + 2 files changed, 34 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 47d6c6dfcd..fc865a2b63 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -117,6 +117,9 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, static uint32_t r300_vs_op(unsigned op) { switch (op) { + case TGSI_OPCODE_DP3: + case TGSI_OPCODE_DP4: + return R300_VE_DOT_PRODUCT; case TGSI_OPCODE_MUL: return R300_VE_MULTIPLY; case TGSI_OPCODE_ADD: @@ -195,6 +198,36 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2); break; + case TGSI_OPCODE_DP3: + /* Set alpha swizzle to zero for src0 and src1 */ + if (!inst->FullSrcRegisters[0].SrcRegister.Extended) { + inst->FullSrcRegisters[0].SrcRegister.Extended = TRUE; + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleX = + inst->FullSrcRegisters[0].SrcRegister.SwizzleX; + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleY = + inst->FullSrcRegisters[0].SrcRegister.SwizzleY; + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleZ = + inst->FullSrcRegisters[0].SrcRegister.SwizzleZ; + } + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleW = + TGSI_EXTSWIZZLE_ZERO; + if (!inst->FullSrcRegisters[1].SrcRegister.Extended) { + inst->FullSrcRegisters[1].SrcRegister.Extended = TRUE; + inst->FullSrcRegisters[1].SrcRegisterExtSwz.ExtSwizzleX = + inst->FullSrcRegisters[1].SrcRegister.SwizzleX; + inst->FullSrcRegisters[1].SrcRegisterExtSwz.ExtSwizzleY = + inst->FullSrcRegisters[1].SrcRegister.SwizzleY; + inst->FullSrcRegisters[1].SrcRegisterExtSwz.ExtSwizzleZ = + inst->FullSrcRegisters[1].SrcRegister.SwizzleZ; + } + inst->FullSrcRegisters[1].SrcRegisterExtSwz.ExtSwizzleW = + TGSI_EXTSWIZZLE_ZERO; + /* Fall through */ + case TGSI_OPCODE_DP4: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 2); + break; case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: inst->FullSrcRegisters[1] = r300_constant_zero; diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 3d10e248e1..de944028ba 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -32,6 +32,7 @@ /* XXX get these to r300_reg */ #define R300_PVS_DST_OPCODE(x) ((x) << 0) +# define R300_VE_DOT_PRODUCT 1 # define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 #define R300_PVS_DST_MACRO_INST (1 << 7) -- cgit v1.2.3 From a5f68b40cb4299b54d5cb400bbbf4338673d82ec Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 15 Apr 2009 13:25:20 -0700 Subject: r300-gallium: Point size is at OVM position 15, not 1. Or so sayeth osiris, and he would know. :3 --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- src/gallium/drivers/r300/r300_state_tcl.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index ce7ab6f16a..c4c9784a00 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -86,7 +86,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, break; case TGSI_SEMANTIC_PSIZE: psize = TRUE; - tab[i] = 1; + tab[i] = 15; break; case TGSI_SEMANTIC_FOG: fog = TRUE; diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index fc865a2b63..bb96e2ad67 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -40,6 +40,9 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, /* XXX multiple? */ assembler->tab[decl->DeclarationRange.First] = 6; break; + case TGSI_SEMANTIC_PSIZE: + assembler->tab[decl->DeclarationRange.First] = 15; + break; default: debug_printf("r300: vs: Bad semantic declaration %d\n", decl->Semantic.SemanticName); -- cgit v1.2.3 From a4e0a46a8d6a4f308216c085849305ad82c52f15 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 15 Apr 2009 14:12:11 -0700 Subject: r300-gallium: Don't use indexbufs for now. They aren't working, so best to turn it off. --- src/gallium/drivers/r300/r300_render.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b7ee8fb8a9..cbd84d7c56 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -234,6 +234,8 @@ static void r300_render_draw(struct vbuf_render* render, struct pipe_screen* screen = r300->context.screen; struct pipe_buffer* index_buffer; void* index_map; + int i; + uint32_t index; CS_LOCALS(r300); @@ -252,14 +254,24 @@ static void r300_render_draw(struct vbuf_render* render, pipe_buffer_unmap(screen, index_buffer); debug_printf("r300: Doing indexbuf render, count %d\n", count); - - BEGIN_CS(6); +/* + BEGIN_CS(8); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | r300render->hwprim); OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2)); OUT_CS_INDEX_RELOC(index_buffer, 0, count, RADEON_GEM_DOMAIN_GTT, 0, 0); + END_CS; */ + + BEGIN_CS(2 + count); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, count); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | + r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); + for (i = 0; i < count; i++) { + index = indices[i]; + OUT_CS(index); + } END_CS; } -- cgit v1.2.3 From 1a84072db9fb8faf39bd155c3bf249dcc99130d8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 15 Apr 2009 15:09:43 -0700 Subject: r300-gallium: Use viewport state. --- src/gallium/drivers/r300/r300_state.c | 42 ++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 2a77fd1739..c9507ae193 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -555,25 +555,41 @@ static void r300_set_viewport_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - r300->viewport_state->xscale = state->scale[0]; - r300->viewport_state->yscale = state->scale[1]; - r300->viewport_state->zscale = state->scale[2]; - - r300->viewport_state->xoffset = state->translate[0]; - r300->viewport_state->yoffset = state->translate[1]; - r300->viewport_state->zoffset = state->translate[2]; - - r300->viewport_state->vte_control = 0; if (r300_screen(r300->context.screen)->caps->has_tcl) { /* Do the transform in HW. */ - r300->viewport_state->vte_control |= - R300_VPORT_X_SCALE_ENA | R300_VPORT_X_OFFSET_ENA | - R300_VPORT_Y_SCALE_ENA | R300_VPORT_Y_OFFSET_ENA | - R300_VPORT_Z_SCALE_ENA | R300_VPORT_Z_OFFSET_ENA; + r300->viewport_state->vte_control = R300_VTX_W0_FMT; + + if (state->scale[0] != 1.0f) { + r300->viewport_state->xscale = state->scale[0]; + r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA; + } + if (state->scale[1] != 1.0f) { + r300->viewport_state->yscale = state->scale[1]; + r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA; + } + if (state->scale[2] != 1.0f) { + r300->viewport_state->zscale = state->scale[2]; + r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA; + } + if (state->translate[0] != 0.0f) { + r300->viewport_state->xoffset = state->translate[0]; + r300->viewport_state->vte_control |= R300_VPORT_X_OFFSET_ENA; + } + if (state->translate[1] != 0.0f) { + r300->viewport_state->yoffset = state->translate[1]; + r300->viewport_state->vte_control |= R300_VPORT_Y_OFFSET_ENA; + } + if (state->translate[2] != 0.0f) { + r300->viewport_state->zoffset = state->translate[2]; + r300->viewport_state->vte_control |= R300_VPORT_Z_OFFSET_ENA; + } } else { + r300->viewport_state->vte_control = 0; /* Have Draw do the actual transform. */ draw_set_viewport_state(r300->draw, state); } + + r300->dirty_state |= R300_NEW_VIEWPORT; } static void r300_set_vertex_buffers(struct pipe_context* pipe, -- cgit v1.2.3 From f94053eb7d3f129e5086f6dc431a13f83c93a189 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 19:55:00 -0600 Subject: tests: another extended swizzle test --- progs/fp/swz3.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 progs/fp/swz3.txt diff --git a/progs/fp/swz3.txt b/progs/fp/swz3.txt new file mode 100644 index 0000000000..382f5880d3 --- /dev/null +++ b/progs/fp/swz3.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0, R1; +MOV R0, -fragment.color; +SWZ result.color, R0, -y, -x, z, 1; +END -- cgit v1.2.3 From 9b75627fab5bf2ea90f27ddd31b60c54895f6de6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 15 Apr 2009 15:53:34 +0200 Subject: gallium: Make sure we flush before some texture / buffer operations. Also implement context member functions to optimize away those flushes whenever possible. Signed-off-by: Thomas Hellstrom --- src/gallium/drivers/cell/ppu/cell_context.c | 25 +++++++++++++++ src/gallium/drivers/failover/fo_context.c | 23 ++++++++++++++ src/gallium/drivers/i915simple/i915_context.c | 26 ++++++++++++++++ src/gallium/drivers/i965simple/brw_context.c | 25 +++++++++++++++ src/gallium/drivers/nv04/nv04_context.c | 27 ++++++++++++++++ src/gallium/drivers/nv10/nv10_context.c | 26 ++++++++++++++++ src/gallium/drivers/nv20/nv20_context.c | 27 ++++++++++++++++ src/gallium/drivers/nv30/nv30_context.c | 26 ++++++++++++++++ src/gallium/drivers/nv40/nv40_context.c | 26 ++++++++++++++++ src/gallium/drivers/nv50/nv50_context.c | 26 ++++++++++++++++ src/gallium/drivers/softpipe/sp_context.c | 18 +++++++++++ src/gallium/drivers/trace/tr_context.c | 44 +++++++++++++++++++++++++++ src/gallium/include/pipe/p_context.h | 29 +++++++++++++++++- src/gallium/include/pipe/p_defines.h | 7 +++++ src/mesa/state_tracker/st_cb_accum.c | 36 +++++++++++++++++++--- src/mesa/state_tracker/st_cb_bufferobjects.c | 16 +++++++++- src/mesa/state_tracker/st_cb_drawpixels.c | 8 +++-- src/mesa/state_tracker/st_cb_readpixels.c | 10 +++++- src/mesa/state_tracker/st_cb_texture.c | 17 +++++++++++ src/mesa/state_tracker/st_gen_mipmap.c | 7 +++++ src/mesa/state_tracker/st_texture.c | 22 +++++++++++++- src/mesa/state_tracker/st_texture.h | 7 ++++- 22 files changed, 466 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index 808be589bd..ebb7a7acc4 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -99,6 +99,28 @@ static const struct debug_named_value cell_debug_flags[] = { {NULL, 0} }; +static unsigned int +cell_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +cell_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} struct pipe_context * cell_create_context(struct pipe_screen *screen, @@ -122,6 +144,9 @@ cell_create_context(struct pipe_screen *screen, cell->pipe.clear = cell_clear; cell->pipe.flush = cell_flush; + cell->pipe.is_texture_referenced = cell_is_texture_referenced; + cell->pipe.is_buffer_referenced = cell_is_buffer_referenced; + #if 0 cell->pipe.begin_query = cell_begin_query; cell->pipe.end_query = cell_end_query; diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c index fcad717cf8..37184eac7b 100644 --- a/src/gallium/drivers/failover/fo_context.c +++ b/src/gallium/drivers/failover/fo_context.c @@ -105,7 +105,28 @@ static boolean failover_draw_arrays( struct pipe_context *pipe, return failover_draw_elements(pipe, NULL, 0, prim, start, count); } +static unsigned int +failover_is_texture_referenced( struct pipe_context *_pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + struct failover_context *failover = failover_context( _pipe ); + struct pipe_context *pipe = (failover->mode == FO_HW) ? + failover->hw : failover->sw; + + return pipe->is_texture_referenced(pipe, texture, face, level); +} +static unsigned int +failover_is_buffer_referenced( struct pipe_context *_pipe, + struct pipe_buffer *buf) +{ + struct failover_context *failover = failover_context( _pipe ); + struct pipe_context *pipe = (failover->mode == FO_HW) ? + failover->hw : failover->sw; + + return pipe->is_buffer_referenced(pipe, buf); +} struct pipe_context *failover_create( struct pipe_context *hw, struct pipe_context *sw ) @@ -151,6 +172,8 @@ struct pipe_context *failover_create( struct pipe_context *hw, #endif failover->pipe.flush = hw->flush; + failover->pipe.is_texture_referenced = failover_is_texture_referenced; + failover->pipe.is_buffer_referenced = failover_is_buffer_referenced; failover->dirty = 0; diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c index 3e3a596884..ccf9bb31fb 100644 --- a/src/gallium/drivers/i915simple/i915_context.c +++ b/src/gallium/drivers/i915simple/i915_context.c @@ -136,6 +136,29 @@ static boolean i915_draw_arrays( struct pipe_context *pipe, } +static unsigned int +i915_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +i915_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context *i915_create_context( struct pipe_screen *screen, struct pipe_winsys *pipe_winsys, @@ -160,6 +183,9 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen, i915->pipe.draw_elements = i915_draw_elements; i915->pipe.draw_range_elements = i915_draw_range_elements; + i915->pipe.is_texture_referenced = i915_is_texture_referenced; + i915->pipe.is_buffer_referenced = i915_is_buffer_referenced; + /* * Create drawing context and plug our rendering stage into it. */ diff --git a/src/gallium/drivers/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c index c74cbf8d73..9b33285bc7 100644 --- a/src/gallium/drivers/i965simple/brw_context.c +++ b/src/gallium/drivers/i965simple/brw_context.c @@ -73,6 +73,28 @@ static void brw_clear(struct pipe_context *pipe, struct pipe_surface *ps, pipe->surface_fill(pipe, ps, x, y, w, h, clearValue); } +static unsigned int +brw_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +brw_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} struct pipe_context *brw_create(struct pipe_screen *screen, struct brw_winsys *brw_winsys, @@ -94,6 +116,9 @@ struct pipe_context *brw_create(struct pipe_screen *screen, brw->pipe.destroy = brw_destroy; brw->pipe.clear = brw_clear; + brw->pipe.is_texture_referenced = brw_is_texture_referenced; + brw->pipe.is_buffer_referenced = brw_is_buffer_referenced; + brw_init_surface_functions(brw); brw_init_texture_functions(brw); brw_init_state_functions(brw); diff --git a/src/gallium/drivers/nv04/nv04_context.c b/src/gallium/drivers/nv04/nv04_context.c index d6710cd892..17166c9f51 100644 --- a/src/gallium/drivers/nv04/nv04_context.c +++ b/src/gallium/drivers/nv04/nv04_context.c @@ -64,6 +64,30 @@ nv04_init_hwctx(struct nv04_context *nv04) return TRUE; } +static unsigned int +nv04_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv04_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + + struct pipe_context * nv04_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -89,6 +113,9 @@ nv04_create(struct pipe_screen *pscreen, unsigned pctx_id) nv04->pipe.clear = nv04_clear; nv04->pipe.flush = nv04_flush; + nv04->pipe.is_texture_referenced = nv04_is_texture_referenced; + nv04->pipe.is_buffer_referenced = nv04_is_buffer_referenced; + nv04_init_surface_functions(nv04); nv04_init_state_functions(nv04); diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c index ef2c0c5d9f..3da8d2f568 100644 --- a/src/gallium/drivers/nv10/nv10_context.c +++ b/src/gallium/drivers/nv10/nv10_context.c @@ -257,6 +257,29 @@ nv10_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } +static unsigned int +nv10_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv10_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context * nv10_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -282,6 +305,9 @@ nv10_create(struct pipe_screen *pscreen, unsigned pctx_id) nv10->pipe.clear = nv10_clear; nv10->pipe.flush = nv10_flush; + nv10->pipe.is_texture_referenced = nv10_is_texture_referenced; + nv10->pipe.is_buffer_referenced = nv10_is_buffer_referenced; + nv10_init_surface_functions(nv10); nv10_init_state_functions(nv10); diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c index 1659aec8fa..cbc41707d5 100644 --- a/src/gallium/drivers/nv20/nv20_context.c +++ b/src/gallium/drivers/nv20/nv20_context.c @@ -380,6 +380,30 @@ nv20_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } + +static unsigned int +nv20_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv20_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context * nv20_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -405,6 +429,9 @@ nv20_create(struct pipe_screen *pscreen, unsigned pctx_id) nv20->pipe.clear = nv20_clear; nv20->pipe.flush = nv20_flush; + nv20->pipe.is_texture_referenced = nv20_is_texture_referenced; + nv20->pipe.is_buffer_referenced = nv20_is_buffer_referenced; + nv20_init_surface_functions(nv20); nv20_init_state_functions(nv20); diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index 61654f8756..f827bdc78b 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -31,6 +31,29 @@ nv30_destroy(struct pipe_context *pipe) FREE(nv30); } +static unsigned int +nv30_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv30_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context * nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -55,6 +78,9 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) nv30->pipe.clear = nv30_clear; nv30->pipe.flush = nv30_flush; + nv30->pipe.is_texture_referenced = nv30_is_texture_referenced; + nv30->pipe.is_buffer_referenced = nv30_is_buffer_referenced; + nv30_init_query_functions(nv30); nv30_init_surface_functions(nv30); nv30_init_state_functions(nv30); diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index 5d325f5067..8eba6a43ef 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -31,6 +31,29 @@ nv40_destroy(struct pipe_context *pipe) FREE(nv40); } +static unsigned int +nv40_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv40_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context * nv40_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -55,6 +78,9 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id) nv40->pipe.clear = nv40_clear; nv40->pipe.flush = nv40_flush; + nv40->pipe.is_texture_referenced = nv40_is_texture_referenced; + nv40->pipe.is_buffer_referenced = nv40_is_buffer_referenced; + nv40_init_query_functions(nv40); nv40_init_surface_functions(nv40); nv40_init_state_functions(nv40); diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 565a5da668..a511f655c1 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -51,6 +51,29 @@ nv50_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } +static unsigned int +nv50_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +nv50_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context * nv50_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -76,6 +99,9 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id) nv50->pipe.flush = nv50_flush; + nv50->pipe.is_texture_referenced = nv50_is_texture_referenced; + nv50->pipe.is_buffer_referenced = nv50_is_buffer_referenced; + nv50_init_surface_functions(nv50); nv50_init_state_functions(nv50); nv50_init_query_functions(nv50); diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 06ace27d14..6ae4d1ad7b 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -121,6 +121,21 @@ static void softpipe_destroy( struct pipe_context *pipe ) FREE( softpipe ); } +static unsigned int +softpipe_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level, + unsigned zslice) +{ + return PIPE_UNREFERENCED; +} + +static unsigned int +softpipe_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + return PIPE_UNREFERENCED; +} struct pipe_context * softpipe_create( struct pipe_screen *screen, @@ -190,6 +205,9 @@ softpipe_create( struct pipe_screen *screen, softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush; + softpipe->pipe.is_texture_referenced = softpipe_is_texture_referenced; + softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced; + softpipe_init_query_funcs( softpipe ); softpipe_init_texture_funcs( softpipe ); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index d8d5821a1d..556b5e003f 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1030,6 +1030,48 @@ trace_context_destroy(struct pipe_context *_pipe) FREE(tr_ctx); } +static unsigned int +trace_is_texture_referenced( struct pipe_context *_pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct pipe_context *pipe = tr_ctx->pipe; + unsigned int referenced; + + trace_dump_call_begin("pipe_context", "is_texture_referenced"); + trace_dump_arg(ptr, pipe); + trace_dump_arg(ptr, texture); + trace_dump_arg(uint, face); + trace_dump_arg(uint, level); + + referenced = pipe->is_texture_referenced(pipe, texture, face, level); + + trace_dump_ret(uint, referenced); + trace_dump_call_end(); + + return referenced; +} + +static unsigned int +trace_is_buffer_referenced( struct pipe_context *_pipe, + struct pipe_buffer *buf) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct pipe_context *pipe = tr_ctx->pipe; + unsigned int referenced; + + trace_dump_call_begin("pipe_context", "is_buffer_referenced"); + trace_dump_arg(ptr, pipe); + trace_dump_arg(ptr, buf); + + referenced = pipe->is_buffer_referenced(pipe, buf); + + trace_dump_ret(uint, referenced); + trace_dump_call_end(); + + return referenced; +} struct pipe_context * trace_context_create(struct pipe_screen *_screen, @@ -1096,6 +1138,8 @@ trace_context_create(struct pipe_screen *_screen, tr_ctx->base.surface_fill = trace_context_surface_fill; tr_ctx->base.clear = trace_context_clear; tr_ctx->base.flush = trace_context_flush; + tr_ctx->base.is_texture_referenced = trace_is_texture_referenced; + tr_ctx->base.is_buffer_referenced = trace_is_buffer_referenced; tr_ctx->pipe = pipe; diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index c5c839799e..57e966ac3b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -42,7 +42,6 @@ struct pipe_state_cache; struct pipe_query; struct pipe_winsys; - /** * Gallium rendering context. Basically: * - state setting functions @@ -231,6 +230,34 @@ struct pipe_context { void (*flush)( struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence ); + + /** + * Check whether a texture is referenced by an unflushed hw command. + * The state-tracker uses this function to optimize away unnecessary + * flushes. It is safe (but wasteful) to always return. + * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. + * \param pipe The pipe context whose unflushed hw commands will be + * checked. + * \param level mipmap level. + * \param texture texture to check. + * \param face cubemap face. Use 0 for non-cubemap texture. + */ + + unsigned int (*is_texture_referenced) (struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level); + /** + * Check whether a buffer is referenced by an unflushed hw command. + * The state-tracker uses this function to optimize away unnecessary + * flushes. It is safe (but wasteful) to always return + * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. + * \param pipe The pipe context whose unflushed hw commands will be + * checked. + * \param buf Buffer to check. + */ + + unsigned int (*is_buffer_referenced) (struct pipe_context *pipe, + struct pipe_buffer *buf); }; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 1d2aa10949..82e23c413c 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -312,6 +312,13 @@ enum pipe_transfer_usage { #define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26 +/** + * Referenced query flags. + */ + +#define PIPE_UNREFERENCED 0 +#define PIPE_REFERENCED_FOR_READ (1 << 0) +#define PIPE_REFERENCED_FOR_WRITE (1 << 1) #ifdef __cplusplus } diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 3f9a825a15..1510a1e236 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -40,6 +40,7 @@ #include "st_draw.h" #include "st_public.h" #include "st_format.h" +#include "st_texture.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" @@ -118,6 +119,9 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) const GLint height = ctx->DrawBuffer->_Ymax - ypos; GLubyte *map; + st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, + PIPE_TRANSFER_WRITE); + acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, PIPE_TRANSFER_WRITE, xpos, ypos, width, height); @@ -163,6 +167,9 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, struct pipe_transfer *acc_pt; GLubyte *map; + st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, + PIPE_TRANSFER_READ_WRITE); + acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ_WRITE, xpos, ypos, width, height); @@ -192,20 +199,27 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, static void -accum_accum(struct pipe_context *pipe, GLfloat value, +accum_accum(struct st_context *st, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb, struct st_renderbuffer *color_strb) { + struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_transfer *acc_trans, *color_trans; GLfloat *colorBuf, *accBuf; GLint i; + st_teximage_flush_before_map(st, acc_strb->texture, 0, 0, + PIPE_TRANSFER_READ); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, width, height); + st_teximage_flush_before_map(st, color_strb->texture, 0, 0, + PIPE_TRANSFER_READ); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, width, height); @@ -235,20 +249,27 @@ accum_accum(struct pipe_context *pipe, GLfloat value, static void -accum_load(struct pipe_context *pipe, GLfloat value, +accum_load(struct st_context *st, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb, struct st_renderbuffer *color_strb) { + struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_transfer *acc_trans, *color_trans; GLfloat *buf; GLint i; + st_teximage_flush_before_map(st, acc_strb->texture, 0, 0, + PIPE_TRANSFER_WRITE); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, PIPE_TRANSFER_WRITE, xpos, ypos, width, height); + st_teximage_flush_before_map(st, color_strb->texture, 0, 0, + PIPE_TRANSFER_READ); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, width, height); @@ -284,10 +305,16 @@ accum_return(GLcontext *ctx, GLfloat value, abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, + PIPE_TRANSFER_READ); + acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, width, height); + st_teximage_flush_before_map(ctx->st, color_strb->texture, 0, 0, + PIPE_TRANSFER_READ_WRITE); + color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ_WRITE, xpos, ypos, width, height); @@ -325,7 +352,6 @@ static void st_Accum(GLcontext *ctx, GLenum op, GLfloat value) { struct st_context *st = ctx->st; - struct pipe_context *pipe = st->pipe; struct st_renderbuffer *acc_strb = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer); struct st_renderbuffer *color_strb @@ -352,11 +378,11 @@ st_Accum(GLcontext *ctx, GLenum op, GLfloat value) break; case GL_ACCUM: if (value != 0.0F) { - accum_accum(pipe, value, xpos, ypos, width, height, acc_strb, color_strb); + accum_accum(st, value, xpos, ypos, width, height, acc_strb, color_strb); } break; case GL_LOAD: - accum_load(pipe, value, xpos, ypos, width, height, acc_strb, color_strb); + accum_load(st, value, xpos, ypos, width, height, acc_strb, color_strb); break; case GL_RETURN: accum_return(ctx, value, xpos, ypos, width, height, acc_strb, color_strb); diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 3651e4ae7d..fdb800fbd0 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -32,6 +32,7 @@ #include "st_context.h" #include "st_cb_bufferobjects.h" +#include "st_public.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -103,6 +104,9 @@ st_bufferobj_subdata(GLcontext *ctx, if (offset >= st_obj->size || size > (st_obj->size - offset)) return; + if (pipe->is_buffer_referenced(pipe, st_obj->buffer)) + st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); + pipe_buffer_write(pipe->screen, st_obj->buffer, offset, size, data); } @@ -123,6 +127,10 @@ st_bufferobj_get_subdata(GLcontext *ctx, if (offset >= st_obj->size || size > (st_obj->size - offset)) return; + if (pipe->is_buffer_referenced(pipe, st_obj->buffer) & + PIPE_REFERENCED_FOR_WRITE) + st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); + pipe_buffer_read(pipe->screen, st_obj->buffer, offset, size, data); } @@ -171,7 +179,7 @@ st_bufferobj_data(GLcontext *ctx, st_obj->size = size; if (data) - st_bufferobj_subdata(ctx, target, 0, size, data, obj); + pipe_buffer_write(pipe->screen, st_obj->buffer, 0, size, data); } @@ -185,6 +193,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); GLuint flags; + unsigned referenced; switch (access) { case GL_WRITE_ONLY: @@ -200,6 +209,11 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, break; } + referenced = pipe->is_buffer_referenced(pipe, st_obj->buffer); + if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || + (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) + st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); + obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags); if(obj->Pointer) { obj->Offset = 0; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 0a4430501f..c67b026413 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -631,8 +631,6 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, GLint skipPixels; ubyte *stmap; - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - strb = st_renderbuffer(ctx->DrawBuffer-> Attachment[BUFFER_STENCIL].Renderbuffer); @@ -640,6 +638,9 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, y = ctx->DrawBuffer->Height - y - height; } + st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, + PIPE_TRANSFER_WRITE); + pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, PIPE_TRANSFER_WRITE, x, y, width, height); @@ -825,6 +826,9 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &ctx->DefaultPacking, buffer); + st_teximage_flush_before_map(ctx->st, rbDraw->texture, 0, 0, + PIPE_TRANSFER_WRITE); + ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0, PIPE_TRANSFER_WRITE, dstx, dsty, width, height); diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 9ce5f3fe84..519ad6660f 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -42,13 +42,14 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "util/u_tile.h" + #include "st_context.h" #include "st_cb_bitmap.h" #include "st_cb_readpixels.h" #include "st_cb_fbo.h" #include "st_format.h" #include "st_public.h" - +#include "st_texture.h" /** * Special case for reading stencil buffer. @@ -73,6 +74,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } /* Create a read transfer from the renderbuffer's texture */ + + st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, + PIPE_TRANSFER_READ); + pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, x, y, width, height); @@ -240,6 +245,9 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, y = strb->texture->height[0] - y - height; } + st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, + PIPE_TRANSFER_READ); + trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, x, y, width, height); if (!trans) { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 1f14b3705d..727432d7de 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -700,6 +700,10 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, /* Image is stored in hardware format in a buffer managed by the * kernel. Need to explicitly map and unmap it. */ + + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level, + PIPE_TRANSFER_READ); + texImage->Data = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_READ, 0, 0, stImage->base.Width, @@ -808,6 +812,8 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, * from uploading the buffer under us. */ if (stImage->pt) { + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level, + PIPE_TRANSFER_WRITE); texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset, PIPE_TRANSFER_WRITE, xoffset, yoffset, @@ -932,6 +938,9 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcY = strb->Base.Height - srcY - height; } + st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, + PIPE_TRANSFER_READ); + src_trans = screen->get_tex_transfer( screen, strb->texture, 0, 0, 0, @@ -939,6 +948,9 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcX, srcY, width, height); + st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0, + PIPE_TRANSFER_WRITE); + texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE, destX, destY, width, height); @@ -1318,6 +1330,11 @@ copy_image_data_to_texture(struct st_context *st, /* More straightforward upload. */ + + st_teximage_flush_before_map(st, stObj->pt, stImage->face, dstLevel, + PIPE_TRANSFER_WRITE); + + st_texture_image_data(st->pipe, stObj->pt, stImage->face, diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 9cc2176d5e..6e9aa5245e 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -123,10 +123,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, const ubyte *srcData; ubyte *dstData; + st_teximage_flush_before_map(ctx->st, pt, face, srcLevel, + PIPE_TRANSFER_READ); + srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, pt->width[srcLevel], pt->height[srcLevel]); + + st_teximage_flush_before_map(ctx->st, pt, face, dstLevel, + PIPE_TRANSFER_WRITE); + dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, pt->width[dstLevel], diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 19eb7e2f69..fcbaeb6989 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -188,8 +188,10 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, GLuint zoffset, enum pipe_transfer_usage usage, GLuint x, GLuint y, GLuint w, GLuint h) { - struct pipe_screen *screen = st->pipe->screen; + struct pipe_context *pipe = st->pipe; + struct pipe_screen *screen = pipe->screen; struct pipe_texture *pt = stImage->pt; + DBG("%s \n", __FUNCTION__); stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face, @@ -265,6 +267,7 @@ st_texture_image_data(struct pipe_context *pipe, struct pipe_transfer *dst_transfer; DBG("%s\n", __FUNCTION__); + for (i = 0; i < depth; i++) { dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i, PIPE_TRANSFER_WRITE, 0, 0, @@ -481,3 +484,20 @@ st_release_teximage(struct st_framebuffer *stfb, uint surfIndex, return 1; } + +void +st_teximage_flush_before_map(struct st_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + enum pipe_transfer_usage usage) +{ + struct pipe_context *pipe = st->pipe; + unsigned referenced = + pipe->is_texture_referenced(pipe, pt, face, level); + + if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || + usage == PIPE_TRANSFER_WRITE || + usage == PIPE_TRANSFER_READ_WRITE)) + st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); +} diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 60c000115e..a392e3d57c 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -170,5 +170,10 @@ st_texture_image_copy(struct pipe_context *pipe, struct pipe_texture *src, GLuint face); - +extern void +st_teximage_flush_before_map(struct st_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + enum pipe_transfer_usage usage); #endif -- cgit v1.2.3 From b83cf05d0d986f324fe9c93525c84eb62fed4f20 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 15 Apr 2009 17:22:40 +0200 Subject: r300-gallium: Fixup for commit 9b75627fab5bf2ea90f27ddd31b60c54895f6de6. Signed-off-by: Thomas Hellstrom --- src/gallium/drivers/r300/r300_context.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 31efe91417..6bdf544a05 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -102,6 +102,29 @@ static void r300_destroy_context(struct pipe_context* context) { FREE(r300); } +static unsigned int +r300_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +r300_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Optimize. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + struct pipe_context* r300_create_context(struct pipe_screen* screen, struct r300_winsys* r300_winsys) { @@ -124,6 +147,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.draw_elements = r300_draw_elements; r300->context.draw_range_elements = r300_draw_range_elements; + r300->context.is_texture_referenced = r300_is_texture_referenced; + r300->context.is_buffer_referenced = r300_is_buffer_referenced; + r300->draw = draw_create(); draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); -- cgit v1.2.3 From 49b40f9bf4aef3a32ddb88f7e8d378f08e26b081 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 09:36:03 -0600 Subject: gallium: new, simple RGBA surface create/destroy helpers Use these for quickly creating an RGBA drawing surface. --- src/gallium/auxiliary/util/Makefile | 1 + src/gallium/auxiliary/util/SConscript | 1 + src/gallium/auxiliary/util/u_surface.c | 113 +++++++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_surface.h | 52 +++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_surface.c create mode 100644 src/gallium/auxiliary/util/u_surface.h diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile index 5035e9cc13..2995aba1b9 100644 --- a/src/gallium/auxiliary/util/Makefile +++ b/src/gallium/auxiliary/util/Makefile @@ -23,6 +23,7 @@ C_SOURCES = \ u_snprintf.c \ u_stream_stdc.c \ u_stream_wd.c \ + u_surface.c \ u_tile.c \ u_time.c \ u_timed_winsys.c \ diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index 8317263bb8..d3ac7f747f 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -24,6 +24,7 @@ util = env.ConvenienceLibrary( 'u_snprintf.c', 'u_stream_stdc.c', 'u_stream_wd.c', + 'u_surface.c', 'u_tile.c', 'u_time.c', 'u_timed_winsys.c', diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c new file mode 100644 index 0000000000..8c2c227915 --- /dev/null +++ b/src/gallium/auxiliary/util/u_surface.c @@ -0,0 +1,113 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * @file + * Surface utility functions. + * + * @author Brian Paul + */ + + +#include "pipe/p_screen.h" +#include "pipe/p_state.h" +#include "pipe/p_defines.h" + +#include "util/u_surface.h" + + +/** + * Helper to quickly create an RGBA rendering surface of a certain size. + * \param textureOut returns the new texture + * \param surfaceOut returns the new surface + * \return TRUE for success, FALSE if failure + */ +boolean +util_create_rgba_surface(struct pipe_screen *screen, + uint width, uint height, + struct pipe_texture **textureOut, + struct pipe_surface **surfaceOut) +{ + static const enum pipe_format rgbaFormats[] = { + PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_FORMAT_B8G8R8A8_UNORM, + PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_NONE + }; + const uint target = PIPE_TEXTURE_2D; + const uint usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; + enum pipe_format format = PIPE_FORMAT_NONE; + struct pipe_texture templ; + uint i; + + /* Choose surface format */ + for (i = 0; rgbaFormats[i]; i++) { + if (screen->is_format_supported(screen, rgbaFormats[i], + target, usage, 0)) { + format = rgbaFormats[i]; + break; + } + } + if (format == PIPE_FORMAT_NONE) + return FALSE; /* unable to get an rgba format!?! */ + + /* create texture */ + memset(&templ, 0, sizeof(templ)); + templ.target = target; + templ.format = format; + templ.last_level = 0; + templ.width[0] = width; + templ.height[0] = height; + templ.depth[0] = 1; + pf_get_block(format, &templ.block); + templ.tex_usage = usage; + + *textureOut = screen->texture_create(screen, &templ); + if (!*textureOut) + return FALSE; + + /* create surface / view into texture */ + *surfaceOut = screen->get_tex_surface(screen, *textureOut, 0, 0, 0, usage); + if (!*surfaceOut) { + screen->texture_destroy(*textureOut); + return FALSE; + } + + return TRUE; +} + + +/** + * Release the surface and texture from util_create_rgba_surface(). + */ +void +util_destroy_rgba_surface(struct pipe_texture *texture, + struct pipe_surface *surface) +{ + pipe_surface_reference(&surface, NULL); + pipe_texture_reference(&texture, NULL); +} + diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h new file mode 100644 index 0000000000..a5b73cfc20 --- /dev/null +++ b/src/gallium/auxiliary/util/u_surface.h @@ -0,0 +1,52 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef U_SURFACE_H +#define U_SURFACE_H + + +#include "pipe/p_compiler.h" + + +struct pipe_screen; +struct pipe_texture; +struct pipe_surface; + + +extern boolean +util_create_rgba_surface(struct pipe_screen *screen, + uint width, uint height, + struct pipe_texture **textureOut, + struct pipe_surface **surfaceOut); + + +extern void +util_destroy_rgba_surface(struct pipe_texture *texture, + struct pipe_surface *surface); + + +#endif /* U_SURFACE_H */ -- cgit v1.2.3 From 51b339af2e8b80575a24bb9146f031c9605180bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 09:37:22 -0600 Subject: st: decompress_with_blit() path for glGetTexImage(). Decompress a texture by rendering a textured quad. --- src/mesa/state_tracker/st_cb_texture.c | 83 +++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index e68c3d87ee..53396c0278 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -55,6 +55,7 @@ #include "pipe/p_inlines.h" #include "util/u_tile.h" #include "util/u_blit.h" +#include "util/u_surface.h" #define DBG if (0) printf @@ -817,6 +818,72 @@ st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, } + +/** + * glGetTexImage() helper: decompress a compressed texture by rendering + * a textured quad. Store the results in the user's buffer. + * XXX unfinished business: decompress sRGB texture + */ +static void +decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid *pixels, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + struct pipe_screen *screen = ctx->st->pipe->screen; + struct st_texture_image *stImage = st_texture_image(texImage); + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + struct pipe_surface *dst_surface; + struct pipe_texture *dst_texture; + struct pipe_transfer *tex_xfer; + GLuint row; + + /* create temp / dest surface */ + if (!util_create_rgba_surface(screen, width, height, + &dst_texture, &dst_surface)) { + _mesa_problem(ctx, "util_create_rgba_surface() failed " + "in decompress_with_blit()"); + return; + } + + /* blit/render/decompress */ + util_blit_pixels_tex(ctx->st->blit, + stImage->pt, /* pipe_texture (src) */ + 0, 0, /* src x0, y0 */ + width, height, /* src x1, y1 */ + dst_surface, /* pipe_surface (dst) */ + 0, 0, /* dst x0, y0 */ + width, height, /* dst x1, y1 */ + 0.0, /* z */ + PIPE_TEX_MIPFILTER_NEAREST); + + /* map the dst_surface so we can read from it */ + tex_xfer = screen->get_tex_transfer(screen, dst_texture, 0, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, width, height); + + /* copy/pack data into user buffer */ + /* XXX: to do: look for cases where we can just memcpy() */ + for (row = 0; row < height; row++) { + const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */ + GLfloat rgba[4 * MAX_WIDTH]; + GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, height, + format, type, row, 0); + + /* get float[4] rgba row from surface */ + pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba); + + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, &ctx->Pack, transferOps); + } + + /* destroy the temp / dest surface */ + util_destroy_rgba_surface(dst_texture, dst_surface); +} + + + /** * Need to map texture image into memory before copying image data, * then unmap it. @@ -825,7 +892,7 @@ static void st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, - struct gl_texture_image *texImage, GLboolean compressed) + struct gl_texture_image *texImage, GLboolean compressed_dst) { struct st_texture_image *stImage = st_texture_image(texImage); const GLuint dstImageStride = @@ -834,6 +901,18 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, GLuint depth, i; GLubyte *dest; + if (stImage->pt && + pf_is_compressed(stImage->pt->format) && + !compressed_dst) { + /* Need to decompress the texture. + * We'll do this by rendering a textured quad. + * Note that we only expect RGBA formats (no Z/depth formats). + */ + decompress_with_blit(ctx, target, level, format, type, pixels, + texObj, texImage); + return; + } + /* Map */ if (stImage->pt) { /* Image is stored in hardware format in a buffer managed by the @@ -863,7 +942,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, dest = (GLubyte *) pixels; for (i = 0; i < depth; i++) { - if (compressed) { + if (compressed_dst) { _mesa_get_compressed_teximage(ctx, target, level, dest, texObj, texImage); } -- cgit v1.2.3 From 66cdbf945a3ee75d7b8cba5135310a7ebec21289 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 09:51:38 -0600 Subject: st: st_equal_formats() function to compare gallium/GL pixel formats --- src/mesa/state_tracker/st_format.c | 20 ++++++++++++++++++++ src/mesa/state_tracker/st_format.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 9e2d60c926..d507e3e58d 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -716,3 +716,23 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, return translate_gallium_format_to_mesa_format(pFormat); } + + +/** + * Test if a gallium format is equivalent to a GL format/type. + */ +GLboolean +st_equal_formats(enum pipe_format pFormat, GLenum format, GLenum type) +{ + switch (pFormat) { + case PIPE_FORMAT_R8G8B8A8_UNORM: + return format == GL_RGBA && type == GL_UNSIGNED_BYTE; + case PIPE_FORMAT_B8G8R8A8_UNORM: + return format == GL_BGRA && type == GL_UNSIGNED_BYTE; + case PIPE_FORMAT_R5G6B5_UNORM: + return format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5; + /* XXX more combos... */ + default: + return GL_FALSE; + } +} diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 3f5ac3201b..7bbbe2d570 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -76,4 +76,8 @@ st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type); +extern GLboolean +st_equal_formats(enum pipe_format pFormat, GLenum format, GLenum type); + + #endif /* ST_CB_TEXIMAGE_H */ -- cgit v1.2.3 From 7b24e58a0ca571d6230ef5076ea352253b81fe6e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 09:52:04 -0600 Subject: st: check for fast memcpy path in decompress_with_blit() --- src/mesa/state_tracker/st_cb_texture.c | 46 ++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 53396c0278..cf20e029a7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "main/mfeatures.h" +#include "main/bufferobj.h" #if FEATURE_convolve #include "main/convolve.h" #endif @@ -837,7 +838,6 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, struct pipe_surface *dst_surface; struct pipe_texture *dst_texture; struct pipe_transfer *tex_xfer; - GLuint row; /* create temp / dest surface */ if (!util_create_rgba_surface(screen, width, height, @@ -863,20 +863,40 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, PIPE_TRANSFER_READ, 0, 0, width, height); - /* copy/pack data into user buffer */ - /* XXX: to do: look for cases where we can just memcpy() */ - for (row = 0; row < height; row++) { - const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */ - GLfloat rgba[4 * MAX_WIDTH]; - GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, height, - format, type, row, 0); - - /* get float[4] rgba row from surface */ - pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba); + pixels = _mesa_map_readpix_pbo(ctx, &ctx->Pack, pixels); - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, - format, type, dest, &ctx->Pack, transferOps); + /* copy/pack data into user buffer */ + if (st_equal_formats(stImage->pt->format, format, type)) { + /* memcpy */ + const uint bytesPerRow = width * pf_get_size(stImage->pt->format); + ubyte *map = screen->transfer_map(screen, tex_xfer); + GLuint row; + for (row = 0; row < height; row++) { + GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, + height, format, type, row, 0); + memcpy(dest, map, bytesPerRow); + map += tex_xfer->stride; + } + screen->transfer_unmap(screen, tex_xfer); } + else { + /* format translation via floats */ + GLuint row; + for (row = 0; row < height; row++) { + const GLbitfield transferOps = 0x0; /* bypassed for glGetTexImage() */ + GLfloat rgba[4 * MAX_WIDTH]; + GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, + height, format, type, row, 0); + + /* get float[4] rgba row from surface */ + pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba); + + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, + type, dest, &ctx->Pack, transferOps); + } + } + + _mesa_unmap_readpix_pbo(ctx, &ctx->Pack); /* destroy the temp / dest surface */ util_destroy_rgba_surface(dst_texture, dst_surface); -- cgit v1.2.3 From 255c33d733cc4d2d7483d903513fdc9c34c90f0d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 09:54:04 -0600 Subject: st: remove XXX comment --- src/mesa/state_tracker/st_cb_texture.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index cf20e029a7..ad3bb64e47 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -823,7 +823,6 @@ st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level, /** * glGetTexImage() helper: decompress a compressed texture by rendering * a textured quad. Store the results in the user's buffer. - * XXX unfinished business: decompress sRGB texture */ static void decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, -- cgit v1.2.3 From 5a118d46507f4d551cba64014ac0dbbbad493742 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 15 Apr 2009 23:33:07 +0200 Subject: util: Fix surface usage --- src/gallium/auxiliary/util/u_surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 8c2c227915..85e443204e 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -90,9 +90,9 @@ util_create_rgba_surface(struct pipe_screen *screen, return FALSE; /* create surface / view into texture */ - *surfaceOut = screen->get_tex_surface(screen, *textureOut, 0, 0, 0, usage); + *surfaceOut = screen->get_tex_surface(screen, *textureOut, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); if (!*surfaceOut) { - screen->texture_destroy(*textureOut); + pipe_texture_reference(textureOut, NULL); return FALSE; } -- cgit v1.2.3 From 82e92eeab0c831683961175d155865786149a354 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 15 Apr 2009 23:36:22 +0200 Subject: progs/tests: Make texcompress2 get texture --- progs/tests/texcompress2.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/progs/tests/texcompress2.c b/progs/tests/texcompress2.c index cbb8f1d3a2..b95aca9fb9 100644 --- a/progs/tests/texcompress2.c +++ b/progs/tests/texcompress2.c @@ -51,7 +51,6 @@ TestSubTex(void) GLboolean all = 0*GL_TRUE; GLubyte *buffer; GLint size, fmt; - int i; glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &size); @@ -82,6 +81,23 @@ TestSubTex(void) } +static void +TestGetTex(void) +{ + GLubyte *buffer; + + buffer = (GLubyte *) malloc(3 * ImgWidth * ImgHeight); + + glGetTexImage(GL_TEXTURE_2D, + 0, + GL_RGB, + GL_UNSIGNED_BYTE, + buffer); + + free(buffer); +} + + static void LoadCompressedImage(const char *file) { @@ -146,7 +162,10 @@ LoadCompressedImage(const char *file) glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter); - TestSubTex(); + if (0) + TestSubTex(); + else + TestGetTex(); } -- cgit v1.2.3 From 143b416af6662995059cd5209a750dbace78081c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 16 Apr 2009 13:06:08 +1000 Subject: radeon: take a bo reference when adding to validate list --- src/mesa/drivers/dri/radeon/radeon_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 756c09fff3..2449795ea9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -928,6 +928,7 @@ void radeon_validate_reset_bos(radeonContextPtr radeon) int i; for (i = 0; i < radeon->state.validated_bo_count; i++) { + radeon_bo_unref(radeon->state.bos[i].bo); radeon->state.bos[i].bo = NULL; radeon->state.bos[i].read_domains = 0; radeon->state.bos[i].write_domain = 0; @@ -938,6 +939,7 @@ void radeon_validate_reset_bos(radeonContextPtr radeon) void radeon_validate_bo(radeonContextPtr radeon, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain) { + radeon_bo_ref(bo); radeon->state.bos[radeon->state.validated_bo_count].bo = bo; radeon->state.bos[radeon->state.validated_bo_count].read_domains = read_domains; radeon->state.bos[radeon->state.validated_bo_count].write_domain = write_domain; -- cgit v1.2.3 From 3264352c577ce1d6681e70abd76624ede906df71 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 16 Apr 2009 13:06:24 +1000 Subject: dri: attempt to actually refcount the __DRIDrawable valgrind was showing a race between the drawable getting destroyed by the X resource freeing code, and the context getting destroyed later and freeing the drawable. However I've no idea if some other combination of things could cause this code to leak. --- src/mesa/drivers/dri/common/dri_util.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 38c2e7b00d..0ec4adc232 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -37,6 +37,9 @@ typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); #endif +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + /** * This is just a token extension used to signal that the driver * supports setting a read drawable. @@ -127,7 +130,7 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; } - pdp->refcount--; + dri_put_drawable(pdp); if (prp != pdp) { if (prp->refcount == 0) { @@ -135,7 +138,7 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_FALSE; } - prp->refcount--; + dri_put_drawable(prp); } @@ -170,10 +173,10 @@ static int driBindContext(__DRIcontext *pcp, pcp->driReadablePriv = prp; if (pdp) { pdp->driContextPriv = pcp; - pdp->refcount++; + dri_get_drawable(pdp); } if ( prp && pdp != prp ) { - prp->refcount++; + dri_get_drawable(prp); } } @@ -430,7 +433,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->loaderPrivate = data; pdp->hHWDrawable = hwDrawable; - pdp->refcount = 0; + pdp->refcount = 1; pdp->pStamp = NULL; pdp->lastStamp = 0; pdp->index = 0; @@ -483,12 +486,19 @@ dri2CreateNewDrawable(__DRIscreen *screen, return pdraw; } - -static void -driDestroyDrawable(__DRIdrawable *pdp) +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} + +static void dri_put_drawable(__DRIdrawable *pdp) { __DRIscreenPrivate *psp; + pdp->refcount--; + if (pdp->refcount) + return; + if (pdp) { psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); @@ -504,6 +514,12 @@ driDestroyDrawable(__DRIdrawable *pdp) } } +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + /*@}*/ -- cgit v1.2.3 From 8b2ebd15310cbd5d905b08761b5e950f8e2580e5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 16 Apr 2009 12:19:19 +0100 Subject: vbo: cache last dlist vertex in malloced memory Avoids repeated mapping of the VBO buffer on display list replay. We need access to the final vertex in order to update the GL current attrib values. --- src/mesa/vbo/vbo_save.h | 7 +++++++ src/mesa/vbo/vbo_save_api.c | 25 +++++++++++++++++++++++++ src/mesa/vbo/vbo_save_draw.c | 31 +++++++++++++++++++++---------- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 9558f83883..86bbd24f7b 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -64,6 +64,13 @@ struct vbo_save_vertex_list { GLubyte attrsz[VBO_ATTRIB_MAX]; GLuint vertex_size; + /* Copy of the final vertex from node->vertex_store->bufferobj. + * Keep this in regular (non-VBO) memory to avoid repeated + * map/unmap of the VBO when updating GL current data. + */ + GLfloat *current_data; + GLuint current_size; + GLuint buffer_offset; GLuint count; GLuint wrap_count; /* number of copied vertices at start */ diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 52b6f1884e..868226075a 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -289,6 +289,31 @@ static void _save_compile_vertex_list( GLcontext *ctx ) node->vertex_store->refcount++; node->prim_store->refcount++; + + node->current_size = node->vertex_size - node->attrsz[0]; + node->current_data = NULL; + + if (node->current_size) { + /* If the malloc fails, we just pull the data out of the VBO + * later instead. + */ + node->current_data = MALLOC( node->current_size * sizeof(GLfloat) ); + if (node->current_data) { + const char *buffer = (const char *)save->vertex_store->buffer; + unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat); + unsigned vertex_offset = 0; + + if (node->count) + vertex_offset = (node->count-1) * node->vertex_size * sizeof(GLfloat); + + memcpy( node->current_data, + buffer + node->buffer_offset + vertex_offset + attr_offset, + node->current_size * sizeof(GLfloat) ); + } + } + + + assert(node->attrsz[VBO_ATTRIB_POS] != 0 || node->count == 0); diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index f59e1036d0..5110648c28 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -46,20 +46,31 @@ static void _playback_copy_to_current( GLcontext *ctx, const struct vbo_save_vertex_list *node ) { struct vbo_context *vbo = vbo_context(ctx); - GLfloat vertex[VBO_ATTRIB_MAX * 4], *data = vertex; + GLfloat vertex[VBO_ATTRIB_MAX * 4]; + GLfloat *data; GLuint i, offset; - if (node->count) - offset = (node->buffer_offset + - (node->count-1) * node->vertex_size * sizeof(GLfloat)); - else - offset = node->buffer_offset; + if (node->current_size == 0) + return; - ctx->Driver.GetBufferSubData( ctx, 0, offset, - node->vertex_size * sizeof(GLfloat), - data, node->vertex_store->bufferobj ); + if (node->current_data) { + data = node->current_data; + } + else { + data = vertex; + + if (node->count) + offset = (node->buffer_offset + + (node->count-1) * node->vertex_size * sizeof(GLfloat)); + else + offset = node->buffer_offset; - data += node->attrsz[0]; /* skip vertex position */ + ctx->Driver.GetBufferSubData( ctx, 0, offset, + node->vertex_size * sizeof(GLfloat), + data, node->vertex_store->bufferobj ); + + data += node->attrsz[0]; /* skip vertex position */ + } for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) { if (node->attrsz[i]) { -- cgit v1.2.3 From 0d0028e6df3542272ce833fec2e7af99d762fe8f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 09:25:52 -0600 Subject: demos: use larger buffer for snprintf() call, see bug 21220 --- progs/samples/blendeq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/samples/blendeq.c b/progs/samples/blendeq.c index cd0474c5ce..037d06fa52 100644 --- a/progs/samples/blendeq.c +++ b/progs/samples/blendeq.c @@ -100,7 +100,7 @@ static void PrintColorStrings( void ) { GLubyte ubbuf[3]; int i, xleft, xright; - char colorString[18]; + char colorString[100]; xleft = 5 + windW/4; xright = 5 + windW/2; -- cgit v1.2.3 From 666702baec09f60f7e1eddd9f1dd65ee2e826abb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 09:31:45 -0600 Subject: mesa: add distclean target to top-level Makefile --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59f0a07a48..a77825e8f9 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,9 @@ realclean: clean -name depend -o -name depend.bak ')' -exec rm -f '{}' ';' +distclean: realclean + + install: @for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ @@ -45,7 +48,7 @@ install: done -.PHONY: default doxygen clean realclean install linux-directfb-install +.PHONY: default doxygen clean realclean distclean install linux-directfb-install # If there's no current configuration file $(TOP)/configs/current: -- cgit v1.2.3 From 69cbf3c68675915517ae64c81d7a8a42de4e01a3 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 16 Apr 2009 17:39:43 +0200 Subject: intel: fix small compressed texture upload need to round up height for _mesa_copy_rect otherwise textures with height smaller than 4 won't get copied to the miptree at all Also fix up the confusing debug output (don't output unitialized values, and output if data is present and the compressed flag) --- src/mesa/drivers/dri/intel/intel_tex_image.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index c81f230984..1f192dafbe 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -315,7 +315,7 @@ intelTexImage(GLcontext * ctx, GLint postConvWidth = width; GLint postConvHeight = height; GLint texelBytes, sizeInBytes; - GLuint dstRowStride, srcRowStride = texImage->RowStride; + GLuint dstRowStride = 0, srcRowStride = texImage->RowStride; GLboolean needs_map; DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, @@ -516,8 +516,9 @@ intelTexImage(GLcontext * ctx, } DBG("Upload image %dx%dx%d row_len %d " - "pitch %d\n", - width, height, depth, width * texelBytes, dstRowStride); + "pitch %d pixels %d compressed %d\n", + width, height, depth, width * texelBytes, dstRowStride, + pixels ? 1 : 0, compressed); /* Copy data. Would like to know when it's ok for us to eg. use * the blitter to copy. Or, use the hardware to do the format @@ -530,7 +531,7 @@ intelTexImage(GLcontext * ctx, _mesa_copy_rect(texImage->Data, dst->cpp, dst->pitch, 0, 0, intelImage->mt->level[level].width, - intelImage->mt->level[level].height/4, + (intelImage->mt->level[level].height+3)/4, pixels, srcRowStride, 0, 0); -- cgit v1.2.3 From d82876e850960eb5e3799c4ab02b618c4b548fd8 Mon Sep 17 00:00:00 2001 From: Lars Henning Wendt Date: Thu, 16 Apr 2009 10:14:17 -0600 Subject: mesa: fix bad mask bit in clip plane restore code for glPopAttrib() --- src/mesa/main/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index d5d0a552db..e43fa96dd3 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1265,7 +1265,7 @@ _mesa_PopAttrib(void) /* restore clip planes */ for (i = 0; i < MAX_CLIP_PLANES; i++) { - const GLuint mask = 1 << 1; + const GLuint mask = 1 << i; const GLfloat *eyePlane = xform->EyeUserPlane[i]; COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane); if (xform->ClipPlanesEnabled & mask) { -- cgit v1.2.3 From f2cfbfa2baa15c4b56c6f22dbe37d75a3c07e549 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 12:22:47 -0600 Subject: i965: fix const buffer temp register clobbering Calls to release_tmps() were causing the temps holding constants to get recycled. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 2ee63129bc..5881a9d8d8 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -170,6 +170,14 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) reg++; } + if (c->use_const_buffer) { + for (i = 0; i < 3; i++) { + c->current_const[i].index = -1; + c->current_const[i].reg = brw_vec8_grf(reg, 0); + reg++; + } + } + for (i = 0; i < 128; i++) { if (c->output_regs[i].used_in_src) { c->output_regs[i].reg = brw_vec8_grf(reg, 0); @@ -194,13 +202,6 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4; c->prog_data.total_grf = reg; - if (c->use_const_buffer) { - for (i = 0; i < 3; i++) { - c->current_const[i].index = -1; - c->current_const[i].reg = get_tmp(c); - } - } - if (INTEL_DEBUG & DEBUG_VS) { _mesa_printf("%s NumAddrRegs %d\n", __FUNCTION__, c->vp->program.Base.NumAddressRegs); _mesa_printf("%s NumTemps %d\n", __FUNCTION__, c->vp->program.Base.NumTemporaries); @@ -655,6 +656,8 @@ static void emit_lit_noalias( struct brw_vs_compile *c, } brw_ENDIF(p, if_insn); + + release_tmp(c, tmp); } static void emit_lrp_noalias(struct brw_vs_compile *c, @@ -704,6 +707,8 @@ get_constant(struct brw_vs_compile *c, struct brw_compile *p = &c->func; struct brw_reg const_reg; + assert(argIndex < 3); + if (c->current_const[argIndex].index != src->Index) { c->current_const[argIndex].index = src->Index; @@ -843,6 +848,7 @@ static struct brw_reg deref( struct brw_vs_compile *c, brw_pop_insn_state(p); } + /* NOTE: tmp not released */ return vec8(tmp); } @@ -1178,6 +1184,11 @@ void brw_vs_emit(struct brw_vs_compile *c ) struct brw_reg args[3], dst; GLuint i; +#if 0 + printf("%d: ", insn); + _mesa_print_instruction(inst); +#endif + /* Get argument regs. SWZ is special and does this itself. */ if (inst->Opcode != OPCODE_SWZ) -- cgit v1.2.3 From 19ac3e2729abd85346f88fd69c6bc72938d26101 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 14:53:51 -0600 Subject: i965: handle address reg in get_dst() --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 5881a9d8d8..19ead73d8c 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -925,6 +925,10 @@ static struct brw_reg get_dst( struct brw_vs_compile *c, assert(c->regs[dst.File][dst.Index].nr != 0); reg = c->regs[dst.File][dst.Index]; break; + case PROGRAM_ADDRESS: + assert(dst.Index == 0); + reg = c->regs[dst.File][dst.Index]; + break; case PROGRAM_UNDEFINED: /* we may hit this for OPCODE_END, OPCODE_KIL, etc */ reg = brw_null_reg(); -- cgit v1.2.3 From ee32e9b4753eca62e360f96ce61ef7ff683e6bb7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 16:49:18 -0600 Subject: i965: implement relative addressing for VS constant buffer reads A scatter-read should be possible, but we're just using two READs for the time being. --- src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_eu_emit.c | 59 +++++++++++++++-- src/mesa/drivers/dri/i965/brw_vs_emit.c | 114 +++++++++++++++++--------------- 3 files changed, 115 insertions(+), 59 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 66f8eb840c..896e67dbfe 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -868,6 +868,7 @@ void brw_dp_READ_4( struct brw_compile *p, void brw_dp_READ_4_vs( struct brw_compile *p, struct brw_reg dest, GLboolean relAddr, + struct brw_reg addrReg, GLuint location, GLuint bind_table_index ); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index c731a93a8d..df2141660c 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1003,15 +1003,18 @@ void brw_dp_READ_4( struct brw_compile *p, /** - * Read float[4] constant from VS constant buffer. + * Read float[4] constant(s) from VS constant buffer. + * For relative addressing, two float[4] constants will be read into 'dest'. + * Otherwise, one float[4] constant will be read into the lower half of 'dest'. */ void brw_dp_READ_4_vs(struct brw_compile *p, struct brw_reg dest, GLboolean relAddr, + struct brw_reg addrReg, GLuint location, GLuint bind_table_index) { - const GLuint msg_reg_nr = 1; + GLuint msg_reg_nr = 1; /* printf("vs const read msg, location %u, msg_reg_nr %d\n", @@ -1034,7 +1037,12 @@ void brw_dp_READ_4_vs(struct brw_compile *p, b = brw_message_reg(msg_reg_nr); b = retype(b, BRW_REGISTER_TYPE_UD); /*b = get_element_ud(b, 2);*/ - brw_MOV(p, b, brw_imm_ud(location)); + if (relAddr) { + brw_ADD(p, b, addrReg, brw_imm_ud(location)); + } + else { + brw_MOV(p, b, brw_imm_ud(location)); + } brw_pop_insn_state(p); } @@ -1053,13 +1061,56 @@ void brw_dp_READ_4_vs(struct brw_compile *p, brw_set_dp_read_message(insn, bind_table_index, - 0, /* msg_control (0 means 1 Oword) */ + 0, /* msg_control (0 means 1 Oword, lower half) */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ 0, /* source cache = data cache */ 1, /* msg_length */ 1, /* response_length (1 Oword) */ 0); /* eot */ } + + if (relAddr) { + /* second read to get second constant */ + msg_reg_nr++; + { + /* Setup MRF[1] with location/offset into const buffer */ + struct brw_reg b; + + brw_push_insn_state(p); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + + b = brw_message_reg(msg_reg_nr); + b = retype(b, BRW_REGISTER_TYPE_UD); + addrReg = suboffset(addrReg, 1); /* upper half of addrReg */ + brw_ADD(p, b, addrReg, brw_imm_ud(location)); + + brw_pop_insn_state(p); + } + + { + struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); + + insn->header.predicate_control = BRW_PREDICATE_NONE; + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.destreg__conditonalmod = msg_reg_nr; + insn->header.mask_control = BRW_MASK_DISABLE; + /*insn->header.access_mode = BRW_ALIGN_16;*/ + + brw_set_dest(insn, dest); + brw_set_src0(insn, brw_null_reg()); + + brw_set_dp_read_message(insn, + bind_table_index, + 1, /* msg_control (1 means 1 Oword, upper half) */ + BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ + 0, /* source cache = data cache */ + 1, /* msg_length */ + 1, /* response_length (1 Oword) */ + 0); /* eot */ + } + } } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 19ead73d8c..98fbdf5064 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -709,7 +709,7 @@ get_constant(struct brw_vs_compile *c, assert(argIndex < 3); - if (c->current_const[argIndex].index != src->Index) { + if (c->current_const[argIndex].index != src->Index || src->RelAddr) { c->current_const[argIndex].index = src->Index; @@ -722,15 +722,18 @@ get_constant(struct brw_vs_compile *c, brw_dp_READ_4_vs(p, c->current_const[argIndex].reg, /* writeback dest */ src->RelAddr, /* relative indexing? */ + c->regs[PROGRAM_ADDRESS][0], /* address register */ 16 * src->Index, /* byte offset */ SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ ); } - /* replicate lower four floats into upper four floats (to get XYZWXYZW) */ const_reg = c->current_const[argIndex].reg; - const_reg = stride(const_reg, 0, 4, 0); - const_reg.subnr = 0; + if (!src->RelAddr) { + /* replicate lower four floats into upper half (to get XYZWXYZW) */ + const_reg = stride(const_reg, 0, 4, 0); + const_reg.subnr = 0; + } return const_reg; } @@ -771,6 +774,42 @@ static struct brw_reg get_reg( struct brw_vs_compile *c, } +/** + * Indirect addressing: get reg[[arg] + offset]. + */ +static struct brw_reg deref( struct brw_vs_compile *c, + struct brw_reg arg, + GLint offset) +{ + struct brw_compile *p = &c->func; + struct brw_reg tmp = vec4(get_tmp(c)); + struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0]; + struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_UW); + GLuint byte_offset = arg.nr * 32 + arg.subnr + offset * 16; + struct brw_reg indirect = brw_vec4_indirect(0,0); + + { + brw_push_insn_state(p); + brw_set_access_mode(p, BRW_ALIGN_1); + + /* This is pretty clunky - load the address register twice and + * fetch each 4-dword value in turn. There must be a way to do + * this in a single pass, but I couldn't get it to work. + */ + brw_ADD(p, brw_address_reg(0), vp_address, brw_imm_d(byte_offset)); + brw_MOV(p, tmp, indirect); + + brw_ADD(p, brw_address_reg(0), suboffset(vp_address, 8), brw_imm_d(byte_offset)); + brw_MOV(p, suboffset(tmp, 4), indirect); + + brw_pop_insn_state(p); + } + + /* NOTE: tmp not released */ + return vec8(tmp); +} + + /** * Get brw reg corresponding to the instruction's [argIndex] src reg. * TODO: relative addressing! @@ -782,19 +821,29 @@ get_src_reg( struct brw_vs_compile *c, { const GLuint file = inst->SrcReg[argIndex].File; const GLint index = inst->SrcReg[argIndex].Index; + const GLboolean relAddr = inst->SrcReg[argIndex].RelAddr; switch (file) { case PROGRAM_TEMPORARY: case PROGRAM_INPUT: case PROGRAM_OUTPUT: - assert(c->regs[file][index].nr != 0); - return c->regs[file][index]; + if (relAddr) { + return deref(c, c->regs[file][0], index); + } + else { + assert(c->regs[file][index].nr != 0); + return c->regs[file][index]; + } + case PROGRAM_STATE_VAR: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: if (c->use_const_buffer) { return get_constant(c, inst, argIndex); } + else if (relAddr) { + return deref(c, c->regs[PROGRAM_STATE_VAR][0], index); + } else { assert(c->regs[PROGRAM_STATE_VAR][index].nr != 0); return c->regs[PROGRAM_STATE_VAR][index]; @@ -817,42 +866,6 @@ get_src_reg( struct brw_vs_compile *c, } -/** - * Indirect addressing: get reg[[arg] + offset]. - */ -static struct brw_reg deref( struct brw_vs_compile *c, - struct brw_reg arg, - GLint offset) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp = vec4(get_tmp(c)); - struct brw_reg addr_reg = c->regs[PROGRAM_ADDRESS][0]; - struct brw_reg vp_address = retype(vec1(addr_reg), BRW_REGISTER_TYPE_UW); - GLuint byte_offset = arg.nr * 32 + arg.subnr + offset * 16; - struct brw_reg indirect = brw_vec4_indirect(0,0); - - { - brw_push_insn_state(p); - brw_set_access_mode(p, BRW_ALIGN_1); - - /* This is pretty clunky - load the address register twice and - * fetch each 4-dword value in turn. There must be a way to do - * this in a single pass, but I couldn't get it to work. - */ - brw_ADD(p, brw_address_reg(0), vp_address, brw_imm_d(byte_offset)); - brw_MOV(p, tmp, indirect); - - brw_ADD(p, brw_address_reg(0), suboffset(vp_address, 8), brw_imm_d(byte_offset)); - brw_MOV(p, suboffset(tmp, 4), indirect); - - brw_pop_insn_state(p); - } - - /* NOTE: tmp not released */ - return vec8(tmp); -} - - static void emit_arl( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0 ) @@ -864,8 +877,8 @@ static void emit_arl( struct brw_vs_compile *c, if (need_tmp) tmp = get_tmp(c); - brw_RNDD(p, tmp, arg0); - brw_MUL(p, dst, tmp, brw_imm_d(16)); + brw_RNDD(p, tmp, arg0); /* tmp = round(arg0) */ + brw_MUL(p, dst, tmp, brw_imm_d(16)); /* dst = tmp * 16 */ if (need_tmp) release_tmp(c, tmp); @@ -888,13 +901,7 @@ static struct brw_reg get_arg( struct brw_vs_compile *c, if (src->File == PROGRAM_UNDEFINED) return brw_null_reg(); - if (src->RelAddr) { - /* XXX fix */ - reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src->Index); - } - else { - reg = get_src_reg(c, inst, argIndex); - } + reg = get_src_reg(c, inst, argIndex); /* Convert 3-bit swizzle to 2-bit. */ @@ -989,10 +996,7 @@ static void emit_swz( struct brw_vs_compile *c, if (src_mask) { struct brw_reg arg0; - if (src.RelAddr) - arg0 = deref(c, c->regs[PROGRAM_STATE_VAR][0], src.Index); - else - arg0 = get_src_reg(c, inst, argIndex); + arg0 = get_src_reg(c, inst, argIndex); arg0 = brw_swizzle(arg0, src_swz[0], src_swz[1], -- cgit v1.2.3 From fc76781456182f487fc7e0057ca8a4c648dfe530 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Apr 2009 16:49:48 -0600 Subject: i965: const buffer debug code (disabled) --- src/mesa/drivers/dri/i965/brw_curbe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index dfab14aa74..fe1de821f0 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -353,6 +353,14 @@ update_constant_buffer(struct brw_context *brw, map = const_buffer->virtual; memcpy(map, params->ParameterValues, size); dri_bo_unmap(const_buffer); + + if (0) { + int i; + for (i = 0; i < params->NumParameters; i++) { + float *p = params->ParameterValues[i]; + printf("%d: %f %f %f %f\n", i, p[0], p[1], p[2], p[3]); + } + } } } @@ -363,6 +371,10 @@ update_vertex_constant_buffer(struct brw_context *brw) { struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; + if (0) { + printf("update VS constants in buffer %p\n", vp->const_buffer); + printf("program %u\n", vp->program.Base.Id); + } update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); } -- cgit v1.2.3 From a25632d890bcc769e2d39650e3dfe6ee49393e54 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 11:06:00 -0600 Subject: i965: minor debug output changes --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 49fea2e41a..62fa573b37 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -346,10 +346,10 @@ get_src_reg_const(struct brw_wm_compile *c, const_reg = brw_abs(const_reg); #if 0 - printf(" form const[%d] for arg %d, comp %d, reg %d\n", + printf(" form const[%d].%d for arg %d, reg %d\n", c->current_const[srcRegIndex].index, - srcRegIndex, component, + srcRegIndex, const_reg.nr); #endif @@ -407,7 +407,7 @@ static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, if (src->Abs) value = FABSF(value); #if 0 - printf(" form imm reg %f\n", value); + printf(" form immed value %f for chan %d\n", value, channel); #endif return brw_imm_f(value); } -- cgit v1.2.3 From 33b865f70dc1461b040c9c436ec8e5a8171f00e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 11:08:12 -0600 Subject: i965: disable using immediate values for MOV instructions For some reason, MOV instructions using immediate src values don't seem to work reliably on the GLSL path. Disable them for now (falling back to const buffer reads). This fixes a bunch of glean glsl1 failures. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 62fa573b37..634648ad5b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -527,7 +527,9 @@ static void emit_mov( struct brw_wm_compile *c, if (mask & (1< Date: Thu, 9 Apr 2009 18:30:12 -0700 Subject: intel: Add support for argb1555, argb4444 FBOs and fix rgb565 fbo readpixels. Also enable them all regardless of screen bpp, as 32 bpp what I've been testing against, and haven't been able to detect any screen bpp-specific troubles with them. --- src/mesa/drivers/dri/common/spantmp2.h | 65 +++++++++ src/mesa/drivers/dri/i915/i830_vtbl.c | 30 +++- src/mesa/drivers/dri/i915/i915_vtbl.c | 28 +++- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 48 +++++-- src/mesa/drivers/dri/intel/intel_blit.c | 54 +++++-- src/mesa/drivers/dri/intel/intel_context.h | 3 + src/mesa/drivers/dri/intel/intel_fbo.c | 69 +++++---- src/mesa/drivers/dri/intel/intel_fbo.h | 2 + src/mesa/drivers/dri/intel/intel_span.c | 172 +++++++++++++++-------- 9 files changed, 346 insertions(+), 125 deletions(-) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index f2868cb58a..89c815722f 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -82,6 +82,71 @@ rgba[3] = 0xff; \ } while (0) +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_4444(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 8) & 0xf) * 0x11; \ + rgba[1] = ((p >> 4) & 0xf) * 0x11; \ + rgba[2] = ((p >> 0) & 0xf) * 0x11; \ + rgba[3] = ((p >> 12) & 0xf) * 0x11; \ + } while (0) + + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_1555(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = ((p >> 15) & 0x1) * 0xff; \ + } while (0) + #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) /** diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 1a94921078..3bf02de61f 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -26,12 +26,14 @@ **************************************************************************/ #include "glapi/glapi.h" +#include "main/texformat.h" #include "i830_context.h" #include "i830_reg.h" #include "intel_batchbuffer.h" #include "intel_regions.h" #include "intel_tris.h" +#include "intel_fbo.h" #include "tnl/t_context.h" #include "tnl/t_vertex.h" @@ -614,6 +616,8 @@ i830_state_draw_region(struct intel_context *intel, { struct i830_context *i830 = i830_context(&intel->ctx); GLcontext *ctx = &intel->ctx; + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; ASSERT(state == &i830->state || state == &i830->meta); @@ -651,13 +655,27 @@ i830_state_draw_region(struct intel_context *intel, */ value = (DSTORG_HORT_BIAS(0x8) | /* .5 */ DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */ - - if (color_region && color_region->cpp == 4) { - value |= DV_PF_8888; - } - else { - value |= DV_PF_565; + + if (irb != NULL) { + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_ARGB8888: + value |= DV_PF_8888; + break; + case MESA_FORMAT_RGB565: + value |= DV_PF_565; + break; + case MESA_FORMAT_ARGB1555: + value |= DV_PF_1555; + break; + case MESA_FORMAT_ARGB4444: + value |= DV_PF_4444; + break; + default: + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", + irb->texformat->MesaFormat); + } } + if (depth_region && depth_region->cpp == 4) { value |= DEPTH_FRMT_24_FIXED_8_OTHER; } diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 3f6d282d34..115004616f 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -32,6 +32,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/colormac.h" +#include "main/texformat.h" #include "tnl/t_context.h" #include "tnl/t_vertex.h" @@ -40,6 +41,7 @@ #include "intel_tex.h" #include "intel_regions.h" #include "intel_tris.h" +#include "intel_fbo.h" #include "i915_reg.h" #include "i915_context.h" @@ -542,6 +544,8 @@ i915_state_draw_region(struct intel_context *intel, { struct i915_context *i915 = i915_context(&intel->ctx); GLcontext *ctx = &intel->ctx; + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + struct intel_renderbuffer *irb = intel_renderbuffer(rb); GLuint value; ASSERT(state == &i915->state || state == &i915->meta); @@ -580,12 +584,26 @@ i915_state_draw_region(struct intel_context *intel, value = (DSTORG_HORT_BIAS(0x8) | /* .5 */ DSTORG_VERT_BIAS(0x8) | /* .5 */ LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL); - if (color_region && color_region->cpp == 4) { - value |= DV_PF_8888; - } - else { - value |= (DITHER_FULL_ALWAYS | DV_PF_565); + if (irb != NULL) { + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_ARGB8888: + value |= DV_PF_8888; + break; + case MESA_FORMAT_RGB565: + value |= DV_PF_565 | DITHER_FULL_ALWAYS; + break; + case MESA_FORMAT_ARGB1555: + value |= DV_PF_1555 | DITHER_FULL_ALWAYS; + break; + case MESA_FORMAT_ARGB4444: + value |= DV_PF_4444 | DITHER_FULL_ALWAYS; + break; + default: + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", + irb->texformat->MesaFormat); + } } + if (depth_region && depth_region->cpp == 4) { value |= DEPTH_FRMT_24_FIXED_8_OTHER; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index ce5dbb334b..0dc377be65 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -38,7 +38,7 @@ #include "intel_mipmap_tree.h" #include "intel_batchbuffer.h" #include "intel_tex.h" - +#include "intel_fbo.h" #include "brw_context.h" #include "brw_state.h" @@ -505,15 +505,18 @@ brw_update_vs_constant_surface( GLcontext *ctx, * usable for further buffers when doing ARB_draw_buffer support. */ static void -brw_update_region_surface(struct brw_context *brw, struct intel_region *region, - unsigned int unit, GLboolean cached) +brw_update_renderbuffer_surface(struct brw_context *brw, + struct gl_renderbuffer *rb, + unsigned int unit, GLboolean cached) { GLcontext *ctx = &brw->intel.ctx; dri_bo *region_bo = NULL; + struct intel_renderbuffer *irb = intel_renderbuffer(rb); + struct intel_region *region = irb ? irb->region : NULL; struct { unsigned int surface_type; unsigned int surface_format; - unsigned int width, height, cpp; + unsigned int width, height, pitch, cpp; GLubyte color_mask[4]; GLboolean color_blend; uint32_t tiling; @@ -525,13 +528,27 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region, region_bo = region->buffer; key.surface_type = BRW_SURFACE_2D; - if (region->cpp == 4) + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_ARGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - else + break; + case MESA_FORMAT_RGB565: key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; + break; + case MESA_FORMAT_ARGB1555: + key.surface_format = BRW_SURFACEFORMAT_B5G5R5A1_UNORM; + break; + case MESA_FORMAT_ARGB4444: + key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM; + break; + default: + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", + irb->texformat->MesaFormat); + } key.tiling = region->tiling; - key.width = region->pitch; /* XXX: not really! */ - key.height = region->height; + key.width = rb->Width; + key.height = rb->Height; + key.pitch = region->pitch; key.cpp = region->cpp; } else { key.surface_type = BRW_SURFACE_NULL; @@ -567,7 +584,7 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region, surf.ss2.width = key.width - 1; surf.ss2.height = key.height - 1; brw_set_surface_tiling(&surf, key.tiling); - surf.ss3.pitch = (key.width * key.cpp) - 1; + surf.ss3.pitch = (key.pitch * key.cpp) - 1; /* _NEW_COLOR */ surf.ss0.color_blend = key.color_blend; @@ -655,14 +672,17 @@ static void prepare_wm_surfaces(struct brw_context *brw ) GLuint i; int old_nr_surfaces; + /* _NEW_BUFFERS */ /* Update surfaces for drawing buffers */ - if (brw->state.nr_color_regions > 1) { - for (i = 0; i < brw->state.nr_color_regions; i++) { - brw_update_region_surface(brw, brw->state.color_regions[i], i, - GL_FALSE); + if (ctx->DrawBuffer->_NumColorDrawBuffers >= 1) { + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + brw_update_renderbuffer_surface(brw, + ctx->DrawBuffer->_ColorDrawBuffers[i], + i, + GL_FALSE); } } else { - brw_update_region_surface(brw, brw->state.color_regions[0], 0, GL_TRUE); + brw_update_renderbuffer_surface(brw, NULL, 0, GL_TRUE); } old_nr_surfaces = brw->wm.nr_surfaces; diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 4ae9b118a3..4919828131 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -32,6 +32,8 @@ #include "main/mtypes.h" #include "main/context.h" #include "main/enums.h" +#include "main/texformat.h" +#include "main/colormac.h" #include "intel_blit.h" #include "intel_buffers.h" @@ -484,10 +486,9 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) const GLbitfield bufBit = 1 << buf; if ((clearMask & bufBit) && !(bufBit & skipBuffers)) { /* OK, clear this renderbuffer */ - struct intel_region *irb_region = - intel_get_rb_region(fb, buf); + struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, buf); dri_bo *write_buffer = - intel_region_buffer(intel, irb_region, + intel_region_buffer(intel, irb->region, all ? INTEL_WRITE_FULL : INTEL_WRITE_PART); @@ -495,15 +496,13 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) GLint pitch, cpp; GLuint BR13, CMD; - ASSERT(irb_region); - - pitch = irb_region->pitch; - cpp = irb_region->cpp; + pitch = irb->region->pitch; + cpp = irb->region->cpp; DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", __FUNCTION__, - irb_region->buffer, (pitch * cpp), - irb_region->draw_offset, + irb->region->buffer, (pitch * cpp), + irb->region->draw_offset, b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1); BR13 = 0xf0 << 16; @@ -529,7 +528,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) } #ifndef I915 - if (irb_region->tiling != I915_TILING_NONE) { + if (irb->region->tiling != I915_TILING_NONE) { CMD |= XY_DST_TILED; pitch /= 4; } @@ -540,9 +539,36 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) clearVal = clear_depth; } else { - clearVal = (cpp == 4) - ? intel->ClearColor8888 : intel->ClearColor565; - } + uint8_t clear[4]; + GLclampf *color = ctx->Color.ClearColor; + + CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); + + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_ARGB8888: + clearVal = intel->ClearColor8888; + break; + case MESA_FORMAT_RGB565: + clearVal = intel->ClearColor565; + break; + case MESA_FORMAT_ARGB4444: + clearVal = PACK_COLOR_4444(clear[3], clear[0], + clear[1], clear[2]); + break; + case MESA_FORMAT_ARGB1555: + clearVal = PACK_COLOR_1555(clear[3], clear[0], + clear[1], clear[2]); + break; + default: + _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n", + irb->texformat->MesaFormat); + clearVal = 0; + } + } + /* _mesa_debug(ctx, "hardware blit clear buf %d rb id %d\n", buf, irb->Base.Name); @@ -558,7 +584,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) OUT_BATCH((b.y2 << 16) | b.x2); OUT_RELOC(write_buffer, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, - irb_region->draw_offset); + irb->region->draw_offset); OUT_BATCH(clearVal); ADVANCE_BATCH(); clearMask &= ~bufBit; /* turn off bit, for faster loop exit */ diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index bd3810549a..d798225ddd 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -48,6 +48,8 @@ #define DV_PF_555 (1<<8) #define DV_PF_565 (2<<8) #define DV_PF_8888 (3<<8) +#define DV_PF_4444 (8<<8) +#define DV_PF_1555 (9<<8) struct intel_region; struct intel_context; @@ -337,6 +339,7 @@ extern char *__progname; #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) +#define IS_POWER_OF_TWO(val) (((val) & (val - 1)) == 0) #define INTEL_FIREVERTICES(intel) \ do { \ diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index a401f730ba..52647ddf8b 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -119,6 +119,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->RedBits = 5; rb->GreenBits = 6; rb->BlueBits = 5; + irb->texformat = &_mesa_texformat_rgb565; cpp = 2; break; case GL_RGB: @@ -132,6 +133,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 0; + irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ cpp = 4; break; case GL_RGBA: @@ -148,6 +150,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 8; + irb->texformat = &_mesa_texformat_argb8888; cpp = 4; break; case GL_STENCIL_INDEX: @@ -160,12 +163,14 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->StencilBits = 8; cpp = 4; + irb->texformat = &_mesa_texformat_s8_z24; break; case GL_DEPTH_COMPONENT16: rb->_ActualFormat = GL_DEPTH_COMPONENT16; rb->DataType = GL_UNSIGNED_SHORT; rb->DepthBits = 16; cpp = 2; + irb->texformat = &_mesa_texformat_z16; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: @@ -174,6 +179,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->DepthBits = 24; cpp = 4; + irb->texformat = &_mesa_texformat_s8_z24; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: @@ -182,6 +188,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DepthBits = 24; rb->StencilBits = 8; cpp = 4; + irb->texformat = &_mesa_texformat_s8_z24; break; default: _mesa_problem(ctx, @@ -322,6 +329,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.GreenBits = 6; irb->Base.BlueBits = 5; irb->Base.DataType = GL_UNSIGNED_BYTE; + irb->texformat = &_mesa_texformat_rgb565; break; case GL_RGB8: irb->Base._ActualFormat = GL_RGB8; @@ -331,6 +339,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 0; irb->Base.DataType = GL_UNSIGNED_BYTE; + irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ break; case GL_RGBA8: irb->Base._ActualFormat = GL_RGBA8; @@ -340,24 +349,28 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; + irb->texformat = &_mesa_texformat_argb8888; break; case GL_STENCIL_INDEX8_EXT: irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT; irb->Base._BaseFormat = GL_STENCIL_INDEX; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; + irb->texformat = &_mesa_texformat_s8_z24; break; case GL_DEPTH_COMPONENT16: irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 16; irb->Base.DataType = GL_UNSIGNED_SHORT; + irb->texformat = &_mesa_texformat_z16; break; case GL_DEPTH_COMPONENT24: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 24; irb->Base.DataType = GL_UNSIGNED_INT; + irb->texformat = &_mesa_texformat_s8_z24; break; case GL_DEPTH24_STENCIL8_EXT: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; @@ -365,6 +378,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.DepthBits = 24; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; + irb->texformat = &_mesa_texformat_s8_z24; break; default: _mesa_problem(NULL, @@ -449,6 +463,8 @@ static GLboolean intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { + irb->texformat = texImage->TexFormat; + if (texImage->TexFormat == &_mesa_texformat_argb8888) { irb->Base._ActualFormat = GL_RGBA8; irb->Base._BaseFormat = GL_RGBA; @@ -458,9 +474,21 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, else if (texImage->TexFormat == &_mesa_texformat_rgb565) { irb->Base._ActualFormat = GL_RGB5; irb->Base._BaseFormat = GL_RGB; - irb->Base.DataType = GL_UNSIGNED_SHORT; + irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } + else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + irb->Base._ActualFormat = GL_RGB5_A1; + irb->Base._BaseFormat = GL_RGBA; + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to ARGB1555 texture OK\n"); + } + else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + irb->Base._ActualFormat = GL_RGBA4; + irb->Base._BaseFormat = GL_RGBA; + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to ARGB4444 texture OK\n"); + } else if (texImage->TexFormat == &_mesa_texformat_z16) { irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; @@ -631,11 +659,11 @@ intel_finish_render_texture(GLcontext * ctx, static void intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) { - struct intel_context *intel = intel_context(ctx); const struct intel_renderbuffer *depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH); const struct intel_renderbuffer *stencilRb = intel_get_renderbuffer(fb, BUFFER_STENCIL); + int i; if (stencilRb && stencilRb != depthRb) { /* we only support combined depth/stencil buffers, not separate @@ -644,32 +672,21 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; } - /* check that texture color buffers are a format we can render into */ - { - const struct gl_texture_format *supportedFormat; - GLuint i; + for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i]; + struct intel_renderbuffer *irb = intel_renderbuffer(rb); - /* The texture format we can render into seems to depend on the - * screen depth. There currently seems to be a problem when - * rendering into a rgb565 texture when the screen is abgr8888. - */ + if (rb == NULL) + continue; - if (intel->ctx.Visual.rgbBits >= 24) - supportedFormat = &_mesa_texformat_argb8888; - else - supportedFormat = &_mesa_texformat_rgb565; - - for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { - const struct gl_texture_object *texObj = - fb->Attachment[BUFFER_COLOR0 + i].Texture; - if (texObj) { - const struct gl_texture_image *texImg = - texObj->Image[0][texObj->BaseLevel]; - if (texImg && texImg->TexFormat != supportedFormat) { - fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; - break; - } - } + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_RGB565: + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB4444: + break; + default: + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; } } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 7226ee026f..f0665af482 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -61,6 +61,8 @@ struct intel_renderbuffer struct gl_renderbuffer Base; struct intel_region *region; + const struct gl_texture_format *texformat; + GLuint vbl_pending; /**< vblank sequence number of pending flip */ uint8_t *span_cache; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index c3a873f1ab..34b78ebc1a 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -29,6 +29,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/colormac.h" +#include "main/texformat.h" #include "intel_buffers.h" #include "intel_fbo.h" @@ -313,6 +314,22 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define INTEL_TAG(x) x##_RGB565 #include "intel_spantmp.h" +/* a4r4g4b4 color span and pixel functions */ +#define INTEL_PIXEL_FMT GL_BGRA +#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4_REV +#define INTEL_READ_VALUE(offset) pread_16(irb, offset) +#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v) +#define INTEL_TAG(x) x##_ARGB4444 +#include "intel_spantmp.h" + +/* a1r5g5b5 color span and pixel functions */ +#define INTEL_PIXEL_FMT GL_BGRA +#define INTEL_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5_REV +#define INTEL_READ_VALUE(offset) pread_16(irb, offset) +#define INTEL_WRITE_VALUE(offset, v) pwrite_16(irb, offset, v) +#define INTEL_TAG(x) x##_ARGB1555 +#include "intel_spantmp.h" + /* a8r8g8b8 color span and pixel functions */ #define INTEL_PIXEL_FMT GL_BGRA #define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV @@ -561,8 +578,8 @@ intel_set_span_functions(struct intel_context *intel, else tiling = I915_TILING_NONE; - if (rb->_ActualFormat == GL_RGB5) { - /* 565 RGB */ + switch (irb->texformat->MesaFormat) { + case MESA_FORMAT_RGB565: switch (tiling) { case I915_TILING_NONE: default: @@ -575,38 +592,67 @@ intel_set_span_functions(struct intel_context *intel, intel_YTile_InitPointers_RGB565(rb); break; } - } - else if (rb->_ActualFormat == GL_RGB8) { - /* 8888 RGBx */ + break; + case MESA_FORMAT_ARGB4444: switch (tiling) { case I915_TILING_NONE: default: - intelInitPointers_xRGB8888(rb); + intelInitPointers_ARGB4444(rb); break; case I915_TILING_X: - intel_XTile_InitPointers_xRGB8888(rb); + intel_XTile_InitPointers_ARGB4444(rb); break; case I915_TILING_Y: - intel_YTile_InitPointers_xRGB8888(rb); + intel_YTile_InitPointers_ARGB4444(rb); break; } - } - else if (rb->_ActualFormat == GL_RGBA8) { - /* 8888 RGBA */ + break; + case MESA_FORMAT_ARGB1555: switch (tiling) { case I915_TILING_NONE: default: - intelInitPointers_ARGB8888(rb); + intelInitPointers_ARGB1555(rb); break; case I915_TILING_X: - intel_XTile_InitPointers_ARGB8888(rb); + intel_XTile_InitPointers_ARGB1555(rb); break; case I915_TILING_Y: - intel_YTile_InitPointers_ARGB8888(rb); + intel_YTile_InitPointers_ARGB1555(rb); break; } - } - else if (rb->_ActualFormat == GL_DEPTH_COMPONENT16) { + break; + case MESA_FORMAT_ARGB8888: + if (rb->AlphaBits == 0) { /* XXX: Need xRGB8888 Mesa format */ + /* 8888 RGBx */ + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitPointers_xRGB8888(rb); + break; + case I915_TILING_X: + intel_XTile_InitPointers_xRGB8888(rb); + break; + case I915_TILING_Y: + intel_YTile_InitPointers_xRGB8888(rb); + break; + } + } else { + /* 8888 RGBA */ + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitPointers_ARGB8888(rb); + break; + case I915_TILING_X: + intel_XTile_InitPointers_ARGB8888(rb); + break; + case I915_TILING_Y: + intel_YTile_InitPointers_ARGB8888(rb); + break; + } + } + break; + case MESA_FORMAT_Z16: switch (tiling) { case I915_TILING_NONE: default: @@ -619,51 +665,57 @@ intel_set_span_functions(struct intel_context *intel, intel_YTile_InitDepthPointers_z16(rb); break; } - } - else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24) { - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitDepthPointers_z24(rb); - break; - case I915_TILING_X: - intel_XTile_InitDepthPointers_z24(rb); - break; - case I915_TILING_Y: - intel_YTile_InitDepthPointers_z24(rb); - break; - } - } - else if (rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitDepthPointers_z24_s8(rb); - break; - case I915_TILING_X: - intel_XTile_InitDepthPointers_z24_s8(rb); - break; - case I915_TILING_Y: - intel_YTile_InitDepthPointers_z24_s8(rb); - break; - } - } - else if (rb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitStencilPointers_z24_s8(rb); - break; - case I915_TILING_X: - intel_XTile_InitStencilPointers_z24_s8(rb); - break; - case I915_TILING_Y: - intel_YTile_InitStencilPointers_z24_s8(rb); - break; + break; + case MESA_FORMAT_S8_Z24: + /* There are a few different ways SW asks us to access the S8Z24 data: + * Z24 depth-only depth reads + * S8Z24 depth reads + * S8Z24 stencil reads. + */ + if (rb->_ActualFormat == GL_DEPTH_COMPONENT24) { + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitDepthPointers_z24(rb); + break; + case I915_TILING_X: + intel_XTile_InitDepthPointers_z24(rb); + break; + case I915_TILING_Y: + intel_YTile_InitDepthPointers_z24(rb); + break; + } + } else if (rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitDepthPointers_z24_s8(rb); + break; + case I915_TILING_X: + intel_XTile_InitDepthPointers_z24_s8(rb); + break; + case I915_TILING_Y: + intel_YTile_InitDepthPointers_z24_s8(rb); + break; + } + } else if (rb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitStencilPointers_z24_s8(rb); + break; + case I915_TILING_X: + intel_XTile_InitStencilPointers_z24_s8(rb); + break; + case I915_TILING_Y: + intel_YTile_InitStencilPointers_z24_s8(rb); + break; + } } - } - else { + break; + default: _mesa_problem(NULL, - "Unexpected _ActualFormat in intelSetSpanFunctions"); + "Unexpected MesaFormat in intelSetSpanFunctions"); + break; } } -- cgit v1.2.3 From f17ea143cbe214eb4b249b56264a378f839dc3a6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 16 Apr 2009 11:32:30 -0700 Subject: i915: Remove dead i830TexEnv and i915TexEnv. These LOD bias updates are covered by the texture state uploads in *_texstate.c now. --- src/mesa/drivers/dri/i915/Makefile | 2 - src/mesa/drivers/dri/i915/i830_context.c | 1 - src/mesa/drivers/dri/i915/i830_tex.c | 100 ------------------------------- src/mesa/drivers/dri/i915/i915_context.c | 1 - src/mesa/drivers/dri/i915/i915_tex.c | 78 ------------------------ 5 files changed, 182 deletions(-) delete mode 100644 src/mesa/drivers/dri/i915/i830_tex.c delete mode 100644 src/mesa/drivers/dri/i915/i915_tex.c diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 954a7e2af1..9f4bd1699f 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -11,7 +11,6 @@ DRIVER_SOURCES = \ i830_metaops.c \ i830_state.c \ i830_texblend.c \ - i830_tex.c \ i830_texstate.c \ i830_vtbl.c \ intel_render.c \ @@ -36,7 +35,6 @@ DRIVER_SOURCES = \ intel_buffers.c \ intel_blit.c \ intel_swapbuffers.c \ - i915_tex.c \ i915_tex_layout.c \ i915_texstate.c \ i915_context.c \ diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 9c540cb2bb..10b9bf371c 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -47,7 +47,6 @@ i830InitDriverFunctions(struct dd_function_table *functions) { intelInitDriverFunctions(functions); i830InitStateFuncs(functions); - i830InitTextureFuncs(functions); } extern const struct tnl_pipeline_stage *intel_pipeline[]; diff --git a/src/mesa/drivers/dri/i915/i830_tex.c b/src/mesa/drivers/dri/i915/i830_tex.c deleted file mode 100644 index 34ac42a78e..0000000000 --- a/src/mesa/drivers/dri/i915/i830_tex.c +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/imports.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "main/image.h" -#include "main/mm.h" -#include "main/texstore.h" -#include "main/texformat.h" -#include "swrast/swrast.h" - -#include "texmem.h" - -#include "i830_context.h" -#include "i830_reg.h" - - - -static void -i830TexEnv(GLcontext * ctx, GLenum target, - GLenum pname, const GLfloat * param) -{ - - switch (pname) { - case GL_TEXTURE_ENV_COLOR: - case GL_TEXTURE_ENV_MODE: - case GL_COMBINE_RGB: - case GL_COMBINE_ALPHA: - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - case GL_RGB_SCALE: - case GL_ALPHA_SCALE: - break; - - case GL_TEXTURE_LOD_BIAS:{ - struct i830_context *i830 = i830_context(ctx); - GLuint unit = ctx->Texture.CurrentUnit; - int b = (int) ((*param) * 16.0); - if (b > 63) - b = 63; - if (b < -64) - b = -64; - I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit)); - i830->lodbias_tm0s3[unit] = - ((b << TM0S3_LOD_BIAS_SHIFT) & TM0S3_LOD_BIAS_MASK); - break; - } - - default: - break; - } -} - - - - -void -i830InitTextureFuncs(struct dd_function_table *functions) -{ -/* - functions->TexEnv = i830TexEnv; -*/ -} diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 7549029a1b..fdd2cf6109 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -83,7 +83,6 @@ i915InitDriverFunctions(struct dd_function_table *functions) { intelInitDriverFunctions(functions); i915InitStateFunctions(functions); - i915InitTextureFuncs(functions); i915InitFragProgFuncs(functions); functions->UpdateState = i915InvalidateState; } diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c deleted file mode 100644 index e38d8fe79d..0000000000 --- a/src/mesa/drivers/dri/i915/i915_tex.c +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/imports.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "main/image.h" -#include "main/mm.h" -#include "main/texstore.h" -#include "main/texformat.h" -#include "swrast/swrast.h" - -#include "texmem.h" - -#include "i915_context.h" -#include "i915_reg.h" - - - -static void -i915TexEnv(GLcontext * ctx, GLenum target, - GLenum pname, const GLfloat * param) -{ - struct i915_context *i915 = I915_CONTEXT(ctx); - - switch (pname) { - case GL_TEXTURE_LOD_BIAS:{ - GLuint unit = ctx->Texture.CurrentUnit; - GLint b = (int) ((*param) * 16.0); - if (b > 255) - b = 255; - if (b < -256) - b = -256; - I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit)); - i915->lodbias_ss2[unit] = - ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK); - break; - } - - default: - break; - } -} - - -void -i915InitTextureFuncs(struct dd_function_table *functions) -{ -/* - functions->TexEnv = i915TexEnv; -*/ -} -- cgit v1.2.3 From a92bc56e2428e4219e0eaaa6f142c6cc60fee710 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 16 Apr 2009 12:38:39 +0200 Subject: r300: update r500 path for reordered WPOS and FOG fp attributes Report and regression testing by Fabio Pedretti. --- src/mesa/drivers/dri/r300/r300_state.c | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 46c3df7099..f464335422 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1701,16 +1701,29 @@ static void r500SetupRSUnit(GLcontext * ctx) ++fp_reg; } + if (InputsRead & FRAG_BIT_WPOS) { + r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) | + ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) | + ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) | + ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT); + + r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); + InputsRead &= ~FRAG_BIT_WPOS; + rs_tex_count += 4; + ++tex_ip; + ++fp_reg; + } + if (InputsRead & FRAG_BIT_FOGC) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) | - ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) | - ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) | - ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT); + r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= (rs_tex_count << R500_RS_IP_TEX_PTR_S_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT); r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_FOGC; - rs_tex_count += 4; + rs_tex_count += 1; ++tex_ip; ++fp_reg; } else { @@ -1718,19 +1731,6 @@ static void r500SetupRSUnit(GLcontext * ctx) } } - if (InputsRead & FRAG_BIT_WPOS) { - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) | - ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) | - ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) | - ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT); - - r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); - InputsRead &= ~FRAG_BIT_WPOS; - rs_tex_count += 4; - ++tex_ip; - ++fp_reg; - } - /* Setup default color if no color or tex was set */ if (rs_tex_count == 0 && col_ip == 0) { r300->hw.rr.cmd[R300_RR_INST_0] |= R500_RS_INST_COL_ID(0) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(0) | R500_RS_COL_FMT(R300_RS_COL_FMT_0001); -- cgit v1.2.3 From d7d5c97a215e6845ffa9fc60cee52da6a2d3148a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 16 Apr 2009 17:50:13 +0200 Subject: r300: cleanup frag prog setup a little Use proper fields for marking if fp is translated, and if is translated succesfully. Now if fp gets translated (even unsuccesfully) fp->translated is true. If the translation failed (i.e. because we exceeded limit of maximum texture indirections) the fp->error is set. With a little updated fallback function it prevents non native fragment programs from beeing translated with every frame (the translation would fail anyway so there's no point to try again). Also implement IsProgramNative function for GL_FRAGMENT_PROGRAM_ARB (it should give some performance boost in apps that checks if program is native and falls back to simpler shader to meet hw limits if necessary) and cleanup indentation (remove whitespaces on empty lines). --- src/mesa/drivers/dri/r300/r300_fragprog.c | 6 ++-- src/mesa/drivers/dri/r300/r300_render.c | 32 +++++++++---------- src/mesa/drivers/dri/r300/r300_shader.c | 21 ++++++++++++- src/mesa/drivers/dri/r300/r300_state.c | 52 +++++++++++++++---------------- src/mesa/drivers/dri/r300/r500_fragprog.c | 7 +++-- 5 files changed, 70 insertions(+), 48 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 32182bb667..f2d7cec5d3 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -175,7 +175,7 @@ static GLboolean transform_TEX( inst.SrcReg[0].File = PROGRAM_TEMPORARY; inst.SrcReg[0].Index = tmpreg; } - + tgt = radeonAppendInstructions(t->Program, 1); _mesa_copy_instructions(tgt, &inst, 1); @@ -466,8 +466,8 @@ void r300TranslateFragmentShader(r300ContextPtr r300, _mesa_reference_program(r300->radeon.glCtx, &compiler.program, NULL); - if (!fp->error) - fp->translated = GL_TRUE; + fp->translated = GL_TRUE; + if (fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) r300FragmentProgramDump(fp, &fp->code); r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 924305dd12..d33396e150 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -194,7 +194,7 @@ static void r300FireEB(r300ContextPtr rmesa, int vertex_count, int type) ((vertex_count + 0) << 16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); - + if (!rmesa->radeon.radeonScreen->kernel_mm) { OUT_BATCH_PACKET3(R300_PACKET3_INDX_BUFFER, 2); OUT_BATCH(R300_INDX_BUFFER_ONE_REG_WR | (0 << R300_INDX_BUFFER_SKIP_SHIFT) | @@ -224,12 +224,12 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) uint32_t voffset; int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; int i; - + if (RADEON_DEBUG & DEBUG_VERTS) fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __FUNCTION__, nr, offset); - + if (!rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH(sz+2+(nr * 2)); OUT_BATCH_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, sz - 1); @@ -240,7 +240,7 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) (rmesa->radeon.tcl.aos[i].stride << 8) | (rmesa->radeon.tcl.aos[i + 1].components << 16) | (rmesa->radeon.tcl.aos[i + 1].stride << 24)); - + voffset = rmesa->radeon.tcl.aos[i + 0].offset + offset * 4 * rmesa->radeon.tcl.aos[i + 0].stride; OUT_BATCH_RELOC(voffset, @@ -256,7 +256,7 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) RADEON_GEM_DOMAIN_GTT, 0, 0); } - + if (nr & 1) { OUT_BATCH((rmesa->radeon.tcl.aos[nr - 1].components << 0) | (rmesa->radeon.tcl.aos[nr - 1].stride << 8)); @@ -280,7 +280,7 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) (rmesa->radeon.tcl.aos[i].stride << 8) | (rmesa->radeon.tcl.aos[i + 1].components << 16) | (rmesa->radeon.tcl.aos[i + 1].stride << 24)); - + voffset = rmesa->radeon.tcl.aos[i + 0].offset + offset * 4 * rmesa->radeon.tcl.aos[i + 0].stride; OUT_BATCH(voffset); @@ -288,7 +288,7 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) offset * 4 * rmesa->radeon.tcl.aos[i + 1].stride; OUT_BATCH(voffset); } - + if (nr & 1) { OUT_BATCH((rmesa->radeon.tcl.aos[nr - 1].components << 0) | (rmesa->radeon.tcl.aos[nr - 1].stride << 8)); @@ -427,7 +427,7 @@ static int r300Fallback(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; - + FALLBACK_IF(r300->radeon.Fallback); /* Do we need to use new-style shaders? * Also is there a better way to do this? */ @@ -435,19 +435,19 @@ static int r300Fallback(GLcontext * ctx) struct r500_fragment_program *fp = (struct r500_fragment_program *) (char *)ctx->FragmentProgram._Current; if (fp) { - if (!fp->translated) { + if (!fp->translated) r500TranslateFragmentShader(r300, fp); - FALLBACK_IF(!fp->translated); - } + + FALLBACK_IF(fp->error); } } else { struct r300_fragment_program *fp = (struct r300_fragment_program *) (char *)ctx->FragmentProgram._Current; if (fp) { - if (!fp->translated) { + if (!fp->translated) r300TranslateFragmentShader(r300, fp); - FALLBACK_IF(!fp->translated); - } + + FALLBACK_IF(fp->error); } } @@ -492,7 +492,7 @@ static GLboolean r300RunNonTCLRender(GLcontext * ctx, if (!r300ValidateBuffers(ctx)) return GL_TRUE; - + return r300RunRender(ctx, stage); } @@ -517,7 +517,7 @@ static GLboolean r300RunTCLRender(GLcontext * ctx, if (!r300ValidateBuffers(ctx)) return GL_TRUE; - + r300UpdateShaders(rmesa); vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index f30fd986e0..d90658ba47 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -81,7 +81,26 @@ r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) static GLboolean r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { - return GL_TRUE; + if (target == GL_FRAGMENT_PROGRAM_ARB) { + r300ContextPtr rmesa = R300_CONTEXT(ctx); + + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog; + + if (!r500_fp->translated) + r500TranslateFragmentShader(rmesa, r500_fp); + + return !r500_fp->error; + } else { + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; + + if (!r300_fp->translated) + r300TranslateFragmentShader(rmesa, r300_fp); + + return !r300_fp->error; + } + } else + return GL_TRUE; } void r300InitShaderFuncs(struct dd_function_table *functions) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index f464335422..64ec870976 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2301,7 +2301,7 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, } -static void r300SetupPixelShader(r300ContextPtr rmesa) +static GLboolean r300SetupPixelShader(r300ContextPtr rmesa) { GLcontext *ctx = rmesa->radeon.glCtx; struct r300_fragment_program *fp = (struct r300_fragment_program *) @@ -2309,15 +2309,12 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) struct r300_fragment_program_code *code; int i, k; - if (!fp) /* should only happenen once, just after context is created */ - return; - r300TranslateFragmentShader(rmesa, fp); - if (!fp->translated) { - fprintf(stderr, "%s: No valid fragment shader, exiting\n", - __FUNCTION__); - return; - } + + /* Program is not native, fallback to software */ + if (fp->error) + return GL_FALSE; + code = &fp->code; r300SetupTextures(ctx); @@ -2369,6 +2366,8 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat24(constant[2]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 3] = r300PackFloat24(constant[3]); } + + return GL_TRUE; } #define bump_r500fp_count(ptr, new_count) do{\ @@ -2385,7 +2384,7 @@ static void r300SetupPixelShader(r300ContextPtr rmesa) if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ } while(0) -static void r500SetupPixelShader(r300ContextPtr rmesa) +static GLboolean r500SetupPixelShader(r300ContextPtr rmesa) { GLcontext *ctx = rmesa->radeon.glCtx; struct r500_fragment_program *fp = (struct r500_fragment_program *) @@ -2393,18 +2392,15 @@ static void r500SetupPixelShader(r300ContextPtr rmesa) int i; struct r500_fragment_program_code *code; - if (!fp) /* should only happenen once, just after context is created */ - return; - ((drm_r300_cmd_header_t *) rmesa->hw.r500fp.cmd)->r500fp.count = 0; ((drm_r300_cmd_header_t *) rmesa->hw.r500fp_const.cmd)->r500fp.count = 0; r500TranslateFragmentShader(rmesa, fp); - if (!fp->translated) { - fprintf(stderr, "%s: No valid fragment shader, exiting\n", - __FUNCTION__); - return; - } + + /* Program is not native, fallback to software */ + if (fp->error) + return GL_FALSE; + code = &fp->code; r300SetupTextures(ctx); @@ -2445,6 +2441,7 @@ static void r500SetupPixelShader(r300ContextPtr rmesa) } bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, code->const_nr * 4); + return GL_TRUE; } void r300UpdateShaderStates(r300ContextPtr rmesa) @@ -2452,6 +2449,10 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) GLcontext *ctx; ctx = rmesa->radeon.glCtx; + /* should only happenen once, just after context is created */ + if (!ctx->FragmentProgram._Current) + return; + r300SetEarlyZState(ctx); /* w_fmt value is set to get best performance @@ -2475,19 +2476,18 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; } - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) - r500SetupPixelShader(rmesa); - else - r300SetupPixelShader(rmesa); - - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) + if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + if (!r500SetupPixelShader(rmesa)) + return; r500SetupRSUnit(ctx); - else + } else { + if (!r300SetupPixelShader(rmesa)) + return; r300SetupRSUnit(ctx); + } if ((rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) r300SetupVertexProgram(rmesa); - } /** diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 07a2a7b17c..1b8343ab21 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -493,7 +493,10 @@ void r500TranslateFragmentShader(r300ContextPtr r300, _mesa_print_program(compiler.program); } - fp->translated = r500FragmentProgramEmit(&compiler); + if (!r500FragmentProgramEmit(&compiler)) + fp->error = GL_TRUE; + + fp->translated = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ _mesa_free_parameter_list(fp->mesa_program.Base.Parameters); @@ -505,7 +508,7 @@ void r500TranslateFragmentShader(r300ContextPtr r300, r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); if (RADEON_DEBUG & DEBUG_PIXEL) { - if (fp->translated) { + if (!fp->error) { _mesa_printf("Machine-readable code:\n"); dump_program(&fp->code); } -- cgit v1.2.3 From 9028335371af465a73c13282a3608f76168e4d63 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 16 Apr 2009 18:22:44 +0200 Subject: r300: we always want non NDC coords format for swtcl --- src/mesa/drivers/dri/r300/r300_swtcl.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 03c1521de7..553bdb12dd 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -66,10 +66,7 @@ do { \ static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten, GLuint vap_out_fmt_1) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; struct vertex_attribute *attrs = rmesa->swtcl.vert_attrs; - int vte = 0; int i, j, reg_count; uint32_t *vir0 = &rmesa->hw.vir[0].cmd[1]; uint32_t *vir1 = &rmesa->hw.vir[1].cmd[1]; @@ -123,7 +120,6 @@ static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsW R300_STATECHANGE(rmesa, vir[0]); R300_STATECHANGE(rmesa, vir[1]); R300_STATECHANGE(rmesa, vof); - R300_STATECHANGE(rmesa, vte); R300_STATECHANGE(rmesa, vic); if (rmesa->radeon.radeonScreen->kernel_mm) { @@ -145,24 +141,6 @@ static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsW * for HW TCL path, but not for SW TCL. */ rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_out_fmt_1; - - vte = rmesa->hw.vte.cmd[1]; - vte &= ~(R300_VTX_XY_FMT | R300_VTX_Z_FMT | R300_VTX_W0_FMT); - /* Important: - */ - if ( VB->NdcPtr != NULL ) { - VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; - vte |= R300_VTX_XY_FMT | R300_VTX_Z_FMT; - } - else { - VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr; - vte |= R300_VTX_W0_FMT; - } - - assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL ); - - rmesa->hw.vte.cmd[1] = vte; - rmesa->hw.vte.cmd[2] = rmesa->radeon.swtcl.vertex_size; } @@ -180,6 +158,9 @@ static void r300SetVertexFormat( GLcontext *ctx ) rmesa->swtcl.coloroffset = rmesa->swtcl.specoffset = 0; rmesa->radeon.swtcl.vertex_attr_count = 0; + /* We always want non Ndc coords format */ + VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr; + if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_POS)) { InputsRead |= 1 << VERT_ATTRIB_POS; OutputsWritten |= 1 << VERT_RESULT_HPOS; -- cgit v1.2.3 From 7571d5d3b013e544a9fbde91e4aec05e0b13b4cb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 16 Apr 2009 20:06:08 -0700 Subject: egl/main/Makefile: Add dependency of install target on default build target Signed-off-by: Alan Coopersmith --- src/egl/main/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 5ee246dc3f..8cfa25ca16 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -64,7 +64,7 @@ $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) -install $(TOP)/$(LIB_DIR) \ $(EGL_LIB_DEPS) $(OBJECTS) -install: +install: default $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR) -- cgit v1.2.3 From a902b6ba48c8ff8bebda95e32310781d9a0763ce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 10:28:15 -0600 Subject: docs: separate compilation units in 7.5 --- docs/relnotes-7.5.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index 3c822da863..c75720b699 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -58,6 +58,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
  • GL_NV_texture_env_combine4 extension (software drivers, i965/i915 drivers)
  • GL_EXT_texture_swizzle extension (software drivers, i965 driver)
  • Updated SPARC assembly optimizations (David S. Miller) +
  • Initial support for separate compilation units in GLSL compiler. -- cgit v1.2.3 From 189db329caba805f4ae9ab28c675f37565fd4c9c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 10:28:27 -0600 Subject: demos: set init window size, not pos --- progs/glsl/linktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c index 601b24e893..988d082341 100644 --- a/progs/glsl/linktest.c +++ b/progs/glsl/linktest.c @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) { glutInit(&argc, argv); - glutInitWindowPosition( 0, 0); + glutInitWindowSize(300, 300); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); -- cgit v1.2.3 From 56c2cd7ae2a4324bc191a680c2429add1a5a1644 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 16 Apr 2009 21:41:01 +0100 Subject: scons: Cleanup. --- scons/mslib_sa.py | 4 +--- scons/winsdk.py | 22 +++++++--------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/scons/mslib_sa.py b/scons/mslib_sa.py index c5ebdec273..50d47ee37b 100644 --- a/scons/mslib_sa.py +++ b/scons/mslib_sa.py @@ -118,12 +118,10 @@ def generate(env): if env.Detect('lib'): env['AR'] = 'lib' - elif env.Detect('link'): + else: # Recent WINDDK versions do not ship with lib. env['AR'] = 'link /lib' env['TEMPFILE'] = TempFileMunge - else: - raise SCons.Errors.InternalError, "lib and link not found" env['ARFLAGS'] = SCons.Util.CLVar('/nologo') env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" env['LIBPREFIX'] = '' diff --git a/scons/winsdk.py b/scons/winsdk.py index 255f9c5a65..7e874a507b 100644 --- a/scons/winsdk.py +++ b/scons/winsdk.py @@ -77,13 +77,9 @@ def get_vc_paths(env): raise SCons.Errors.InternalError, "Unsupported target machine" include_dir = 'include' - exe_path = os.path.join(vc_root, bin_dir) - include_path = os.path.join(vc_root, include_dir) - lib_path = os.path.join(vc_root, lib_dir) - - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) + env.PrependENVPath('PATH', os.path.join(vc_root, bin_dir)) + env.PrependENVPath('INCLUDE', os.path.join(vc_root, include_dir)) + env.PrependENVPath('LIB', os.path.join(vc_root, lib_dir)) def get_sdk_root(env): if SCons.Util.can_read_reg: @@ -108,18 +104,14 @@ def get_sdk_paths(env): if target_cpu in ('generic', 'x86'): lib_dir = 'Lib' elif target_cpu == 'x86_64': - lib_dir = 'Lib/x64' + lib_dir = r'Lib\x64' else: raise SCons.Errors.InternalError, "Unsupported target machine" include_dir = 'Include' - exe_path = os.path.join(sdk_root, bin_dir) - include_path = os.path.join(sdk_root, include_dir) - lib_path = os.path.join(sdk_root, lib_dir) - - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) + env.PrependENVPath('PATH', os.path.join(sdk_root, bin_dir)) + env.PrependENVPath('INCLUDE', os.path.join(sdk_root, include_dir)) + env.PrependENVPath('LIB', os.path.join(sdk_root, lib_dir)) def generate(env): if not env.has_key('ENV'): -- cgit v1.2.3 From 3a618da6e15a6dc4351eb933583569a1ecefc768 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Apr 2009 10:07:53 +0100 Subject: python/retrace: Rename module as it conflicts with a builtin module. And there is no way to override a builtin module... sigh --- .../state_trackers/python/retrace/interpreter.py | 2 +- src/gallium/state_trackers/python/retrace/parse.py | 392 +++++++++++++++++++++ .../state_trackers/python/retrace/parser.py | 360 +------------------ 3 files changed, 394 insertions(+), 360 deletions(-) create mode 100755 src/gallium/state_trackers/python/retrace/parse.py diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 5ea07724a5..5d4d04498b 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -32,7 +32,7 @@ import struct import gallium import model -import parser +import parse as parser try: diff --git a/src/gallium/state_trackers/python/retrace/parse.py b/src/gallium/state_trackers/python/retrace/parse.py new file mode 100755 index 0000000000..b0f3e8a432 --- /dev/null +++ b/src/gallium/state_trackers/python/retrace/parse.py @@ -0,0 +1,392 @@ +#!/usr/bin/env python +########################################################################## +# +# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sub license, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice (including the +# next paragraph) shall be included in all copies or substantial portions +# of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR +# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +########################################################################## + + +import sys +import xml.parsers.expat +import binascii +import optparse + +from model import * + + +ELEMENT_START, ELEMENT_END, CHARACTER_DATA, EOF = range(4) + + +class XmlToken: + + def __init__(self, type, name_or_data, attrs = None, line = None, column = None): + assert type in (ELEMENT_START, ELEMENT_END, CHARACTER_DATA, EOF) + self.type = type + self.name_or_data = name_or_data + self.attrs = attrs + self.line = line + self.column = column + + def __str__(self): + if self.type == ELEMENT_START: + return '<' + self.name_or_data + ' ...>' + if self.type == ELEMENT_END: + return '' + if self.type == CHARACTER_DATA: + return self.name_or_data + if self.type == EOF: + return 'end of file' + assert 0 + + +class XmlTokenizer: + """Expat based XML tokenizer.""" + + def __init__(self, fp, skip_ws = True): + self.fp = fp + self.tokens = [] + self.index = 0 + self.final = False + self.skip_ws = skip_ws + + self.character_pos = 0, 0 + self.character_data = '' + + self.parser = xml.parsers.expat.ParserCreate() + self.parser.StartElementHandler = self.handle_element_start + self.parser.EndElementHandler = self.handle_element_end + self.parser.CharacterDataHandler = self.handle_character_data + + def handle_element_start(self, name, attributes): + self.finish_character_data() + line, column = self.pos() + token = XmlToken(ELEMENT_START, name, attributes, line, column) + self.tokens.append(token) + + def handle_element_end(self, name): + self.finish_character_data() + line, column = self.pos() + token = XmlToken(ELEMENT_END, name, None, line, column) + self.tokens.append(token) + + def handle_character_data(self, data): + if not self.character_data: + self.character_pos = self.pos() + self.character_data += data + + def finish_character_data(self): + if self.character_data: + if not self.skip_ws or not self.character_data.isspace(): + line, column = self.character_pos + token = XmlToken(CHARACTER_DATA, self.character_data, None, line, column) + self.tokens.append(token) + self.character_data = '' + + def next(self): + size = 16*1024 + while self.index >= len(self.tokens) and not self.final: + self.tokens = [] + self.index = 0 + data = self.fp.read(size) + self.final = len(data) < size + data = data.rstrip('\0') + try: + self.parser.Parse(data, self.final) + except xml.parsers.expat.ExpatError, e: + #if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS: + if e.code == 3: + pass + else: + raise e + if self.index >= len(self.tokens): + line, column = self.pos() + token = XmlToken(EOF, None, None, line, column) + else: + token = self.tokens[self.index] + self.index += 1 + return token + + def pos(self): + return self.parser.CurrentLineNumber, self.parser.CurrentColumnNumber + + +class TokenMismatch(Exception): + + def __init__(self, expected, found): + self.expected = expected + self.found = found + + def __str__(self): + return '%u:%u: %s expected, %s found' % (self.found.line, self.found.column, str(self.expected), str(self.found)) + + + +class XmlParser: + """Base XML document parser.""" + + def __init__(self, fp): + self.tokenizer = XmlTokenizer(fp) + self.consume() + + def consume(self): + self.token = self.tokenizer.next() + + def match_element_start(self, name): + return self.token.type == ELEMENT_START and self.token.name_or_data == name + + def match_element_end(self, name): + return self.token.type == ELEMENT_END and self.token.name_or_data == name + + def element_start(self, name): + while self.token.type == CHARACTER_DATA: + self.consume() + if self.token.type != ELEMENT_START: + raise TokenMismatch(XmlToken(ELEMENT_START, name), self.token) + if self.token.name_or_data != name: + raise TokenMismatch(XmlToken(ELEMENT_START, name), self.token) + attrs = self.token.attrs + self.consume() + return attrs + + def element_end(self, name): + while self.token.type == CHARACTER_DATA: + self.consume() + if self.token.type != ELEMENT_END: + raise TokenMismatch(XmlToken(ELEMENT_END, name), self.token) + if self.token.name_or_data != name: + raise TokenMismatch(XmlToken(ELEMENT_END, name), self.token) + self.consume() + + def character_data(self, strip = True): + data = '' + while self.token.type == CHARACTER_DATA: + data += self.token.name_or_data + self.consume() + if strip: + data = data.strip() + return data + + +class TraceParser(XmlParser): + + def __init__(self, fp): + XmlParser.__init__(self, fp) + self.last_call_no = 0 + + def parse(self): + self.element_start('trace') + while self.token.type not in (ELEMENT_END, EOF): + call = self.parse_call() + self.handle_call(call) + if self.token.type != EOF: + self.element_end('trace') + + def parse_call(self): + attrs = self.element_start('call') + try: + no = int(attrs['no']) + except KeyError: + self.last_call_no += 1 + no = self.last_call_no + else: + self.last_call_no = no + klass = attrs['class'] + method = attrs['method'] + args = [] + ret = None + while self.token.type == ELEMENT_START: + if self.token.name_or_data == 'arg': + arg = self.parse_arg() + args.append(arg) + elif self.token.name_or_data == 'ret': + ret = self.parse_ret() + elif self.token.name_or_data == 'call': + # ignore nested function calls + self.parse_call() + else: + raise TokenMismatch(" or ", self.token) + self.element_end('call') + + return Call(no, klass, method, args, ret) + + def parse_arg(self): + attrs = self.element_start('arg') + name = attrs['name'] + value = self.parse_value() + self.element_end('arg') + + return name, value + + def parse_ret(self): + attrs = self.element_start('ret') + value = self.parse_value() + self.element_end('ret') + + return value + + def parse_value(self): + expected_tokens = ('null', 'bool', 'int', 'uint', 'float', 'string', 'enum', 'array', 'struct', 'ptr', 'bytes') + if self.token.type == ELEMENT_START: + if self.token.name_or_data in expected_tokens: + method = getattr(self, 'parse_' + self.token.name_or_data) + return method() + raise TokenMismatch(" or " .join(expected_tokens), self.token) + + def parse_null(self): + self.element_start('null') + self.element_end('null') + return Literal(None) + + def parse_bool(self): + self.element_start('bool') + value = int(self.character_data()) + self.element_end('bool') + return Literal(value) + + def parse_int(self): + self.element_start('int') + value = int(self.character_data()) + self.element_end('int') + return Literal(value) + + def parse_uint(self): + self.element_start('uint') + value = int(self.character_data()) + self.element_end('uint') + return Literal(value) + + def parse_float(self): + self.element_start('float') + value = float(self.character_data()) + self.element_end('float') + return Literal(value) + + def parse_enum(self): + self.element_start('enum') + name = self.character_data() + self.element_end('enum') + return NamedConstant(name) + + def parse_string(self): + self.element_start('string') + value = self.character_data() + self.element_end('string') + return Literal(value) + + def parse_bytes(self): + self.element_start('bytes') + value = binascii.a2b_hex(self.character_data()) + self.element_end('bytes') + return Literal(value) + + def parse_array(self): + self.element_start('array') + elems = [] + while self.token.type != ELEMENT_END: + elems.append(self.parse_elem()) + self.element_end('array') + return Array(elems) + + def parse_elem(self): + self.element_start('elem') + value = self.parse_value() + self.element_end('elem') + return value + + def parse_struct(self): + attrs = self.element_start('struct') + name = attrs['name'] + members = [] + while self.token.type != ELEMENT_END: + members.append(self.parse_member()) + self.element_end('struct') + return Struct(name, members) + + def parse_member(self): + attrs = self.element_start('member') + name = attrs['name'] + value = self.parse_value() + self.element_end('member') + + return name, value + + def parse_ptr(self): + self.element_start('ptr') + address = self.character_data() + self.element_end('ptr') + + return Pointer(address) + + def handle_call(self, call): + pass + + +class TraceDumper(TraceParser): + + def __init__(self, fp): + TraceParser.__init__(self, fp) + self.formatter = format.DefaultFormatter(sys.stdout) + self.pretty_printer = PrettyPrinter(self.formatter) + + def handle_call(self, call): + call.visit(self.pretty_printer) + self.formatter.newline() + + +class Main: + '''Common main class for all retrace command line utilities.''' + + def __init__(self): + pass + + def main(self): + optparser = self.get_optparser() + (options, args) = optparser.parse_args(sys.argv[1:]) + + if args: + for arg in args: + if arg.endswith('.gz'): + from gzip import GzipFile + stream = GzipFile(arg, 'rt') + elif arg.endswith('.bz2'): + from bz2 import BZ2File + stream = BZ2File(arg, 'rt') + else: + stream = open(arg, 'rt') + self.process_arg(stream, options) + else: + self.process_arg(stream, options) + + def get_optparser(self): + optparser = optparse.OptionParser( + usage="\n\t%prog [options] [traces] ...") + return optparser + + def process_arg(self, stream, options): + parser = TraceDumper(stream) + parser.parse() + + +if __name__ == '__main__': + Main().main() diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py index b0f3e8a432..bd47c9a6b0 100755 --- a/src/gallium/state_trackers/python/retrace/parser.py +++ b/src/gallium/state_trackers/python/retrace/parser.py @@ -27,365 +27,7 @@ ########################################################################## -import sys -import xml.parsers.expat -import binascii -import optparse - -from model import * - - -ELEMENT_START, ELEMENT_END, CHARACTER_DATA, EOF = range(4) - - -class XmlToken: - - def __init__(self, type, name_or_data, attrs = None, line = None, column = None): - assert type in (ELEMENT_START, ELEMENT_END, CHARACTER_DATA, EOF) - self.type = type - self.name_or_data = name_or_data - self.attrs = attrs - self.line = line - self.column = column - - def __str__(self): - if self.type == ELEMENT_START: - return '<' + self.name_or_data + ' ...>' - if self.type == ELEMENT_END: - return '' - if self.type == CHARACTER_DATA: - return self.name_or_data - if self.type == EOF: - return 'end of file' - assert 0 - - -class XmlTokenizer: - """Expat based XML tokenizer.""" - - def __init__(self, fp, skip_ws = True): - self.fp = fp - self.tokens = [] - self.index = 0 - self.final = False - self.skip_ws = skip_ws - - self.character_pos = 0, 0 - self.character_data = '' - - self.parser = xml.parsers.expat.ParserCreate() - self.parser.StartElementHandler = self.handle_element_start - self.parser.EndElementHandler = self.handle_element_end - self.parser.CharacterDataHandler = self.handle_character_data - - def handle_element_start(self, name, attributes): - self.finish_character_data() - line, column = self.pos() - token = XmlToken(ELEMENT_START, name, attributes, line, column) - self.tokens.append(token) - - def handle_element_end(self, name): - self.finish_character_data() - line, column = self.pos() - token = XmlToken(ELEMENT_END, name, None, line, column) - self.tokens.append(token) - - def handle_character_data(self, data): - if not self.character_data: - self.character_pos = self.pos() - self.character_data += data - - def finish_character_data(self): - if self.character_data: - if not self.skip_ws or not self.character_data.isspace(): - line, column = self.character_pos - token = XmlToken(CHARACTER_DATA, self.character_data, None, line, column) - self.tokens.append(token) - self.character_data = '' - - def next(self): - size = 16*1024 - while self.index >= len(self.tokens) and not self.final: - self.tokens = [] - self.index = 0 - data = self.fp.read(size) - self.final = len(data) < size - data = data.rstrip('\0') - try: - self.parser.Parse(data, self.final) - except xml.parsers.expat.ExpatError, e: - #if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS: - if e.code == 3: - pass - else: - raise e - if self.index >= len(self.tokens): - line, column = self.pos() - token = XmlToken(EOF, None, None, line, column) - else: - token = self.tokens[self.index] - self.index += 1 - return token - - def pos(self): - return self.parser.CurrentLineNumber, self.parser.CurrentColumnNumber - - -class TokenMismatch(Exception): - - def __init__(self, expected, found): - self.expected = expected - self.found = found - - def __str__(self): - return '%u:%u: %s expected, %s found' % (self.found.line, self.found.column, str(self.expected), str(self.found)) - - - -class XmlParser: - """Base XML document parser.""" - - def __init__(self, fp): - self.tokenizer = XmlTokenizer(fp) - self.consume() - - def consume(self): - self.token = self.tokenizer.next() - - def match_element_start(self, name): - return self.token.type == ELEMENT_START and self.token.name_or_data == name - - def match_element_end(self, name): - return self.token.type == ELEMENT_END and self.token.name_or_data == name - - def element_start(self, name): - while self.token.type == CHARACTER_DATA: - self.consume() - if self.token.type != ELEMENT_START: - raise TokenMismatch(XmlToken(ELEMENT_START, name), self.token) - if self.token.name_or_data != name: - raise TokenMismatch(XmlToken(ELEMENT_START, name), self.token) - attrs = self.token.attrs - self.consume() - return attrs - - def element_end(self, name): - while self.token.type == CHARACTER_DATA: - self.consume() - if self.token.type != ELEMENT_END: - raise TokenMismatch(XmlToken(ELEMENT_END, name), self.token) - if self.token.name_or_data != name: - raise TokenMismatch(XmlToken(ELEMENT_END, name), self.token) - self.consume() - - def character_data(self, strip = True): - data = '' - while self.token.type == CHARACTER_DATA: - data += self.token.name_or_data - self.consume() - if strip: - data = data.strip() - return data - - -class TraceParser(XmlParser): - - def __init__(self, fp): - XmlParser.__init__(self, fp) - self.last_call_no = 0 - - def parse(self): - self.element_start('trace') - while self.token.type not in (ELEMENT_END, EOF): - call = self.parse_call() - self.handle_call(call) - if self.token.type != EOF: - self.element_end('trace') - - def parse_call(self): - attrs = self.element_start('call') - try: - no = int(attrs['no']) - except KeyError: - self.last_call_no += 1 - no = self.last_call_no - else: - self.last_call_no = no - klass = attrs['class'] - method = attrs['method'] - args = [] - ret = None - while self.token.type == ELEMENT_START: - if self.token.name_or_data == 'arg': - arg = self.parse_arg() - args.append(arg) - elif self.token.name_or_data == 'ret': - ret = self.parse_ret() - elif self.token.name_or_data == 'call': - # ignore nested function calls - self.parse_call() - else: - raise TokenMismatch(" or ", self.token) - self.element_end('call') - - return Call(no, klass, method, args, ret) - - def parse_arg(self): - attrs = self.element_start('arg') - name = attrs['name'] - value = self.parse_value() - self.element_end('arg') - - return name, value - - def parse_ret(self): - attrs = self.element_start('ret') - value = self.parse_value() - self.element_end('ret') - - return value - - def parse_value(self): - expected_tokens = ('null', 'bool', 'int', 'uint', 'float', 'string', 'enum', 'array', 'struct', 'ptr', 'bytes') - if self.token.type == ELEMENT_START: - if self.token.name_or_data in expected_tokens: - method = getattr(self, 'parse_' + self.token.name_or_data) - return method() - raise TokenMismatch(" or " .join(expected_tokens), self.token) - - def parse_null(self): - self.element_start('null') - self.element_end('null') - return Literal(None) - - def parse_bool(self): - self.element_start('bool') - value = int(self.character_data()) - self.element_end('bool') - return Literal(value) - - def parse_int(self): - self.element_start('int') - value = int(self.character_data()) - self.element_end('int') - return Literal(value) - - def parse_uint(self): - self.element_start('uint') - value = int(self.character_data()) - self.element_end('uint') - return Literal(value) - - def parse_float(self): - self.element_start('float') - value = float(self.character_data()) - self.element_end('float') - return Literal(value) - - def parse_enum(self): - self.element_start('enum') - name = self.character_data() - self.element_end('enum') - return NamedConstant(name) - - def parse_string(self): - self.element_start('string') - value = self.character_data() - self.element_end('string') - return Literal(value) - - def parse_bytes(self): - self.element_start('bytes') - value = binascii.a2b_hex(self.character_data()) - self.element_end('bytes') - return Literal(value) - - def parse_array(self): - self.element_start('array') - elems = [] - while self.token.type != ELEMENT_END: - elems.append(self.parse_elem()) - self.element_end('array') - return Array(elems) - - def parse_elem(self): - self.element_start('elem') - value = self.parse_value() - self.element_end('elem') - return value - - def parse_struct(self): - attrs = self.element_start('struct') - name = attrs['name'] - members = [] - while self.token.type != ELEMENT_END: - members.append(self.parse_member()) - self.element_end('struct') - return Struct(name, members) - - def parse_member(self): - attrs = self.element_start('member') - name = attrs['name'] - value = self.parse_value() - self.element_end('member') - - return name, value - - def parse_ptr(self): - self.element_start('ptr') - address = self.character_data() - self.element_end('ptr') - - return Pointer(address) - - def handle_call(self, call): - pass - - -class TraceDumper(TraceParser): - - def __init__(self, fp): - TraceParser.__init__(self, fp) - self.formatter = format.DefaultFormatter(sys.stdout) - self.pretty_printer = PrettyPrinter(self.formatter) - - def handle_call(self, call): - call.visit(self.pretty_printer) - self.formatter.newline() - - -class Main: - '''Common main class for all retrace command line utilities.''' - - def __init__(self): - pass - - def main(self): - optparser = self.get_optparser() - (options, args) = optparser.parse_args(sys.argv[1:]) - - if args: - for arg in args: - if arg.endswith('.gz'): - from gzip import GzipFile - stream = GzipFile(arg, 'rt') - elif arg.endswith('.bz2'): - from bz2 import BZ2File - stream = BZ2File(arg, 'rt') - else: - stream = open(arg, 'rt') - self.process_arg(stream, options) - else: - self.process_arg(stream, options) - - def get_optparser(self): - optparser = optparse.OptionParser( - usage="\n\t%prog [options] [traces] ...") - return optparser - - def process_arg(self, stream, options): - parser = TraceDumper(stream) - parser.parse() +from parse import * if __name__ == '__main__': -- cgit v1.2.3 From db93dcecc80a45e850b4594326fc453c950b54f5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 10:17:59 +0100 Subject: gallium: add #warning to mutex-based atomic implementation Some builds end up picking this up. --- src/gallium/include/pipe/p_atomic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index f2fe083efa..7698ac5e03 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -299,6 +299,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) * Add an assembly port instead. It may abort and * doesn't destroy used mutexes. */ +#warning "using mutex-based fallback for pipe_atomic" struct pipe_atomic { pipe_mutex mutex; -- cgit v1.2.3 From 29a2f6fead25b8231c27ec47cadb9265736d8527 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 10:38:07 +0100 Subject: util: flush stdout before emitting debug_printf on stderr A lot of the mesa demos emit commentary on stdout, try to keep it in sync with the corresponding output from debug_printf(). --- src/gallium/auxiliary/util/u_debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 96a2222f9b..ae47a274a6 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -109,6 +109,7 @@ void _debug_vprintf(const char *format, va_list ap) } if(GetConsoleWindow() && !IsDebuggerPresent()) { + fflush(stdout); vfprintf(stderr, format, ap); fflush(stderr); } @@ -145,6 +146,7 @@ void _debug_vprintf(const char *format, va_list ap) /* TODO */ #else /* !PIPE_SUBSYSTEM_WINDOWS */ #ifdef DEBUG + fflush(stdout); vfprintf(stderr, format, ap); #endif #endif -- cgit v1.2.3 From 687f331a1ff0721d1a84c203eb7f721527a3f882 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 11:01:22 +0100 Subject: gallium: simplify further the logic for selecting mutex implementation Cleaner than the previous cleanup... --- src/gallium/include/pipe/p_atomic.h | 77 ++++++++++++------------------------- 1 file changed, 24 insertions(+), 53 deletions(-) diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index 7698ac5e03..54dab12f89 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -18,58 +18,29 @@ extern "C" { /* Favor OS-provided implementations. + * + * Where no OS-provided implementation is available, fall back to + * locally coded assembly, compiler intrinsic or ultimately a + * mutex-based implementation. */ -#define PIPE_ATOMIC_OS_UNLOCKED \ - (defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || \ - defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)) - -#define PIPE_ATOMIC_OS_MS_INTERLOCK \ - (!defined(PIPE_CC_GCC) && \ - !PIPE_ATOMIC_OS_UNLOCKED && \ - defined(PIPE_SUBSYSTEM_WINDOWS_USER)) - -#define PIPE_ATOMIC_OS_PROVIDED \ - (PIPE_ATOMIC_OS_UNLOCKED || \ - PIPE_ATOMIC_OS_MS_INTERLOCK) - -/* Where no OS-provided implementation is available, fall back to - * either locally coded assembly or ultimately a mutex-based - * implementation: - */ -#define PIPE_ATOMIC_ASM_GCC_X86 \ - (!PIPE_ATOMIC_OS_PROVIDED && \ - defined(PIPE_CC_GCC) && \ - defined(PIPE_ARCH_X86)) - -/* KW: this was originally used when x86 asm wasn't available. - * Maintain that logic here. - */ -#define PIPE_ATOMIC_GCC_INTRINISIC \ - (!PIPE_ATOMIC_OS_PROVIDED && \ - !PIPE_ATOMIC_ASM_GCC_X86 && \ - defined(PIPE_CC_GCC)) - -#define PIPE_ATOMIC_ASM_MSVC_X86 \ - (!PIPE_ATOMIC_OS_PROVIDED && \ - defined(PIPE_CC_MSVC) && \ - defined(PIPE_ARCH_X86)) - -#define PIPE_ATOMIC_ASM \ - (PIPE_ATOMIC_ASM_GCC_X86 || \ - PIPE_ATOMIC_ASM_GCC_INTRINSIC || \ - PIPE_ATOMIC_ASM_MSVC_X86) - - -/* Where no OS-provided or locally-coded assembly implemenation is - * available, use pipe_mutex: - */ -#define PIPE_ATOMIC_MUTEX \ - (!PIPE_ATOMIC_OS_PROVIDED && \ - !PIPE_ATOMIC_ASM) +#if (defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || \ + defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)) +#define PIPE_ATOMIC_OS_UNLOCKED +#elif (defined(PIPE_CC_MSVC) && defined(PIPE_SUBSYSTEM_WINDOWS_USER)) +#define PIPE_ATOMIC_OS_MS_INTERLOCK +#elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)) +#define PIPE_ATOMIC_ASM_MSVC_X86 +#elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) +#define PIPE_ATOMIC_ASM_GCC_X86 +#elif defined(PIPE_CC_GCC) +#define PIPE_ATOMIC_GCC_INTRINISIC +#else +#define PIPE_ATOMIC_MUTEX +#endif -#if (PIPE_ATOMIC_ASM_GCC_X86) +#if defined(PIPE_ATOMIC_ASM_GCC_X86) #define PIPE_ATOMIC "GCC x86 assembly" @@ -115,7 +86,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) /* Implementation using GCC-provided synchronization intrinsics */ -#if (PIPE_ATOMIC_ASM_GCC_INTRINSIC) +#if defined(PIPE_ATOMIC_ASM_GCC_INTRINSIC) #define PIPE_ATOMIC "GCC Sync Intrinsics" @@ -157,7 +128,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) /* Unlocked version for single threaded environments, such as some * windows kernel modules. */ -#if (PIPE_ATOMIC_OS_UNLOCKED) +#if defined(PIPE_ATOMIC_OS_UNLOCKED) #define PIPE_ATOMIC "Unlocked" @@ -178,7 +149,7 @@ struct pipe_atomic /* Locally coded assembly for MSVC on x86: */ -#if (PIPE_ATOMIC_ASM_MSVC_X86) +#if defined(PIPE_ATOMIC_ASM_MSVC_X86) #define PIPE_ATOMIC "MSVC x86 assembly" @@ -246,7 +217,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) #endif -#if (PIPE_ATOMIC_OS_MS_INTERLOCK) +#if defined(PIPE_ATOMIC_OS_MS_INTERLOCK) #define PIPE_ATOMIC "MS userspace interlocks" @@ -288,7 +259,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) -#if (PIPE_ATOMIC_MUTEX) +#if defined(PIPE_ATOMIC_MUTEX) #define PIPE_ATOMIC "mutex-based fallback" -- cgit v1.2.3 From ee2a5f307a026c1c258d3f7616d46cc7230d77ce Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 17 Apr 2009 07:05:24 -0400 Subject: egl: don't crash with one more khronos api --- src/gallium/winsys/egl_xlib/egl_xlib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index 9ceb67d2ac..68fe64a52e 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -388,6 +388,7 @@ xlib_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx) /* API-dependent clean-up */ switch (context->Base.ClientAPI) { case EGL_OPENGL_ES_API: + case EGL_OPENVG_API: /* fall-through */ case EGL_OPENGL_API: st_destroy_context(context->Context); -- cgit v1.2.3 From e50dd26ca6d0eb0d0f97c2780020ea16e3d4a687 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 17 Apr 2009 11:47:30 +0200 Subject: gallium: Create OGL state tracker wrappers for various CPU access operations. There are two usage types of buffer CPU accesses: One where we try to use the buffer contents for multiple draw commands in a batch. (batch := sequence of commands that are flushed together), like incrementally adding bitmaps to a bitmap texture that is reallocated on flush. And one where we assume we can safely overwrite the old buffer contexts, like glTexSubImage. In this case we need to make sure all old drawing commands referencing the buffer are flushed before we map the buffer. This is easily forgotten. Add wrappers for the most common of these operations. The first type is prefixed with "st_no_flush" and the second type is prefixed with "st_cond_flush", where "cond" indicates that we attmpt to only flush if there is indeed unflushed draw commands referencing the buffer. Prefixed functions are screen::get_tex_transfer pipe_buffer_write pipe_buffer_read pipe_buffer_map Please use the wrappers whenever possible. Signed-off-by: Thomas Hellstrom --- src/mesa/state_tracker/st_atom_constbuf.c | 8 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 6 +- src/mesa/state_tracker/st_cb_accum.c | 87 ++++++++---------- src/mesa/state_tracker/st_cb_bitmap.c | 25 ++--- src/mesa/state_tracker/st_cb_bufferobjects.c | 31 ++----- src/mesa/state_tracker/st_cb_clear.c | 9 +- src/mesa/state_tracker/st_cb_drawpixels.c | 42 ++++----- src/mesa/state_tracker/st_cb_readpixels.c | 28 +++--- src/mesa/state_tracker/st_cb_texture.c | 33 ++++--- src/mesa/state_tracker/st_gen_mipmap.c | 27 +++--- src/mesa/state_tracker/st_inlines.h | 122 +++++++++++++++++++++++++ src/mesa/state_tracker/st_texture.c | 18 ++-- src/mesa/state_tracker/st_texture.h | 2 +- 13 files changed, 265 insertions(+), 173 deletions(-) create mode 100644 src/mesa/state_tracker/st_inlines.h diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index fd81ac36d2..ec3605e4d6 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -42,7 +42,7 @@ #include "st_atom.h" #include "st_atom_constbuf.h" #include "st_program.h" - +#include "st_inlines.h" /** * Pass the given program parameters to the graphics pipe as a @@ -86,9 +86,9 @@ void st_upload_constants( struct st_context *st, /* load Mesa constants into the constant buffer */ if (cbuf->buffer) - pipe_buffer_write(pipe->screen, cbuf->buffer, - 0, paramBytes, - params->ParameterValues); + st_no_flush_pipe_buffer_write(st, cbuf->buffer, + 0, paramBytes, + params->ParameterValues); st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf); } diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index e0bbf7f3be..eff3666ca8 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -45,6 +45,7 @@ #include "st_format.h" #include "st_program.h" #include "st_texture.h" +#include "st_inlines.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" @@ -147,8 +148,9 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) uint *dest; uint i, j; - transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, - 0, 0, texSize, texSize); + transfer = st_cond_flush_get_tex_transfer(st_context(ctx), + pt, 0, 0, 0, PIPE_TRANSFER_WRITE, + 0, 0, texSize, texSize); dest = (uint *) screen->transfer_map(screen, transfer); /* Pack four 1D maps into a 2D texture: diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 1510a1e236..7f793cf08d 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -41,6 +41,7 @@ #include "st_public.h" #include "st_format.h" #include "st_texture.h" +#include "st_inlines.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" @@ -119,12 +120,10 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) const GLint height = ctx->DrawBuffer->_Ymax - ypos; GLubyte *map; - st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, - PIPE_TRANSFER_WRITE); - - acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); + acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture, + 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); map = screen->transfer_map(screen, acc_pt); /* note acc_strb->format might not equal acc_pt->format */ @@ -167,12 +166,11 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, struct pipe_transfer *acc_pt; GLubyte *map; - st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, - PIPE_TRANSFER_READ_WRITE); - - acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ_WRITE, xpos, ypos, - width, height); + acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ_WRITE, + xpos, ypos, + width, height); map = screen->transfer_map(screen, acc_pt); /* note acc_strb->format might not equal acc_pt->format */ @@ -210,19 +208,14 @@ accum_accum(struct st_context *st, GLfloat value, GLfloat *colorBuf, *accBuf; GLint i; - st_teximage_flush_before_map(st, acc_strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); - - st_teximage_flush_before_map(st, color_strb->texture, 0, 0, - PIPE_TRANSFER_READ); + acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); + color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); @@ -235,9 +228,9 @@ accum_accum(struct st_context *st, GLfloat value, } screen->tex_transfer_destroy(acc_trans); - acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); + acc_trans = st_no_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf); @@ -260,19 +253,14 @@ accum_load(struct st_context *st, GLfloat value, GLfloat *buf; GLint i; - st_teximage_flush_before_map(st, acc_strb->texture, 0, 0, - PIPE_TRANSFER_WRITE); + acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, xpos, ypos, + width, height); - acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); - - st_teximage_flush_before_map(st, color_strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); + color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); @@ -305,19 +293,16 @@ accum_return(GLcontext *ctx, GLfloat value, abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); - - st_teximage_flush_before_map(ctx->st, color_strb->texture, 0, 0, - PIPE_TRANSFER_READ_WRITE); + acc_trans = st_cond_flush_get_tex_transfer(st_context(ctx), + acc_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ, xpos, ypos, + width, height); - color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ_WRITE, xpos, ypos, - width, height); + color_trans = st_cond_flush_get_tex_transfer(st_context(ctx), + color_strb->texture, 0, 0, 0, + PIPE_TRANSFER_READ_WRITE, + xpos, ypos, + width, height); acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf); diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index fa4f4082a7..31ff1f74c0 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -47,6 +47,8 @@ #include "st_cb_program.h" #include "st_mesa_to_tgsi.h" #include "st_texture.h" +#include "st_inlines.h" + #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" @@ -337,8 +339,9 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, return NULL; } - transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, - 0, 0, width, height); + transfer = st_no_flush_get_tex_transfer(st_context(ctx), pt, 0, 0, 0, + PIPE_TRANSFER_WRITE, + 0, 0, width, height); dest = screen->transfer_map(screen, transfer); @@ -425,11 +428,11 @@ setup_bitmap_vertex_data(struct st_context *st, } /* put vertex data into vbuf */ - pipe_buffer_write(pipe->screen, - st->bitmap.vbuf, - st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, - sizeof st->bitmap.vertices, - st->bitmap.vertices); + st_no_flush_pipe_buffer_write(st, + st->bitmap.vbuf, + st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, + sizeof st->bitmap.vertices, + st->bitmap.vertices); return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices; } @@ -584,10 +587,10 @@ reset_cache(struct st_context *st) /* Map the texture transfer. * Subsequent glBitmap calls will write into the texture image. */ - cache->trans = screen->get_tex_transfer(screen, cache->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, - BITMAP_CACHE_WIDTH, - BITMAP_CACHE_HEIGHT); + cache->trans = st_no_flush_get_tex_transfer(st, cache->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, + BITMAP_CACHE_WIDTH, + BITMAP_CACHE_HEIGHT); cache->buffer = screen->transfer_map(screen, cache->trans); /* init image to all 0xff */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index fdb800fbd0..1025265cb9 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -30,9 +30,9 @@ #include "main/mtypes.h" #include "main/bufferobj.h" +#include "st_inlines.h" #include "st_context.h" #include "st_cb_bufferobjects.h" -#include "st_public.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -98,16 +98,13 @@ st_bufferobj_subdata(GLcontext *ctx, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object *obj) { - struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); if (offset >= st_obj->size || size > (st_obj->size - offset)) return; - if (pipe->is_buffer_referenced(pipe, st_obj->buffer)) - st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); - - pipe_buffer_write(pipe->screen, st_obj->buffer, offset, size, data); + st_cond_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, + offset, size, data); } @@ -121,17 +118,13 @@ st_bufferobj_get_subdata(GLcontext *ctx, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object *obj) { - struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); if (offset >= st_obj->size || size > (st_obj->size - offset)) return; - if (pipe->is_buffer_referenced(pipe, st_obj->buffer) & - PIPE_REFERENCED_FOR_WRITE) - st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); - - pipe_buffer_read(pipe->screen, st_obj->buffer, offset, size, data); + st_cond_flush_pipe_buffer_read(st_context(ctx), st_obj->buffer, + offset, size, data); } @@ -179,7 +172,8 @@ st_bufferobj_data(GLcontext *ctx, st_obj->size = size; if (data) - pipe_buffer_write(pipe->screen, st_obj->buffer, 0, size, data); + st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0, + size, data); } @@ -190,10 +184,8 @@ static void * st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { - struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); GLuint flags; - unsigned referenced; switch (access) { case GL_WRITE_ONLY: @@ -209,12 +201,9 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, break; } - referenced = pipe->is_buffer_referenced(pipe, st_obj->buffer); - if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || - (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) - st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL); - - obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags); + obj->Pointer = st_cond_flush_pipe_buffer_map(st_context(ctx), + st_obj->buffer, + flags); if(obj->Pointer) { obj->Offset = 0; obj->Length = obj->Size; diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 5bdc6a1330..880e83108c 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -45,6 +45,7 @@ #include "st_program.h" #include "st_public.h" #include "st_mesa_to_tgsi.h" +#include "st_inlines.h" #include "pipe/p_context.h" #include "pipe/p_inlines.h" @@ -166,10 +167,10 @@ draw_quad(GLcontext *ctx, } /* put vertex data into vbuf */ - pipe_buffer_write(pipe->screen, st->clear.vbuf, - st->clear.vbuf_slot * sizeof(st->clear.vertices), - sizeof(st->clear.vertices), - st->clear.vertices); + st_no_flush_pipe_buffer_write(st, st->clear.vbuf, + st->clear.vbuf_slot * sizeof(st->clear.vertices), + sizeof(st->clear.vertices), + st->clear.vertices); /* draw */ util_draw_vertex_buffer(pipe, diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c67b026413..acc9240b5d 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -53,6 +53,8 @@ #include "st_format.h" #include "st_mesa_to_tgsi.h" #include "st_texture.h" +#include "st_inlines.h" + #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" @@ -368,9 +370,9 @@ make_texture(struct st_context *st, /* we'll do pixel transfer in a fragment shader */ ctx->_ImageTransferState = 0x0; - transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, - width, height); + transfer = st_no_flush_get_tex_transfer(st, pt, 0, 0, 0, + PIPE_TRANSFER_WRITE, 0, 0, + width, height); /* map texture transfer */ dest = screen->transfer_map(screen, transfer); @@ -490,7 +492,7 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, /* allocate/load buffer object with vertex data */ buf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX, sizeof(verts)); - pipe_buffer_write(pipe->screen, buf, 0, sizeof(verts), verts); + st_no_flush_pipe_buffer_write(st, buf, 0, sizeof(verts), verts); util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_QUADS, @@ -638,12 +640,9 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, y = ctx->DrawBuffer->Height - y - height; } - st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, - PIPE_TRANSFER_WRITE); - - pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, x, y, - width, height); + pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, x, y, + width, height); stmap = screen->transfer_map(screen, pt); @@ -826,12 +825,10 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &ctx->DefaultPacking, buffer); - st_teximage_flush_before_map(ctx->st, rbDraw->texture, 0, 0, - PIPE_TRANSFER_WRITE); - - ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, dstx, dsty, - width, height); + ptDraw = st_cond_flush_get_tex_transfer(st_context(ctx), + rbDraw->texture, 0, 0, 0, + PIPE_TRANSFER_WRITE, dstx, dsty, + width, height); assert(ptDraw->block.width == 1); assert(ptDraw->block.height == 1); @@ -907,9 +904,6 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, GLfloat *color; enum pipe_format srcFormat, texFormat; - /* make sure rendering has completed */ - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - st_validate_state(st); if (type == GL_STENCIL) { @@ -981,13 +975,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, else { /* CPU-based fallback/conversion */ struct pipe_transfer *ptRead = - screen->get_tex_transfer(screen, rbRead->texture, 0, 0, 0, - PIPE_TRANSFER_READ, srcx, srcy, width, - height); + st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0, + PIPE_TRANSFER_READ, srcx, srcy, width, + height); struct pipe_transfer *ptTex = - screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, - 0, 0, width, height); + st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, PIPE_TRANSFER_WRITE, + 0, 0, width, height); if (type == GL_COLOR) { /* alternate path using get/put_tile() */ diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 519ad6660f..85adcb785e 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -50,6 +50,7 @@ #include "st_format.h" #include "st_public.h" #include "st_texture.h" +#include "st_inlines.h" /** * Special case for reading stencil buffer. @@ -75,11 +76,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, /* Create a read transfer from the renderbuffer's texture */ - st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, x, y, width, height); + pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, x, y, + width, height); /* map the stencil buffer */ stmap = screen->transfer_map(screen, pt); @@ -245,11 +245,10 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, y = strb->texture->height[0] - y - height; } - st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, x, y, width, height); + trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, x, y, + width, height); if (!trans) { return GL_FALSE; } @@ -358,9 +357,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (!dest) return; - /* make sure rendering has completed */ - st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); - if (format == GL_STENCIL_INDEX || format == GL_DEPTH_STENCIL) { st_read_stencil_pixels(ctx, x, y, width, height, @@ -403,8 +399,10 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } /* Create a read transfer from the renderbuffer's texture */ - trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, x, y, width, height); + trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, x, y, + width, height); /* determine bottom-to-top vs. top-to-bottom order */ if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 98dc6ec74d..94e340b7e9 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -50,6 +50,7 @@ #include "state_tracker/st_public.h" #include "state_tracker/st_texture.h" #include "state_tracker/st_gen_mipmap.h" +#include "state_tracker/st_inlines.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -465,10 +466,10 @@ compress_with_blit(GLcontext * ctx, /* Put user's tex data into the temporary texture */ - tex_xfer = screen->get_tex_transfer(screen, src_tex, - face, level, 0, - PIPE_TRANSFER_WRITE, - 0, 0, width, height); /* x, y, w, h */ + tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex, + face, level, 0, + PIPE_TRANSFER_WRITE, + 0, 0, width, height); /* x, y, w, h */ map = screen->transfer_map(screen, tex_xfer); mesa_format->StoreImage(ctx, 2, GL_RGBA, mesa_format, @@ -858,9 +859,10 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, PIPE_TEX_MIPFILTER_NEAREST); /* map the dst_surface so we can read from it */ - tex_xfer = screen->get_tex_transfer(screen, dst_texture, 0, 0, 0, - PIPE_TRANSFER_READ, - 0, 0, width, height); + tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), + dst_texture, 0, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, width, height); pixels = _mesa_map_readpix_pbo(ctx, &ctx->Pack, pixels); @@ -1192,15 +1194,12 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcY = strb->Base.Height - srcY - height; } - st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - src_trans = screen->get_tex_transfer( screen, - strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ, - srcX, srcY, - width, height); + src_trans = st_cond_flush_get_tex_transfer( st_context(ctx), + strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, + srcX, srcY, + width, height); st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0, PIPE_TRANSFER_WRITE); @@ -1589,7 +1588,7 @@ copy_image_data_to_texture(struct st_context *st, PIPE_TRANSFER_WRITE); - st_texture_image_data(st->pipe, + st_texture_image_data(st, stObj->pt, stImage->face, dstLevel, diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 6e9aa5245e..e159b4c9db 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -47,6 +47,7 @@ #include "st_program.h" #include "st_texture.h" #include "st_cb_texture.h" +#include "st_inlines.h" /** @@ -123,21 +124,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, const ubyte *srcData; ubyte *dstData; - st_teximage_flush_before_map(ctx->st, pt, face, srcLevel, - PIPE_TRANSFER_READ); - - srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, - PIPE_TRANSFER_READ, 0, 0, - pt->width[srcLevel], - pt->height[srcLevel]); - - st_teximage_flush_before_map(ctx->st, pt, face, dstLevel, - PIPE_TRANSFER_WRITE); - - dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, - PIPE_TRANSFER_WRITE, 0, 0, - pt->width[dstLevel], - pt->height[dstLevel]); + srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, + srcLevel, zslice, + PIPE_TRANSFER_READ, 0, 0, + pt->width[srcLevel], + pt->height[srcLevel]); + + dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, + dstLevel, zslice, + PIPE_TRANSFER_WRITE, 0, 0, + pt->width[dstLevel], + pt->height[dstLevel]); srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h new file mode 100644 index 0000000000..0322d5dfa6 --- /dev/null +++ b/src/mesa/state_tracker/st_inlines.h @@ -0,0 +1,122 @@ +#ifndef ST_INLINES_H +#define ST_INLINES_H + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" + +#include "st_context.h" +#include "st_texture.h" +#include "st_public.h" + +static INLINE struct pipe_transfer * +st_cond_flush_get_tex_transfer(struct st_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + unsigned int zslice, + enum pipe_transfer_usage usage, + unsigned int x, unsigned int y, + unsigned int w, unsigned int h) +{ + struct pipe_screen *screen = st->pipe->screen; + + st_teximage_flush_before_map(st, pt, face, level, usage); + return screen->get_tex_transfer(screen, pt, face, level, zslice, usage, + x, y, w, h); +} + +static INLINE struct pipe_transfer * +st_no_flush_get_tex_transfer(struct st_context *st, + struct pipe_texture *pt, + unsigned int face, + unsigned int level, + unsigned int zslice, + enum pipe_transfer_usage usage, + unsigned int x, unsigned int y, + unsigned int w, unsigned int h) +{ + struct pipe_screen *screen = st->pipe->screen; + + return screen->get_tex_transfer(screen, pt, face, level, + zslice, usage, x, y, w, h); +} + +static INLINE void * +st_cond_flush_pipe_buffer_map(struct st_context *st, + struct pipe_buffer *buf, + unsigned int map_flags) +{ + struct pipe_context *pipe = st->pipe; + unsigned int referenced = pipe->is_buffer_referenced(pipe, buf); + + if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || + (map_flags & PIPE_BUFFER_USAGE_CPU_WRITE))) + st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); + + return pipe_buffer_map(pipe->screen, buf, map_flags); +} + +static INLINE void * +st_no_flush_pipe_buffer_map(struct st_context *st, + struct pipe_buffer *buf, + unsigned int map_flags) +{ + return pipe_buffer_map(st->pipe->screen, buf, map_flags); +} + + +static INLINE void +st_cond_flush_pipe_buffer_write(struct st_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + const void * data) +{ + struct pipe_context *pipe = st->pipe; + + if (pipe->is_buffer_referenced(pipe, buf)) + st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); + + pipe_buffer_write(pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_no_flush_pipe_buffer_write(struct st_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + const void * data) +{ + pipe_buffer_write(st->pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_cond_flush_pipe_buffer_read(struct st_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + void * data) +{ + struct pipe_context *pipe = st->pipe; + + if (pipe->is_buffer_referenced(pipe, buf) & PIPE_REFERENCED_FOR_WRITE) + st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); + + pipe_buffer_read(pipe->screen, buf, offset, size, data); +} + +static INLINE void +st_no_flush_pipe_buffer_read(struct st_context *st, + struct pipe_buffer *buf, + unsigned int offset, + unsigned int size, + void * data) +{ + pipe_buffer_read(st->pipe->screen, buf, offset, size, data); +} + +#endif + diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index fcbaeb6989..10faa633ea 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -30,6 +30,7 @@ #include "st_public.h" #include "st_texture.h" #include "st_cb_fbo.h" +#include "st_inlines.h" #include "main/enums.h" #include "main/teximage.h" #include "main/texstore.h" @@ -194,9 +195,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, DBG("%s \n", __FUNCTION__); - stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face, - stImage->level, zoffset, - usage, x, y, w, h); + stImage->transfer = st_no_flush_get_tex_transfer(st, pt, stImage->face, + stImage->level, zoffset, + usage, x, y, w, h); if (stImage->transfer) return screen->transfer_map(screen, stImage->transfer); @@ -253,13 +254,14 @@ st_surface_data(struct pipe_context *pipe, /* Upload data for a particular image. */ void -st_texture_image_data(struct pipe_context *pipe, +st_texture_image_data(struct st_context *st, struct pipe_texture *dst, GLuint face, GLuint level, void *src, GLuint src_row_stride, GLuint src_image_stride) { + struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; GLuint depth = dst->depth[level]; GLuint i; @@ -269,10 +271,10 @@ st_texture_image_data(struct pipe_context *pipe, DBG("%s\n", __FUNCTION__); for (i = 0; i < depth; i++) { - dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i, - PIPE_TRANSFER_WRITE, 0, 0, - dst->width[level], - dst->height[level]); + dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i, + PIPE_TRANSFER_WRITE, 0, 0, + dst->width[level], + dst->height[level]); st_surface_data(pipe, dst_transfer, 0, 0, /* dstx, dsty */ diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index a392e3d57c..b9d447cb56 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -156,7 +156,7 @@ st_texture_texel_offset(const struct pipe_texture * pt, /* Upload an image into a texture */ extern void -st_texture_image_data(struct pipe_context *pipe, +st_texture_image_data(struct st_context *st, struct pipe_texture *dst, GLuint face, GLuint level, void *src, GLuint src_row_pitch, GLuint src_image_pitch); -- cgit v1.2.3 From 5458f8eff6b6212d170fd5862c4fc82659666d22 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Apr 2009 14:53:10 +0100 Subject: wgl: Flip the pixel format order. List 32bit pixel formats first, as nobody is interested in 16bit pixel formats nowadays. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 67a92d3d8e..c1cd81b445 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -65,33 +65,33 @@ struct stw_pf_depth_info }; -/* NOTE: order matters, since in otherwise equal circunstances the first +/* NOTE: order matters, since in otherwise equal circumstances the first * format listed will get chosen */ static const struct stw_pf_color_info stw_pf_color[] = { /* no-alpha */ - { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, { PIPE_FORMAT_X8R8G8B8_UNORM, { 8, 8, 8, 0}, {16, 8, 0, 0} }, { PIPE_FORMAT_B8G8R8X8_UNORM, { 8, 8, 8, 0}, { 8, 16, 24, 0} }, + { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, /* alpha */ - { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, - { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} }, { PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} }, { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} } #if 0 { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} } #endif + { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, + { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} }, }; static const struct stw_pf_depth_info stw_pf_depth_stencil[] = { /* pure depth */ - { PIPE_FORMAT_Z16_UNORM, {16, 0} }, + { PIPE_FORMAT_Z32_UNORM, {32, 0} }, { PIPE_FORMAT_Z24X8_UNORM, {24, 0} }, { PIPE_FORMAT_X8Z24_UNORM, {24, 0} }, - { PIPE_FORMAT_Z32_UNORM, {32, 0} }, + { PIPE_FORMAT_Z16_UNORM, {16, 0} }, /* pure stencil */ { PIPE_FORMAT_S8_UNORM, { 0, 8} }, /* combined depth-stencil */ -- cgit v1.2.3 From 995a168dea015ea6063bdf18ca0b031fd428460a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Apr 2009 14:55:49 +0100 Subject: wgl: Put commas in the right places. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index c1cd81b445..9e642cbdd4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -76,12 +76,12 @@ stw_pf_color[] = { { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, /* alpha */ { PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} }, - { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} } + { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} }, #if 0 - { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} } + { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} }, #endif { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, - { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} }, + { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} } }; -- cgit v1.2.3 From dbb90436f8385a33b9938c66a0fa3eff8c36a4cc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Apr 2009 15:01:38 +0100 Subject: pipe: Fix InterlockedDecrement usage. --- src/gallium/include/pipe/p_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index 54dab12f89..a963267e26 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -234,7 +234,7 @@ struct pipe_atomic static INLINE boolean p_atomic_dec_zero(struct pipe_atomic *v) { - return InterlockedDecrement(&v->count); + return InterlockedDecrement(&v->count) != 0; } static INLINE void -- cgit v1.2.3 From 5800e0aad1e803fbe2a1e1a7f8abcdff58699901 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 17 Apr 2009 15:52:05 +0200 Subject: trace: Simplify trace_buffer function --- src/gallium/drivers/trace/tr_buffer.c | 3 ++- src/gallium/drivers/trace/tr_buffer.h | 6 ++---- src/gallium/drivers/trace/tr_context.c | 8 +++----- src/gallium/drivers/trace/tr_dump.c | 3 +-- src/gallium/drivers/trace/tr_screen.c | 10 +++++----- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/trace/tr_buffer.c b/src/gallium/drivers/trace/tr_buffer.c index 6ffce1660e..3cdb107dc6 100644 --- a/src/gallium/drivers/trace/tr_buffer.c +++ b/src/gallium/drivers/trace/tr_buffer.c @@ -64,7 +64,8 @@ void trace_buffer_destroy(struct trace_screen *tr_scr, struct pipe_buffer *buffer) { - struct trace_buffer *tr_buf = trace_buffer(tr_scr, buffer); + struct trace_buffer *tr_buf = trace_buffer(buffer); + pipe_buffer_reference(&tr_buf->buffer, NULL); FREE(tr_buf); } diff --git a/src/gallium/drivers/trace/tr_buffer.h b/src/gallium/drivers/trace/tr_buffer.h index e9e4d354da..bb8a3b2c3a 100644 --- a/src/gallium/drivers/trace/tr_buffer.h +++ b/src/gallium/drivers/trace/tr_buffer.h @@ -47,13 +47,11 @@ struct trace_buffer static INLINE struct trace_buffer * -trace_buffer(struct trace_screen *tr_scr, - struct pipe_buffer *buffer) +trace_buffer(struct pipe_buffer *buffer) { if(!buffer) return NULL; - assert(tr_scr); - assert(buffer->screen == &tr_scr->base); + (void)trace_screen(buffer->screen); return (struct trace_buffer *)buffer; } diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 556b5e003f..179c8fd354 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -46,7 +46,7 @@ trace_buffer_unwrap(struct trace_context *tr_ctx, if(!buffer) return NULL; - tr_buf = trace_buffer(tr_scr, buffer); + tr_buf = trace_buffer(buffer); assert(tr_buf->buffer); assert(tr_buf->buffer->screen == tr_scr->screen); @@ -142,9 +142,8 @@ trace_context_draw_elements(struct pipe_context *_pipe, unsigned indexSize, unsigned mode, unsigned start, unsigned count) { - struct trace_screen *tr_scr = trace_screen(_pipe->screen); struct trace_context *tr_ctx = trace_context(_pipe); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer); + struct trace_buffer *tr_buf = trace_buffer(_indexBuffer); struct pipe_context *pipe = tr_ctx->pipe; struct pipe_buffer *indexBuffer = tr_buf->buffer; boolean result; @@ -180,9 +179,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, unsigned start, unsigned count) { - struct trace_screen *tr_scr = trace_screen(_pipe->screen); struct trace_context *tr_ctx = trace_context(_pipe); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _indexBuffer); + struct trace_buffer *tr_buf = trace_buffer(_indexBuffer); struct pipe_context *pipe = tr_ctx->pipe; struct pipe_buffer *indexBuffer = tr_buf->buffer; boolean result; diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 2618883e70..d2a7664ed9 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -425,8 +425,7 @@ void trace_dump_ptr(const void *value) void trace_dump_buffer_ptr(struct pipe_buffer *_buffer) { if (_buffer) { - struct trace_screen *tr_scr = trace_screen(_buffer->screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); trace_dump_ptr(tr_buf->buffer); } else { trace_dump_null(); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 28506da4dc..3e676f0155 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -603,7 +603,7 @@ trace_screen_buffer_map(struct pipe_screen *_screen, unsigned usage) { struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; struct pipe_buffer *buffer = tr_buf->buffer; void *map; @@ -628,7 +628,7 @@ trace_screen_buffer_map_range(struct pipe_screen *_screen, unsigned usage) { struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; struct pipe_buffer *buffer = tr_buf->buffer; void *map; @@ -680,7 +680,7 @@ trace_screen_buffer_flush_mapped_range(struct pipe_screen *_screen, unsigned length) { struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; struct pipe_buffer *buffer = tr_buf->buffer; @@ -696,7 +696,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen, struct pipe_buffer *_buffer) { struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; struct pipe_buffer *buffer = tr_buf->buffer; @@ -712,7 +712,7 @@ static void trace_screen_buffer_destroy(struct pipe_buffer *_buffer) { struct trace_screen *tr_scr = trace_screen(_buffer->screen); - struct trace_buffer *tr_buf = trace_buffer(tr_scr, _buffer); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; struct pipe_buffer *buffer = tr_buf->buffer; -- cgit v1.2.3 From 1e42f68fd612b2a4c877b91393e5ff5bc34dbe0d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 17 Apr 2009 16:00:25 +0200 Subject: trace: Fix is_referenced functions --- src/gallium/drivers/trace/tr_context.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 179c8fd354..696b6a4f59 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1030,11 +1030,13 @@ trace_context_destroy(struct pipe_context *_pipe) static unsigned int trace_is_texture_referenced( struct pipe_context *_pipe, - struct pipe_texture *texture, + struct pipe_texture *_texture, unsigned face, unsigned level) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_texture *tr_tex = trace_texture(_texture); struct pipe_context *pipe = tr_ctx->pipe; + struct pipe_texture *texture = tr_tex->texture; unsigned int referenced; trace_dump_call_begin("pipe_context", "is_texture_referenced"); @@ -1053,10 +1055,12 @@ trace_is_texture_referenced( struct pipe_context *_pipe, static unsigned int trace_is_buffer_referenced( struct pipe_context *_pipe, - struct pipe_buffer *buf) + struct pipe_buffer *_buf) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_buffer *tr_buf = trace_buffer(_buf); struct pipe_context *pipe = tr_ctx->pipe; + struct pipe_buffer *buf = tr_buf->buffer; unsigned int referenced; trace_dump_call_begin("pipe_context", "is_buffer_referenced"); -- cgit v1.2.3 From 44d0e0caf4ad3b01dc08d8432867c449dc3f2a23 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 17 Apr 2009 15:55:51 +0200 Subject: trace: Keep screen objects on lists --- src/gallium/drivers/trace/tr_buffer.c | 6 +++++- src/gallium/drivers/trace/tr_buffer.h | 2 ++ src/gallium/drivers/trace/tr_context.c | 11 ++++++++--- src/gallium/drivers/trace/tr_context.h | 2 ++ src/gallium/drivers/trace/tr_screen.c | 7 +++++++ src/gallium/drivers/trace/tr_screen.h | 33 +++++++++++++++++++++++++++++++++ src/gallium/drivers/trace/tr_texture.c | 21 +++++++++++++++++++++ src/gallium/drivers/trace/tr_texture.h | 6 ++++++ 8 files changed, 84 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/trace/tr_buffer.c b/src/gallium/drivers/trace/tr_buffer.c index 3cdb107dc6..4f0eff6a5a 100644 --- a/src/gallium/drivers/trace/tr_buffer.c +++ b/src/gallium/drivers/trace/tr_buffer.c @@ -27,10 +27,10 @@ #include "util/u_memory.h" +#include "util/u_simple_list.h" #include "tr_buffer.h" - struct pipe_buffer * trace_buffer_create(struct trace_screen *tr_scr, struct pipe_buffer *buffer) @@ -52,6 +52,8 @@ trace_buffer_create(struct trace_screen *tr_scr, tr_buf->base.screen = &tr_scr->base; tr_buf->buffer = buffer; + trace_screen_add_to_list(tr_scr, buffers, tr_buf); + return &tr_buf->base; error: @@ -66,6 +68,8 @@ trace_buffer_destroy(struct trace_screen *tr_scr, { struct trace_buffer *tr_buf = trace_buffer(buffer); + trace_screen_remove_from_list(tr_scr, buffers, tr_buf); + pipe_buffer_reference(&tr_buf->buffer, NULL); FREE(tr_buf); } diff --git a/src/gallium/drivers/trace/tr_buffer.h b/src/gallium/drivers/trace/tr_buffer.h index bb8a3b2c3a..1a2d0b9aea 100644 --- a/src/gallium/drivers/trace/tr_buffer.h +++ b/src/gallium/drivers/trace/tr_buffer.h @@ -41,6 +41,8 @@ struct trace_buffer struct pipe_buffer *buffer; + struct tr_list list; + void *map; boolean range_flushed; }; diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 696b6a4f59..38646f8aad 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -26,6 +26,8 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_simple_list.h" + #include "pipe/p_screen.h" #include "tr_dump.h" @@ -1014,16 +1016,17 @@ trace_context_flush(struct pipe_context *_pipe, static INLINE void trace_context_destroy(struct pipe_context *_pipe) { + struct trace_screen *tr_scr = trace_screen(_pipe->screen); struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; trace_dump_call_begin("pipe_context", "destroy"); - trace_dump_arg(ptr, pipe); + trace_dump_call_end(); - pipe->destroy(pipe); + trace_screen_remove_from_list(tr_scr, contexts, tr_ctx); - trace_dump_call_end(); + pipe->destroy(pipe); FREE(tr_ctx); } @@ -1150,6 +1153,8 @@ trace_context_create(struct pipe_screen *_screen, trace_dump_ret(ptr, pipe); trace_dump_call_end(); + trace_screen_add_to_list(tr_scr, contexts, tr_ctx); + return &tr_ctx->base; error1: diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index d02b22a069..2512a0a232 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -44,6 +44,8 @@ struct trace_context struct pipe_context base; struct pipe_context *pipe; + + struct tr_list list; }; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 3e676f0155..7205dfd1d9 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_simple_list.h" #include "tr_buffer.h" #include "tr_dump.h" @@ -855,6 +856,12 @@ trace_screen_create(struct pipe_screen *screen) #else winsys = screen->winsys; #endif + pipe_mutex_init(tr_scr->list_mutex); + make_empty_list(&tr_scr->buffers); + make_empty_list(&tr_scr->contexts); + make_empty_list(&tr_scr->textures); + make_empty_list(&tr_scr->surfaces); + make_empty_list(&tr_scr->transfers); tr_scr->base.winsys = winsys; tr_scr->base.destroy = trace_screen_destroy; diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 8c65516b50..59f254166d 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -30,6 +30,7 @@ #include "pipe/p_screen.h" +#include "pipe/p_thread.h" #ifdef __cplusplus @@ -37,6 +38,11 @@ extern "C" { #endif +struct tr_list { + struct tr_list *next; + struct tr_list *prev; +}; + /** * It often happens that new data is written directly to the user buffers * without mapping/unmapping. This flag marks user buffers, so that their @@ -50,6 +56,18 @@ struct trace_screen struct pipe_screen base; struct pipe_screen *screen; + + pipe_mutex list_mutex; + int num_buffers; + int num_contexts; + int num_textures; + int num_surfaces; + int num_transfers; + struct tr_list buffers; + struct tr_list contexts; + struct tr_list textures; + struct tr_list surfaces; + struct tr_list transfers; }; @@ -65,6 +83,21 @@ void trace_screen_user_buffer_update(struct pipe_screen *screen, struct pipe_buffer *buffer); +#define trace_screen_add_to_list(tr_scr, name, obj) \ + do { \ + pipe_mutex_lock(tr_scr->list_mutex); \ + insert_at_head(&tr_scr->name, &obj->list); \ + tr_scr->num_##name++; \ + pipe_mutex_unlock(tr_scr->list_mutex); \ + } while (0) + +#define trace_screen_remove_from_list(tr_scr, name, obj) \ + do { \ + pipe_mutex_lock(tr_scr->list_mutex); \ + remove_from_list(&obj->list); \ + tr_scr->num_##name--; \ + pipe_mutex_unlock(tr_scr->list_mutex); \ + } while (0) #ifdef __cplusplus } diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c index f4e433792b..1f25fe38d4 100644 --- a/src/gallium/drivers/trace/tr_texture.c +++ b/src/gallium/drivers/trace/tr_texture.c @@ -27,6 +27,7 @@ #include "util/u_hash_table.h" #include "util/u_memory.h" +#include "util/u_simple_list.h" #include "tr_screen.h" #include "tr_texture.h" @@ -53,6 +54,8 @@ trace_texture_create(struct trace_screen *tr_scr, tr_tex->base.screen = &tr_scr->base; tr_tex->texture = texture; + trace_screen_add_to_list(tr_scr, textures, tr_tex); + return &tr_tex->base; error: @@ -64,6 +67,10 @@ error: void trace_texture_destroy(struct trace_texture *tr_tex) { + struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen); + + trace_screen_remove_from_list(tr_scr, textures, tr_tex); + pipe_texture_reference(&tr_tex->texture, NULL); FREE(tr_tex); } @@ -73,6 +80,7 @@ struct pipe_surface * trace_surface_create(struct trace_texture *tr_tex, struct pipe_surface *surface) { + struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen); struct trace_surface *tr_surf; if(!surface) @@ -91,6 +99,8 @@ trace_surface_create(struct trace_texture *tr_tex, pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base); tr_surf->surface = surface; + trace_screen_add_to_list(tr_scr, surfaces, tr_surf); + return &tr_surf->base; error: @@ -102,6 +112,10 @@ error: void trace_surface_destroy(struct trace_surface *tr_surf) { + struct trace_screen *tr_scr = trace_screen(tr_surf->base.texture->screen); + + trace_screen_remove_from_list(tr_scr, surfaces, tr_surf); + pipe_texture_reference(&tr_surf->base.texture, NULL); pipe_surface_reference(&tr_surf->surface, NULL); FREE(tr_surf); @@ -112,6 +126,7 @@ struct pipe_transfer * trace_transfer_create(struct trace_texture *tr_tex, struct pipe_transfer *transfer) { + struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen); struct trace_transfer *tr_trans; if(!transfer) @@ -130,6 +145,8 @@ trace_transfer_create(struct trace_texture *tr_tex, tr_trans->transfer = transfer; assert(tr_trans->base.texture == &tr_tex->base); + trace_screen_add_to_list(tr_scr, transfers, tr_trans); + return &tr_trans->base; error: @@ -141,7 +158,11 @@ error: void trace_transfer_destroy(struct trace_transfer *tr_trans) { + struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen); struct pipe_screen *screen = tr_trans->transfer->texture->screen; + + trace_screen_remove_from_list(tr_scr, transfers, tr_trans); + pipe_texture_reference(&tr_trans->base.texture, NULL); screen->tex_transfer_destroy(tr_trans->transfer); FREE(tr_trans); diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index 14dafd8b2c..395e523e73 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -40,6 +40,8 @@ struct trace_texture struct pipe_texture base; struct pipe_texture *texture; + + struct tr_list list; }; @@ -48,6 +50,8 @@ struct trace_surface struct pipe_surface base; struct pipe_surface *surface; + + struct tr_list list; }; @@ -57,6 +61,8 @@ struct trace_transfer struct pipe_transfer *transfer; + struct tr_list list; + void *map; }; -- cgit v1.2.3 From 047efcd050a92687403952910de4fded3df46964 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 08:09:17 -0600 Subject: demos: move glewInit() after glutCreateWindow() Fixes segfault. See bug 21239. However, the demo doesn't render properly. Probably a bug in the GL_ATI_fragment_shader code. --- progs/tests/afsmultiarb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/tests/afsmultiarb.c b/progs/tests/afsmultiarb.c index 162ab19493..ca25a4d75b 100644 --- a/progs/tests/afsmultiarb.c +++ b/progs/tests/afsmultiarb.c @@ -442,8 +442,8 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 300, 300 ); glutInitWindowPosition( 0, 0 ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glewInit(); glutCreateWindow(argv[0] ); + glewInit(); Init( argc, argv ); -- cgit v1.2.3 From 3b760729158ff39a40688980d7a823b006e0a31a Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Fri, 17 Apr 2009 17:02:34 +0200 Subject: gallium: Fix PIPE_ATOMIC_GCC_INTRINSIC build. --- src/gallium/include/pipe/p_atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index a963267e26..ed5f665512 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -33,7 +33,7 @@ extern "C" { #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_GCC_X86 #elif defined(PIPE_CC_GCC) -#define PIPE_ATOMIC_GCC_INTRINISIC +#define PIPE_ATOMIC_GCC_INTRINSIC #else #define PIPE_ATOMIC_MUTEX #endif @@ -86,7 +86,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) /* Implementation using GCC-provided synchronization intrinsics */ -#if defined(PIPE_ATOMIC_ASM_GCC_INTRINSIC) +#if defined(PIPE_ATOMIC_GCC_INTRINSIC) #define PIPE_ATOMIC "GCC Sync Intrinsics" -- cgit v1.2.3 From 90c880f08996cce57273544d8ba11b56ce2a06f3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 09:15:58 -0600 Subject: demos: move glewInit() call, fixes crash/bug 21247 --- progs/tests/vparray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/tests/vparray.c b/progs/tests/vparray.c index 9c2fad97d9..af9b62d33e 100644 --- a/progs/tests/vparray.c +++ b/progs/tests/vparray.c @@ -280,9 +280,9 @@ int main(int argc, char **argv) glutInitWindowPosition(0, 0); glutInitWindowSize(400, 400); if (glutCreateWindow("Isosurface") <= 0) { - glewInit(); exit(0); } + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutSpecialFunc(SpecialKey); -- cgit v1.2.3 From 86ed894e47bae10d158f2b4a02065daa9dbe5194 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Apr 2009 18:40:46 +0100 Subject: pipe: Get the p_atomic_dec_zero logic right this time. --- src/gallium/include/pipe/p_atomic.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index ed5f665512..0c3fbae428 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -225,7 +225,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) struct pipe_atomic { - long count; + volatile long count; }; #define p_atomic_set(_v, _i) ((_v)->count = (_i)) @@ -234,7 +234,7 @@ struct pipe_atomic static INLINE boolean p_atomic_dec_zero(struct pipe_atomic *v) { - return InterlockedDecrement(&v->count) != 0; + return InterlockedDecrement(&v->count) == 0; } static INLINE void @@ -270,7 +270,6 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new) * Add an assembly port instead. It may abort and * doesn't destroy used mutexes. */ -#warning "using mutex-based fallback for pipe_atomic" struct pipe_atomic { pipe_mutex mutex; -- cgit v1.2.3 From 867afa4c093cb05bedf11a1c7a74feb202fb858b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 17 Apr 2009 21:23:14 +0200 Subject: xlib/trace: Fixup xlib trace --- src/gallium/winsys/xlib/xlib_trace.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gallium/winsys/xlib/xlib_trace.c b/src/gallium/winsys/xlib/xlib_trace.c index 37095c5d8e..dbea655ab4 100644 --- a/src/gallium/winsys/xlib/xlib_trace.c +++ b/src/gallium/winsys/xlib/xlib_trace.c @@ -37,6 +37,7 @@ #include "trace/tr_screen.h" #include "trace/tr_context.h" +#include "trace/tr_texture.h" #include "pipe/p_screen.h" @@ -66,9 +67,11 @@ fail: } static struct pipe_context * -xlib_create_trace_context( struct pipe_screen *screen, +xlib_create_trace_context( struct pipe_screen *_screen, void *priv ) { + struct trace_screen *tr_scr = trace_screen( _screen ); + struct pipe_screen *screen = tr_scr->screen; struct pipe_context *pipe, *trace_pipe; pipe = xlib_softpipe_driver.create_pipe_context( screen, priv ); @@ -77,7 +80,7 @@ xlib_create_trace_context( struct pipe_screen *screen, /* Wrap it: */ - trace_pipe = trace_context_create(screen, pipe); + trace_pipe = trace_context_create(_screen, pipe); if (trace_pipe == NULL) goto fail; @@ -86,15 +89,18 @@ xlib_create_trace_context( struct pipe_screen *screen, return trace_pipe; fail: + if (pipe) + pipe->destroy( pipe ); return NULL; } static void xlib_trace_display_surface( struct xmesa_buffer *buffer, - struct pipe_surface *surf ) + struct pipe_surface *_surf ) { - /* ?? - */ + struct trace_surface *tr_surf = trace_surface( _surf ); + struct pipe_surface *surf = tr_surf->surface; + xlib_softpipe_driver.display_surface( buffer, surf ); } -- cgit v1.2.3 From f8f23e33c21f41756d068b546f2aae37030b5773 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 15:43:32 -0600 Subject: i965: updated CURBE allocation code Now that we have real constant buffers, the demands on the CURBE are lessened. When we use real VS/WM constant buffers we only use the CURBE for clip planes. --- src/mesa/drivers/dri/i965/brw_context.h | 3 ++- src/mesa/drivers/dri/i965/brw_curbe.c | 14 +++++++++----- src/mesa/drivers/dri/i965/brw_vs_emit.c | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 4c2d3af8ae..a0b3b06309 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -187,7 +187,7 @@ struct brw_wm_prog_data { GLuint total_grf; GLuint total_scratch; - GLuint nr_params; + GLuint nr_params; /**< number of float params/constants */ GLboolean error; /* Pointer to tracked values (only valid once @@ -226,6 +226,7 @@ struct brw_vs_prog_data { GLuint urb_read_length; GLuint total_grf; GLuint outputs_written; + GLuint nr_params; /**< number of float params/constants */ GLuint inputs_read; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index fe1de821f0..18b187ed1d 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -45,17 +45,21 @@ #include "brw_util.h" -/* Partition the CURBE between the various users of constant values: +/** + * Partition the CURBE between the various users of constant values: + * Note that vertex and fragment shaders can now fetch constants out + * of constant buffers. We no longer allocatea block of the GRF for + * constants. That greatly reduces the demand for space in the CURBE. + * Some of the comments within are dated... */ static void calculate_curbe_offsets( struct brw_context *brw ) { GLcontext *ctx = &brw->intel.ctx; /* CACHE_NEW_WM_PROG */ - GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16; + const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16; /* BRW_NEW_VERTEX_PROGRAM */ - const struct brw_vertex_program *vp = brw_vertex_program_const(brw->vertex_program); - GLuint nr_vp_regs = (vp->program.Base.Parameters->NumParameters * 4 + 15) / 16; + const GLuint nr_vp_regs = (brw->vs.prog_data->nr_params + 15) / 16; GLuint nr_clip_regs = 0; GLuint total_regs; @@ -248,7 +252,7 @@ static void prepare_constant_buffer(struct brw_context *brw) /* vertex shader constants */ if (brw->curbe.vs_size) { GLuint offset = brw->curbe.vs_start * 16; - GLuint nr = vp->program.Base.Parameters->NumParameters; + GLuint nr = brw->vs.prog_data->nr_params / 4; _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index af0f501621..0c86c23ad9 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -68,7 +68,6 @@ static void release_tmps( struct brw_vs_compile *c ) static void brw_vs_alloc_regs( struct brw_vs_compile *c ) { GLuint i, reg = 0, mrf; - GLuint nr_params; #if 0 if (c->vp->program.Base.Parameters->NumParameters >= 6) @@ -100,15 +99,18 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) if (c->use_const_buffer) { /* get constants from a real constant buffer */ c->prog_data.curb_read_length = 0; + c->prog_data.nr_params = 4; /* XXX 0 causes a bug elsewhere... */ } else { /* use a section of the GRF for constants */ - nr_params = c->vp->program.Base.Parameters->NumParameters; + GLuint nr_params = c->vp->program.Base.Parameters->NumParameters; for (i = 0; i < nr_params; i++) { c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1); } reg += (nr_params + 1) / 2; c->prog_data.curb_read_length = reg - 1; + + c->prog_data.nr_params = nr_params * 4; } /* Allocate input regs: -- cgit v1.2.3 From 08ac96e55b6e4f30d75307b796a271b824ffd4ac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 16:29:45 -0600 Subject: mesa: minor tweak to error message --- src/mesa/main/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 7388276c45..39b4967a58 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -161,7 +161,7 @@ _mesa_MatrixMode( GLenum mode ) break; case GL_TEXTURE: if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid unit %d)", + _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid tex unit %d)", ctx->Texture.CurrentUnit); return; } -- cgit v1.2.3 From e1a8852aa49b535a4fcec4eefda3fb7f8e57a5cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 16:37:53 -0600 Subject: dri: __driUtilMessage(): not all messages are errors --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index f620c26000..e112720471 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -59,7 +59,7 @@ __driUtilMessage(const char *f, ...) va_list args; if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL error: \n"); + fprintf(stderr, "libGL: "); va_start(args, f); vfprintf(stderr, f, args); va_end(args); -- cgit v1.2.3 From 4c13cb65a0ee44d10298a1efe78c901c642b7ebe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Apr 2009 16:41:07 -0600 Subject: dri: build DRI swrast driver too --- configs/linux-dri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/linux-dri b/configs/linux-dri index c5e30d3060..0998ba8549 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -64,4 +64,4 @@ GALLIUM_WINSYS_DRM_DIRS = intel GALLIUM_STATE_TRACKERS_DIRS = egl DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ - savage sis tdfx trident unichrome ffb + savage sis tdfx trident unichrome ffb swrast -- cgit v1.2.3 From 905130852ac481cb286b0215d8c61e9eb6845520 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 13:55:58 -0600 Subject: mesa: build a float[4] value in _mesa_add_sampler() to avoid random values --- src/mesa/shader/prog_parameter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index e9ed3985ee..bcd8c5d9dc 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -327,15 +327,16 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList, else { GLuint i; const GLint size = 1; /* a sampler is basically a texture unit number */ - GLfloat value; + GLfloat value[4]; GLint numSamplers = 0; for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Type == PROGRAM_SAMPLER) numSamplers++; } - value = (GLfloat) numSamplers; + value[0] = (GLfloat) numSamplers; + value[1] = value[2] = value[3] = 0.0F; (void) _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, - size, datatype, &value, NULL, 0x0); + size, datatype, value, NULL, 0x0); return numSamplers; } } -- cgit v1.2.3 From 0bc214a834bbb12b9338837dd9fca9bc389b4bc2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 16:01:20 -0600 Subject: i915: fix broken indirect constant buffer reads The READ message's msg_control value can be 0 or 1 to indicate that the Oword should be read into the lower or upper half of the target register. It seems that the other half of the register gets clobbered though. So we read into two dest registers then use a MOV to combine the upper/lower halves. --- src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_eu_emit.c | 47 +++------------------------------ src/mesa/drivers/dri/i965/brw_vs_emit.c | 43 +++++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 51 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 896e67dbfe..62c98bd8bb 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -867,6 +867,7 @@ void brw_dp_READ_4( struct brw_compile *p, void brw_dp_READ_4_vs( struct brw_compile *p, struct brw_reg dest, + GLuint oword, GLboolean relAddr, struct brw_reg addrReg, GLuint location, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index df2141660c..60ea44f7a9 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1009,6 +1009,7 @@ void brw_dp_READ_4( struct brw_compile *p, */ void brw_dp_READ_4_vs(struct brw_compile *p, struct brw_reg dest, + GLuint oword, GLboolean relAddr, struct brw_reg addrReg, GLuint location, @@ -1016,6 +1017,7 @@ void brw_dp_READ_4_vs(struct brw_compile *p, { GLuint msg_reg_nr = 1; + assert(oword < 2); /* printf("vs const read msg, location %u, msg_reg_nr %d\n", location, msg_reg_nr); @@ -1061,56 +1063,13 @@ void brw_dp_READ_4_vs(struct brw_compile *p, brw_set_dp_read_message(insn, bind_table_index, - 0, /* msg_control (0 means 1 Oword, lower half) */ + oword, /* 0 = lower Oword, 1 = upper Oword */ BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ 0, /* source cache = data cache */ 1, /* msg_length */ 1, /* response_length (1 Oword) */ 0); /* eot */ } - - if (relAddr) { - /* second read to get second constant */ - msg_reg_nr++; - { - /* Setup MRF[1] with location/offset into const buffer */ - struct brw_reg b; - - brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - b = brw_message_reg(msg_reg_nr); - b = retype(b, BRW_REGISTER_TYPE_UD); - addrReg = suboffset(addrReg, 1); /* upper half of addrReg */ - brw_ADD(p, b, addrReg, brw_imm_ud(location)); - - brw_pop_insn_state(p); - } - - { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - - insn->header.predicate_control = BRW_PREDICATE_NONE; - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.destreg__conditonalmod = msg_reg_nr; - insn->header.mask_control = BRW_MASK_DISABLE; - /*insn->header.access_mode = BRW_ALIGN_16;*/ - - brw_set_dest(insn, dest); - brw_set_src0(insn, brw_null_reg()); - - brw_set_dp_read_message(insn, - bind_table_index, - 1, /* msg_control (1 means 1 Oword, upper half) */ - BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ - 0, /* source cache = data cache */ - 1, /* msg_length */ - 1, /* response_length (1 Oword) */ - 0); /* eot */ - } - } } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 0c86c23ad9..524f1211ce 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -708,10 +708,12 @@ get_constant(struct brw_vs_compile *c, const struct prog_src_register *src = &inst->SrcReg[argIndex]; struct brw_compile *p = &c->func; struct brw_reg const_reg; + struct brw_reg const2_reg; assert(argIndex < 3); if (c->current_const[argIndex].index != src->Index || src->RelAddr) { + struct brw_reg addrReg = c->regs[PROGRAM_ADDRESS][0]; c->current_const[argIndex].index = src->Index; @@ -719,19 +721,46 @@ get_constant(struct brw_vs_compile *c, printf(" fetch const[%d] for arg %d into reg %d\n", src->Index, argIndex, c->current_const[argIndex].reg.nr); #endif - /* need to fetch the constant now */ brw_dp_READ_4_vs(p, - c->current_const[argIndex].reg, /* writeback dest */ - src->RelAddr, /* relative indexing? */ - c->regs[PROGRAM_ADDRESS][0], /* address register */ - 16 * src->Index, /* byte offset */ - SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ + c->current_const[argIndex].reg,/* writeback dest */ + 0, /* oword */ + src->RelAddr, /* relative indexing? */ + addrReg, /* address register */ + 16 * src->Index, /* byte offset */ + SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ ); + + if (src->RelAddr) { + /* second read */ + const2_reg = get_tmp(c); + + /* use upper half of address reg for second read */ + addrReg = stride(addrReg, 0, 4, 0); + addrReg.subnr = 16; + + brw_dp_READ_4_vs(p, + const2_reg, /* writeback dest */ + 1, /* oword */ + src->RelAddr, /* relative indexing? */ + addrReg, /* address register */ + 16 * src->Index, /* byte offset */ + SURF_INDEX_VERT_CONST_BUFFER + ); + } } const_reg = c->current_const[argIndex].reg; - if (!src->RelAddr) { + + if (src->RelAddr) { + /* merge the two Owords into the constant register */ + /* const_reg[7..4] = const2_reg[7..4] */ + brw_MOV(p, + suboffset(stride(const_reg, 0, 4, 1), 4), + suboffset(stride(const2_reg, 0, 4, 1), 4)); + release_tmp(c, const2_reg); + } + else { /* replicate lower four floats into upper half (to get XYZWXYZW) */ const_reg = stride(const_reg, 0, 4, 0); const_reg.subnr = 0; -- cgit v1.2.3 From 36b0f26721652639351522915d9a57f9d4a8bcde Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 16:04:41 -0600 Subject: mesa: suppress extra newline --- src/mesa/main/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b24a3b4409..4cff36adfa 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -434,7 +434,7 @@ one_time_init( GLcontext *ctx ) } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", + _mesa_debug(ctx, "Mesa %s DEBUG build %s %s", MESA_VERSION_STRING, __DATE__, __TIME__); #endif -- cgit v1.2.3 From 794d488e6dc795c225505b8c00a7f00f1960a5ad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 16:11:05 -0600 Subject: intel: make sure polygon mode is set properly in intel_clear_tris() Fixes progs/glsl/skinning.c demo. --- src/mesa/drivers/dri/intel/intel_clear.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 28281b3861..8c431cf189 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -93,6 +93,7 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | + GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT | GL_TRANSFORM_BIT | GL_CURRENT_BIT); @@ -114,6 +115,7 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) _mesa_Disable(GL_CLIP_PLANE3); _mesa_Disable(GL_CLIP_PLANE4); _mesa_Disable(GL_CLIP_PLANE5); + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) { saved_fp_enable = GL_TRUE; _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); -- cgit v1.2.3 From 538a82388293ca1b14e6eb8b26179d1f42627210 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Apr 2009 16:23:33 -0600 Subject: demos: new glsl/array.c demo Test variable indexing into a uniform array in a vertex shader. --- progs/glsl/Makefile | 8 ++ progs/glsl/array.c | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 progs/glsl/array.c diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 0f1a299570..5fb95c4b3b 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -10,6 +10,7 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(T LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) PROGS = \ + array \ bitmap \ brick \ bump \ @@ -80,6 +81,13 @@ shaderutil.o: shaderutil.c shaderutil.h +array.o: array.c extfuncs.h shaderutil.h + $(APP_CC) -c -I$(INCDIR) $(CFLAGS) array.c + +array: array.o shaderutil.o + $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) array.o shaderutil.o $(LIBS) -o $@ + + bitmap.o: bitmap.c extfuncs.h shaderutil.h $(APP_CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c diff --git a/progs/glsl/array.c b/progs/glsl/array.c new file mode 100644 index 0000000000..46ef8043bc --- /dev/null +++ b/progs/glsl/array.c @@ -0,0 +1,261 @@ +/** + * Test variable array indexing in a vertex shader. + * Brian Paul + * 17 April 2009 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "extfuncs.h" +#include "shaderutil.h" + + +/** + * The vertex position.z is used as a (variable) index into an + * array which returns a new Z value. + */ +static const char *VertShaderText = + "uniform sampler2D tex1; \n" + "uniform float HeightArray[20]; \n" + "void main() \n" + "{ \n" + " vec4 pos = gl_Vertex; \n" + " int i = int(pos.z * 9.5); \n" + " pos.z = HeightArray[i]; \n" + " gl_Position = gl_ModelViewProjectionMatrix * pos; \n" + " gl_FrontColor = pos; \n" + "} \n"; + +static const char *FragShaderText = + "void main() \n" + "{ \n" + " gl_FragColor = gl_Color; \n" + "} \n"; + + +static GLuint fragShader; +static GLuint vertShader; +static GLuint program; + +static GLint win = 0; +static GLboolean Anim = GL_TRUE; +static GLboolean WireFrame = GL_TRUE; +static GLfloat xRot = -70.0f, yRot = 0.0f, zRot = 0.0f; + + +static void +Idle(void) +{ + zRot = 90 + glutGet(GLUT_ELAPSED_TIME) * 0.05; + glutPostRedisplay(); +} + + +/** z=f(x,y) */ +static float +fz(float x, float y) +{ + return fabs(cos(1.5*x) + cos(1.5*y)); +} + + +static void +DrawMesh(void) +{ + GLfloat xmin = -2.0, xmax = 2.0; + GLfloat ymin = -2.0, ymax = 2.0; + GLuint xdivs = 20, ydivs = 20; + GLfloat dx = (xmax - xmin) / xdivs; + GLfloat dy = (ymax - ymin) / ydivs; + GLfloat ds = 1.0 / xdivs, dt = 1.0 / ydivs; + GLfloat x, y, s, t; + GLuint i, j; + + y = ymin; + t = 0.0; + for (i = 0; i < ydivs; i++) { + x = xmin; + s = 0.0; + glBegin(GL_QUAD_STRIP); + for (j = 0; j < xdivs; j++) { + float z0 = fz(x, y), z1 = fz(x, y + dy); + + glTexCoord2f(s, t); + glVertex3f(x, y, z0); + + glTexCoord2f(s, t + dt); + glVertex3f(x, y + dy, z1); + x += dx; + s += ds; + } + glEnd(); + y += dy; + t += dt; + } +} + + +static void +Redisplay(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (WireFrame) + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + else + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + glPushMatrix(); + glRotatef(xRot, 1.0f, 0.0f, 0.0f); + glRotatef(yRot, 0.0f, 1.0f, 0.0f); + glRotatef(zRot, 0.0f, 0.0f, 1.0f); + + glPushMatrix(); + DrawMesh(); + glPopMatrix(); + + glPopMatrix(); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -15.0f); +} + + +static void +CleanUp(void) +{ + glDeleteShader_func(fragShader); + glDeleteShader_func(vertShader); + glDeleteProgram_func(program); + glutDestroyWindow(win); +} + + +static void +Key(unsigned char key, int x, int y) +{ + const GLfloat step = 2.0; + (void) x; + (void) y; + + switch(key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'w': + WireFrame = !WireFrame; + break; + case 'z': + zRot += step; + break; + case 'Z': + zRot -= step; + break; + case 27: + CleanUp(); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + const GLfloat step = 2.0; + + (void) x; + (void) y; + + switch(key) { + case GLUT_KEY_UP: + xRot += step; + break; + case GLUT_KEY_DOWN: + xRot -= step; + break; + case GLUT_KEY_LEFT: + yRot -= step; + break; + case GLUT_KEY_RIGHT: + yRot += step; + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + GLfloat HeightArray[20]; + GLint u, i; + + if (!ShadersSupported()) + exit(1); + + GetExtensionFuncs(); + + vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText); + fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText); + program = LinkShaders(vertShader, fragShader); + + glUseProgram_func(program); + + /* Setup the HeightArray[] uniform */ + for (i = 0; i < 20; i++) + HeightArray[i] = i / 20.0; + u = glGetUniformLocation_func(program, "HeightArray"); + glUniform1fv_func(u, 20, HeightArray); + + assert(glGetError() == 0); + + glClearColor(0.4f, 0.4f, 0.8f, 0.0f); + glEnable(GL_DEPTH_TEST); + glColor3f(1, 1, 1); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(500, 500); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Redisplay); + Init(); + if (Anim) + glutIdleFunc(Idle); + glutMainLoop(); + return 0; +} + -- cgit v1.2.3 From 54fb6f0053dc153b76a2e6a242bac376c6723279 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Sat, 18 Apr 2009 15:47:14 +0200 Subject: intel: Handle ARB_vertex_buffer_object state in intel_clear_tris(). Fixes gearsvbo app by Michael Clark. --- src/mesa/drivers/dri/intel/intel_clear.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 8c431cf189..6c609336a2 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -148,6 +148,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) } } +#if FEATURE_ARB_vertex_buffer_object + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); +#endif + intel_meta_set_passthrough_transform(intel); for (i = 0; i < 4; i++) { -- cgit v1.2.3 From 2bf326af10d02b2d5a44cee98fa62c8a8940dd11 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 10:08:15 -0600 Subject: demos: fix usage text --- progs/tests/jkrahntest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/tests/jkrahntest.c b/progs/tests/jkrahntest.c index 08660b8932..3fef105fc2 100644 --- a/progs/tests/jkrahntest.c +++ b/progs/tests/jkrahntest.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) if (argc < 2) { fprintf(stderr, "This program tests GLX context switching.\n"); - fprintf(stderr, "Usage: cxbug \n"); + fprintf(stderr, "Usage: jkrahntest \n"); fprintf(stderr, "Where n is:\n"); fprintf(stderr, "\t1) Use two contexts and swap only when the context is current (typical case).\n"); fprintf(stderr, "\t2) Use two contexts and swap at the same time.\n"); -- cgit v1.2.3 From c5af2ed60fa4fe3f33b53a8e252e24cfa490a156 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 10:08:54 -0600 Subject: mesa: add switch case for GL_VERTEX_STATE_PROGRAM_NV in _mesa_new_program() Fixes bug seen in progs/tests/vptest1.c --- src/mesa/shader/program.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2e5632710e..d270bf9e1c 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -296,6 +296,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) struct gl_program *prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ + case GL_VERTEX_STATE_PROGRAM_NV: prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), target, id ); break; -- cgit v1.2.3 From 3e750ce5c4576883f5b567eaf3336fea3df3a997 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 10:20:26 -0600 Subject: demos: fix incorrect assertion --- progs/tests/vptest1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/tests/vptest1.c b/progs/tests/vptest1.c index 5162919292..6e32b03346 100644 --- a/progs/tests/vptest1.c +++ b/progs/tests/vptest1.c @@ -128,7 +128,7 @@ static void Init( void ) glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1, strlen(prog1), (const GLubyte *) prog1); - assert(!glIsProgramNV(1)); + assert(glIsProgramNV(1)); glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 2, strlen(prog2), -- cgit v1.2.3 From 957a625b2d7cf1f84c917948c8c0f6899d86379e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 10:40:21 -0600 Subject: intel: #include polygon.h to silence warning --- src/mesa/drivers/dri/intel/intel_clear.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 6c609336a2..aed95c7c56 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -38,6 +38,7 @@ #include "main/enable.h" #include "main/macros.h" #include "main/matrix.h" +#include "main/polygon.h" #include "main/texstate.h" #include "main/shaders.h" #include "main/stencil.h" -- cgit v1.2.3 From 927dc39de0aa3840b6e054128f49a6882771ab19 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 10:42:15 -0600 Subject: i965: use region width, height in brw_update_renderbuffer_surface() Fixes a regression from commit 2c30fd84dfa052949a117c78d932b58c1f88b446 seen with DRI1. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 0dc377be65..71840d1e4e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -546,8 +546,8 @@ brw_update_renderbuffer_surface(struct brw_context *brw, irb->texformat->MesaFormat); } key.tiling = region->tiling; - key.width = rb->Width; - key.height = rb->Height; + key.width = region->width; + key.height = region->height; key.pitch = region->pitch; key.cpp = region->cpp; } else { -- cgit v1.2.3 From 118856641f4871d6f6afd1abb67ad7fe56a6814b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 12:54:27 -0600 Subject: demos: move glslnoise.c demo to glsl/noise2.c --- progs/demos/Makefile | 1 - progs/demos/glslnoise.c | 201 ------------------------------------------------ progs/glsl/Makefile | 8 ++ progs/glsl/noise2.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 209 insertions(+), 202 deletions(-) delete mode 100644 progs/demos/glslnoise.c create mode 100644 progs/glsl/noise2.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 32c6072123..43bf09c0af 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -32,7 +32,6 @@ PROGS = \ geartrain \ glinfo \ gloss \ - glslnoise \ gltestperf \ glutfx \ isosurf \ diff --git a/progs/demos/glslnoise.c b/progs/demos/glslnoise.c deleted file mode 100644 index e972b62673..0000000000 --- a/progs/demos/glslnoise.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * GLSL noise demo. - * - * Michal Krol - * 20 February 2006 - * - * Based on the original demo by: - * Stefan Gustavson (stegu@itn.liu.se) 2004, 2005 - */ - -#ifdef WIN32 -#include -#endif - -#include -#include -#include -#include -#include - -#ifdef WIN32 -#define GETPROCADDRESS(F) wglGetProcAddress(F) -#else -#define GETPROCADDRESS(F) glutGetProcAddress(F) -#endif - -static GLhandleARB fragShader; -static GLhandleARB vertShader; -static GLhandleARB program; - -static GLint uTime; - -static GLint t0 = 0; -static GLint frames = 0; - -static GLfloat u_time = 0.0f; - -static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL; -static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; -static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; -static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL; -static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; -static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; -static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; -static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL; -static PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL; - -static void Redisplay (void) -{ - GLint t; - - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glUniform1fARB (uTime, 0.5f * u_time); - - glPushMatrix (); - glutSolidSphere (2.0, 20, 10); - glPopMatrix (); - - glutSwapBuffers(); - frames++; - - t = glutGet (GLUT_ELAPSED_TIME); - if (t - t0 >= 5000) { - GLfloat seconds = (GLfloat) (t - t0) / 1000.0f; - GLfloat fps = frames / seconds; - printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps); - fflush(stdout); - t0 = t; - frames = 0; - } -} - -static void Idle (void) -{ - u_time += 0.1f; - glutPostRedisplay (); -} - -static void Reshape (int width, int height) -{ - glViewport (0, 0, width, height); - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - glFrustum (-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); - glTranslatef (0.0f, 0.0f, -15.0f); -} - -static void Key (unsigned char key, int x, int y) -{ - (void) x; - (void) y; - - switch (key) - { - case 27: - exit(0); - break; - } - glutPostRedisplay (); -} - -static void Init (void) -{ - static const char *fragShaderText = - "uniform float time;\n" - "varying vec3 position;\n" - "void main () {\n" - " gl_FragColor = vec4 (vec3 (0.5 + 0.5 * noise1 (vec4 (position, time))), 1.0);\n" - "}\n" - ; - static const char *vertShaderText = - "varying vec3 position;\n" - "void main () {\n" - " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" - " position = 4.0 * gl_Vertex.xyz;\n" - "}\n" - ; - - if (!glutExtensionSupported ("GL_ARB_fragment_shader")) - { - printf ("Sorry, this demo requires GL_ARB_fragment_shader\n"); - exit(1); - } - if (!glutExtensionSupported ("GL_ARB_shader_objects")) - { - printf ("Sorry, this demo requires GL_ARB_shader_objects\n"); - exit(1); - } - if (!glutExtensionSupported ("GL_ARB_shading_language_100")) - { - printf ("Sorry, this demo requires GL_ARB_shading_language_100\n"); - exit(1); - } - if (!glutExtensionSupported ("GL_ARB_vertex_shader")) - { - printf ("Sorry, this demo requires GL_ARB_vertex_shader\n"); - exit(1); - } - - glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) - GETPROCADDRESS("glCreateShaderObjectARB"); - glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) - GETPROCADDRESS("glShaderSourceARB"); - glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) - GETPROCADDRESS("glCompileShaderARB"); - glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) - GETPROCADDRESS("glCreateProgramObjectARB"); - glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) - GETPROCADDRESS("glAttachObjectARB"); - glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) - GETPROCADDRESS ("glLinkProgramARB"); - glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) - GETPROCADDRESS("glUseProgramObjectARB"); - - glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) - GETPROCADDRESS("glGetUniformLocationARB"); - glUniform1fARB = (PFNGLUNIFORM1FARBPROC) - GETPROCADDRESS("glUniform1fARB"); - - fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB); - glShaderSourceARB (fragShader, 1, &fragShaderText, NULL); - glCompileShaderARB (fragShader); - - vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); - glShaderSourceARB (vertShader, 1, &vertShaderText, NULL); - glCompileShaderARB (vertShader); - - program = glCreateProgramObjectARB (); - glAttachObjectARB (program, fragShader); - glAttachObjectARB (program, vertShader); - glLinkProgramARB (program); - glUseProgramObjectARB (program); - - uTime = glGetUniformLocationARB (program, "time"); - - glClearColor (0.0f, 0.1f, 0.3f, 1.0f); - glEnable (GL_CULL_FACE); - glEnable (GL_DEPTH_TEST); - - printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER)); -} - -int main (int argc, char *argv[]) -{ - glutInit (&argc, argv); - glutInitWindowPosition ( 0, 0); - glutInitWindowSize (200, 200); - glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - glutCreateWindow (argv[0]); - glutReshapeFunc (Reshape); - glutKeyboardFunc (Key); - glutDisplayFunc (Redisplay); - glutIdleFunc (Idle); - Init (); - glutMainLoop (); - return 0; -} - diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 5fb95c4b3b..8e61ab690b 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -23,6 +23,7 @@ PROGS = \ multinoise \ multitex \ noise \ + noise2 \ points \ pointcoord \ samplers \ @@ -163,6 +164,13 @@ noise: noise.o shaderutil.o $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@ +noise2.o: noise2.c extfuncs.h shaderutil.h + $(APP_CC) -c -I$(INCDIR) $(CFLAGS) noise2.c + +noise2: noise2.o shaderutil.o + $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise2.o shaderutil.o $(LIBS) -o $@ + + points.o: points.c extfuncs.h shaderutil.h $(APP_CC) -c -I$(INCDIR) $(CFLAGS) points.c diff --git a/progs/glsl/noise2.c b/progs/glsl/noise2.c new file mode 100644 index 0000000000..e972b62673 --- /dev/null +++ b/progs/glsl/noise2.c @@ -0,0 +1,201 @@ +/* + * GLSL noise demo. + * + * Michal Krol + * 20 February 2006 + * + * Based on the original demo by: + * Stefan Gustavson (stegu@itn.liu.se) 2004, 2005 + */ + +#ifdef WIN32 +#include +#endif + +#include +#include +#include +#include +#include + +#ifdef WIN32 +#define GETPROCADDRESS(F) wglGetProcAddress(F) +#else +#define GETPROCADDRESS(F) glutGetProcAddress(F) +#endif + +static GLhandleARB fragShader; +static GLhandleARB vertShader; +static GLhandleARB program; + +static GLint uTime; + +static GLint t0 = 0; +static GLint frames = 0; + +static GLfloat u_time = 0.0f; + +static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL; +static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL; +static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL; +static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL; +static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL; +static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL; +static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL; +static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL; +static PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL; + +static void Redisplay (void) +{ + GLint t; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glUniform1fARB (uTime, 0.5f * u_time); + + glPushMatrix (); + glutSolidSphere (2.0, 20, 10); + glPopMatrix (); + + glutSwapBuffers(); + frames++; + + t = glutGet (GLUT_ELAPSED_TIME); + if (t - t0 >= 5000) { + GLfloat seconds = (GLfloat) (t - t0) / 1000.0f; + GLfloat fps = frames / seconds; + printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps); + fflush(stdout); + t0 = t; + frames = 0; + } +} + +static void Idle (void) +{ + u_time += 0.1f; + glutPostRedisplay (); +} + +static void Reshape (int width, int height) +{ + glViewport (0, 0, width, height); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glFrustum (-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + glTranslatef (0.0f, 0.0f, -15.0f); +} + +static void Key (unsigned char key, int x, int y) +{ + (void) x; + (void) y; + + switch (key) + { + case 27: + exit(0); + break; + } + glutPostRedisplay (); +} + +static void Init (void) +{ + static const char *fragShaderText = + "uniform float time;\n" + "varying vec3 position;\n" + "void main () {\n" + " gl_FragColor = vec4 (vec3 (0.5 + 0.5 * noise1 (vec4 (position, time))), 1.0);\n" + "}\n" + ; + static const char *vertShaderText = + "varying vec3 position;\n" + "void main () {\n" + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + " position = 4.0 * gl_Vertex.xyz;\n" + "}\n" + ; + + if (!glutExtensionSupported ("GL_ARB_fragment_shader")) + { + printf ("Sorry, this demo requires GL_ARB_fragment_shader\n"); + exit(1); + } + if (!glutExtensionSupported ("GL_ARB_shader_objects")) + { + printf ("Sorry, this demo requires GL_ARB_shader_objects\n"); + exit(1); + } + if (!glutExtensionSupported ("GL_ARB_shading_language_100")) + { + printf ("Sorry, this demo requires GL_ARB_shading_language_100\n"); + exit(1); + } + if (!glutExtensionSupported ("GL_ARB_vertex_shader")) + { + printf ("Sorry, this demo requires GL_ARB_vertex_shader\n"); + exit(1); + } + + glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) + GETPROCADDRESS("glCreateShaderObjectARB"); + glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) + GETPROCADDRESS("glShaderSourceARB"); + glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) + GETPROCADDRESS("glCompileShaderARB"); + glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) + GETPROCADDRESS("glCreateProgramObjectARB"); + glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) + GETPROCADDRESS("glAttachObjectARB"); + glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) + GETPROCADDRESS ("glLinkProgramARB"); + glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) + GETPROCADDRESS("glUseProgramObjectARB"); + + glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) + GETPROCADDRESS("glGetUniformLocationARB"); + glUniform1fARB = (PFNGLUNIFORM1FARBPROC) + GETPROCADDRESS("glUniform1fARB"); + + fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB); + glShaderSourceARB (fragShader, 1, &fragShaderText, NULL); + glCompileShaderARB (fragShader); + + vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB); + glShaderSourceARB (vertShader, 1, &vertShaderText, NULL); + glCompileShaderARB (vertShader); + + program = glCreateProgramObjectARB (); + glAttachObjectARB (program, fragShader); + glAttachObjectARB (program, vertShader); + glLinkProgramARB (program); + glUseProgramObjectARB (program); + + uTime = glGetUniformLocationARB (program, "time"); + + glClearColor (0.0f, 0.1f, 0.3f, 1.0f); + glEnable (GL_CULL_FACE); + glEnable (GL_DEPTH_TEST); + + printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER)); +} + +int main (int argc, char *argv[]) +{ + glutInit (&argc, argv); + glutInitWindowPosition ( 0, 0); + glutInitWindowSize (200, 200); + glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + glutCreateWindow (argv[0]); + glutReshapeFunc (Reshape); + glutKeyboardFunc (Key); + glutDisplayFunc (Redisplay); + glutIdleFunc (Idle); + Init (); + glutMainLoop (); + return 0; +} + -- cgit v1.2.3 From 6a495d26af54011ff1ec0597b38db2ce162c7d50 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 12:55:55 -0600 Subject: demos: move streaming_rect.c demo to tests/ --- progs/demos/Makefile | 1 - progs/demos/streaming_rect.c | 327 ------------------------------------------- progs/tests/Makefile | 1 + progs/tests/streaming_rect.c | 327 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 328 insertions(+), 328 deletions(-) delete mode 100644 progs/demos/streaming_rect.c create mode 100644 progs/tests/streaming_rect.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 43bf09c0af..1cdd963417 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -48,7 +48,6 @@ PROGS = \ renormal \ shadowtex \ singlebuffer \ - streaming_rect \ spectex \ spriteblast \ stex3d \ diff --git a/progs/demos/streaming_rect.c b/progs/demos/streaming_rect.c deleted file mode 100644 index f65ac4ce36..0000000000 --- a/progs/demos/streaming_rect.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * GL_ARB_pixel_buffer_object test - * - * Command line options: - * -w WIDTH -h HEIGHT sets window size - * - */ - -#include -#include -#include -#include -#include -#include - -#include "readtex.h" - - -#define ANIMATE 10 -#define PBO 11 -#define QUIT 100 - -static GLuint DrawPBO; - -static GLboolean Animate = GL_TRUE; -static GLboolean use_pbo = 1; -static GLboolean whole_rect = 1; - -static GLfloat Drift = 0.0; -static GLfloat drift_increment = 1/255.0; -static GLfloat Xrot = 20.0, Yrot = 30.0; - -static GLuint Width = 1024; -static GLuint Height = 512; - - -static void Idle( void ) -{ - if (Animate) { - - Drift += drift_increment; - if (Drift >= 1.0) - Drift = 0.0; - - glutPostRedisplay(); - } -} - -/*static int max( int a, int b ) { return a > b ? a : b; }*/ - -#ifndef min -static int min( int a, int b ) { return a < b ? a : b; } -#endif - -static void DrawObject() -{ - GLint size = Width * Height * 4; - - if (use_pbo) { - /* XXX: This is extremely important - semantically makes the buffer - * contents undefined, but in practice means that the driver can - * release the old copy of the texture and allocate a new one - * without waiting for outstanding rendering to complete. - */ - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, size, NULL, GL_STREAM_DRAW_ARB); - - { - char *image = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY_ARB); - - printf("char %d\n", (unsigned char)(Drift * 255)); - - memset(image, (unsigned char)(Drift * 255), size); - - glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT); - } - - - /* BGRA is required for most hardware paths: - */ - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, Width, Height, 0, - GL_BGRA, GL_UNSIGNED_BYTE, NULL); - } - else { - static char *image = NULL; - - if (image == NULL) - image = malloc(size); - - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - - memset(image, (unsigned char)(Drift * 255), size); - - /* BGRA should be the fast path for regular uploads as well. - */ - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, Width, Height, 0, - GL_BGRA, GL_UNSIGNED_BYTE, image); - } - - { - int x,y,w,h; - - if (whole_rect) { - x = y = 0; - w = Width; - h = Height; - } - else { - x = y = 0; - w = min(10, Width); - h = min(10, Height); - } - - glBegin(GL_QUADS); - - glTexCoord2f( x, y); - glVertex2f( x, y ); - - glTexCoord2f( x, y + h); - glVertex2f( x, y + h); - - glTexCoord2f( x + w + .5, y + h); - glVertex2f( x + w, y + h ); - - glTexCoord2f( x + w, y + .5); - glVertex2f( x + w, y ); - - glEnd(); - } -} - - - -static void Display( void ) -{ - static GLint T0 = 0; - static GLint Frames = 0; - GLint t; - - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - DrawObject(); - glPopMatrix(); - - glutSwapBuffers(); - - Frames++; - - t = glutGet(GLUT_ELAPSED_TIME); - if (t - T0 >= 1000) { - GLfloat seconds = (t - T0) / 1000.0; - - GLfloat fps = Frames / seconds; - printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); - fflush(stdout); - - drift_increment = 2.2 * seconds / Frames; - T0 = t; - Frames = 0; - } -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); -/* glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); */ - gluOrtho2D( 0, width, height, 0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef(0.375, 0.375, 0); -} - - -static void ModeMenu(int entry) -{ - if (entry==ANIMATE) { - Animate = !Animate; - } - else if (entry==PBO) { - use_pbo = !use_pbo; - } - else if (entry==QUIT) { - exit(0); - } - - glutPostRedisplay(); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - const char *exten = (const char *) glGetString(GL_EXTENSIONS); - GLuint texObj; - GLint size; - - - if (!strstr(exten, "GL_ARB_pixel_buffer_object")) { - printf("Sorry, GL_ARB_pixel_buffer_object not supported by this renderer.\n"); - exit(1); - } - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); - printf("%d x %d max texture size\n", size, size); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - /* allocate two texture objects */ - glGenTextures(1, &texObj); - - /* setup the texture objects */ - glActiveTextureARB(GL_TEXTURE0_ARB); - glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texObj); - - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glGenBuffersARB(1, &DrawPBO); - - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, - Width * Height * 4, NULL, GL_STREAM_DRAW); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - glEnable(GL_TEXTURE_RECTANGLE_ARB); - - glShadeModel(GL_SMOOTH); - glClearColor(0.3, 0.3, 0.4, 1.0); - - if (argc > 1 && strcmp(argv[1], "-info")==0) { - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); - } -} - - -int main( int argc, char *argv[] ) -{ - GLint i; - - glutInit( &argc, argv ); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-w") == 0) { - Width = atoi(argv[i+1]); - if (Width <= 0) { - printf("Error, bad width\n"); - exit(1); - } - i++; - } - else if (strcmp(argv[i], "-h") == 0) { - Height = atoi(argv[i+1]); - if (Height <= 0) { - printf("Error, bad height\n"); - exit(1); - } - i++; - } - } - - glutInitWindowSize( Width, Height ); - glutInitWindowPosition( 0, 0 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0] ); - glewInit(); - - Init( argc, argv ); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutIdleFunc( Idle ); - - glutCreateMenu(ModeMenu); - glutAddMenuEntry("Toggle Animation", ANIMATE); - glutAddMenuEntry("Toggle PBO", PBO); - glutAddMenuEntry("Quit", QUIT); - glutAttachMenu(GLUT_RIGHT_BUTTON); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 90c41a327e..28b6fb9a5c 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -77,6 +77,7 @@ SOURCES = \ stencil_twoside.c \ stencilwrap.c \ stencil_wrap.c \ + streaming_rect \ subtex \ subtexrate.c \ tex1d.c \ diff --git a/progs/tests/streaming_rect.c b/progs/tests/streaming_rect.c new file mode 100644 index 0000000000..f65ac4ce36 --- /dev/null +++ b/progs/tests/streaming_rect.c @@ -0,0 +1,327 @@ +/* + * GL_ARB_pixel_buffer_object test + * + * Command line options: + * -w WIDTH -h HEIGHT sets window size + * + */ + +#include +#include +#include +#include +#include +#include + +#include "readtex.h" + + +#define ANIMATE 10 +#define PBO 11 +#define QUIT 100 + +static GLuint DrawPBO; + +static GLboolean Animate = GL_TRUE; +static GLboolean use_pbo = 1; +static GLboolean whole_rect = 1; + +static GLfloat Drift = 0.0; +static GLfloat drift_increment = 1/255.0; +static GLfloat Xrot = 20.0, Yrot = 30.0; + +static GLuint Width = 1024; +static GLuint Height = 512; + + +static void Idle( void ) +{ + if (Animate) { + + Drift += drift_increment; + if (Drift >= 1.0) + Drift = 0.0; + + glutPostRedisplay(); + } +} + +/*static int max( int a, int b ) { return a > b ? a : b; }*/ + +#ifndef min +static int min( int a, int b ) { return a < b ? a : b; } +#endif + +static void DrawObject() +{ + GLint size = Width * Height * 4; + + if (use_pbo) { + /* XXX: This is extremely important - semantically makes the buffer + * contents undefined, but in practice means that the driver can + * release the old copy of the texture and allocate a new one + * without waiting for outstanding rendering to complete. + */ + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); + glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, size, NULL, GL_STREAM_DRAW_ARB); + + { + char *image = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY_ARB); + + printf("char %d\n", (unsigned char)(Drift * 255)); + + memset(image, (unsigned char)(Drift * 255), size); + + glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT); + } + + + /* BGRA is required for most hardware paths: + */ + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, Width, Height, 0, + GL_BGRA, GL_UNSIGNED_BYTE, NULL); + } + else { + static char *image = NULL; + + if (image == NULL) + image = malloc(size); + + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); + + memset(image, (unsigned char)(Drift * 255), size); + + /* BGRA should be the fast path for regular uploads as well. + */ + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, Width, Height, 0, + GL_BGRA, GL_UNSIGNED_BYTE, image); + } + + { + int x,y,w,h; + + if (whole_rect) { + x = y = 0; + w = Width; + h = Height; + } + else { + x = y = 0; + w = min(10, Width); + h = min(10, Height); + } + + glBegin(GL_QUADS); + + glTexCoord2f( x, y); + glVertex2f( x, y ); + + glTexCoord2f( x, y + h); + glVertex2f( x, y + h); + + glTexCoord2f( x + w + .5, y + h); + glVertex2f( x + w, y + h ); + + glTexCoord2f( x + w, y + .5); + glVertex2f( x + w, y ); + + glEnd(); + } +} + + + +static void Display( void ) +{ + static GLint T0 = 0; + static GLint Frames = 0; + GLint t; + + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + DrawObject(); + glPopMatrix(); + + glutSwapBuffers(); + + Frames++; + + t = glutGet(GLUT_ELAPSED_TIME); + if (t - T0 >= 1000) { + GLfloat seconds = (t - T0) / 1000.0; + + GLfloat fps = Frames / seconds; + printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); + fflush(stdout); + + drift_increment = 2.2 * seconds / Frames; + T0 = t; + Frames = 0; + } +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); +/* glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 ); */ + gluOrtho2D( 0, width, height, 0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef(0.375, 0.375, 0); +} + + +static void ModeMenu(int entry) +{ + if (entry==ANIMATE) { + Animate = !Animate; + } + else if (entry==PBO) { + use_pbo = !use_pbo; + } + else if (entry==QUIT) { + exit(0); + } + + glutPostRedisplay(); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + float step = 3.0; + (void) x; + (void) y; + + switch (key) { + case GLUT_KEY_UP: + Xrot += step; + break; + case GLUT_KEY_DOWN: + Xrot -= step; + break; + case GLUT_KEY_LEFT: + Yrot += step; + break; + case GLUT_KEY_RIGHT: + Yrot -= step; + break; + } + glutPostRedisplay(); +} + + +static void Init( int argc, char *argv[] ) +{ + const char *exten = (const char *) glGetString(GL_EXTENSIONS); + GLuint texObj; + GLint size; + + + if (!strstr(exten, "GL_ARB_pixel_buffer_object")) { + printf("Sorry, GL_ARB_pixel_buffer_object not supported by this renderer.\n"); + exit(1); + } + + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size); + printf("%d x %d max texture size\n", size, size); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + /* allocate two texture objects */ + glGenTextures(1, &texObj); + + /* setup the texture objects */ + glActiveTextureARB(GL_TEXTURE0_ARB); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texObj); + + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glGenBuffersARB(1, &DrawPBO); + + glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); + glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, + Width * Height * 4, NULL, GL_STREAM_DRAW); + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + glEnable(GL_TEXTURE_RECTANGLE_ARB); + + glShadeModel(GL_SMOOTH); + glClearColor(0.3, 0.3, 0.4, 1.0); + + if (argc > 1 && strcmp(argv[1], "-info")==0) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } +} + + +int main( int argc, char *argv[] ) +{ + GLint i; + + glutInit( &argc, argv ); + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-w") == 0) { + Width = atoi(argv[i+1]); + if (Width <= 0) { + printf("Error, bad width\n"); + exit(1); + } + i++; + } + else if (strcmp(argv[i], "-h") == 0) { + Height = atoi(argv[i+1]); + if (Height <= 0) { + printf("Error, bad height\n"); + exit(1); + } + i++; + } + } + + glutInitWindowSize( Width, Height ); + glutInitWindowPosition( 0, 0 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + glutCreateWindow(argv[0] ); + glewInit(); + + Init( argc, argv ); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutIdleFunc( Idle ); + + glutCreateMenu(ModeMenu); + glutAddMenuEntry("Toggle Animation", ANIMATE); + glutAddMenuEntry("Toggle PBO", PBO); + glutAddMenuEntry("Quit", QUIT); + glutAttachMenu(GLUT_RIGHT_BUTTON); + + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From dfd69a27f8c3db3d90e2334237bf4a8eabb17e9e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 12:57:13 -0600 Subject: demos: move glutfx demo to tests/ --- progs/demos/Makefile | 1 - progs/demos/glutfx.c | 189 --------------------------------------------------- progs/tests/Makefile | 1 + progs/tests/glutfx.c | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 190 deletions(-) delete mode 100644 progs/demos/glutfx.c create mode 100644 progs/tests/glutfx.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 1cdd963417..0d4b845137 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -33,7 +33,6 @@ PROGS = \ glinfo \ gloss \ gltestperf \ - glutfx \ isosurf \ ipers \ lodbias \ diff --git a/progs/demos/glutfx.c b/progs/demos/glutfx.c deleted file mode 100644 index 8bf5582389..0000000000 --- a/progs/demos/glutfx.c +++ /dev/null @@ -1,189 +0,0 @@ - -/* - * Example of how one might use GLUT with the 3Dfx driver in full-screen mode. - * Note: this only works with X since we're using Mesa's GLX "hack" for - * using Glide. - * - * Goals: - * easy setup and input event handling with GLUT - * use 3Dfx hardware - * automatically set MESA environment variables - * don't lose mouse input focus - * - * Brian Paul This file is in the public domain. - */ - - -#include -#include -#include -#include - - -#define WIDTH 640 -#define HEIGHT 480 - - -static int Window = 0; -static int ScreenWidth, ScreenHeight; -static GLuint Torus = 0; -static GLfloat Xrot = 0.0, Yrot = 0.0; - - - -static void Display( void ) -{ - static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; - static GLfloat red[4] = {1.0, 0.2, 0.2, 1.0}; - static GLfloat green[4] = {0.2, 1.0, 0.2, 1.0}; - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue); - glCallList(Torus); - - glRotatef(90.0, 1, 0, 0); - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red); - glCallList(Torus); - - glRotatef(90.0, 0, 1, 0); - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green); - glCallList(Torus); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - float ratio = (float) width / (float) height; - - ScreenWidth = width; - ScreenHeight = height; - - /* - * The 3Dfx driver is limited to 640 x 480 but the X window may be larger. - * Enforce that here. - */ - if (width > WIDTH) - width = WIDTH; - if (height > HEIGHT) - height = HEIGHT; - - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ratio, ratio, -1.0, 1.0, 5.0, 30.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -20.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - glutDestroyWindow(Window); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - break; - case GLUT_KEY_DOWN: - break; - case GLUT_KEY_LEFT: - break; - case GLUT_KEY_RIGHT: - break; - } - glutPostRedisplay(); -} - - -static void MouseMove( int x, int y ) -{ - Xrot = y - ScreenWidth / 2; - Yrot = x - ScreenHeight / 2; - glutPostRedisplay(); -} - - -static void Init( void ) -{ - Torus = glGenLists(1); - glNewList(Torus, GL_COMPILE); - glutSolidTorus(0.5, 2.0, 10, 20); - glEndList(); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_CULL_FACE); -} - - -int main( int argc, char *argv[] ) -{ -#ifndef _WIN32 - printf("NOTE: if you've got 3Dfx VooDoo hardware you must run this"); - printf(" program as root.\n\n"); - printf("Move the mouse. Press ESC to exit.\n\n"); -#endif - - /* Tell Mesa GLX to use 3Dfx driver in fullscreen mode. */ - putenv("MESA_GLX_FX=fullscreen"); - - /* Disable 3Dfx Glide splash screen */ - putenv("FX_GLIDE_NO_SPLASH="); - - /* Give an initial size and position so user doesn't have to place window */ - glutInitWindowPosition(0, 0); - glutInitWindowSize(WIDTH, HEIGHT); - glutInit( &argc, argv ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - - Window = glutCreateWindow(argv[0]); - if (!Window) { - printf("Error, couldn't open window\n"); - exit(1); - } - - /* - * Want the X window to fill the screen so that we don't have to - * worry about losing the mouse input focus. - * Note that we won't actually see the X window since we never draw - * to it, hence, the original X screen's contents aren't disturbed. - */ - glutFullScreen(); - - Init(); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - glutPassiveMotionFunc( MouseMove ); - - glutMainLoop(); - return 0; -} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 28b6fb9a5c..18ea559b46 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -50,6 +50,7 @@ SOURCES = \ fptest1.c \ fptexture.c \ getprocaddress.c \ + glutfx \ interleave.c \ invert.c \ jkrahntest.c \ diff --git a/progs/tests/glutfx.c b/progs/tests/glutfx.c new file mode 100644 index 0000000000..8bf5582389 --- /dev/null +++ b/progs/tests/glutfx.c @@ -0,0 +1,189 @@ + +/* + * Example of how one might use GLUT with the 3Dfx driver in full-screen mode. + * Note: this only works with X since we're using Mesa's GLX "hack" for + * using Glide. + * + * Goals: + * easy setup and input event handling with GLUT + * use 3Dfx hardware + * automatically set MESA environment variables + * don't lose mouse input focus + * + * Brian Paul This file is in the public domain. + */ + + +#include +#include +#include +#include + + +#define WIDTH 640 +#define HEIGHT 480 + + +static int Window = 0; +static int ScreenWidth, ScreenHeight; +static GLuint Torus = 0; +static GLfloat Xrot = 0.0, Yrot = 0.0; + + + +static void Display( void ) +{ + static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0}; + static GLfloat red[4] = {1.0, 0.2, 0.2, 1.0}; + static GLfloat green[4] = {0.2, 1.0, 0.2, 1.0}; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glPushMatrix(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue); + glCallList(Torus); + + glRotatef(90.0, 1, 0, 0); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red); + glCallList(Torus); + + glRotatef(90.0, 0, 1, 0); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green); + glCallList(Torus); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + float ratio = (float) width / (float) height; + + ScreenWidth = width; + ScreenHeight = height; + + /* + * The 3Dfx driver is limited to 640 x 480 but the X window may be larger. + * Enforce that here. + */ + if (width > WIDTH) + width = WIDTH; + if (height > HEIGHT) + height = HEIGHT; + + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -ratio, ratio, -1.0, 1.0, 5.0, 30.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -20.0 ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glutDestroyWindow(Window); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + break; + case GLUT_KEY_DOWN: + break; + case GLUT_KEY_LEFT: + break; + case GLUT_KEY_RIGHT: + break; + } + glutPostRedisplay(); +} + + +static void MouseMove( int x, int y ) +{ + Xrot = y - ScreenWidth / 2; + Yrot = x - ScreenHeight / 2; + glutPostRedisplay(); +} + + +static void Init( void ) +{ + Torus = glGenLists(1); + glNewList(Torus, GL_COMPILE); + glutSolidTorus(0.5, 2.0, 10, 20); + glEndList(); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); +} + + +int main( int argc, char *argv[] ) +{ +#ifndef _WIN32 + printf("NOTE: if you've got 3Dfx VooDoo hardware you must run this"); + printf(" program as root.\n\n"); + printf("Move the mouse. Press ESC to exit.\n\n"); +#endif + + /* Tell Mesa GLX to use 3Dfx driver in fullscreen mode. */ + putenv("MESA_GLX_FX=fullscreen"); + + /* Disable 3Dfx Glide splash screen */ + putenv("FX_GLIDE_NO_SPLASH="); + + /* Give an initial size and position so user doesn't have to place window */ + glutInitWindowPosition(0, 0); + glutInitWindowSize(WIDTH, HEIGHT); + glutInit( &argc, argv ); + + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + + Window = glutCreateWindow(argv[0]); + if (!Window) { + printf("Error, couldn't open window\n"); + exit(1); + } + + /* + * Want the X window to fill the screen so that we don't have to + * worry about losing the mouse input focus. + * Note that we won't actually see the X window since we never draw + * to it, hence, the original X screen's contents aren't disturbed. + */ + glutFullScreen(); + + Init(); + + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + glutPassiveMotionFunc( MouseMove ); + + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From f47495ec42491f1c32391f29e5ed8819eaef6ee2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 12:58:00 -0600 Subject: demos: move texdown.c to tests/ --- progs/demos/Makefile | 1 - progs/demos/texdown.c | 477 -------------------------------------------------- progs/tests/Makefile | 1 + progs/tests/texdown.c | 477 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 478 insertions(+), 478 deletions(-) delete mode 100644 progs/demos/texdown.c create mode 100644 progs/tests/texdown.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 0d4b845137..0f72595c23 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -54,7 +54,6 @@ PROGS = \ terrain \ tessdemo \ texcyl \ - texdown \ texenv \ texobj \ textures \ diff --git a/progs/demos/texdown.c b/progs/demos/texdown.c deleted file mode 100644 index 7e46045832..0000000000 --- a/progs/demos/texdown.c +++ /dev/null @@ -1,477 +0,0 @@ - -/* - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * texdown - * - * Measure texture download speed. - * Use keyboard to change texture size, format, datatype, scale/bias, - * subimageload, etc. - * - * Brian Paul 28 January 2000 - */ - - -#include -#include -#include -#include - - -static GLsizei MaxSize = 2048; -static GLsizei TexWidth = 1024, TexHeight = 1024, TexBorder = 0; -static GLboolean ScaleAndBias = GL_FALSE; -static GLboolean SubImage = GL_FALSE; -static GLdouble DownloadRate = 0.0; /* texels/sec */ - -static GLuint Mode = 0; - - -/* Try and avoid L2 cache effects by cycling through a small number of - * textures. - * - * At the initial size of 1024x1024x4 == 4mbyte, say 8 textures will - * keep us out of most caches at 32mb total. - * - * This turns into a fairly interesting question of what exactly you - * expect to be in cache in normal usage, and what you think should be - * outside. There's no rules for this, no reason to favour one usage - * over another except what the application you care about happens to - * resemble most closely. - * - * - Should the client texture image be in L2 cache? Has it just been - * generated or read from disk? - * - Does the application really use >1 texture, or is it constantly - * updating one image in-place? - * - * Different answers will favour different texture upload mechanisms. - * To upload an image that is purely outside of cache, a DMA-based - * upload will probably win, whereas for small, in-cache textures, - * copying looks good. - */ -#define NR_TEXOBJ 4 -static GLuint TexObj[NR_TEXOBJ]; - - -struct FormatRec { - GLenum Format; - GLenum Type; - GLenum IntFormat; - GLint TexelSize; -}; - - -static const struct FormatRec FormatTable[] = { - /* Format Type IntFormat TexelSize */ - { GL_BGRA, GL_UNSIGNED_BYTE, GL_RGBA, 4 }, - { GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, 3 }, - { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA, 4 }, - { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGB, 4 }, - { GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB, 2 }, - { GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE, 1 }, - { GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE_ALPHA, 2 }, - { GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA, 1 }, -}; -static GLint Format; - -#define NUM_FORMATS (sizeof(FormatTable)/sizeof(FormatTable[0])) - -static int -BytesPerTexel(GLint format) -{ - return FormatTable[format].TexelSize; -} - - -static const char * -FormatStr(GLenum format) -{ - switch (format) { - case GL_RGB: - return "GL_RGB"; - case GL_RGBA: - return "GL_RGBA"; - case GL_BGRA: - return "GL_BGRA"; - case GL_LUMINANCE: - return "GL_LUMINANCE"; - case GL_LUMINANCE_ALPHA: - return "GL_LUMINANCE_ALPHA"; - case GL_ALPHA: - return "GL_ALPHA"; - default: - return ""; - } -} - - -static const char * -TypeStr(GLenum type) -{ - switch (type) { - case GL_UNSIGNED_BYTE: - return "GL_UNSIGNED_BYTE"; - case GL_UNSIGNED_SHORT: - return "GL_UNSIGNED_SHORT"; - case GL_UNSIGNED_SHORT_5_6_5: - return "GL_UNSIGNED_SHORT_5_6_5"; - case GL_UNSIGNED_SHORT_5_6_5_REV: - return "GL_UNSIGNED_SHORT_5_6_5_REV"; - default: - return ""; - } -} - -/* On x86, there is a performance cliff for memcpy to texture memory - * for sources below 64 byte alignment. We do our best with this in - * the driver, but it is better if the images are correctly aligned to - * start with: - */ -#define ALIGN (1<<12) - -static unsigned long align(unsigned long value, unsigned long a) -{ - return (value + a - 1) & ~(a-1); -} - -static void -MeasureDownloadRate(void) -{ - const int w = TexWidth + 2 * TexBorder; - const int h = TexHeight + 2 * TexBorder; - const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN); - const int bytes = image_bytes * NR_TEXOBJ; - GLubyte *orig_texImage, *orig_getImage; - GLubyte *texImage, *getImage; - GLdouble t0, t1, time; - int count; - int i; - int offset = 0; - GLdouble total = 0; /* ints will tend to overflow */ - - printf("allocating %d bytes for %d %dx%d images\n", - bytes, NR_TEXOBJ, w, h); - - orig_texImage = (GLubyte *) malloc(bytes + ALIGN); - orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); - if (!orig_texImage || !orig_getImage) { - DownloadRate = 0.0; - return; - } - - printf("alloc %p %p\n", orig_texImage, orig_getImage); - - texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN); - getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN); - - for (i = 1; !(((unsigned long)texImage) & i); i<<=1) - ; - printf("texture image alignment: %d bytes (%p)\n", i, texImage); - - for (i = 0; i < bytes; i++) { - texImage[i] = i & 0xff; - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - if (ScaleAndBias) { - glPixelTransferf(GL_RED_SCALE, 0.5); - glPixelTransferf(GL_GREEN_SCALE, 0.5); - glPixelTransferf(GL_BLUE_SCALE, 0.5); - glPixelTransferf(GL_RED_BIAS, 0.5); - glPixelTransferf(GL_GREEN_BIAS, 0.5); - glPixelTransferf(GL_BLUE_BIAS, 0.5); - } - else { - glPixelTransferf(GL_RED_SCALE, 1.0); - glPixelTransferf(GL_GREEN_SCALE, 1.0); - glPixelTransferf(GL_BLUE_SCALE, 1.0); - glPixelTransferf(GL_RED_BIAS, 0.0); - glPixelTransferf(GL_GREEN_BIAS, 0.0); - glPixelTransferf(GL_BLUE_BIAS, 0.0); - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glEnable(GL_TEXTURE_2D); - - count = 0; - t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - do { - int img = count%NR_TEXOBJ; - GLubyte *img_ptr = texImage + img * image_bytes; - - glBindTexture(GL_TEXTURE_2D, TexObj[img]); - - if (SubImage && count > 0) { - /* Only update a portion of the image each iteration. This - * is presumably why you'd want to use texsubimage, otherwise - * you may as well just call teximage again. - * - * A bigger question is whether to use a pointer that moves - * with each call, ie does the incoming data come from L2 - * cache under normal circumstances, or is it pulled from - * uncached memory? - * - * There's a good argument to say L2 cache, ie you'd expect - * the data to have been recently generated. It's possible - * that it could have come from a file read, which may or may - * not have gone through the cpu. - */ - glTexSubImage2D(GL_TEXTURE_2D, 0, - -TexBorder, - -TexBorder + offset * h/8, - w, - h/8, - FormatTable[Format].Format, - FormatTable[Format].Type, -#if 1 - texImage /* likely in L2$ */ -#else - img_ptr + offset * bytes/8 /* unlikely in L2$ */ -#endif - ); - offset += 1; - offset %= 8; - total += w * h / 8; - } - else { - glTexImage2D(GL_TEXTURE_2D, 0, - FormatTable[Format].IntFormat, w, h, TexBorder, - FormatTable[Format].Format, - FormatTable[Format].Type, - img_ptr); - total += w*h; - } - - /* draw a tiny polygon to force texture into texram */ - glBegin(GL_TRIANGLES); - glTexCoord2f(0, 0); glVertex2f(1, 1); - glTexCoord2f(1, 0); glVertex2f(3, 1); - glTexCoord2f(0.5, 1); glVertex2f(2, 3); - glEnd(); - - t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - time = t1 - t0; - count++; - } while (time < 3.0); - - glDisable(GL_TEXTURE_2D); - - printf("total texels=%f time=%f\n", total, time); - DownloadRate = total / time; - - - free(orig_texImage); - free(orig_getImage); - - { - GLint err = glGetError(); - if (err) - printf("GL error %d\n", err); - } -} - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - -static void -Display(void) -{ - const int w = TexWidth + 2 * TexBorder; - const int h = TexHeight + 2 * TexBorder; - char s[1000]; - - glClear(GL_COLOR_BUFFER_BIT); - - glRasterPos2i(10, 80); - sprintf(s, "Texture size[cursor]: %d x %d Border[b]: %d", w, h, TexBorder); - PrintString(s); - - glRasterPos2i(10, 65); - sprintf(s, "Format[f]: %s Type: %s IntFormat: %s", - FormatStr(FormatTable[Format].Format), - TypeStr( FormatTable[Format].Type), - FormatStr(FormatTable[Format].IntFormat)); - PrintString(s); - - glRasterPos2i(10, 50); - sprintf(s, "Pixel Scale&Bias[p]: %s TexSubImage[s]: %s", - ScaleAndBias ? "Yes" : "No", - SubImage ? "Yes" : "No"); - PrintString(s); - - if (Mode == 0) { - glRasterPos2i(200, 10); - sprintf(s, "...Measuring..."); - PrintString(s); - glutSwapBuffers(); - glutPostRedisplay(); - Mode++; - } - else if (Mode == 1) { - MeasureDownloadRate(); - glutPostRedisplay(); - Mode++; - } - else { - /* show results */ - glRasterPos2i(10, 10); - sprintf(s, "Download rate: %g Mtexels/second %g MB/second", - DownloadRate / 1000000.0, - DownloadRate * BytesPerTexel(Format) / 1000000.0); - PrintString(s); - { - GLint r, g, b, a, l, i; - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); - sprintf(s, "TexelBits: R=%d G=%d B=%d A=%d L=%d I=%d", r, g, b, a, l, i); - glRasterPos2i(10, 25); - PrintString(s); - } - - glutSwapBuffers(); - } -} - - -static void -Reshape(int width, int height) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case ' ': - Mode = 0; - break; - case 'b': - /* toggle border */ - TexBorder = 1 - TexBorder; - Mode = 0; - break; - case 'f': - /* change format */ - Format = (Format + 1) % NUM_FORMATS; - Mode = 0; - break; - case 'F': - /* change format */ - Format = (Format - 1) % NUM_FORMATS; - Mode = 0; - break; - case 'p': - /* toggle border */ - ScaleAndBias = !ScaleAndBias; - Mode = 0; - break; - case 's': - SubImage = !SubImage; - Mode = 0; - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - if (TexHeight < MaxSize) - TexHeight *= 2; - break; - case GLUT_KEY_DOWN: - if (TexHeight > 1) - TexHeight /= 2; - break; - case GLUT_KEY_LEFT: - if (TexWidth > 1) - TexWidth /= 2; - break; - case GLUT_KEY_RIGHT: - if (TexWidth < MaxSize) - TexWidth *= 2; - break; - } - Mode = 0; - glutPostRedisplay(); -} - - -static void -Init(void) -{ - printf("GL_VENDOR = %s\n", (const char *) glGetString(GL_VENDOR)); - printf("GL_VERSION = %s\n", (const char *) glGetString(GL_VERSION)); - printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER)); -} - - -int -main(int argc, char *argv[]) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 600, 100 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 18ea559b46..cd6c496961 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -83,6 +83,7 @@ SOURCES = \ subtexrate.c \ tex1d.c \ texcompress2.c \ + texdown \ texfilt.c \ texline.c \ texobjshare.c \ diff --git a/progs/tests/texdown.c b/progs/tests/texdown.c new file mode 100644 index 0000000000..7e46045832 --- /dev/null +++ b/progs/tests/texdown.c @@ -0,0 +1,477 @@ + +/* + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * texdown + * + * Measure texture download speed. + * Use keyboard to change texture size, format, datatype, scale/bias, + * subimageload, etc. + * + * Brian Paul 28 January 2000 + */ + + +#include +#include +#include +#include + + +static GLsizei MaxSize = 2048; +static GLsizei TexWidth = 1024, TexHeight = 1024, TexBorder = 0; +static GLboolean ScaleAndBias = GL_FALSE; +static GLboolean SubImage = GL_FALSE; +static GLdouble DownloadRate = 0.0; /* texels/sec */ + +static GLuint Mode = 0; + + +/* Try and avoid L2 cache effects by cycling through a small number of + * textures. + * + * At the initial size of 1024x1024x4 == 4mbyte, say 8 textures will + * keep us out of most caches at 32mb total. + * + * This turns into a fairly interesting question of what exactly you + * expect to be in cache in normal usage, and what you think should be + * outside. There's no rules for this, no reason to favour one usage + * over another except what the application you care about happens to + * resemble most closely. + * + * - Should the client texture image be in L2 cache? Has it just been + * generated or read from disk? + * - Does the application really use >1 texture, or is it constantly + * updating one image in-place? + * + * Different answers will favour different texture upload mechanisms. + * To upload an image that is purely outside of cache, a DMA-based + * upload will probably win, whereas for small, in-cache textures, + * copying looks good. + */ +#define NR_TEXOBJ 4 +static GLuint TexObj[NR_TEXOBJ]; + + +struct FormatRec { + GLenum Format; + GLenum Type; + GLenum IntFormat; + GLint TexelSize; +}; + + +static const struct FormatRec FormatTable[] = { + /* Format Type IntFormat TexelSize */ + { GL_BGRA, GL_UNSIGNED_BYTE, GL_RGBA, 4 }, + { GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, 3 }, + { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA, 4 }, + { GL_RGBA, GL_UNSIGNED_BYTE, GL_RGB, 4 }, + { GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB, 2 }, + { GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE, 1 }, + { GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE_ALPHA, 2 }, + { GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA, 1 }, +}; +static GLint Format; + +#define NUM_FORMATS (sizeof(FormatTable)/sizeof(FormatTable[0])) + +static int +BytesPerTexel(GLint format) +{ + return FormatTable[format].TexelSize; +} + + +static const char * +FormatStr(GLenum format) +{ + switch (format) { + case GL_RGB: + return "GL_RGB"; + case GL_RGBA: + return "GL_RGBA"; + case GL_BGRA: + return "GL_BGRA"; + case GL_LUMINANCE: + return "GL_LUMINANCE"; + case GL_LUMINANCE_ALPHA: + return "GL_LUMINANCE_ALPHA"; + case GL_ALPHA: + return "GL_ALPHA"; + default: + return ""; + } +} + + +static const char * +TypeStr(GLenum type) +{ + switch (type) { + case GL_UNSIGNED_BYTE: + return "GL_UNSIGNED_BYTE"; + case GL_UNSIGNED_SHORT: + return "GL_UNSIGNED_SHORT"; + case GL_UNSIGNED_SHORT_5_6_5: + return "GL_UNSIGNED_SHORT_5_6_5"; + case GL_UNSIGNED_SHORT_5_6_5_REV: + return "GL_UNSIGNED_SHORT_5_6_5_REV"; + default: + return ""; + } +} + +/* On x86, there is a performance cliff for memcpy to texture memory + * for sources below 64 byte alignment. We do our best with this in + * the driver, but it is better if the images are correctly aligned to + * start with: + */ +#define ALIGN (1<<12) + +static unsigned long align(unsigned long value, unsigned long a) +{ + return (value + a - 1) & ~(a-1); +} + +static void +MeasureDownloadRate(void) +{ + const int w = TexWidth + 2 * TexBorder; + const int h = TexHeight + 2 * TexBorder; + const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN); + const int bytes = image_bytes * NR_TEXOBJ; + GLubyte *orig_texImage, *orig_getImage; + GLubyte *texImage, *getImage; + GLdouble t0, t1, time; + int count; + int i; + int offset = 0; + GLdouble total = 0; /* ints will tend to overflow */ + + printf("allocating %d bytes for %d %dx%d images\n", + bytes, NR_TEXOBJ, w, h); + + orig_texImage = (GLubyte *) malloc(bytes + ALIGN); + orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN); + if (!orig_texImage || !orig_getImage) { + DownloadRate = 0.0; + return; + } + + printf("alloc %p %p\n", orig_texImage, orig_getImage); + + texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN); + getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN); + + for (i = 1; !(((unsigned long)texImage) & i); i<<=1) + ; + printf("texture image alignment: %d bytes (%p)\n", i, texImage); + + for (i = 0; i < bytes; i++) { + texImage[i] = i & 0xff; + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + if (ScaleAndBias) { + glPixelTransferf(GL_RED_SCALE, 0.5); + glPixelTransferf(GL_GREEN_SCALE, 0.5); + glPixelTransferf(GL_BLUE_SCALE, 0.5); + glPixelTransferf(GL_RED_BIAS, 0.5); + glPixelTransferf(GL_GREEN_BIAS, 0.5); + glPixelTransferf(GL_BLUE_BIAS, 0.5); + } + else { + glPixelTransferf(GL_RED_SCALE, 1.0); + glPixelTransferf(GL_GREEN_SCALE, 1.0); + glPixelTransferf(GL_BLUE_SCALE, 1.0); + glPixelTransferf(GL_RED_BIAS, 0.0); + glPixelTransferf(GL_GREEN_BIAS, 0.0); + glPixelTransferf(GL_BLUE_BIAS, 0.0); + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glEnable(GL_TEXTURE_2D); + + count = 0; + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + do { + int img = count%NR_TEXOBJ; + GLubyte *img_ptr = texImage + img * image_bytes; + + glBindTexture(GL_TEXTURE_2D, TexObj[img]); + + if (SubImage && count > 0) { + /* Only update a portion of the image each iteration. This + * is presumably why you'd want to use texsubimage, otherwise + * you may as well just call teximage again. + * + * A bigger question is whether to use a pointer that moves + * with each call, ie does the incoming data come from L2 + * cache under normal circumstances, or is it pulled from + * uncached memory? + * + * There's a good argument to say L2 cache, ie you'd expect + * the data to have been recently generated. It's possible + * that it could have come from a file read, which may or may + * not have gone through the cpu. + */ + glTexSubImage2D(GL_TEXTURE_2D, 0, + -TexBorder, + -TexBorder + offset * h/8, + w, + h/8, + FormatTable[Format].Format, + FormatTable[Format].Type, +#if 1 + texImage /* likely in L2$ */ +#else + img_ptr + offset * bytes/8 /* unlikely in L2$ */ +#endif + ); + offset += 1; + offset %= 8; + total += w * h / 8; + } + else { + glTexImage2D(GL_TEXTURE_2D, 0, + FormatTable[Format].IntFormat, w, h, TexBorder, + FormatTable[Format].Format, + FormatTable[Format].Type, + img_ptr); + total += w*h; + } + + /* draw a tiny polygon to force texture into texram */ + glBegin(GL_TRIANGLES); + glTexCoord2f(0, 0); glVertex2f(1, 1); + glTexCoord2f(1, 0); glVertex2f(3, 1); + glTexCoord2f(0.5, 1); glVertex2f(2, 3); + glEnd(); + + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + time = t1 - t0; + count++; + } while (time < 3.0); + + glDisable(GL_TEXTURE_2D); + + printf("total texels=%f time=%f\n", total, time); + DownloadRate = total / time; + + + free(orig_texImage); + free(orig_getImage); + + { + GLint err = glGetError(); + if (err) + printf("GL error %d\n", err); + } +} + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + +static void +Display(void) +{ + const int w = TexWidth + 2 * TexBorder; + const int h = TexHeight + 2 * TexBorder; + char s[1000]; + + glClear(GL_COLOR_BUFFER_BIT); + + glRasterPos2i(10, 80); + sprintf(s, "Texture size[cursor]: %d x %d Border[b]: %d", w, h, TexBorder); + PrintString(s); + + glRasterPos2i(10, 65); + sprintf(s, "Format[f]: %s Type: %s IntFormat: %s", + FormatStr(FormatTable[Format].Format), + TypeStr( FormatTable[Format].Type), + FormatStr(FormatTable[Format].IntFormat)); + PrintString(s); + + glRasterPos2i(10, 50); + sprintf(s, "Pixel Scale&Bias[p]: %s TexSubImage[s]: %s", + ScaleAndBias ? "Yes" : "No", + SubImage ? "Yes" : "No"); + PrintString(s); + + if (Mode == 0) { + glRasterPos2i(200, 10); + sprintf(s, "...Measuring..."); + PrintString(s); + glutSwapBuffers(); + glutPostRedisplay(); + Mode++; + } + else if (Mode == 1) { + MeasureDownloadRate(); + glutPostRedisplay(); + Mode++; + } + else { + /* show results */ + glRasterPos2i(10, 10); + sprintf(s, "Download rate: %g Mtexels/second %g MB/second", + DownloadRate / 1000000.0, + DownloadRate * BytesPerTexel(Format) / 1000000.0); + PrintString(s); + { + GLint r, g, b, a, l, i; + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_LUMINANCE_SIZE, &l); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTENSITY_SIZE, &i); + sprintf(s, "TexelBits: R=%d G=%d B=%d A=%d L=%d I=%d", r, g, b, a, l, i); + glRasterPos2i(10, 25); + PrintString(s); + } + + glutSwapBuffers(); + } +} + + +static void +Reshape(int width, int height) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(0, width, 0, height, -1, 1); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case ' ': + Mode = 0; + break; + case 'b': + /* toggle border */ + TexBorder = 1 - TexBorder; + Mode = 0; + break; + case 'f': + /* change format */ + Format = (Format + 1) % NUM_FORMATS; + Mode = 0; + break; + case 'F': + /* change format */ + Format = (Format - 1) % NUM_FORMATS; + Mode = 0; + break; + case 'p': + /* toggle border */ + ScaleAndBias = !ScaleAndBias; + Mode = 0; + break; + case 's': + SubImage = !SubImage; + Mode = 0; + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + if (TexHeight < MaxSize) + TexHeight *= 2; + break; + case GLUT_KEY_DOWN: + if (TexHeight > 1) + TexHeight /= 2; + break; + case GLUT_KEY_LEFT: + if (TexWidth > 1) + TexWidth /= 2; + break; + case GLUT_KEY_RIGHT: + if (TexWidth < MaxSize) + TexWidth *= 2; + break; + } + Mode = 0; + glutPostRedisplay(); +} + + +static void +Init(void) +{ + printf("GL_VENDOR = %s\n", (const char *) glGetString(GL_VENDOR)); + printf("GL_VERSION = %s\n", (const char *) glGetString(GL_VERSION)); + printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER)); +} + + +int +main(int argc, char *argv[]) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 600, 100 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 292e1920930dad242b1130cb2b7b4ced2a3024f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:00:48 -0600 Subject: demos: move tests/fbotexture.c to demos/ --- progs/demos/Makefile | 1 + progs/demos/fbotexture.c | 621 +++++++++++++++++++++++++++++++++++++++++++++++ progs/tests/Makefile | 1 - progs/tests/fbotexture.c | 621 ----------------------------------------------- 4 files changed, 622 insertions(+), 622 deletions(-) create mode 100644 progs/demos/fbotexture.c delete mode 100644 progs/tests/fbotexture.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 0f72595c23..a1c99c6c54 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -22,6 +22,7 @@ PROGS = \ drawpix \ engine \ fbo_firecube \ + fbotexture \ fire \ fogcoord \ fplight \ diff --git a/progs/demos/fbotexture.c b/progs/demos/fbotexture.c new file mode 100644 index 0000000000..50a4b00afc --- /dev/null +++ b/progs/demos/fbotexture.c @@ -0,0 +1,621 @@ +/* + * Test GL_EXT_framebuffer_object render-to-texture + * + * Draw a teapot into a texture image with stenciling. + * Then draw a textured quad using that texture. + * + * Brian Paul + * 18 Apr 2005 + */ + + +#include +#include +#include +#include +#include +#include +#include + +/* For debug */ +#define DEPTH 1 +#define STENCIL 1 +#define DRAW 1 + + +static int Win = 0; +static int Width = 400, Height = 400; + +#if 1 +static GLenum TexTarget = GL_TEXTURE_2D; +static int TexWidth = 512, TexHeight = 512; +static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ +#else +static GLenum TexTarget = GL_TEXTURE_RECTANGLE_ARB; +static int TexWidth = 200, TexHeight = 200; +static GLenum TexIntFormat = GL_RGB5; /* either GL_RGB or GL_RGBA */ +#endif +static GLuint TextureLevel = 0; /* which texture level to render to */ + +static GLuint MyFB; +static GLuint TexObj; +static GLuint DepthRB = 0, StencilRB = 0; +static GLboolean Anim = GL_FALSE; +static GLfloat Rot = 0.0; +static GLboolean UsePackedDepthStencil = GL_FALSE; +static GLboolean UsePackedDepthStencilBoth = GL_FALSE; +static GLboolean Use_ARB_fbo = GL_FALSE; +static GLboolean Cull = GL_FALSE; +static GLboolean Wireframe = GL_FALSE; + + +static void +CheckError(int line) +{ + GLenum err = glGetError(); + if (err) { + printf("GL Error 0x%x at line %d\n", (int) err, line); + } +} + + +static void +Idle(void) +{ + Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; + glutPostRedisplay(); +} + + +static void +RenderTexture(void) +{ + GLenum status; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); + + /* draw to texture image */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); + + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("Framebuffer incomplete!!!\n"); + } + + glViewport(0, 0, TexWidth, TexHeight); + + glClearColor(0.5, 0.5, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + CheckError(__LINE__); + +#if DEPTH + glEnable(GL_DEPTH_TEST); +#endif + +#if STENCIL + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_NEVER, 1, ~0); + glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE); +#endif + + CheckError(__LINE__); + +#if DEPTH || STENCIL + /* draw diamond-shaped stencil pattern */ + glColor3f(0, 1, 0); + glBegin(GL_POLYGON); + glVertex2f(-0.2, 0.0); + glVertex2f( 0.0, -0.2); + glVertex2f( 0.2, 0.0); + glVertex2f( 0.0, 0.2); + glEnd(); +#endif + + /* draw teapot where stencil != 1 */ +#if STENCIL + glStencilFunc(GL_NOTEQUAL, 1, ~0); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); +#endif + + CheckError(__LINE__); + + if (Wireframe) { + glPolygonMode(GL_FRONT, GL_LINE); + } + else { + glPolygonMode(GL_FRONT, GL_FILL); + } + + if (Cull) { + /* cull back */ + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + } + else { + glDisable(GL_CULL_FACE); + } + +#if 0 + glBegin(GL_POLYGON); + glColor3f(1, 0, 0); + glVertex2f(-1, -1); + glColor3f(0, 1, 0); + glVertex2f(1, -1); + glColor3f(0, 0, 1); + glVertex2f(0, 1); + glEnd(); +#else + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glPushMatrix(); + glRotatef(0.5 * Rot, 1.0, 0.0, 0.0); + glFrontFace(GL_CW); /* Teapot patches backward */ + glutSolidTeapot(0.5); + glFrontFace(GL_CCW); + glPopMatrix(); + glDisable(GL_LIGHTING); + /* + PrintStencilHistogram(TexWidth, TexHeight); + */ +#endif + + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + glDisable(GL_CULL_FACE); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + +#if DRAW + /* Bind normal framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +#endif + + CheckError(__LINE__); +} + + + +static void +Display(void) +{ + float ar = (float) Width / (float) Height; + + RenderTexture(); + + /* draw textured quad in the window */ +#if DRAW + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -7.0); + + glViewport(0, 0, Width, Height); + + glClearColor(0.25, 0.25, 0.25, 0); + glClear(GL_COLOR_BUFFER_BIT); + + glPushMatrix(); + glRotatef(Rot, 0, 1, 0); + glEnable(TexTarget); + glBindTexture(TexTarget, TexObj); + glBegin(GL_POLYGON); + glColor3f(0.25, 0.25, 0.25); + if (TexTarget == GL_TEXTURE_2D) { + glTexCoord2f(0, 0); + glVertex2f(-1, -1); + glTexCoord2f(1, 0); + glVertex2f(1, -1); + glColor3f(1.0, 1.0, 1.0); + glTexCoord2f(1, 1); + glVertex2f(1, 1); + glTexCoord2f(0, 1); + glVertex2f(-1, 1); + } + else { + assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB); + glTexCoord2f(0, 0); + glVertex2f(-1, -1); + glTexCoord2f(TexWidth, 0); + glVertex2f(1, -1); + glColor3f(1.0, 1.0, 1.0); + glTexCoord2f(TexWidth, TexHeight); + glVertex2f(1, 1); + glTexCoord2f(0, TexHeight); + glVertex2f(-1, 1); + } + glEnd(); + glPopMatrix(); + glDisable(TexTarget); +#endif + + glutSwapBuffers(); + CheckError(__LINE__); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + Width = width; + Height = height; +} + + +static void +CleanUp(void) +{ +#if DEPTH + glDeleteRenderbuffersEXT(1, &DepthRB); +#endif +#if STENCIL + glDeleteRenderbuffersEXT(1, &StencilRB); +#endif + glDeleteFramebuffersEXT(1, &MyFB); + + glDeleteTextures(1, &TexObj); + + glutDestroyWindow(Win); + + exit(0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'c': + Cull = !Cull; + break; + case 'w': + Wireframe = !Wireframe; + break; + case 's': + Rot += 2.0; + break; + case 'S': + Rot -= 2.0; + break; + case 27: + CleanUp(); + break; + } + glutPostRedisplay(); +} + + +/** + * Attach depth and stencil renderbuffer(s) to the given framebuffer object. + * \param tryDepthStencil if true, try to use a combined depth+stencil buffer + * \param bindDepthStencil if true, and tryDepthStencil is true, bind with + * the GL_DEPTH_STENCIL_ATTACHMENT target. + * \return GL_TRUE for success, GL_FALSE for failure + */ +static GLboolean +AttachDepthAndStencilBuffers(GLuint fbo, + GLsizei width, GLsizei height, + GLboolean tryDepthStencil, + GLboolean bindDepthStencil, + GLuint *depthRbOut, GLuint *stencilRbOut) +{ + GLenum status; + + *depthRbOut = *stencilRbOut = 0; + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); + + if (tryDepthStencil) { + GLuint rb; + + glGenRenderbuffersEXT(1, &rb); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, + GL_DEPTH24_STENCIL8_EXT, + width, height); + if (glGetError()) + return GL_FALSE; + + if (bindDepthStencil) { + /* attach to both depth and stencil at once */ + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_DEPTH_STENCIL_ATTACHMENT, + GL_RENDERBUFFER_EXT, rb); + if (glGetError()) + return GL_FALSE; + } + else { + /* attach to depth attachment point */ + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, rb); + if (glGetError()) + return GL_FALSE; + + /* and attach to stencil attachment point */ + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, rb); + if (glGetError()) + return GL_FALSE; + } + + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) + return GL_FALSE; + + *depthRbOut = *stencilRbOut = rb; + return GL_TRUE; + } + + /* just depth renderbuffer */ + { + GLuint rb; + + glGenRenderbuffersEXT(1, &rb); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, + GL_DEPTH_COMPONENT, + width, height); + if (glGetError()) + return GL_FALSE; + + /* attach to depth attachment point */ + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, rb); + if (glGetError()) + return GL_FALSE; + + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) + return GL_FALSE; + + *depthRbOut = rb; + } + + /* just stencil renderbuffer */ + { + GLuint rb; + + glGenRenderbuffersEXT(1, &rb); + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, + GL_STENCIL_INDEX, + width, height); + if (glGetError()) + return GL_FALSE; + + /* attach to depth attachment point */ + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, rb); + if (glGetError()) + return GL_FALSE; + + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + glDeleteRenderbuffersEXT(1, depthRbOut); + *depthRbOut = 0; + glDeleteRenderbuffersEXT(1, &rb); + return GL_FALSE; + } + + *stencilRbOut = rb; + } + + return GL_TRUE; +} + + +static void +ParseArgs(int argc, char *argv[]) +{ + GLint i; + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-ds") == 0) { + if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) { + printf("GL_EXT_packed_depth_stencil not found!\n"); + exit(0); + } + UsePackedDepthStencil = GL_TRUE; + printf("Using GL_EXT_packed_depth_stencil\n"); + } + else if (strcmp(argv[i], "-ds2") == 0) { + if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) { + printf("GL_EXT_packed_depth_stencil not found!\n"); + exit(0); + } + if (!glutExtensionSupported("GL_ARB_framebuffer_object")) { + printf("GL_ARB_framebuffer_object not found!\n"); + exit(0); + } + UsePackedDepthStencilBoth = GL_TRUE; + printf("Using GL_EXT_packed_depth_stencil and GL_DEPTH_STENCIL attachment point\n"); + } + else if (strcmp(argv[i], "-arb") == 0) { + if (!glutExtensionSupported("GL_ARB_framebuffer_object")) { + printf("Sorry, GL_ARB_framebuffer object not supported!\n"); + } + else { + Use_ARB_fbo = GL_TRUE; + } + } + else { + printf("Unknown option: %s\n", argv[i]); + } + } +} + + +/* + * Make FBO to render into given texture. + */ +static GLuint +MakeFBO_RenderTexture(GLuint TexObj) +{ + GLuint fb; + GLint sizeFudge = 0; + + glGenFramebuffersEXT(1, &fb); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); + /* Render color to texture */ + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + TexTarget, TexObj, TextureLevel); + + if (Use_ARB_fbo) { + /* use a smaller depth buffer to see what happens */ + sizeFudge = 90; + } + + /* Setup depth and stencil buffers */ + { + GLboolean b; + b = AttachDepthAndStencilBuffers(fb, + TexWidth - sizeFudge, + TexHeight - sizeFudge, + UsePackedDepthStencil, + UsePackedDepthStencilBoth, + &DepthRB, &StencilRB); + if (!b) { + /* try !UsePackedDepthStencil */ + b = AttachDepthAndStencilBuffers(fb, + TexWidth - sizeFudge, + TexHeight - sizeFudge, + !UsePackedDepthStencil, + UsePackedDepthStencilBoth, + &DepthRB, &StencilRB); + } + if (!b) { + printf("Unable to create/attach depth and stencil renderbuffers " + " to FBO!\n"); + exit(1); + } + } + + /* queries */ + { + GLint bits, w, h; + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, + GL_RENDERBUFFER_WIDTH_EXT, &w); + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, + GL_RENDERBUFFER_HEIGHT_EXT, &h); + printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight); + printf("Depth buffer size: %d x %d\n", w, h); + + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, + GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits); + printf("Depth renderbuffer size = %d bits\n", bits); + + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB); + glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, + GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits); + printf("Stencil renderbuffer size = %d bits\n", bits); + } + + /* bind the regular framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + return fb; +} + + +static void +Init(void) +{ + if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { + printf("GL_EXT_framebuffer_object not found!\n"); + exit(0); + } + + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + /* lighting */ + { + static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 }; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat); + } + + /* + * Make texture object/image (we'll render into this texture) + */ + { + glGenTextures(1, &TexObj); + glBindTexture(TexTarget, TexObj); + + /* make two image levels */ + glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (TexTarget == GL_TEXTURE_2D) { + glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + TexWidth = TexWidth >> TextureLevel; + TexHeight = TexHeight >> TextureLevel; + glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); + } + + glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } + + MyFB = MakeFBO_RenderTexture(TexObj); +} + + +static void +Usage(void) +{ + printf("Usage:\n"); + printf(" -ds Use combined depth/stencil renderbuffer\n"); + printf(" -arb Try GL_ARB_framebuffer_object's mismatched buffer sizes\n"); + printf(" -ds2 Try GL_ARB_framebuffer_object's GL_DEPTH_STENCIL_ATTACHMENT\n"); + printf("Keys:\n"); + printf(" a Toggle animation\n"); + printf(" s/s Step/rotate\n"); + printf(" c Toggle back-face culling\n"); + printf(" w Toggle wireframe mode (front-face only)\n"); + printf(" Esc Exit\n"); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(Width, Height); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + Win = glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + if (Anim) + glutIdleFunc(Idle); + + ParseArgs(argc, argv); + Init(); + Usage(); + + glutMainLoop(); + return 0; +} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index cd6c496961..7dfc65807a 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -43,7 +43,6 @@ SOURCES = \ floattex.c \ fbotest1.c \ fbotest2.c \ - fbotexture.c \ fillrate.c \ fog.c \ fogcoord.c \ diff --git a/progs/tests/fbotexture.c b/progs/tests/fbotexture.c deleted file mode 100644 index 50a4b00afc..0000000000 --- a/progs/tests/fbotexture.c +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Test GL_EXT_framebuffer_object render-to-texture - * - * Draw a teapot into a texture image with stenciling. - * Then draw a textured quad using that texture. - * - * Brian Paul - * 18 Apr 2005 - */ - - -#include -#include -#include -#include -#include -#include -#include - -/* For debug */ -#define DEPTH 1 -#define STENCIL 1 -#define DRAW 1 - - -static int Win = 0; -static int Width = 400, Height = 400; - -#if 1 -static GLenum TexTarget = GL_TEXTURE_2D; -static int TexWidth = 512, TexHeight = 512; -static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ -#else -static GLenum TexTarget = GL_TEXTURE_RECTANGLE_ARB; -static int TexWidth = 200, TexHeight = 200; -static GLenum TexIntFormat = GL_RGB5; /* either GL_RGB or GL_RGBA */ -#endif -static GLuint TextureLevel = 0; /* which texture level to render to */ - -static GLuint MyFB; -static GLuint TexObj; -static GLuint DepthRB = 0, StencilRB = 0; -static GLboolean Anim = GL_FALSE; -static GLfloat Rot = 0.0; -static GLboolean UsePackedDepthStencil = GL_FALSE; -static GLboolean UsePackedDepthStencilBoth = GL_FALSE; -static GLboolean Use_ARB_fbo = GL_FALSE; -static GLboolean Cull = GL_FALSE; -static GLboolean Wireframe = GL_FALSE; - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Idle(void) -{ - Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; - glutPostRedisplay(); -} - - -static void -RenderTexture(void) -{ - GLenum status; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); - - /* draw to texture image */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Framebuffer incomplete!!!\n"); - } - - glViewport(0, 0, TexWidth, TexHeight); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - CheckError(__LINE__); - -#if DEPTH - glEnable(GL_DEPTH_TEST); -#endif - -#if STENCIL - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_NEVER, 1, ~0); - glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE); -#endif - - CheckError(__LINE__); - -#if DEPTH || STENCIL - /* draw diamond-shaped stencil pattern */ - glColor3f(0, 1, 0); - glBegin(GL_POLYGON); - glVertex2f(-0.2, 0.0); - glVertex2f( 0.0, -0.2); - glVertex2f( 0.2, 0.0); - glVertex2f( 0.0, 0.2); - glEnd(); -#endif - - /* draw teapot where stencil != 1 */ -#if STENCIL - glStencilFunc(GL_NOTEQUAL, 1, ~0); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); -#endif - - CheckError(__LINE__); - - if (Wireframe) { - glPolygonMode(GL_FRONT, GL_LINE); - } - else { - glPolygonMode(GL_FRONT, GL_FILL); - } - - if (Cull) { - /* cull back */ - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - } - else { - glDisable(GL_CULL_FACE); - } - -#if 0 - glBegin(GL_POLYGON); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f(1, -1); - glColor3f(0, 0, 1); - glVertex2f(0, 1); - glEnd(); -#else - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glPushMatrix(); - glRotatef(0.5 * Rot, 1.0, 0.0, 0.0); - glFrontFace(GL_CW); /* Teapot patches backward */ - glutSolidTeapot(0.5); - glFrontFace(GL_CCW); - glPopMatrix(); - glDisable(GL_LIGHTING); - /* - PrintStencilHistogram(TexWidth, TexHeight); - */ -#endif - - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glDisable(GL_CULL_FACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - -#if DRAW - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#endif - - CheckError(__LINE__); -} - - - -static void -Display(void) -{ - float ar = (float) Width / (float) Height; - - RenderTexture(); - - /* draw textured quad in the window */ -#if DRAW - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -7.0); - - glViewport(0, 0, Width, Height); - - glClearColor(0.25, 0.25, 0.25, 0); - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Rot, 0, 1, 0); - glEnable(TexTarget); - glBindTexture(TexTarget, TexObj); - glBegin(GL_POLYGON); - glColor3f(0.25, 0.25, 0.25); - if (TexTarget == GL_TEXTURE_2D) { - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(1, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(-1, 1); - } - else { - assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB); - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(TexWidth, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(TexWidth, TexHeight); - glVertex2f(1, 1); - glTexCoord2f(0, TexHeight); - glVertex2f(-1, 1); - } - glEnd(); - glPopMatrix(); - glDisable(TexTarget); -#endif - - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - Width = width; - Height = height; -} - - -static void -CleanUp(void) -{ -#if DEPTH - glDeleteRenderbuffersEXT(1, &DepthRB); -#endif -#if STENCIL - glDeleteRenderbuffersEXT(1, &StencilRB); -#endif - glDeleteFramebuffersEXT(1, &MyFB); - - glDeleteTextures(1, &TexObj); - - glutDestroyWindow(Win); - - exit(0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'c': - Cull = !Cull; - break; - case 'w': - Wireframe = !Wireframe; - break; - case 's': - Rot += 2.0; - break; - case 'S': - Rot -= 2.0; - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -/** - * Attach depth and stencil renderbuffer(s) to the given framebuffer object. - * \param tryDepthStencil if true, try to use a combined depth+stencil buffer - * \param bindDepthStencil if true, and tryDepthStencil is true, bind with - * the GL_DEPTH_STENCIL_ATTACHMENT target. - * \return GL_TRUE for success, GL_FALSE for failure - */ -static GLboolean -AttachDepthAndStencilBuffers(GLuint fbo, - GLsizei width, GLsizei height, - GLboolean tryDepthStencil, - GLboolean bindDepthStencil, - GLuint *depthRbOut, GLuint *stencilRbOut) -{ - GLenum status; - - *depthRbOut = *stencilRbOut = 0; - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - - if (tryDepthStencil) { - GLuint rb; - - glGenRenderbuffersEXT(1, &rb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, - GL_DEPTH24_STENCIL8_EXT, - width, height); - if (glGetError()) - return GL_FALSE; - - if (bindDepthStencil) { - /* attach to both depth and stencil at once */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_DEPTH_STENCIL_ATTACHMENT, - GL_RENDERBUFFER_EXT, rb); - if (glGetError()) - return GL_FALSE; - } - else { - /* attach to depth attachment point */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, rb); - if (glGetError()) - return GL_FALSE; - - /* and attach to stencil attachment point */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, rb); - if (glGetError()) - return GL_FALSE; - } - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) - return GL_FALSE; - - *depthRbOut = *stencilRbOut = rb; - return GL_TRUE; - } - - /* just depth renderbuffer */ - { - GLuint rb; - - glGenRenderbuffersEXT(1, &rb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, - GL_DEPTH_COMPONENT, - width, height); - if (glGetError()) - return GL_FALSE; - - /* attach to depth attachment point */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, rb); - if (glGetError()) - return GL_FALSE; - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) - return GL_FALSE; - - *depthRbOut = rb; - } - - /* just stencil renderbuffer */ - { - GLuint rb; - - glGenRenderbuffersEXT(1, &rb); - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb); - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, - GL_STENCIL_INDEX, - width, height); - if (glGetError()) - return GL_FALSE; - - /* attach to depth attachment point */ - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, rb); - if (glGetError()) - return GL_FALSE; - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - glDeleteRenderbuffersEXT(1, depthRbOut); - *depthRbOut = 0; - glDeleteRenderbuffersEXT(1, &rb); - return GL_FALSE; - } - - *stencilRbOut = rb; - } - - return GL_TRUE; -} - - -static void -ParseArgs(int argc, char *argv[]) -{ - GLint i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-ds") == 0) { - if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) { - printf("GL_EXT_packed_depth_stencil not found!\n"); - exit(0); - } - UsePackedDepthStencil = GL_TRUE; - printf("Using GL_EXT_packed_depth_stencil\n"); - } - else if (strcmp(argv[i], "-ds2") == 0) { - if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) { - printf("GL_EXT_packed_depth_stencil not found!\n"); - exit(0); - } - if (!glutExtensionSupported("GL_ARB_framebuffer_object")) { - printf("GL_ARB_framebuffer_object not found!\n"); - exit(0); - } - UsePackedDepthStencilBoth = GL_TRUE; - printf("Using GL_EXT_packed_depth_stencil and GL_DEPTH_STENCIL attachment point\n"); - } - else if (strcmp(argv[i], "-arb") == 0) { - if (!glutExtensionSupported("GL_ARB_framebuffer_object")) { - printf("Sorry, GL_ARB_framebuffer object not supported!\n"); - } - else { - Use_ARB_fbo = GL_TRUE; - } - } - else { - printf("Unknown option: %s\n", argv[i]); - } - } -} - - -/* - * Make FBO to render into given texture. - */ -static GLuint -MakeFBO_RenderTexture(GLuint TexObj) -{ - GLuint fb; - GLint sizeFudge = 0; - - glGenFramebuffersEXT(1, &fb); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); - /* Render color to texture */ - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TexTarget, TexObj, TextureLevel); - - if (Use_ARB_fbo) { - /* use a smaller depth buffer to see what happens */ - sizeFudge = 90; - } - - /* Setup depth and stencil buffers */ - { - GLboolean b; - b = AttachDepthAndStencilBuffers(fb, - TexWidth - sizeFudge, - TexHeight - sizeFudge, - UsePackedDepthStencil, - UsePackedDepthStencilBoth, - &DepthRB, &StencilRB); - if (!b) { - /* try !UsePackedDepthStencil */ - b = AttachDepthAndStencilBuffers(fb, - TexWidth - sizeFudge, - TexHeight - sizeFudge, - !UsePackedDepthStencil, - UsePackedDepthStencilBoth, - &DepthRB, &StencilRB); - } - if (!b) { - printf("Unable to create/attach depth and stencil renderbuffers " - " to FBO!\n"); - exit(1); - } - } - - /* queries */ - { - GLint bits, w, h; - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_WIDTH_EXT, &w); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_HEIGHT_EXT, &h); - printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight); - printf("Depth buffer size: %d x %d\n", w, h); - - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits); - printf("Depth renderbuffer size = %d bits\n", bits); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB); - glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, - GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits); - printf("Stencil renderbuffer size = %d bits\n", bits); - } - - /* bind the regular framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - return fb; -} - - -static void -Init(void) -{ - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - /* lighting */ - { - static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 }; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat); - } - - /* - * Make texture object/image (we'll render into this texture) - */ - { - glGenTextures(1, &TexObj); - glBindTexture(TexTarget, TexObj); - - /* make two image levels */ - glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - if (TexTarget == GL_TEXTURE_2D) { - glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - TexWidth = TexWidth >> TextureLevel; - TexHeight = TexHeight >> TextureLevel; - glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); - } - - glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } - - MyFB = MakeFBO_RenderTexture(TexObj); -} - - -static void -Usage(void) -{ - printf("Usage:\n"); - printf(" -ds Use combined depth/stencil renderbuffer\n"); - printf(" -arb Try GL_ARB_framebuffer_object's mismatched buffer sizes\n"); - printf(" -ds2 Try GL_ARB_framebuffer_object's GL_DEPTH_STENCIL_ATTACHMENT\n"); - printf("Keys:\n"); - printf(" a Toggle animation\n"); - printf(" s/s Step/rotate\n"); - printf(" c Toggle back-face culling\n"); - printf(" w Toggle wireframe mode (front-face only)\n"); - printf(" Esc Exit\n"); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - if (Anim) - glutIdleFunc(Idle); - - ParseArgs(argc, argv); - Init(); - Usage(); - - glutMainLoop(); - return 0; -} -- cgit v1.2.3 From 49c3e7172db1ee2afef6bcd19c3cd55dbe60bd33 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:05:51 -0600 Subject: demos: move tests/projtex.c to demos/ And fix compiler warnings. --- progs/demos/Makefile | 1 + progs/demos/projtex.c | 1028 ++++++++++++++++++++++++++++++++++++++++++++++++ progs/tests/Makefile | 1 - progs/tests/projtex.c | 1030 ------------------------------------------------- 4 files changed, 1029 insertions(+), 1031 deletions(-) create mode 100644 progs/demos/projtex.c delete mode 100644 progs/tests/projtex.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index a1c99c6c54..2fe407972d 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -41,6 +41,7 @@ PROGS = \ multiarb \ paltex \ pointblast \ + projtex \ rain \ ray \ readpix \ diff --git a/progs/demos/projtex.c b/progs/demos/projtex.c new file mode 100644 index 0000000000..99154d7bdc --- /dev/null +++ b/progs/demos/projtex.c @@ -0,0 +1,1028 @@ + +/* projtex.c - by David Yu and David Blythe, SGI */ + +/** + ** Demonstrates simple projective texture mapping. + ** + ** Button1 changes view, Button2 moves texture. + ** + ** (See: Segal, Korobkin, van Widenfelt, Foran, and Haeberli + ** "Fast Shadows and Lighting Effects Using Texture Mapping", SIGGRAPH '92) + ** + ** 1994,1995 -- David G Yu + ** + ** cc -o projtex projtex.c texture.c -lglut -lGLU -lGL -lX11 -lm + **/ + +#include +#include +#include +#include +#include +#include +#include "readtex.h" + + +/* Some files do not define M_PI... */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define MAX_TEX 4 +int NumTextures = 1; + +int winWidth, winHeight; + +GLboolean redrawContinuously = GL_FALSE; + +float angle, axis[3]; +enum MoveModes { + MoveNone, MoveView, MoveObject, MoveTexture +}; +enum MoveModes mode = MoveNone; + +GLfloat objectXform[4][4]; +GLfloat textureXform[MAX_TEX][4][4]; + +void (*drawObject) (void); +void (*loadTexture) (void); +GLboolean textureEnabled = GL_TRUE; +GLboolean showProjection = GL_TRUE; +GLboolean linearFilter = GL_TRUE; + +char *texFilename[MAX_TEX] = { + "../images/girl.rgb", + "../images/tile.rgb", + "../images/bw.rgb", + "../images/reflect.rgb" +}; + + +GLfloat zoomFactor = 1.0; + +/*****************************************************************/ + + +static void +ActiveTexture(int i) +{ + glActiveTextureARB(i); +} + + +/* matrix = identity */ +static void +matrixIdentity(GLfloat matrix[16]) +{ + matrix[0] = 1.0; + matrix[1] = 0.0; + matrix[2] = 0.0; + matrix[3] = 0.0; + matrix[4] = 0.0; + matrix[5] = 1.0; + matrix[6] = 0.0; + matrix[7] = 0.0; + matrix[8] = 0.0; + matrix[9] = 0.0; + matrix[10] = 1.0; + matrix[11] = 0.0; + matrix[12] = 0.0; + matrix[13] = 0.0; + matrix[14] = 0.0; + matrix[15] = 1.0; +} + +/* matrix2 = transpose(matrix1) */ +static void +matrixTranspose(GLfloat matrix2[16], GLfloat matrix1[16]) +{ + matrix2[0] = matrix1[0]; + matrix2[1] = matrix1[4]; + matrix2[2] = matrix1[8]; + matrix2[3] = matrix1[12]; + + matrix2[4] = matrix1[1]; + matrix2[5] = matrix1[5]; + matrix2[6] = matrix1[9]; + matrix2[7] = matrix1[13]; + + matrix2[8] = matrix1[2]; + matrix2[9] = matrix1[6]; + matrix2[10] = matrix1[10]; + matrix2[11] = matrix1[14]; + + matrix2[12] = matrix1[3]; + matrix2[13] = matrix1[7]; + matrix2[14] = matrix1[14]; + matrix2[15] = matrix1[15]; +} + +/*****************************************************************/ + +/* load SGI .rgb image (pad with a border of the specified width and color) */ +#if 0 +static void +imgLoad(char *filenameIn, int borderIn, GLfloat borderColorIn[4], + int *wOut, int *hOut, GLubyte ** imgOut) +{ + int border = borderIn; + int width, height; + int w, h; + GLubyte *image, *img, *p; + int i, j, components; + + image = (GLubyte *) read_texture(filenameIn, &width, &height, &components); + w = width + 2 * border; + h = height + 2 * border; + img = (GLubyte *) calloc(w * h, 4 * sizeof(unsigned char)); + + p = img; + for (j = -border; j < height + border; ++j) { + for (i = -border; i < width + border; ++i) { + if (0 <= j && j <= height - 1 && 0 <= i && i <= width - 1) { + p[0] = image[4 * (j * width + i) + 0]; + p[1] = image[4 * (j * width + i) + 1]; + p[2] = image[4 * (j * width + i) + 2]; + p[3] = 0xff; + } else { + p[0] = borderColorIn[0] * 0xff; + p[1] = borderColorIn[1] * 0xff; + p[2] = borderColorIn[2] * 0xff; + p[3] = borderColorIn[3] * 0xff; + } + p += 4; + } + } + free(image); + *wOut = w; + *hOut = h; + *imgOut = img; +} +#endif + + +/*****************************************************************/ + +/* Load the image file specified on the command line as the current texture */ +static void +loadImageTextures(void) +{ + GLfloat borderColor[4] = + {1.0, 1.0, 1.0, 1.0}; + int tex; + + for (tex = 0; tex < NumTextures; tex++) { + GLubyte *image, *texData3, *texData4; + GLint imgWidth, imgHeight; + GLenum imgFormat; + int i, j; + + printf("loading %s\n", texFilename[tex]); + image = LoadRGBImage(texFilename[tex], &imgWidth, &imgHeight, &imgFormat); + if (!image) { + printf("can't find %s\n", texFilename[tex]); + exit(1); + } + assert(imgFormat == GL_RGB); + + /* scale to 256x256 */ + texData3 = malloc(256 * 256 * 4); + texData4 = malloc(256 * 256 * 4); + assert(texData3); + assert(texData4); + gluScaleImage(imgFormat, imgWidth, imgHeight, GL_UNSIGNED_BYTE, image, + 256, 256, GL_UNSIGNED_BYTE, texData3); + + /* convert to rgba */ + for (i = 0; i < 256 * 256; i++) { + texData4[i*4+0] = texData3[i*3+0]; + texData4[i*4+1] = texData3[i*3+1]; + texData4[i*4+2] = texData3[i*3+2]; + texData4[i*4+3] = 128; + } + + /* put transparent border around image */ + for (i = 0; i < 256; i++) { + texData4[i*4+0] = 255; + texData4[i*4+1] = 255; + texData4[i*4+2] = 255; + texData4[i*4+3] = 0; + } + j = 256 * 255 * 4; + for (i = 0; i < 256; i++) { + texData4[j + i*4+0] = 255; + texData4[j + i*4+1] = 255; + texData4[j + i*4+2] = 255; + texData4[j + i*4+3] = 0; + } + for (i = 0; i < 256; i++) { + j = i * 256 * 4; + texData4[j+0] = 255; + texData4[j+1] = 255; + texData4[j+2] = 255; + texData4[j+3] = 0; + } + for (i = 0; i < 256; i++) { + j = i * 256 * 4 + 255 * 4; + texData4[j+0] = 255; + texData4[j+1] = 255; + texData4[j+2] = 255; + texData4[j+3] = 0; + } + + ActiveTexture(GL_TEXTURE0_ARB + tex); + glBindTexture(GL_TEXTURE_2D, tex + 1); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texData4); + + if (linearFilter) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + } +} + +/* Create a simple spotlight pattern and make it the current texture */ +static void +loadSpotlightTexture(void) +{ + static int texWidth = 64, texHeight = 64; + static GLubyte *texData; + GLfloat borderColor[4] = + {0.1, 0.1, 0.1, 1.0}; + + if (!texData) { + GLubyte *p; + int i, j; + + texData = (GLubyte *) malloc(texWidth * texHeight * 4 * sizeof(GLubyte)); + + p = texData; + for (j = 0; j < texHeight; ++j) { + float dy = (texHeight * 0.5 - j + 0.5) / (texHeight * 0.5); + + for (i = 0; i < texWidth; ++i) { + float dx = (texWidth * 0.5 - i + 0.5) / (texWidth * 0.5); + float r = cos(M_PI / 2.0 * sqrt(dx * dx + dy * dy)); + float c; + + r = (r < 0) ? 0 : r * r; + c = 0xff * (r + borderColor[0]); + p[0] = (c <= 0xff) ? c : 0xff; + c = 0xff * (r + borderColor[1]); + p[1] = (c <= 0xff) ? c : 0xff; + c = 0xff * (r + borderColor[2]); + p[2] = (c <= 0xff) ? c : 0xff; + c = 0xff * (r + borderColor[3]); + p[3] = (c <= 0xff) ? c : 0xff; + p += 4; + } + } + } + if (linearFilter) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); + gluBuild2DMipmaps(GL_TEXTURE_2D, 4, texWidth, texHeight, + GL_RGBA, GL_UNSIGNED_BYTE, texData); +} + +/*****************************************************************/ + +static void +checkErrors(void) +{ + GLenum error; + while ((error = glGetError()) != GL_NO_ERROR) { + fprintf(stderr, "Error: %s\n", (char *) gluErrorString(error)); + } +} + +static void +drawCube(void) +{ + glBegin(GL_QUADS); + + glNormal3f(-1.0, 0.0, 0.0); + glColor3f(0.80, 0.50, 0.50); + glVertex3f(-0.5, -0.5, -0.5); + glVertex3f(-0.5, -0.5, 0.5); + glVertex3f(-0.5, 0.5, 0.5); + glVertex3f(-0.5, 0.5, -0.5); + + glNormal3f(1.0, 0.0, 0.0); + glColor3f(0.50, 0.80, 0.50); + glVertex3f(0.5, 0.5, 0.5); + glVertex3f(0.5, -0.5, 0.5); + glVertex3f(0.5, -0.5, -0.5); + glVertex3f(0.5, 0.5, -0.5); + + glNormal3f(0.0, -1.0, 0.0); + glColor3f(0.50, 0.50, 0.80); + glVertex3f(-0.5, -0.5, -0.5); + glVertex3f(0.5, -0.5, -0.5); + glVertex3f(0.5, -0.5, 0.5); + glVertex3f(-0.5, -0.5, 0.5); + + glNormal3f(0.0, 1.0, 0.0); + glColor3f(0.50, 0.80, 0.80); + glVertex3f(0.5, 0.5, 0.5); + glVertex3f(0.5, 0.5, -0.5); + glVertex3f(-0.5, 0.5, -0.5); + glVertex3f(-0.5, 0.5, 0.5); + + glNormal3f(0.0, 0.0, -1.0); + glColor3f(0.80, 0.50, 0.80); + glVertex3f(-0.5, -0.5, -0.5); + glVertex3f(-0.5, 0.5, -0.5); + glVertex3f(0.5, 0.5, -0.5); + glVertex3f(0.5, -0.5, -0.5); + + glNormal3f(0.0, 0.0, 1.0); + glColor3f(1.00, 0.80, 0.50); + glVertex3f(0.5, 0.5, 0.5); + glVertex3f(-0.5, 0.5, 0.5); + glVertex3f(-0.5, -0.5, 0.5); + glVertex3f(0.5, -0.5, 0.5); + glEnd(); +} + +static void +drawDodecahedron(void) +{ +#define A (0.5 * 1.61803) /* (sqrt(5) + 1) / 2 */ +#define B (0.5 * 0.61803) /* (sqrt(5) - 1) / 2 */ +#define C (0.5 * 1.0) + GLfloat vertexes[20][3] = + { + {-A, 0.0, B}, + {-A, 0.0, -B}, + {A, 0.0, -B}, + {A, 0.0, B}, + {B, -A, 0.0}, + {-B, -A, 0.0}, + {-B, A, 0.0}, + {B, A, 0.0}, + {0.0, B, -A}, + {0.0, -B, -A}, + {0.0, -B, A}, + {0.0, B, A}, + {-C, -C, C}, + {-C, -C, -C}, + {C, -C, -C}, + {C, -C, C}, + {-C, C, C}, + {-C, C, -C}, + {C, C, -C}, + {C, C, C}, + }; +#undef A +#undef B +#undef C + GLint polygons[12][5] = + { + {0, 12, 10, 11, 16}, + {1, 17, 8, 9, 13}, + {2, 14, 9, 8, 18}, + {3, 19, 11, 10, 15}, + {4, 14, 2, 3, 15}, + {5, 12, 0, 1, 13}, + {6, 17, 1, 0, 16}, + {7, 19, 3, 2, 18}, + {8, 17, 6, 7, 18}, + {9, 14, 4, 5, 13}, + {10, 12, 5, 4, 15}, + {11, 19, 7, 6, 16}, + }; + int i; + + glColor3f(0.75, 0.75, 0.75); + for (i = 0; i < 12; ++i) { + GLfloat *p0, *p1, *p2, d; + GLfloat u[3], v[3], n[3]; + + p0 = &vertexes[polygons[i][0]][0]; + p1 = &vertexes[polygons[i][1]][0]; + p2 = &vertexes[polygons[i][2]][0]; + + u[0] = p2[0] - p1[0]; + u[1] = p2[1] - p1[1]; + u[2] = p2[2] - p1[2]; + + v[0] = p0[0] - p1[0]; + v[1] = p0[1] - p1[1]; + v[2] = p0[2] - p1[2]; + + n[0] = u[1] * v[2] - u[2] * v[1]; + n[1] = u[2] * v[0] - u[0] * v[2]; + n[2] = u[0] * v[1] - u[1] * v[0]; + + d = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); + n[0] *= d; + n[1] *= d; + n[2] *= d; + + glBegin(GL_POLYGON); + glNormal3fv(n); + glVertex3fv(p0); + glVertex3fv(p1); + glVertex3fv(p2); + glVertex3fv(vertexes[polygons[i][3]]); + glVertex3fv(vertexes[polygons[i][4]]); + glEnd(); + } +} + +static void +drawSphere(void) +{ + int numMajor = 24; + int numMinor = 32; + float radius = 0.8; + double majorStep = (M_PI / numMajor); + double minorStep = (2.0 * M_PI / numMinor); + int i, j; + + glColor3f(0.50, 0.50, 0.50); + for (i = 0; i < numMajor; ++i) { + double a = i * majorStep; + double b = a + majorStep; + double r0 = radius * sin(a); + double r1 = radius * sin(b); + GLfloat z0 = radius * cos(a); + GLfloat z1 = radius * cos(b); + + glBegin(GL_TRIANGLE_STRIP); + for (j = 0; j <= numMinor; ++j) { + double c = j * minorStep; + GLfloat x = cos(c); + GLfloat y = sin(c); + + glNormal3f((x * r0) / radius, (y * r0) / radius, z0 / radius); + glTexCoord2f(j / (GLfloat) numMinor, i / (GLfloat) numMajor); + glVertex3f(x * r0, y * r0, z0); + + glNormal3f((x * r1) / radius, (y * r1) / radius, z1 / radius); + glTexCoord2f(j / (GLfloat) numMinor, (i + 1) / (GLfloat) numMajor); + glVertex3f(x * r1, y * r1, z1); + } + glEnd(); + } +} + +/*****************************************************************/ + +float xmin = -0.035, xmax = 0.035; +float ymin = -0.035, ymax = 0.035; +float nnear = 0.1; +float ffar = 1.9; +float distance = -1.0; + +static void +loadTextureProjection(int texUnit, GLfloat m[16]) +{ + GLfloat mInverse[4][4]; + + /* Should use true inverse, but since m consists only of rotations, we can + just use the transpose. */ + matrixTranspose((GLfloat *) mInverse, m); + + ActiveTexture(GL_TEXTURE0_ARB + texUnit); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef(0.5, 0.5, 0.0); + glScalef(0.5, 0.5, 1.0); + glFrustum(xmin, xmax, ymin, ymax, nnear, ffar); + glTranslatef(0.0, 0.0, distance); + glMultMatrixf((GLfloat *) mInverse); + glMatrixMode(GL_MODELVIEW); +} + +static void +drawTextureProjection(void) +{ + float t = ffar / nnear; + GLfloat n[4][3]; + GLfloat f[4][3]; + + n[0][0] = xmin; + n[0][1] = ymin; + n[0][2] = -(nnear + distance); + + n[1][0] = xmax; + n[1][1] = ymin; + n[1][2] = -(nnear + distance); + + n[2][0] = xmax; + n[2][1] = ymax; + n[2][2] = -(nnear + distance); + + n[3][0] = xmin; + n[3][1] = ymax; + n[3][2] = -(nnear + distance); + + f[0][0] = xmin * t; + f[0][1] = ymin * t; + f[0][2] = -(ffar + distance); + + f[1][0] = xmax * t; + f[1][1] = ymin * t; + f[1][2] = -(ffar + distance); + + f[2][0] = xmax * t; + f[2][1] = ymax * t; + f[2][2] = -(ffar + distance); + + f[3][0] = xmin * t; + f[3][1] = ymax * t; + f[3][2] = -(ffar + distance); + + glColor3f(1.0, 1.0, 0.0); + glBegin(GL_LINE_LOOP); + glVertex3fv(n[0]); + glVertex3fv(n[1]); + glVertex3fv(n[2]); + glVertex3fv(n[3]); + glVertex3fv(f[3]); + glVertex3fv(f[2]); + glVertex3fv(f[1]); + glVertex3fv(f[0]); + glVertex3fv(n[0]); + glVertex3fv(n[1]); + glVertex3fv(f[1]); + glVertex3fv(f[0]); + glVertex3fv(f[3]); + glVertex3fv(f[2]); + glVertex3fv(n[2]); + glVertex3fv(n[3]); + glEnd(); +} + +/*****************************************************************/ + +static void +initialize(void) +{ + GLfloat light0Pos[4] = + {0.3, 0.3, 0.0, 1.0}; + GLfloat matAmb[4] = + {0.01, 0.01, 0.01, 1.00}; + GLfloat matDiff[4] = + {0.65, 0.65, 0.65, 1.00}; + GLfloat matSpec[4] = + {0.30, 0.30, 0.30, 1.00}; + GLfloat matShine = 10.0; + GLfloat eyePlaneS[] = + {1.0, 0.0, 0.0, 0.0}; + GLfloat eyePlaneT[] = + {0.0, 1.0, 0.0, 0.0}; + GLfloat eyePlaneR[] = + {0.0, 0.0, 1.0, 0.0}; + GLfloat eyePlaneQ[] = + {0.0, 0.0, 0.0, 1.0}; + int i; + + /* Setup Misc. */ + glClearColor(0.41, 0.41, 0.31, 0.0); + + glEnable(GL_DEPTH_TEST); + + /* glLineWidth(2.0);*/ + + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + + glMatrixMode(GL_PROJECTION); + glFrustum(-0.5, 0.5, -0.5, 0.5, 1, 3); + glMatrixMode(GL_MODELVIEW); + glTranslatef(0, 0, -2); + + matrixIdentity((GLfloat *) objectXform); + for (i = 0; i < NumTextures; i++) { + matrixIdentity((GLfloat *) textureXform[i]); + } + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, 1, 0, 1, -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glRasterPos2i(0, 0); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + /* Setup Lighting */ + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmb); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, matShine); + + glEnable(GL_COLOR_MATERIAL); + + glLightfv(GL_LIGHT0, GL_POSITION, light0Pos); + glEnable(GL_LIGHT0); + + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + glEnable(GL_LIGHTING); + + /* Setup Texture */ + + (*loadTexture) (); + + + for (i = 0; i < NumTextures; i++) { + ActiveTexture(GL_TEXTURE0_ARB + i); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS); + + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGenfv(GL_T, GL_EYE_PLANE, eyePlaneT); + + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGenfv(GL_R, GL_EYE_PLANE, eyePlaneR); + + glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); + glTexGenfv(GL_Q, GL_EYE_PLANE, eyePlaneQ); + } +} + +static void +display(void) +{ + int i; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (textureEnabled) { + if (mode == MoveTexture || mode == MoveView) { + /* Have OpenGL compute the new transformation (simple but slow). */ + for (i = 0; i < NumTextures; i++) { + glPushMatrix(); + glLoadIdentity(); +#if 0 + if (i & 1) + glRotatef(angle, axis[0], axis[1], axis[2]); + else +#endif + glRotatef(angle*(i+1), axis[0], axis[1], axis[2]); + + glMultMatrixf((GLfloat *) textureXform[i]); + glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) textureXform[i]); + glPopMatrix(); + } + } + for (i = 0; i < NumTextures; i++) { + loadTextureProjection(i, (GLfloat *) textureXform[i]); + } + + if (showProjection) { + for (i = 0; i < NumTextures; i++) { + ActiveTexture(GL_TEXTURE0_ARB + i); + glPushMatrix(); + glMultMatrixf((GLfloat *) textureXform[i]); + glDisable(GL_LIGHTING); + drawTextureProjection(); + glEnable(GL_LIGHTING); + glPopMatrix(); + } + } + for (i = 0; i < NumTextures; i++) { + ActiveTexture(GL_TEXTURE0_ARB + i); + glEnable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_R); + glEnable(GL_TEXTURE_GEN_Q); + } + } + if (mode == MoveObject || mode == MoveView) { + /* Have OpenGL compute the new transformation (simple but slow). */ + glPushMatrix(); + glLoadIdentity(); + glRotatef(angle, axis[0], axis[1], axis[2]); + glMultMatrixf((GLfloat *) objectXform); + glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) objectXform); + glPopMatrix(); + } + glPushMatrix(); + glMultMatrixf((GLfloat *) objectXform); + (*drawObject) (); + glPopMatrix(); + + for (i = 0; i < NumTextures; i++) { + ActiveTexture(GL_TEXTURE0_ARB + i); + glDisable(GL_TEXTURE_2D); + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_R); + glDisable(GL_TEXTURE_GEN_Q); + } + + if (zoomFactor > 1.0) { + glDisable(GL_DEPTH_TEST); + glCopyPixels(0, 0, winWidth / zoomFactor, winHeight / zoomFactor, GL_COLOR); + glEnable(GL_DEPTH_TEST); + } + glFlush(); + glutSwapBuffers(); + checkErrors(); +} + +/*****************************************************************/ + +/* simple trackball-like motion control */ +static float lastPos[3]; +static int lastTime; + +static void +ptov(int x, int y, int width, int height, float v[3]) +{ + float d, a; + + /* project x,y onto a hemi-sphere centered within width, height */ + v[0] = (2.0 * x - width) / width; + v[1] = (height - 2.0 * y) / height; + d = sqrt(v[0] * v[0] + v[1] * v[1]); + v[2] = cos((M_PI / 2.0) * ((d < 1.0) ? d : 1.0)); + a = 1.0 / sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); + v[0] *= a; + v[1] *= a; + v[2] *= a; +} + +static void +startMotion(int x, int y, int but, int time) +{ + if (but == GLUT_LEFT_BUTTON) { + mode = MoveView; + } else if (but == GLUT_MIDDLE_BUTTON) { + mode = MoveTexture; + } else { + return; + } + + lastTime = time; + ptov(x, y, winWidth, winHeight, lastPos); +} + +static void +animate(void) +{ + glutPostRedisplay(); +} + +static void +vis(int visible) +{ + if (visible == GLUT_VISIBLE) { + if (redrawContinuously) + glutIdleFunc(animate); + } else { + if (redrawContinuously) + glutIdleFunc(NULL); + } +} + +static void +stopMotion(int but, int time) +{ + if ((but == GLUT_LEFT_BUTTON && mode == MoveView) || + (but == GLUT_MIDDLE_BUTTON && mode == MoveTexture)) { + } else { + return; + } + + if (time == lastTime) { + /* redrawContinuously = GL_TRUE;*/ + glutIdleFunc(animate); + } else { + angle = 0.0; + redrawContinuously = GL_FALSE; + glutIdleFunc(0); + } + if (!redrawContinuously) { + mode = MoveNone; + } +} + +static void +trackMotion(int x, int y) +{ + float curPos[3], dx, dy, dz; + + ptov(x, y, winWidth, winHeight, curPos); + + dx = curPos[0] - lastPos[0]; + dy = curPos[1] - lastPos[1]; + dz = curPos[2] - lastPos[2]; + angle = 90.0 * sqrt(dx * dx + dy * dy + dz * dz); + + axis[0] = lastPos[1] * curPos[2] - lastPos[2] * curPos[1]; + axis[1] = lastPos[2] * curPos[0] - lastPos[0] * curPos[2]; + axis[2] = lastPos[0] * curPos[1] - lastPos[1] * curPos[0]; + + lastTime = glutGet(GLUT_ELAPSED_TIME); + lastPos[0] = curPos[0]; + lastPos[1] = curPos[1]; + lastPos[2] = curPos[2]; + glutPostRedisplay(); +} + +/*****************************************************************/ + +static void +object(void) +{ + static int object; + + object++; + object %= 3; + switch (object) { + case 0: + drawObject = drawCube; + break; + case 1: + drawObject = drawDodecahedron; + break; + case 2: + drawObject = drawSphere; + break; + default: + break; + } +} + +static void +nop(void) +{ +} + +static void +texture(void) +{ + static int texture = 0; + + texture++; + texture %= 3; + if (texture == 1 && texFilename == NULL) { + /* Skip file texture if not loaded. */ + texture++; + } + switch (texture) { + case 0: + loadTexture = nop; + textureEnabled = GL_FALSE; + break; + case 1: + loadTexture = loadImageTextures; + (*loadTexture) (); + textureEnabled = GL_TRUE; + break; + case 2: + loadTexture = loadSpotlightTexture; + (*loadTexture) (); + textureEnabled = GL_TRUE; + break; + default: + break; + } +} + +static void +help(void) +{ + printf("'h' - help\n"); + printf("'l' - toggle linear/nearest filter\n"); + printf("'s' - toggle projection frustum\n"); + printf("'t' - toggle projected texture\n"); + printf("'o' - toggle object\n"); + printf("'z' - increase zoom factor\n"); + printf("'Z' - decrease zoom factor\n"); + printf("left mouse - move view\n"); + printf("middle mouse - move projection\n"); +} + +/* ARGSUSED1 */ +static void +key(unsigned char key, int x, int y) +{ + switch (key) { + case '\033': + exit(0); + break; + case 'l': + linearFilter = !linearFilter; + (*loadTexture) (); + break; + case 's': + showProjection = !showProjection; + break; + case 't': + texture(); + break; + case 'o': + object(); + break; + case 'z': + zoomFactor += 1.0; + glPixelZoom(zoomFactor, zoomFactor); + glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); + break; + case 'Z': + zoomFactor -= 1.0; + if (zoomFactor < 1.0) + zoomFactor = 1.0; + glPixelZoom(zoomFactor, zoomFactor); + glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); + break; + case 'h': + help(); + break; + } + glutPostRedisplay(); +} + +static void +mouse(int button, int state, int x, int y) +{ + if (state == GLUT_DOWN) + startMotion(x, y, button, glutGet(GLUT_ELAPSED_TIME)); + else if (state == GLUT_UP) + stopMotion(button, glutGet(GLUT_ELAPSED_TIME)); + glutPostRedisplay(); +} + +static void +reshape(int w, int h) +{ + winWidth = w; + winHeight = h; + glViewport(0, 0, w / zoomFactor, h / zoomFactor); +} + + +static void +menu(int selection) +{ + if (selection == 666) { + exit(0); + } + key((unsigned char) selection, 0, 0); +} + +int +main(int argc, char **argv) +{ + glutInit(&argc, argv); + + if (argc > 1) { + NumTextures = atoi(argv[1]); + } + assert(NumTextures <= MAX_TEX); + + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); + glutInitWindowSize(500,500); + (void) glutCreateWindow("projtex"); + glewInit(); + + loadTexture = loadImageTextures; + drawObject = drawCube; + initialize(); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutReshapeFunc(reshape); + glutMouseFunc(mouse); + glutMotionFunc(trackMotion); + glutVisibilityFunc(vis); + glutCreateMenu(menu); + glutAddMenuEntry("Toggle showing projection", 's'); + glutAddMenuEntry("Switch texture", 't'); + glutAddMenuEntry("Switch object", 'o'); + glutAddMenuEntry("Toggle filtering", 'l'); + glutAddMenuEntry("Quit", 666); + glutAttachMenu(GLUT_RIGHT_BUTTON); + texture(); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 7dfc65807a..24275fdc2f 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -66,7 +66,6 @@ SOURCES = \ packedpixels.c \ pbo.c \ prog_parameter.c \ - projtex.c \ quads.c \ random.c \ readrate.c \ diff --git a/progs/tests/projtex.c b/progs/tests/projtex.c deleted file mode 100644 index 800d81ecd6..0000000000 --- a/progs/tests/projtex.c +++ /dev/null @@ -1,1030 +0,0 @@ - -/* projtex.c - by David Yu and David Blythe, SGI */ - -/** - ** Demonstrates simple projective texture mapping. - ** - ** Button1 changes view, Button2 moves texture. - ** - ** (See: Segal, Korobkin, van Widenfelt, Foran, and Haeberli - ** "Fast Shadows and Lighting Effects Using Texture Mapping", SIGGRAPH '92) - ** - ** 1994,1995 -- David G Yu - ** - ** cc -o projtex projtex.c texture.c -lglut -lGLU -lGL -lX11 -lm - **/ - -#include -#include -#include -#include -#include -#include -#if 0 -#include "texture.h" -#else -#include "../util/readtex.c" -#endif - - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#define MAX_TEX 4 -int NumTextures = 1; - -int winWidth, winHeight; - -GLboolean redrawContinuously = GL_FALSE; - -float angle, axis[3]; -enum MoveModes { - MoveNone, MoveView, MoveObject, MoveTexture -}; -enum MoveModes mode = MoveNone; - -GLfloat objectXform[4][4]; -GLfloat textureXform[MAX_TEX][4][4]; - -void (*drawObject) (void); -void (*loadTexture) (void); -GLboolean textureEnabled = GL_TRUE; -GLboolean showProjection = GL_TRUE; -GLboolean linearFilter = GL_TRUE; - -char *texFilename[MAX_TEX] = { - "../images/girl.rgb", - "../images/tile.rgb", - "../images/bw.rgb", - "../images/reflect.rgb" -}; - - -GLfloat zoomFactor = 1.0; - -/*****************************************************************/ - - -void ActiveTexture(int i) -{ - glActiveTextureARB(i); -} - - -/* matrix = identity */ -void -matrixIdentity(GLfloat matrix[16]) -{ - matrix[0] = 1.0; - matrix[1] = 0.0; - matrix[2] = 0.0; - matrix[3] = 0.0; - matrix[4] = 0.0; - matrix[5] = 1.0; - matrix[6] = 0.0; - matrix[7] = 0.0; - matrix[8] = 0.0; - matrix[9] = 0.0; - matrix[10] = 1.0; - matrix[11] = 0.0; - matrix[12] = 0.0; - matrix[13] = 0.0; - matrix[14] = 0.0; - matrix[15] = 1.0; -} - -/* matrix2 = transpose(matrix1) */ -void -matrixTranspose(GLfloat matrix2[16], GLfloat matrix1[16]) -{ - matrix2[0] = matrix1[0]; - matrix2[1] = matrix1[4]; - matrix2[2] = matrix1[8]; - matrix2[3] = matrix1[12]; - - matrix2[4] = matrix1[1]; - matrix2[5] = matrix1[5]; - matrix2[6] = matrix1[9]; - matrix2[7] = matrix1[13]; - - matrix2[8] = matrix1[2]; - matrix2[9] = matrix1[6]; - matrix2[10] = matrix1[10]; - matrix2[11] = matrix1[14]; - - matrix2[12] = matrix1[3]; - matrix2[13] = matrix1[7]; - matrix2[14] = matrix1[14]; - matrix2[15] = matrix1[15]; -} - -/*****************************************************************/ - -/* load SGI .rgb image (pad with a border of the specified width and color) */ -#if 0 -static void -imgLoad(char *filenameIn, int borderIn, GLfloat borderColorIn[4], - int *wOut, int *hOut, GLubyte ** imgOut) -{ - int border = borderIn; - int width, height; - int w, h; - GLubyte *image, *img, *p; - int i, j, components; - - image = (GLubyte *) read_texture(filenameIn, &width, &height, &components); - w = width + 2 * border; - h = height + 2 * border; - img = (GLubyte *) calloc(w * h, 4 * sizeof(unsigned char)); - - p = img; - for (j = -border; j < height + border; ++j) { - for (i = -border; i < width + border; ++i) { - if (0 <= j && j <= height - 1 && 0 <= i && i <= width - 1) { - p[0] = image[4 * (j * width + i) + 0]; - p[1] = image[4 * (j * width + i) + 1]; - p[2] = image[4 * (j * width + i) + 2]; - p[3] = 0xff; - } else { - p[0] = borderColorIn[0] * 0xff; - p[1] = borderColorIn[1] * 0xff; - p[2] = borderColorIn[2] * 0xff; - p[3] = borderColorIn[3] * 0xff; - } - p += 4; - } - } - free(image); - *wOut = w; - *hOut = h; - *imgOut = img; -} -#endif - - -/*****************************************************************/ - -/* Load the image file specified on the command line as the current texture */ -void -loadImageTextures(void) -{ - GLfloat borderColor[4] = - {1.0, 1.0, 1.0, 1.0}; - int tex; - - for (tex = 0; tex < NumTextures; tex++) { - GLubyte *image, *texData3, *texData4; - GLint imgWidth, imgHeight; - GLenum imgFormat; - int i, j; - - printf("loading %s\n", texFilename[tex]); - image = LoadRGBImage(texFilename[tex], &imgWidth, &imgHeight, &imgFormat); - if (!image) { - printf("can't find %s\n", texFilename[tex]); - exit(1); - } - assert(imgFormat == GL_RGB); - - /* scale to 256x256 */ - texData3 = malloc(256 * 256 * 4); - texData4 = malloc(256 * 256 * 4); - assert(texData3); - assert(texData4); - gluScaleImage(imgFormat, imgWidth, imgHeight, GL_UNSIGNED_BYTE, image, - 256, 256, GL_UNSIGNED_BYTE, texData3); - - /* convert to rgba */ - for (i = 0; i < 256 * 256; i++) { - texData4[i*4+0] = texData3[i*3+0]; - texData4[i*4+1] = texData3[i*3+1]; - texData4[i*4+2] = texData3[i*3+2]; - texData4[i*4+3] = 128; - } - - /* put transparent border around image */ - for (i = 0; i < 256; i++) { - texData4[i*4+0] = 255; - texData4[i*4+1] = 255; - texData4[i*4+2] = 255; - texData4[i*4+3] = 0; - } - j = 256 * 255 * 4; - for (i = 0; i < 256; i++) { - texData4[j + i*4+0] = 255; - texData4[j + i*4+1] = 255; - texData4[j + i*4+2] = 255; - texData4[j + i*4+3] = 0; - } - for (i = 0; i < 256; i++) { - j = i * 256 * 4; - texData4[j+0] = 255; - texData4[j+1] = 255; - texData4[j+2] = 255; - texData4[j+3] = 0; - } - for (i = 0; i < 256; i++) { - j = i * 256 * 4 + 255 * 4; - texData4[j+0] = 255; - texData4[j+1] = 255; - texData4[j+2] = 255; - texData4[j+3] = 0; - } - - ActiveTexture(GL_TEXTURE0_ARB + tex); - glBindTexture(GL_TEXTURE_2D, tex + 1); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texData4); - - if (linearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); - } -} - -/* Create a simple spotlight pattern and make it the current texture */ -void -loadSpotlightTexture(void) -{ - static int texWidth = 64, texHeight = 64; - static GLubyte *texData; - GLfloat borderColor[4] = - {0.1, 0.1, 0.1, 1.0}; - - if (!texData) { - GLubyte *p; - int i, j; - - texData = (GLubyte *) malloc(texWidth * texHeight * 4 * sizeof(GLubyte)); - - p = texData; - for (j = 0; j < texHeight; ++j) { - float dy = (texHeight * 0.5 - j + 0.5) / (texHeight * 0.5); - - for (i = 0; i < texWidth; ++i) { - float dx = (texWidth * 0.5 - i + 0.5) / (texWidth * 0.5); - float r = cos(M_PI / 2.0 * sqrt(dx * dx + dy * dy)); - float c; - - r = (r < 0) ? 0 : r * r; - c = 0xff * (r + borderColor[0]); - p[0] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[1]); - p[1] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[2]); - p[2] = (c <= 0xff) ? c : 0xff; - c = 0xff * (r + borderColor[3]); - p[3] = (c <= 0xff) ? c : 0xff; - p += 4; - } - } - } - if (linearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); - gluBuild2DMipmaps(GL_TEXTURE_2D, 4, texWidth, texHeight, - GL_RGBA, GL_UNSIGNED_BYTE, texData); -} - -/*****************************************************************/ - -void -checkErrors(void) -{ - GLenum error; - while ((error = glGetError()) != GL_NO_ERROR) { - fprintf(stderr, "Error: %s\n", (char *) gluErrorString(error)); - } -} - -void -drawCube(void) -{ - glBegin(GL_QUADS); - - glNormal3f(-1.0, 0.0, 0.0); - glColor3f(0.80, 0.50, 0.50); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(-0.5, -0.5, 0.5); - glVertex3f(-0.5, 0.5, 0.5); - glVertex3f(-0.5, 0.5, -0.5); - - glNormal3f(1.0, 0.0, 0.0); - glColor3f(0.50, 0.80, 0.50); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(0.5, -0.5, 0.5); - glVertex3f(0.5, -0.5, -0.5); - glVertex3f(0.5, 0.5, -0.5); - - glNormal3f(0.0, -1.0, 0.0); - glColor3f(0.50, 0.50, 0.80); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(0.5, -0.5, -0.5); - glVertex3f(0.5, -0.5, 0.5); - glVertex3f(-0.5, -0.5, 0.5); - - glNormal3f(0.0, 1.0, 0.0); - glColor3f(0.50, 0.80, 0.80); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(0.5, 0.5, -0.5); - glVertex3f(-0.5, 0.5, -0.5); - glVertex3f(-0.5, 0.5, 0.5); - - glNormal3f(0.0, 0.0, -1.0); - glColor3f(0.80, 0.50, 0.80); - glVertex3f(-0.5, -0.5, -0.5); - glVertex3f(-0.5, 0.5, -0.5); - glVertex3f(0.5, 0.5, -0.5); - glVertex3f(0.5, -0.5, -0.5); - - glNormal3f(0.0, 0.0, 1.0); - glColor3f(1.00, 0.80, 0.50); - glVertex3f(0.5, 0.5, 0.5); - glVertex3f(-0.5, 0.5, 0.5); - glVertex3f(-0.5, -0.5, 0.5); - glVertex3f(0.5, -0.5, 0.5); - glEnd(); -} - -void -drawDodecahedron(void) -{ -#define A (0.5 * 1.61803) /* (sqrt(5) + 1) / 2 */ -#define B (0.5 * 0.61803) /* (sqrt(5) - 1) / 2 */ -#define C (0.5 * 1.0) - GLfloat vertexes[20][3] = - { - {-A, 0.0, B}, - {-A, 0.0, -B}, - {A, 0.0, -B}, - {A, 0.0, B}, - {B, -A, 0.0}, - {-B, -A, 0.0}, - {-B, A, 0.0}, - {B, A, 0.0}, - {0.0, B, -A}, - {0.0, -B, -A}, - {0.0, -B, A}, - {0.0, B, A}, - {-C, -C, C}, - {-C, -C, -C}, - {C, -C, -C}, - {C, -C, C}, - {-C, C, C}, - {-C, C, -C}, - {C, C, -C}, - {C, C, C}, - }; -#undef A -#undef B -#undef C - GLint polygons[12][5] = - { - {0, 12, 10, 11, 16}, - {1, 17, 8, 9, 13}, - {2, 14, 9, 8, 18}, - {3, 19, 11, 10, 15}, - {4, 14, 2, 3, 15}, - {5, 12, 0, 1, 13}, - {6, 17, 1, 0, 16}, - {7, 19, 3, 2, 18}, - {8, 17, 6, 7, 18}, - {9, 14, 4, 5, 13}, - {10, 12, 5, 4, 15}, - {11, 19, 7, 6, 16}, - }; - int i; - - glColor3f(0.75, 0.75, 0.75); - for (i = 0; i < 12; ++i) { - GLfloat *p0, *p1, *p2, d; - GLfloat u[3], v[3], n[3]; - - p0 = &vertexes[polygons[i][0]][0]; - p1 = &vertexes[polygons[i][1]][0]; - p2 = &vertexes[polygons[i][2]][0]; - - u[0] = p2[0] - p1[0]; - u[1] = p2[1] - p1[1]; - u[2] = p2[2] - p1[2]; - - v[0] = p0[0] - p1[0]; - v[1] = p0[1] - p1[1]; - v[2] = p0[2] - p1[2]; - - n[0] = u[1] * v[2] - u[2] * v[1]; - n[1] = u[2] * v[0] - u[0] * v[2]; - n[2] = u[0] * v[1] - u[1] * v[0]; - - d = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]); - n[0] *= d; - n[1] *= d; - n[2] *= d; - - glBegin(GL_POLYGON); - glNormal3fv(n); - glVertex3fv(p0); - glVertex3fv(p1); - glVertex3fv(p2); - glVertex3fv(vertexes[polygons[i][3]]); - glVertex3fv(vertexes[polygons[i][4]]); - glEnd(); - } -} - -void -drawSphere(void) -{ - int numMajor = 24; - int numMinor = 32; - float radius = 0.8; - double majorStep = (M_PI / numMajor); - double minorStep = (2.0 * M_PI / numMinor); - int i, j; - - glColor3f(0.50, 0.50, 0.50); - for (i = 0; i < numMajor; ++i) { - double a = i * majorStep; - double b = a + majorStep; - double r0 = radius * sin(a); - double r1 = radius * sin(b); - GLfloat z0 = radius * cos(a); - GLfloat z1 = radius * cos(b); - - glBegin(GL_TRIANGLE_STRIP); - for (j = 0; j <= numMinor; ++j) { - double c = j * minorStep; - GLfloat x = cos(c); - GLfloat y = sin(c); - - glNormal3f((x * r0) / radius, (y * r0) / radius, z0 / radius); - glTexCoord2f(j / (GLfloat) numMinor, i / (GLfloat) numMajor); - glVertex3f(x * r0, y * r0, z0); - - glNormal3f((x * r1) / radius, (y * r1) / radius, z1 / radius); - glTexCoord2f(j / (GLfloat) numMinor, (i + 1) / (GLfloat) numMajor); - glVertex3f(x * r1, y * r1, z1); - } - glEnd(); - } -} - -/*****************************************************************/ - -float xmin = -0.035, xmax = 0.035; -float ymin = -0.035, ymax = 0.035; -float nnear = 0.1; -float ffar = 1.9; -float distance = -1.0; - -static void -loadTextureProjection(int texUnit, GLfloat m[16]) -{ - GLfloat mInverse[4][4]; - - /* Should use true inverse, but since m consists only of rotations, we can - just use the transpose. */ - matrixTranspose((GLfloat *) mInverse, m); - - ActiveTexture(GL_TEXTURE0_ARB + texUnit); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(0.5, 0.5, 0.0); - glScalef(0.5, 0.5, 1.0); - glFrustum(xmin, xmax, ymin, ymax, nnear, ffar); - glTranslatef(0.0, 0.0, distance); - glMultMatrixf((GLfloat *) mInverse); - glMatrixMode(GL_MODELVIEW); -} - -static void -drawTextureProjection(void) -{ - float t = ffar / nnear; - GLfloat n[4][3]; - GLfloat f[4][3]; - - n[0][0] = xmin; - n[0][1] = ymin; - n[0][2] = -(nnear + distance); - - n[1][0] = xmax; - n[1][1] = ymin; - n[1][2] = -(nnear + distance); - - n[2][0] = xmax; - n[2][1] = ymax; - n[2][2] = -(nnear + distance); - - n[3][0] = xmin; - n[3][1] = ymax; - n[3][2] = -(nnear + distance); - - f[0][0] = xmin * t; - f[0][1] = ymin * t; - f[0][2] = -(ffar + distance); - - f[1][0] = xmax * t; - f[1][1] = ymin * t; - f[1][2] = -(ffar + distance); - - f[2][0] = xmax * t; - f[2][1] = ymax * t; - f[2][2] = -(ffar + distance); - - f[3][0] = xmin * t; - f[3][1] = ymax * t; - f[3][2] = -(ffar + distance); - - glColor3f(1.0, 1.0, 0.0); - glBegin(GL_LINE_LOOP); - glVertex3fv(n[0]); - glVertex3fv(n[1]); - glVertex3fv(n[2]); - glVertex3fv(n[3]); - glVertex3fv(f[3]); - glVertex3fv(f[2]); - glVertex3fv(f[1]); - glVertex3fv(f[0]); - glVertex3fv(n[0]); - glVertex3fv(n[1]); - glVertex3fv(f[1]); - glVertex3fv(f[0]); - glVertex3fv(f[3]); - glVertex3fv(f[2]); - glVertex3fv(n[2]); - glVertex3fv(n[3]); - glEnd(); -} - -/*****************************************************************/ - -void -initialize(void) -{ - GLfloat light0Pos[4] = - {0.3, 0.3, 0.0, 1.0}; - GLfloat matAmb[4] = - {0.01, 0.01, 0.01, 1.00}; - GLfloat matDiff[4] = - {0.65, 0.65, 0.65, 1.00}; - GLfloat matSpec[4] = - {0.30, 0.30, 0.30, 1.00}; - GLfloat matShine = 10.0; - GLfloat eyePlaneS[] = - {1.0, 0.0, 0.0, 0.0}; - GLfloat eyePlaneT[] = - {0.0, 1.0, 0.0, 0.0}; - GLfloat eyePlaneR[] = - {0.0, 0.0, 1.0, 0.0}; - GLfloat eyePlaneQ[] = - {0.0, 0.0, 0.0, 1.0}; - int i; - - /* Setup Misc. */ - glClearColor(0.41, 0.41, 0.31, 0.0); - - glEnable(GL_DEPTH_TEST); - - /* glLineWidth(2.0);*/ - - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - - glMatrixMode(GL_PROJECTION); - glFrustum(-0.5, 0.5, -0.5, 0.5, 1, 3); - glMatrixMode(GL_MODELVIEW); - glTranslatef(0, 0, -2); - - matrixIdentity((GLfloat *) objectXform); - for (i = 0; i < NumTextures; i++) { - matrixIdentity((GLfloat *) textureXform[i]); - } - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0, 1, 0, 1, -1, 1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glRasterPos2i(0, 0); - - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - - /* Setup Lighting */ - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmb); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, matShine); - - glEnable(GL_COLOR_MATERIAL); - - glLightfv(GL_LIGHT0, GL_POSITION, light0Pos); - glEnable(GL_LIGHT0); - - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - glEnable(GL_LIGHTING); - - /* Setup Texture */ - - (*loadTexture) (); - - - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS); - - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_T, GL_EYE_PLANE, eyePlaneT); - - glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_R, GL_EYE_PLANE, eyePlaneR); - - glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGenfv(GL_Q, GL_EYE_PLANE, eyePlaneQ); - } -} - -void -display(void) -{ - int i; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if (textureEnabled) { - if (mode == MoveTexture || mode == MoveView) { - /* Have OpenGL compute the new transformation (simple but slow). */ - for (i = 0; i < NumTextures; i++) { - glPushMatrix(); - glLoadIdentity(); -#if 0 - if (i & 1) - glRotatef(angle, axis[0], axis[1], axis[2]); - else -#endif - glRotatef(angle*(i+1), axis[0], axis[1], axis[2]); - - glMultMatrixf((GLfloat *) textureXform[i]); - glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) textureXform[i]); - glPopMatrix(); - } - } - for (i = 0; i < NumTextures; i++) { - loadTextureProjection(i, (GLfloat *) textureXform[i]); - } - - if (showProjection) { - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glPushMatrix(); - glMultMatrixf((GLfloat *) textureXform[i]); - glDisable(GL_LIGHTING); - drawTextureProjection(); - glEnable(GL_LIGHTING); - glPopMatrix(); - } - } - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glEnable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glEnable(GL_TEXTURE_GEN_R); - glEnable(GL_TEXTURE_GEN_Q); - } - } - if (mode == MoveObject || mode == MoveView) { - /* Have OpenGL compute the new transformation (simple but slow). */ - glPushMatrix(); - glLoadIdentity(); - glRotatef(angle, axis[0], axis[1], axis[2]); - glMultMatrixf((GLfloat *) objectXform); - glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) objectXform); - glPopMatrix(); - } - glPushMatrix(); - glMultMatrixf((GLfloat *) objectXform); - (*drawObject) (); - glPopMatrix(); - - for (i = 0; i < NumTextures; i++) { - ActiveTexture(GL_TEXTURE0_ARB + i); - glDisable(GL_TEXTURE_2D); - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - glDisable(GL_TEXTURE_GEN_R); - glDisable(GL_TEXTURE_GEN_Q); - } - - if (zoomFactor > 1.0) { - glDisable(GL_DEPTH_TEST); - glCopyPixels(0, 0, winWidth / zoomFactor, winHeight / zoomFactor, GL_COLOR); - glEnable(GL_DEPTH_TEST); - } - glFlush(); - glutSwapBuffers(); - checkErrors(); -} - -/*****************************************************************/ - -/* simple trackball-like motion control */ -float lastPos[3]; -int lastTime; - -void -ptov(int x, int y, int width, int height, float v[3]) -{ - float d, a; - - /* project x,y onto a hemi-sphere centered within width, height */ - v[0] = (2.0 * x - width) / width; - v[1] = (height - 2.0 * y) / height; - d = sqrt(v[0] * v[0] + v[1] * v[1]); - v[2] = cos((M_PI / 2.0) * ((d < 1.0) ? d : 1.0)); - a = 1.0 / sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - v[0] *= a; - v[1] *= a; - v[2] *= a; -} - -void -startMotion(int x, int y, int but, int time) -{ - if (but == GLUT_LEFT_BUTTON) { - mode = MoveView; - } else if (but == GLUT_MIDDLE_BUTTON) { - mode = MoveTexture; - } else { - return; - } - - lastTime = time; - ptov(x, y, winWidth, winHeight, lastPos); -} - -void -animate(void) -{ - glutPostRedisplay(); -} - -void -vis(int visible) -{ - if (visible == GLUT_VISIBLE) { - if (redrawContinuously) - glutIdleFunc(animate); - } else { - if (redrawContinuously) - glutIdleFunc(NULL); - } -} - -void -stopMotion(int but, int time) -{ - if ((but == GLUT_LEFT_BUTTON && mode == MoveView) || - (but == GLUT_MIDDLE_BUTTON && mode == MoveTexture)) { - } else { - return; - } - - if (time == lastTime) { - /* redrawContinuously = GL_TRUE;*/ - glutIdleFunc(animate); - } else { - angle = 0.0; - redrawContinuously = GL_FALSE; - glutIdleFunc(0); - } - if (!redrawContinuously) { - mode = MoveNone; - } -} - -void -trackMotion(int x, int y) -{ - float curPos[3], dx, dy, dz; - - ptov(x, y, winWidth, winHeight, curPos); - - dx = curPos[0] - lastPos[0]; - dy = curPos[1] - lastPos[1]; - dz = curPos[2] - lastPos[2]; - angle = 90.0 * sqrt(dx * dx + dy * dy + dz * dz); - - axis[0] = lastPos[1] * curPos[2] - lastPos[2] * curPos[1]; - axis[1] = lastPos[2] * curPos[0] - lastPos[0] * curPos[2]; - axis[2] = lastPos[0] * curPos[1] - lastPos[1] * curPos[0]; - - lastTime = glutGet(GLUT_ELAPSED_TIME); - lastPos[0] = curPos[0]; - lastPos[1] = curPos[1]; - lastPos[2] = curPos[2]; - glutPostRedisplay(); -} - -/*****************************************************************/ - -void -object(void) -{ - static int object; - - object++; - object %= 3; - switch (object) { - case 0: - drawObject = drawCube; - break; - case 1: - drawObject = drawDodecahedron; - break; - case 2: - drawObject = drawSphere; - break; - default: - break; - } -} - -static void -nop(void) -{ -} - -void -texture(void) -{ - static int texture = 0; - - texture++; - texture %= 3; - if (texture == 1 && texFilename == NULL) { - /* Skip file texture if not loaded. */ - texture++; - } - switch (texture) { - case 0: - loadTexture = nop; - textureEnabled = GL_FALSE; - break; - case 1: - loadTexture = loadImageTextures; - (*loadTexture) (); - textureEnabled = GL_TRUE; - break; - case 2: - loadTexture = loadSpotlightTexture; - (*loadTexture) (); - textureEnabled = GL_TRUE; - break; - default: - break; - } -} - -void -help(void) -{ - printf("'h' - help\n"); - printf("'l' - toggle linear/nearest filter\n"); - printf("'s' - toggle projection frustum\n"); - printf("'t' - toggle projected texture\n"); - printf("'o' - toggle object\n"); - printf("'z' - increase zoom factor\n"); - printf("'Z' - decrease zoom factor\n"); - printf("left mouse - move view\n"); - printf("middle mouse - move projection\n"); -} - -/* ARGSUSED1 */ -void -key(unsigned char key, int x, int y) -{ - switch (key) { - case '\033': - exit(0); - break; - case 'l': - linearFilter = !linearFilter; - (*loadTexture) (); - break; - case 's': - showProjection = !showProjection; - break; - case 't': - texture(); - break; - case 'o': - object(); - break; - case 'z': - zoomFactor += 1.0; - glPixelZoom(zoomFactor, zoomFactor); - glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); - break; - case 'Z': - zoomFactor -= 1.0; - if (zoomFactor < 1.0) - zoomFactor = 1.0; - glPixelZoom(zoomFactor, zoomFactor); - glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor); - break; - case 'h': - help(); - break; - } - glutPostRedisplay(); -} - -void -mouse(int button, int state, int x, int y) -{ - if (state == GLUT_DOWN) - startMotion(x, y, button, glutGet(GLUT_ELAPSED_TIME)); - else if (state == GLUT_UP) - stopMotion(button, glutGet(GLUT_ELAPSED_TIME)); - glutPostRedisplay(); -} - -void -reshape(int w, int h) -{ - winWidth = w; - winHeight = h; - glViewport(0, 0, w / zoomFactor, h / zoomFactor); -} - - -void -menu(int selection) -{ - if (selection == 666) { - exit(0); - } - key((unsigned char) selection, 0, 0); -} - -int -main(int argc, char **argv) -{ - glutInit(&argc, argv); - - if (argc > 1) { - NumTextures = atoi(argv[1]); - } - assert(NumTextures <= MAX_TEX); - - glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); - (void) glutCreateWindow("projtex"); - glewInit(); - - loadTexture = loadImageTextures; - drawObject = drawCube; - initialize(); - glutDisplayFunc(display); - glutKeyboardFunc(key); - glutReshapeFunc(reshape); - glutMouseFunc(mouse); - glutMotionFunc(trackMotion); - glutVisibilityFunc(vis); - glutCreateMenu(menu); - glutAddMenuEntry("Toggle showing projection", 's'); - glutAddMenuEntry("Switch texture", 't'); - glutAddMenuEntry("Switch object", 'o'); - glutAddMenuEntry("Toggle filtering", 'l'); - glutAddMenuEntry("Quit", 666); - glutAttachMenu(GLUT_RIGHT_BUTTON); - texture(); - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} -- cgit v1.2.3 From 22af013f85debd0030f2fb00061ce0412fdc0797 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:08:48 -0600 Subject: demos: move tests/dinoshade.c to demos/ --- progs/demos/Makefile | 1 + progs/demos/dinoshade.c | 912 ++++++++++++++++++++++++++++++++++++++++++++++++ progs/tests/Makefile | 1 - progs/tests/dinoshade.c | 912 ------------------------------------------------ 4 files changed, 913 insertions(+), 913 deletions(-) create mode 100644 progs/demos/dinoshade.c delete mode 100644 progs/tests/dinoshade.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 2fe407972d..8febc14d41 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -19,6 +19,7 @@ PROGS = \ clearspd \ copypix \ cubemap \ + dinoshade \ drawpix \ engine \ fbo_firecube \ diff --git a/progs/demos/dinoshade.c b/progs/demos/dinoshade.c new file mode 100644 index 0000000000..451da2ec89 --- /dev/null +++ b/progs/demos/dinoshade.c @@ -0,0 +1,912 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +/* Example for PC game developers to show how to *combine* texturing, + reflections, and projected shadows all in real-time with OpenGL. + Robust reflections use stenciling. Robust projected shadows + use both stenciling and polygon offset. PC game programmers + should realize that neither stenciling nor polygon offset are + supported by Direct3D, so these real-time rendering algorithms + are only really viable with OpenGL. + + The program has modes for disabling the stenciling and polygon + offset uses. It is worth running this example with these features + toggled off so you can see the sort of artifacts that result. + + Notice that the floor texturing, reflections, and shadowing + all co-exist properly. */ + +/* When you run this program: Left mouse button controls the + view. Middle mouse button controls light position (left & + right rotates light around dino; up & down moves light + position up and down). Right mouse button pops up menu. */ + +/* Check out the comments in the "redraw" routine to see how the + reflection blending and surface stenciling is done. You can + also see in "redraw" how the projected shadows are rendered, + including the use of stenciling and polygon offset. */ + +/* This program is derived from glutdino.c */ + +/* Compile: cc -o dinoshade dinoshade.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm */ + +#include +#include +#include +#include /* for cos(), sin(), and sqrt() */ +#include /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */ +#ifdef _WIN32 +#include +#endif +#define GL_GLEXT_LEGACY +#include /* OpenGL Utility Toolkit header */ +#include /* OpenGL Utility Toolkit header */ + +/* Some files do not define M_PI... */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* Variable controlling various rendering modes. */ +static int stencilReflection = 1, stencilShadow = 1, offsetShadow = 1; +static int renderShadow = 1, renderDinosaur = 1, renderReflection = 1; +static int linearFiltering = 0, useMipmaps = 0, useTexture = 1; +static int reportSpeed = 0; +static int animation = 1; +static GLboolean lightSwitch = GL_TRUE; +static int directionalLight = 1; +static int forceExtension = 0; + +/* Time varying or user-controled variables. */ +static float jump = 0.0; +static float lightAngle = 0.0, lightHeight = 20; +GLfloat angle = -150; /* in degrees */ +GLfloat angle2 = 30; /* in degrees */ + +int moving, startx, starty; +int lightMoving = 0, lightStartX, lightStartY; + +enum { + MISSING, EXTENSION, ONE_DOT_ONE +}; +int polygonOffsetVersion; + +static GLdouble bodyWidth = 3.0; +/* *INDENT-OFF* */ +static GLfloat body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5}, + {11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16}, + {8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2}, + {1, 2} }; +static GLfloat arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9}, + {15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10}, + {13, 9}, {11, 11}, {9, 11} }; +static GLfloat leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0}, + {12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} }; +static GLfloat eye[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15}, + {9.6, 15.25}, {9, 15.25} }; +static GLfloat lightPosition[4]; +static GLfloat lightColor[] = {0.8, 1.0, 0.8, 1.0}; /* green-tinted */ +static GLfloat skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0}; +/* *INDENT-ON* */ + +/* Nice floor texture tiling pattern. */ +static char *circles[] = { + "....xxxx........", + "..xxxxxxxx......", + ".xxxxxxxxxx.....", + ".xxx....xxx.....", + "xxx......xxx....", + "xxx......xxx....", + "xxx......xxx....", + "xxx......xxx....", + ".xxx....xxx.....", + ".xxxxxxxxxx.....", + "..xxxxxxxx......", + "....xxxx........", + "................", + "................", + "................", + "................", +}; + +static void +makeFloorTexture(void) +{ + GLubyte floorTexture[16][16][3]; + GLubyte *loc; + int s, t; + + /* Setup RGB image for the texture. */ + loc = (GLubyte*) floorTexture; + for (t = 0; t < 16; t++) { + for (s = 0; s < 16; s++) { + if (circles[t][s] == 'x') { + /* Nice green. */ + loc[0] = 0x1f; + loc[1] = 0x8f; + loc[2] = 0x1f; + } else { + /* Light gray. */ + loc[0] = 0xaa; + loc[1] = 0xaa; + loc[2] = 0xaa; + } + loc += 3; + } + } + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (useMipmaps) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16, + GL_RGB, GL_UNSIGNED_BYTE, floorTexture); + } else { + if (linearFiltering) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0, + GL_RGB, GL_UNSIGNED_BYTE, floorTexture); + } +} + +enum { + X, Y, Z, W +}; +enum { + A, B, C, D +}; + +/* Create a matrix that will project the desired shadow. */ +static void +shadowMatrix(GLfloat shadowMat[4][4], + GLfloat groundplane[4], + GLfloat lightpos[4]) +{ + GLfloat dot; + + /* Find dot product between light position vector and ground plane normal. */ + dot = groundplane[X] * lightpos[X] + + groundplane[Y] * lightpos[Y] + + groundplane[Z] * lightpos[Z] + + groundplane[W] * lightpos[W]; + + shadowMat[0][0] = dot - lightpos[X] * groundplane[X]; + shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y]; + shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z]; + shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W]; + + shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X]; + shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y]; + shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z]; + shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W]; + + shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X]; + shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y]; + shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z]; + shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W]; + + shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X]; + shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y]; + shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z]; + shadowMat[3][3] = dot - lightpos[W] * groundplane[W]; + +} + +/* Find the plane equation given 3 points. */ +static void +findPlane(GLfloat plane[4], + GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]) +{ + GLfloat vec0[3], vec1[3]; + + /* Need 2 vectors to find cross product. */ + vec0[X] = v1[X] - v0[X]; + vec0[Y] = v1[Y] - v0[Y]; + vec0[Z] = v1[Z] - v0[Z]; + + vec1[X] = v2[X] - v0[X]; + vec1[Y] = v2[Y] - v0[Y]; + vec1[Z] = v2[Z] - v0[Z]; + + /* find cross product to get A, B, and C of plane equation */ + plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y]; + plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]); + plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X]; + + plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]); +} + +static void +extrudeSolidFromPolygon(GLfloat data[][2], unsigned int dataSize, + GLdouble thickness, GLuint side, GLuint edge, GLuint whole) +{ + static GLUtriangulatorObj *tobj = NULL; + GLdouble vertex[3], dx, dy, len; + int i; + int count = (int) (dataSize / (2 * sizeof(GLfloat))); + + if (tobj == NULL) { + tobj = gluNewTess(); /* create and initialize a GLU + polygon tesselation object */ + gluTessCallback(tobj, GLU_BEGIN, glBegin); + gluTessCallback(tobj, GLU_VERTEX, glVertex2fv); /* semi-tricky */ + gluTessCallback(tobj, GLU_END, glEnd); + } + glNewList(side, GL_COMPILE); + glShadeModel(GL_SMOOTH); /* smooth minimizes seeing + tessellation */ + gluBeginPolygon(tobj); + for (i = 0; i < count; i++) { + vertex[0] = data[i][0]; + vertex[1] = data[i][1]; + vertex[2] = 0; + gluTessVertex(tobj, vertex, data[i]); + } + gluEndPolygon(tobj); + glEndList(); + glNewList(edge, GL_COMPILE); + glShadeModel(GL_FLAT); /* flat shade keeps angular hands + from being "smoothed" */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= count; i++) { +#if 1 /* weird, but seems to be legal */ + /* mod function handles closing the edge */ + glVertex3f(data[i % count][0], data[i % count][1], 0.0); + glVertex3f(data[i % count][0], data[i % count][1], thickness); + /* Calculate a unit normal by dividing by Euclidean + distance. We * could be lazy and use + glEnable(GL_NORMALIZE) so we could pass in * arbitrary + normals for a very slight performance hit. */ + dx = data[(i + 1) % count][1] - data[i % count][1]; + dy = data[i % count][0] - data[(i + 1) % count][0]; + len = sqrt(dx * dx + dy * dy); + glNormal3f(dx / len, dy / len, 0.0); +#else /* the nice way of doing it */ + /* Calculate a unit normal by dividing by Euclidean + distance. We * could be lazy and use + glEnable(GL_NORMALIZE) so we could pass in * arbitrary + normals for a very slight performance hit. */ + dx = data[i % count][1] - data[(i - 1 + count) % count][1]; + dy = data[(i - 1 + count) % count][0] - data[i % count][0]; + len = sqrt(dx * dx + dy * dy); + glNormal3f(dx / len, dy / len, 0.0); + /* mod function handles closing the edge */ + glVertex3f(data[i % count][0], data[i % count][1], 0.0); + glVertex3f(data[i % count][0], data[i % count][1], thickness); +#endif + } + glEnd(); + glEndList(); + glNewList(whole, GL_COMPILE); + glFrontFace(GL_CW); + glCallList(edge); + glNormal3f(0.0, 0.0, -1.0); /* constant normal for side */ + glCallList(side); + glPushMatrix(); + glTranslatef(0.0, 0.0, thickness); + glFrontFace(GL_CCW); + glNormal3f(0.0, 0.0, 1.0); /* opposite normal for other side */ + glCallList(side); + glPopMatrix(); + glEndList(); +} + +/* Enumerants for refering to display lists. */ +typedef enum { + RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE, + LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE +} displayLists; + +static void +makeDinosaur(void) +{ + extrudeSolidFromPolygon(body, sizeof(body), bodyWidth, + BODY_SIDE, BODY_EDGE, BODY_WHOLE); + extrudeSolidFromPolygon(arm, sizeof(arm), bodyWidth / 4, + ARM_SIDE, ARM_EDGE, ARM_WHOLE); + extrudeSolidFromPolygon(leg, sizeof(leg), bodyWidth / 2, + LEG_SIDE, LEG_EDGE, LEG_WHOLE); + extrudeSolidFromPolygon(eye, sizeof(eye), bodyWidth + 0.2, + EYE_SIDE, EYE_EDGE, EYE_WHOLE); +} + +static void +drawDinosaur(void) + +{ + glPushMatrix(); + /* Translate the dinosaur to be at (0,8,0). */ + glTranslatef(-8, 0, -bodyWidth / 2); + glTranslatef(0.0, jump, 0.0); + glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor); + glCallList(BODY_WHOLE); + glTranslatef(0.0, 0.0, bodyWidth); + glCallList(ARM_WHOLE); + glCallList(LEG_WHOLE); + glTranslatef(0.0, 0.0, -bodyWidth - bodyWidth / 4); + glCallList(ARM_WHOLE); + glTranslatef(0.0, 0.0, -bodyWidth / 4); + glCallList(LEG_WHOLE); + glTranslatef(0.0, 0.0, bodyWidth / 2 - 0.1); + glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor); + glCallList(EYE_WHOLE); + glPopMatrix(); +} + +static GLfloat floorVertices[4][3] = { + { -20.0, 0.0, 20.0 }, + { 20.0, 0.0, 20.0 }, + { 20.0, 0.0, -20.0 }, + { -20.0, 0.0, -20.0 }, +}; + +/* Draw a floor (possibly textured). */ +static void +drawFloor(void) +{ + glDisable(GL_LIGHTING); + + if (useTexture) { + glEnable(GL_TEXTURE_2D); + } + + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex3fv(floorVertices[0]); + glTexCoord2f(0.0, 16.0); + glVertex3fv(floorVertices[1]); + glTexCoord2f(16.0, 16.0); + glVertex3fv(floorVertices[2]); + glTexCoord2f(16.0, 0.0); + glVertex3fv(floorVertices[3]); + glEnd(); + + if (useTexture) { + glDisable(GL_TEXTURE_2D); + } + + glEnable(GL_LIGHTING); +} + +static GLfloat floorPlane[4]; +static GLfloat floorShadow[4][4]; + +static void +redraw(void) +{ + int start, end; + + if (reportSpeed) { + start = glutGet(GLUT_ELAPSED_TIME); + } + + /* Clear; default stencil clears to zero. */ + if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow)) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + } else { + /* Avoid clearing stencil when not using it. */ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } + + /* Reposition the light source. */ + lightPosition[0] = 12*cos(lightAngle); + lightPosition[1] = lightHeight; + lightPosition[2] = 12*sin(lightAngle); + if (directionalLight) { + lightPosition[3] = 0.0; + } else { + lightPosition[3] = 1.0; + } + + shadowMatrix(floorShadow, floorPlane, lightPosition); + + glPushMatrix(); + /* Perform scene rotations based on user mouse input. */ + glRotatef(angle2, 1.0, 0.0, 0.0); + glRotatef(angle, 0.0, 1.0, 0.0); + + /* Tell GL new light source position. */ + glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); + + if (renderReflection) { + if (stencilReflection) { + /* We can eliminate the visual "artifact" of seeing the "flipped" + dinosaur underneath the floor by using stencil. The idea is + draw the floor without color or depth update but so that + a stencil value of one is where the floor will be. Later when + rendering the dinosaur reflection, we will only update pixels + with a stencil value of 1 to make sure the reflection only + lives on the floor, not below the floor. */ + + /* Don't update color or depth. */ + glDisable(GL_DEPTH_TEST); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + /* Draw 1 into the stencil buffer. */ + glEnable(GL_STENCIL_TEST); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + glStencilFunc(GL_ALWAYS, 1, 0xffffffff); + + /* Now render floor; floor pixels just get their stencil set to 1. */ + drawFloor(); + + /* Re-enable update of color and depth. */ + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glEnable(GL_DEPTH_TEST); + + /* Now, only render where stencil is set to 1. */ + glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */ + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + } + + glPushMatrix(); + + /* The critical reflection step: Reflect dinosaur through the floor + (the Y=0 plane) to make a relection. */ + glScalef(1.0, -1.0, 1.0); + + /* Reflect the light position. */ + glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); + + /* To avoid our normals getting reversed and hence botched lighting + on the reflection, turn on normalize. */ + glEnable(GL_NORMALIZE); + glCullFace(GL_FRONT); + + /* Draw the reflected dinosaur. */ + drawDinosaur(); + + /* Disable noramlize again and re-enable back face culling. */ + glDisable(GL_NORMALIZE); + glCullFace(GL_BACK); + + glPopMatrix(); + + /* Switch back to the unreflected light position. */ + glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); + + if (stencilReflection) { + glDisable(GL_STENCIL_TEST); + } + } + + /* Back face culling will get used to only draw either the top or the + bottom floor. This let's us get a floor with two distinct + appearances. The top floor surface is reflective and kind of red. + The bottom floor surface is not reflective and blue. */ + + /* Draw "bottom" of floor in blue. */ + glFrontFace(GL_CW); /* Switch face orientation. */ + glColor4f(0.1, 0.1, 0.7, 1.0); + drawFloor(); + glFrontFace(GL_CCW); + + if (renderShadow) { + if (stencilShadow) { + /* Draw the floor with stencil value 3. This helps us only + draw the shadow once per floor pixel (and only on the + floor pixels). */ + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_ALWAYS, 3, 0xffffffff); + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + } + } + + /* Draw "top" of floor. Use blending to blend in reflection. */ + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.7, 0.0, 0.0, 0.3); + glColor4f(1.0, 1.0, 1.0, 0.3); + drawFloor(); + glDisable(GL_BLEND); + + if (renderDinosaur) { + /* Draw "actual" dinosaur, not its reflection. */ + drawDinosaur(); + } + + if (renderShadow) { + + /* Render the projected shadow. */ + + if (stencilShadow) { + + /* Now, only render where stencil is set above 2 (ie, 3 where + the top floor is). Update stencil with 2 where the shadow + gets drawn so we don't redraw (and accidently reblend) the + shadow). */ + glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */ + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + } + + /* To eliminate depth buffer artifacts, we use polygon offset + to raise the depth of the projected shadow slightly so + that it does not depth buffer alias with the floor. */ + if (offsetShadow) { + switch (polygonOffsetVersion) { + case EXTENSION: +#ifdef GL_EXT_polygon_offset + glEnable(GL_POLYGON_OFFSET_EXT); + break; +#endif +#ifdef GL_VERSION_1_1 + case ONE_DOT_ONE: + glEnable(GL_POLYGON_OFFSET_FILL); + break; +#endif + case MISSING: + /* Oh well. */ + break; + } + } + + /* Render 50% black shadow color on top of whatever the + floor appareance is. */ + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_LIGHTING); /* Force the 50% black. */ + glColor4f(0.0, 0.0, 0.0, 0.5); + + glPushMatrix(); + /* Project the shadow. */ + glMultMatrixf((GLfloat *) floorShadow); + drawDinosaur(); + glPopMatrix(); + + glDisable(GL_BLEND); + glEnable(GL_LIGHTING); + + if (offsetShadow) { + switch (polygonOffsetVersion) { +#ifdef GL_EXT_polygon_offset + case EXTENSION: + glDisable(GL_POLYGON_OFFSET_EXT); + break; +#endif +#ifdef GL_VERSION_1_1 + case ONE_DOT_ONE: + glDisable(GL_POLYGON_OFFSET_FILL); + break; +#endif + case MISSING: + /* Oh well. */ + break; + } + } + if (stencilShadow) { + glDisable(GL_STENCIL_TEST); + } + } + + glPushMatrix(); + glDisable(GL_LIGHTING); + glColor3f(1.0, 1.0, 0.0); + if (directionalLight) { + /* Draw an arrowhead. */ + glDisable(GL_CULL_FACE); + glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); + glRotatef(lightAngle * -180.0 / M_PI, 0, 1, 0); + glRotatef(atan(lightHeight/12) * 180.0 / M_PI, 0, 0, 1); + glBegin(GL_TRIANGLE_FAN); + glVertex3f(0, 0, 0); + glVertex3f(2, 1, 1); + glVertex3f(2, -1, 1); + glVertex3f(2, -1, -1); + glVertex3f(2, 1, -1); + glVertex3f(2, 1, 1); + glEnd(); + /* Draw a white line from light direction. */ + glColor3f(1.0, 1.0, 1.0); + glBegin(GL_LINES); + glVertex3f(0, 0, 0); + glVertex3f(5, 0, 0); + glEnd(); + glEnable(GL_CULL_FACE); + } else { + /* Draw a yellow ball at the light source. */ + glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); + glutSolidSphere(1.0, 5, 5); + } + glEnable(GL_LIGHTING); + glPopMatrix(); + + glPopMatrix(); + + if (reportSpeed) { + glFinish(); + end = glutGet(GLUT_ELAPSED_TIME); + printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start); + } + + glutSwapBuffers(); +} + +/* ARGSUSED2 */ +static void +mouse(int button, int state, int x, int y) +{ + if (button == GLUT_LEFT_BUTTON) { + if (state == GLUT_DOWN) { + moving = 1; + startx = x; + starty = y; + } + if (state == GLUT_UP) { + moving = 0; + } + } + if (button == GLUT_MIDDLE_BUTTON) { + if (state == GLUT_DOWN) { + lightMoving = 1; + lightStartX = x; + lightStartY = y; + } + if (state == GLUT_UP) { + lightMoving = 0; + } + } +} + +/* ARGSUSED1 */ +static void +motion(int x, int y) +{ + if (moving) { + angle = angle + (x - startx); + angle2 = angle2 + (y - starty); + startx = x; + starty = y; + glutPostRedisplay(); + } + if (lightMoving) { + lightAngle += (x - lightStartX)/40.0; + lightHeight += (lightStartY - y)/20.0; + lightStartX = x; + lightStartY = y; + glutPostRedisplay(); + } +} + +/* Advance time varying state when idle callback registered. */ +static void +idle(void) +{ + static float time = 0.0; + + time = glutGet(GLUT_ELAPSED_TIME) / 500.0; + + jump = 4.0 * fabs(sin(time)*0.5); + if (!lightMoving) { + lightAngle += 0.03; + } + glutPostRedisplay(); +} + +enum { + M_NONE, M_MOTION, M_LIGHT, M_TEXTURE, M_SHADOWS, M_REFLECTION, M_DINOSAUR, + M_STENCIL_REFLECTION, M_STENCIL_SHADOW, M_OFFSET_SHADOW, + M_POSITIONAL, M_DIRECTIONAL, M_PERFORMANCE +}; + +static void +controlLights(int value) +{ + switch (value) { + case M_NONE: + return; + case M_MOTION: + animation = 1 - animation; + if (animation) { + glutIdleFunc(idle); + } else { + glutIdleFunc(NULL); + } + break; + case M_LIGHT: + lightSwitch = !lightSwitch; + if (lightSwitch) { + glEnable(GL_LIGHT0); + } else { + glDisable(GL_LIGHT0); + } + break; + case M_TEXTURE: + useTexture = !useTexture; + break; + case M_SHADOWS: + renderShadow = 1 - renderShadow; + break; + case M_REFLECTION: + renderReflection = 1 - renderReflection; + break; + case M_DINOSAUR: + renderDinosaur = 1 - renderDinosaur; + break; + case M_STENCIL_REFLECTION: + stencilReflection = 1 - stencilReflection; + break; + case M_STENCIL_SHADOW: + stencilShadow = 1 - stencilShadow; + break; + case M_OFFSET_SHADOW: + offsetShadow = 1 - offsetShadow; + break; + case M_POSITIONAL: + directionalLight = 0; + break; + case M_DIRECTIONAL: + directionalLight = 1; + break; + case M_PERFORMANCE: + reportSpeed = 1 - reportSpeed; + break; + } + glutPostRedisplay(); +} + +/* When not visible, stop animating. Restart when visible again. */ +static void +visible(int vis) +{ + if (vis == GLUT_VISIBLE) { + if (animation) + glutIdleFunc(idle); + } else { + if (!animation) + glutIdleFunc(NULL); + } +} + +/* Press any key to redraw; good when motion stopped and + performance reporting on. */ +/* ARGSUSED */ +static void +key(unsigned char c, int x, int y) +{ + if (c == 27) { + exit(0); /* IRIS GLism, Escape quits. */ + } + glutPostRedisplay(); +} + +/* Press any key to redraw; good when motion stopped and + performance reporting on. */ +/* ARGSUSED */ +static void +special(int k, int x, int y) +{ + glutPostRedisplay(); +} + +static int +supportsOneDotOne(void) +{ + const char *version; + int major, minor; + + version = (char *) glGetString(GL_VERSION); + if (sscanf(version, "%d.%d", &major, &minor) == 2) + return major * 10 + minor >= 11; + return 0; /* OpenGL version string malformed! */ +} + +int +main(int argc, char **argv) +{ + int i; + + glutInit(&argc, argv); + + for (i=1; i=2 rgb double depth"); +#endif + + glutCreateWindow("Shadowy Leapin' Lizards"); + glewInit(); + + if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) { + printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n"); + exit(1); + } + + /* Register GLUT callbacks. */ + glutDisplayFunc(redraw); + glutMouseFunc(mouse); + glutMotionFunc(motion); + glutVisibilityFunc(visible); + glutKeyboardFunc(key); + glutSpecialFunc(special); + + glutCreateMenu(controlLights); + + glutAddMenuEntry("Toggle motion", M_MOTION); + glutAddMenuEntry("-----------------------", M_NONE); + glutAddMenuEntry("Toggle light", M_LIGHT); + glutAddMenuEntry("Toggle texture", M_TEXTURE); + glutAddMenuEntry("Toggle shadows", M_SHADOWS); + glutAddMenuEntry("Toggle reflection", M_REFLECTION); + glutAddMenuEntry("Toggle dinosaur", M_DINOSAUR); + glutAddMenuEntry("-----------------------", M_NONE); + glutAddMenuEntry("Toggle reflection stenciling", M_STENCIL_REFLECTION); + glutAddMenuEntry("Toggle shadow stenciling", M_STENCIL_SHADOW); + glutAddMenuEntry("Toggle shadow offset", M_OFFSET_SHADOW); + glutAddMenuEntry("----------------------", M_NONE); + glutAddMenuEntry("Positional light", M_POSITIONAL); + glutAddMenuEntry("Directional light", M_DIRECTIONAL); + glutAddMenuEntry("-----------------------", M_NONE); + glutAddMenuEntry("Toggle performance", M_PERFORMANCE); + glutAttachMenu(GLUT_RIGHT_BUTTON); + makeDinosaur(); + +#ifdef GL_VERSION_1_1 + if (supportsOneDotOne() && !forceExtension) { + polygonOffsetVersion = ONE_DOT_ONE; + glPolygonOffset(-2.0, -9.0); + } else +#endif + { +#ifdef GL_EXT_polygon_offset + /* check for the polygon offset extension */ + if (glutExtensionSupported("GL_EXT_polygon_offset")) { + polygonOffsetVersion = EXTENSION; + glPolygonOffsetEXT(-2.0, -0.002); + } else +#endif + { + polygonOffsetVersion = MISSING; + printf("\ndinoshine: Missing polygon offset.\n"); + printf(" Expect shadow depth aliasing artifacts.\n\n"); + } + } + + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + glEnable(GL_TEXTURE_2D); + glLineWidth(3.0); + + glMatrixMode(GL_PROJECTION); + gluPerspective( /* field of view in degree */ 40.0, + /* aspect ratio */ 1.0, + /* Z near */ 20.0, /* Z far */ 100.0); + glMatrixMode(GL_MODELVIEW); + gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */ + 0.0, 8.0, 0.0, /* center is at (0,8,0) */ + 0.0, 1.0, 0.); /* up is in postivie Y direction */ + + glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); + glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); + glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); + glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHTING); + + makeFloorTexture(); + + /* Setup floor plane for projected shadow calculations. */ + findPlane(floorPlane, floorVertices[1], floorVertices[2], floorVertices[3]); + + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 24275fdc2f..e5da72a3e4 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -37,7 +37,6 @@ SOURCES = \ copypixrate.c \ crossbar.c \ cva.c \ - dinoshade.c \ drawbuffers.c \ exactrast.c \ floattex.c \ diff --git a/progs/tests/dinoshade.c b/progs/tests/dinoshade.c deleted file mode 100644 index fb7c3f4535..0000000000 --- a/progs/tests/dinoshade.c +++ /dev/null @@ -1,912 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -/* Example for PC game developers to show how to *combine* texturing, - reflections, and projected shadows all in real-time with OpenGL. - Robust reflections use stenciling. Robust projected shadows - use both stenciling and polygon offset. PC game programmers - should realize that neither stenciling nor polygon offset are - supported by Direct3D, so these real-time rendering algorithms - are only really viable with OpenGL. - - The program has modes for disabling the stenciling and polygon - offset uses. It is worth running this example with these features - toggled off so you can see the sort of artifacts that result. - - Notice that the floor texturing, reflections, and shadowing - all co-exist properly. */ - -/* When you run this program: Left mouse button controls the - view. Middle mouse button controls light position (left & - right rotates light around dino; up & down moves light - position up and down). Right mouse button pops up menu. */ - -/* Check out the comments in the "redraw" routine to see how the - reflection blending and surface stenciling is done. You can - also see in "redraw" how the projected shadows are rendered, - including the use of stenciling and polygon offset. */ - -/* This program is derived from glutdino.c */ - -/* Compile: cc -o dinoshade dinoshade.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm */ - -#include -#include -#include -#include /* for cos(), sin(), and sqrt() */ -#include /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */ -#ifdef _WIN32 -#include -#endif -#define GL_GLEXT_LEGACY -#include /* OpenGL Utility Toolkit header */ -#include /* OpenGL Utility Toolkit header */ - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -/* Variable controlling various rendering modes. */ -static int stencilReflection = 1, stencilShadow = 1, offsetShadow = 1; -static int renderShadow = 1, renderDinosaur = 1, renderReflection = 1; -static int linearFiltering = 0, useMipmaps = 0, useTexture = 1; -static int reportSpeed = 0; -static int animation = 1; -static GLboolean lightSwitch = GL_TRUE; -static int directionalLight = 1; -static int forceExtension = 0; - -/* Time varying or user-controled variables. */ -static float jump = 0.0; -static float lightAngle = 0.0, lightHeight = 20; -GLfloat angle = -150; /* in degrees */ -GLfloat angle2 = 30; /* in degrees */ - -int moving, startx, starty; -int lightMoving = 0, lightStartX, lightStartY; - -enum { - MISSING, EXTENSION, ONE_DOT_ONE -}; -int polygonOffsetVersion; - -static GLdouble bodyWidth = 3.0; -/* *INDENT-OFF* */ -static GLfloat body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5}, - {11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16}, - {8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2}, - {1, 2} }; -static GLfloat arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9}, - {15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10}, - {13, 9}, {11, 11}, {9, 11} }; -static GLfloat leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0}, - {12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} }; -static GLfloat eye[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15}, - {9.6, 15.25}, {9, 15.25} }; -static GLfloat lightPosition[4]; -static GLfloat lightColor[] = {0.8, 1.0, 0.8, 1.0}; /* green-tinted */ -static GLfloat skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0}; -/* *INDENT-ON* */ - -/* Nice floor texture tiling pattern. */ -static char *circles[] = { - "....xxxx........", - "..xxxxxxxx......", - ".xxxxxxxxxx.....", - ".xxx....xxx.....", - "xxx......xxx....", - "xxx......xxx....", - "xxx......xxx....", - "xxx......xxx....", - ".xxx....xxx.....", - ".xxxxxxxxxx.....", - "..xxxxxxxx......", - "....xxxx........", - "................", - "................", - "................", - "................", -}; - -static void -makeFloorTexture(void) -{ - GLubyte floorTexture[16][16][3]; - GLubyte *loc; - int s, t; - - /* Setup RGB image for the texture. */ - loc = (GLubyte*) floorTexture; - for (t = 0; t < 16; t++) { - for (s = 0; s < 16; s++) { - if (circles[t][s] == 'x') { - /* Nice green. */ - loc[0] = 0x1f; - loc[1] = 0x8f; - loc[2] = 0x1f; - } else { - /* Light gray. */ - loc[0] = 0xaa; - loc[1] = 0xaa; - loc[2] = 0xaa; - } - loc += 3; - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (useMipmaps) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16, - GL_RGB, GL_UNSIGNED_BYTE, floorTexture); - } else { - if (linearFiltering) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0, - GL_RGB, GL_UNSIGNED_BYTE, floorTexture); - } -} - -enum { - X, Y, Z, W -}; -enum { - A, B, C, D -}; - -/* Create a matrix that will project the desired shadow. */ -void -shadowMatrix(GLfloat shadowMat[4][4], - GLfloat groundplane[4], - GLfloat lightpos[4]) -{ - GLfloat dot; - - /* Find dot product between light position vector and ground plane normal. */ - dot = groundplane[X] * lightpos[X] + - groundplane[Y] * lightpos[Y] + - groundplane[Z] * lightpos[Z] + - groundplane[W] * lightpos[W]; - - shadowMat[0][0] = dot - lightpos[X] * groundplane[X]; - shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y]; - shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z]; - shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W]; - - shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X]; - shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y]; - shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z]; - shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W]; - - shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X]; - shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y]; - shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z]; - shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W]; - - shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X]; - shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y]; - shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z]; - shadowMat[3][3] = dot - lightpos[W] * groundplane[W]; - -} - -/* Find the plane equation given 3 points. */ -void -findPlane(GLfloat plane[4], - GLfloat v0[3], GLfloat v1[3], GLfloat v2[3]) -{ - GLfloat vec0[3], vec1[3]; - - /* Need 2 vectors to find cross product. */ - vec0[X] = v1[X] - v0[X]; - vec0[Y] = v1[Y] - v0[Y]; - vec0[Z] = v1[Z] - v0[Z]; - - vec1[X] = v2[X] - v0[X]; - vec1[Y] = v2[Y] - v0[Y]; - vec1[Z] = v2[Z] - v0[Z]; - - /* find cross product to get A, B, and C of plane equation */ - plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y]; - plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]); - plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X]; - - plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]); -} - -void -extrudeSolidFromPolygon(GLfloat data[][2], unsigned int dataSize, - GLdouble thickness, GLuint side, GLuint edge, GLuint whole) -{ - static GLUtriangulatorObj *tobj = NULL; - GLdouble vertex[3], dx, dy, len; - int i; - int count = (int) (dataSize / (2 * sizeof(GLfloat))); - - if (tobj == NULL) { - tobj = gluNewTess(); /* create and initialize a GLU - polygon tesselation object */ - gluTessCallback(tobj, GLU_BEGIN, glBegin); - gluTessCallback(tobj, GLU_VERTEX, glVertex2fv); /* semi-tricky */ - gluTessCallback(tobj, GLU_END, glEnd); - } - glNewList(side, GL_COMPILE); - glShadeModel(GL_SMOOTH); /* smooth minimizes seeing - tessellation */ - gluBeginPolygon(tobj); - for (i = 0; i < count; i++) { - vertex[0] = data[i][0]; - vertex[1] = data[i][1]; - vertex[2] = 0; - gluTessVertex(tobj, vertex, data[i]); - } - gluEndPolygon(tobj); - glEndList(); - glNewList(edge, GL_COMPILE); - glShadeModel(GL_FLAT); /* flat shade keeps angular hands - from being "smoothed" */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= count; i++) { -#if 1 /* weird, but seems to be legal */ - /* mod function handles closing the edge */ - glVertex3f(data[i % count][0], data[i % count][1], 0.0); - glVertex3f(data[i % count][0], data[i % count][1], thickness); - /* Calculate a unit normal by dividing by Euclidean - distance. We * could be lazy and use - glEnable(GL_NORMALIZE) so we could pass in * arbitrary - normals for a very slight performance hit. */ - dx = data[(i + 1) % count][1] - data[i % count][1]; - dy = data[i % count][0] - data[(i + 1) % count][0]; - len = sqrt(dx * dx + dy * dy); - glNormal3f(dx / len, dy / len, 0.0); -#else /* the nice way of doing it */ - /* Calculate a unit normal by dividing by Euclidean - distance. We * could be lazy and use - glEnable(GL_NORMALIZE) so we could pass in * arbitrary - normals for a very slight performance hit. */ - dx = data[i % count][1] - data[(i - 1 + count) % count][1]; - dy = data[(i - 1 + count) % count][0] - data[i % count][0]; - len = sqrt(dx * dx + dy * dy); - glNormal3f(dx / len, dy / len, 0.0); - /* mod function handles closing the edge */ - glVertex3f(data[i % count][0], data[i % count][1], 0.0); - glVertex3f(data[i % count][0], data[i % count][1], thickness); -#endif - } - glEnd(); - glEndList(); - glNewList(whole, GL_COMPILE); - glFrontFace(GL_CW); - glCallList(edge); - glNormal3f(0.0, 0.0, -1.0); /* constant normal for side */ - glCallList(side); - glPushMatrix(); - glTranslatef(0.0, 0.0, thickness); - glFrontFace(GL_CCW); - glNormal3f(0.0, 0.0, 1.0); /* opposite normal for other side */ - glCallList(side); - glPopMatrix(); - glEndList(); -} - -/* Enumerants for refering to display lists. */ -typedef enum { - RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE, - LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE -} displayLists; - -static void -makeDinosaur(void) -{ - extrudeSolidFromPolygon(body, sizeof(body), bodyWidth, - BODY_SIDE, BODY_EDGE, BODY_WHOLE); - extrudeSolidFromPolygon(arm, sizeof(arm), bodyWidth / 4, - ARM_SIDE, ARM_EDGE, ARM_WHOLE); - extrudeSolidFromPolygon(leg, sizeof(leg), bodyWidth / 2, - LEG_SIDE, LEG_EDGE, LEG_WHOLE); - extrudeSolidFromPolygon(eye, sizeof(eye), bodyWidth + 0.2, - EYE_SIDE, EYE_EDGE, EYE_WHOLE); -} - -static void -drawDinosaur(void) - -{ - glPushMatrix(); - /* Translate the dinosaur to be at (0,8,0). */ - glTranslatef(-8, 0, -bodyWidth / 2); - glTranslatef(0.0, jump, 0.0); - glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor); - glCallList(BODY_WHOLE); - glTranslatef(0.0, 0.0, bodyWidth); - glCallList(ARM_WHOLE); - glCallList(LEG_WHOLE); - glTranslatef(0.0, 0.0, -bodyWidth - bodyWidth / 4); - glCallList(ARM_WHOLE); - glTranslatef(0.0, 0.0, -bodyWidth / 4); - glCallList(LEG_WHOLE); - glTranslatef(0.0, 0.0, bodyWidth / 2 - 0.1); - glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor); - glCallList(EYE_WHOLE); - glPopMatrix(); -} - -static GLfloat floorVertices[4][3] = { - { -20.0, 0.0, 20.0 }, - { 20.0, 0.0, 20.0 }, - { 20.0, 0.0, -20.0 }, - { -20.0, 0.0, -20.0 }, -}; - -/* Draw a floor (possibly textured). */ -static void -drawFloor(void) -{ - glDisable(GL_LIGHTING); - - if (useTexture) { - glEnable(GL_TEXTURE_2D); - } - - glBegin(GL_QUADS); - glTexCoord2f(0.0, 0.0); - glVertex3fv(floorVertices[0]); - glTexCoord2f(0.0, 16.0); - glVertex3fv(floorVertices[1]); - glTexCoord2f(16.0, 16.0); - glVertex3fv(floorVertices[2]); - glTexCoord2f(16.0, 0.0); - glVertex3fv(floorVertices[3]); - glEnd(); - - if (useTexture) { - glDisable(GL_TEXTURE_2D); - } - - glEnable(GL_LIGHTING); -} - -static GLfloat floorPlane[4]; -static GLfloat floorShadow[4][4]; - -static void -redraw(void) -{ - int start, end; - - if (reportSpeed) { - start = glutGet(GLUT_ELAPSED_TIME); - } - - /* Clear; default stencil clears to zero. */ - if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow)) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - } else { - /* Avoid clearing stencil when not using it. */ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - - /* Reposition the light source. */ - lightPosition[0] = 12*cos(lightAngle); - lightPosition[1] = lightHeight; - lightPosition[2] = 12*sin(lightAngle); - if (directionalLight) { - lightPosition[3] = 0.0; - } else { - lightPosition[3] = 1.0; - } - - shadowMatrix(floorShadow, floorPlane, lightPosition); - - glPushMatrix(); - /* Perform scene rotations based on user mouse input. */ - glRotatef(angle2, 1.0, 0.0, 0.0); - glRotatef(angle, 0.0, 1.0, 0.0); - - /* Tell GL new light source position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - if (renderReflection) { - if (stencilReflection) { - /* We can eliminate the visual "artifact" of seeing the "flipped" - dinosaur underneath the floor by using stencil. The idea is - draw the floor without color or depth update but so that - a stencil value of one is where the floor will be. Later when - rendering the dinosaur reflection, we will only update pixels - with a stencil value of 1 to make sure the reflection only - lives on the floor, not below the floor. */ - - /* Don't update color or depth. */ - glDisable(GL_DEPTH_TEST); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - /* Draw 1 into the stencil buffer. */ - glEnable(GL_STENCIL_TEST); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glStencilFunc(GL_ALWAYS, 1, 0xffffffff); - - /* Now render floor; floor pixels just get their stencil set to 1. */ - drawFloor(); - - /* Re-enable update of color and depth. */ - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glEnable(GL_DEPTH_TEST); - - /* Now, only render where stencil is set to 1. */ - glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */ - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - } - - glPushMatrix(); - - /* The critical reflection step: Reflect dinosaur through the floor - (the Y=0 plane) to make a relection. */ - glScalef(1.0, -1.0, 1.0); - - /* Reflect the light position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - /* To avoid our normals getting reversed and hence botched lighting - on the reflection, turn on normalize. */ - glEnable(GL_NORMALIZE); - glCullFace(GL_FRONT); - - /* Draw the reflected dinosaur. */ - drawDinosaur(); - - /* Disable noramlize again and re-enable back face culling. */ - glDisable(GL_NORMALIZE); - glCullFace(GL_BACK); - - glPopMatrix(); - - /* Switch back to the unreflected light position. */ - glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); - - if (stencilReflection) { - glDisable(GL_STENCIL_TEST); - } - } - - /* Back face culling will get used to only draw either the top or the - bottom floor. This let's us get a floor with two distinct - appearances. The top floor surface is reflective and kind of red. - The bottom floor surface is not reflective and blue. */ - - /* Draw "bottom" of floor in blue. */ - glFrontFace(GL_CW); /* Switch face orientation. */ - glColor4f(0.1, 0.1, 0.7, 1.0); - drawFloor(); - glFrontFace(GL_CCW); - - if (renderShadow) { - if (stencilShadow) { - /* Draw the floor with stencil value 3. This helps us only - draw the shadow once per floor pixel (and only on the - floor pixels). */ - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 3, 0xffffffff); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - } - } - - /* Draw "top" of floor. Use blending to blend in reflection. */ - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(0.7, 0.0, 0.0, 0.3); - glColor4f(1.0, 1.0, 1.0, 0.3); - drawFloor(); - glDisable(GL_BLEND); - - if (renderDinosaur) { - /* Draw "actual" dinosaur, not its reflection. */ - drawDinosaur(); - } - - if (renderShadow) { - - /* Render the projected shadow. */ - - if (stencilShadow) { - - /* Now, only render where stencil is set above 2 (ie, 3 where - the top floor is). Update stencil with 2 where the shadow - gets drawn so we don't redraw (and accidently reblend) the - shadow). */ - glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */ - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - } - - /* To eliminate depth buffer artifacts, we use polygon offset - to raise the depth of the projected shadow slightly so - that it does not depth buffer alias with the floor. */ - if (offsetShadow) { - switch (polygonOffsetVersion) { - case EXTENSION: -#ifdef GL_EXT_polygon_offset - glEnable(GL_POLYGON_OFFSET_EXT); - break; -#endif -#ifdef GL_VERSION_1_1 - case ONE_DOT_ONE: - glEnable(GL_POLYGON_OFFSET_FILL); - break; -#endif - case MISSING: - /* Oh well. */ - break; - } - } - - /* Render 50% black shadow color on top of whatever the - floor appareance is. */ - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_LIGHTING); /* Force the 50% black. */ - glColor4f(0.0, 0.0, 0.0, 0.5); - - glPushMatrix(); - /* Project the shadow. */ - glMultMatrixf((GLfloat *) floorShadow); - drawDinosaur(); - glPopMatrix(); - - glDisable(GL_BLEND); - glEnable(GL_LIGHTING); - - if (offsetShadow) { - switch (polygonOffsetVersion) { -#ifdef GL_EXT_polygon_offset - case EXTENSION: - glDisable(GL_POLYGON_OFFSET_EXT); - break; -#endif -#ifdef GL_VERSION_1_1 - case ONE_DOT_ONE: - glDisable(GL_POLYGON_OFFSET_FILL); - break; -#endif - case MISSING: - /* Oh well. */ - break; - } - } - if (stencilShadow) { - glDisable(GL_STENCIL_TEST); - } - } - - glPushMatrix(); - glDisable(GL_LIGHTING); - glColor3f(1.0, 1.0, 0.0); - if (directionalLight) { - /* Draw an arrowhead. */ - glDisable(GL_CULL_FACE); - glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); - glRotatef(lightAngle * -180.0 / M_PI, 0, 1, 0); - glRotatef(atan(lightHeight/12) * 180.0 / M_PI, 0, 0, 1); - glBegin(GL_TRIANGLE_FAN); - glVertex3f(0, 0, 0); - glVertex3f(2, 1, 1); - glVertex3f(2, -1, 1); - glVertex3f(2, -1, -1); - glVertex3f(2, 1, -1); - glVertex3f(2, 1, 1); - glEnd(); - /* Draw a white line from light direction. */ - glColor3f(1.0, 1.0, 1.0); - glBegin(GL_LINES); - glVertex3f(0, 0, 0); - glVertex3f(5, 0, 0); - glEnd(); - glEnable(GL_CULL_FACE); - } else { - /* Draw a yellow ball at the light source. */ - glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]); - glutSolidSphere(1.0, 5, 5); - } - glEnable(GL_LIGHTING); - glPopMatrix(); - - glPopMatrix(); - - if (reportSpeed) { - glFinish(); - end = glutGet(GLUT_ELAPSED_TIME); - printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start); - } - - glutSwapBuffers(); -} - -/* ARGSUSED2 */ -static void -mouse(int button, int state, int x, int y) -{ - if (button == GLUT_LEFT_BUTTON) { - if (state == GLUT_DOWN) { - moving = 1; - startx = x; - starty = y; - } - if (state == GLUT_UP) { - moving = 0; - } - } - if (button == GLUT_MIDDLE_BUTTON) { - if (state == GLUT_DOWN) { - lightMoving = 1; - lightStartX = x; - lightStartY = y; - } - if (state == GLUT_UP) { - lightMoving = 0; - } - } -} - -/* ARGSUSED1 */ -static void -motion(int x, int y) -{ - if (moving) { - angle = angle + (x - startx); - angle2 = angle2 + (y - starty); - startx = x; - starty = y; - glutPostRedisplay(); - } - if (lightMoving) { - lightAngle += (x - lightStartX)/40.0; - lightHeight += (lightStartY - y)/20.0; - lightStartX = x; - lightStartY = y; - glutPostRedisplay(); - } -} - -/* Advance time varying state when idle callback registered. */ -static void -idle(void) -{ - static float time = 0.0; - - time = glutGet(GLUT_ELAPSED_TIME) / 500.0; - - jump = 4.0 * fabs(sin(time)*0.5); - if (!lightMoving) { - lightAngle += 0.03; - } - glutPostRedisplay(); -} - -enum { - M_NONE, M_MOTION, M_LIGHT, M_TEXTURE, M_SHADOWS, M_REFLECTION, M_DINOSAUR, - M_STENCIL_REFLECTION, M_STENCIL_SHADOW, M_OFFSET_SHADOW, - M_POSITIONAL, M_DIRECTIONAL, M_PERFORMANCE -}; - -static void -controlLights(int value) -{ - switch (value) { - case M_NONE: - return; - case M_MOTION: - animation = 1 - animation; - if (animation) { - glutIdleFunc(idle); - } else { - glutIdleFunc(NULL); - } - break; - case M_LIGHT: - lightSwitch = !lightSwitch; - if (lightSwitch) { - glEnable(GL_LIGHT0); - } else { - glDisable(GL_LIGHT0); - } - break; - case M_TEXTURE: - useTexture = !useTexture; - break; - case M_SHADOWS: - renderShadow = 1 - renderShadow; - break; - case M_REFLECTION: - renderReflection = 1 - renderReflection; - break; - case M_DINOSAUR: - renderDinosaur = 1 - renderDinosaur; - break; - case M_STENCIL_REFLECTION: - stencilReflection = 1 - stencilReflection; - break; - case M_STENCIL_SHADOW: - stencilShadow = 1 - stencilShadow; - break; - case M_OFFSET_SHADOW: - offsetShadow = 1 - offsetShadow; - break; - case M_POSITIONAL: - directionalLight = 0; - break; - case M_DIRECTIONAL: - directionalLight = 1; - break; - case M_PERFORMANCE: - reportSpeed = 1 - reportSpeed; - break; - } - glutPostRedisplay(); -} - -/* When not visible, stop animating. Restart when visible again. */ -static void -visible(int vis) -{ - if (vis == GLUT_VISIBLE) { - if (animation) - glutIdleFunc(idle); - } else { - if (!animation) - glutIdleFunc(NULL); - } -} - -/* Press any key to redraw; good when motion stopped and - performance reporting on. */ -/* ARGSUSED */ -static void -key(unsigned char c, int x, int y) -{ - if (c == 27) { - exit(0); /* IRIS GLism, Escape quits. */ - } - glutPostRedisplay(); -} - -/* Press any key to redraw; good when motion stopped and - performance reporting on. */ -/* ARGSUSED */ -static void -special(int k, int x, int y) -{ - glutPostRedisplay(); -} - -static int -supportsOneDotOne(void) -{ - const char *version; - int major, minor; - - version = (char *) glGetString(GL_VERSION); - if (sscanf(version, "%d.%d", &major, &minor) == 2) - return major * 10 + minor >= 11; - return 0; /* OpenGL version string malformed! */ -} - -int -main(int argc, char **argv) -{ - int i; - - glutInit(&argc, argv); - - for (i=1; i=2 rgb double depth"); -#endif - - glutCreateWindow("Shadowy Leapin' Lizards"); - glewInit(); - - if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) { - printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n"); - exit(1); - } - - /* Register GLUT callbacks. */ - glutDisplayFunc(redraw); - glutMouseFunc(mouse); - glutMotionFunc(motion); - glutVisibilityFunc(visible); - glutKeyboardFunc(key); - glutSpecialFunc(special); - - glutCreateMenu(controlLights); - - glutAddMenuEntry("Toggle motion", M_MOTION); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle light", M_LIGHT); - glutAddMenuEntry("Toggle texture", M_TEXTURE); - glutAddMenuEntry("Toggle shadows", M_SHADOWS); - glutAddMenuEntry("Toggle reflection", M_REFLECTION); - glutAddMenuEntry("Toggle dinosaur", M_DINOSAUR); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle reflection stenciling", M_STENCIL_REFLECTION); - glutAddMenuEntry("Toggle shadow stenciling", M_STENCIL_SHADOW); - glutAddMenuEntry("Toggle shadow offset", M_OFFSET_SHADOW); - glutAddMenuEntry("----------------------", M_NONE); - glutAddMenuEntry("Positional light", M_POSITIONAL); - glutAddMenuEntry("Directional light", M_DIRECTIONAL); - glutAddMenuEntry("-----------------------", M_NONE); - glutAddMenuEntry("Toggle performance", M_PERFORMANCE); - glutAttachMenu(GLUT_RIGHT_BUTTON); - makeDinosaur(); - -#ifdef GL_VERSION_1_1 - if (supportsOneDotOne() && !forceExtension) { - polygonOffsetVersion = ONE_DOT_ONE; - glPolygonOffset(-2.0, -9.0); - } else -#endif - { -#ifdef GL_EXT_polygon_offset - /* check for the polygon offset extension */ - if (glutExtensionSupported("GL_EXT_polygon_offset")) { - polygonOffsetVersion = EXTENSION; - glPolygonOffsetEXT(-2.0, -0.002); - } else -#endif - { - polygonOffsetVersion = MISSING; - printf("\ndinoshine: Missing polygon offset.\n"); - printf(" Expect shadow depth aliasing artifacts.\n\n"); - } - } - - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - glEnable(GL_TEXTURE_2D); - glLineWidth(3.0); - - glMatrixMode(GL_PROJECTION); - gluPerspective( /* field of view in degree */ 40.0, - /* aspect ratio */ 1.0, - /* Z near */ 20.0, /* Z far */ 100.0); - glMatrixMode(GL_MODELVIEW); - gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */ - 0.0, 8.0, 0.0, /* center is at (0,8,0) */ - 0.0, 1.0, 0.); /* up is in postivie Y direction */ - - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); - glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor); - glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1); - glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHTING); - - makeFloorTexture(); - - /* Setup floor plane for projected shadow calculations. */ - findPlane(floorPlane, floorVertices[1], floorVertices[2], floorVertices[3]); - - glutMainLoop(); - return 0; /* ANSI C requires main to return int. */ -} -- cgit v1.2.3 From 30e80f6e559727dd157fbca4e7e537710e9ea199 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:10:51 -0600 Subject: demos: move demos/occlude.c (old HP extension) to tests --- progs/demos/occlude.c | 234 -------------------------------------------------- progs/tests/occlude.c | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+), 234 deletions(-) delete mode 100644 progs/demos/occlude.c create mode 100644 progs/tests/occlude.c diff --git a/progs/demos/occlude.c b/progs/demos/occlude.c deleted file mode 100644 index 8f7b90984e..0000000000 --- a/progs/demos/occlude.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * GL_HP_occlustion_test demo - * - * Brian Paul - * 31 March 2000 - * - * Copyright (C) 2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include -#include -#include -#include -#include -#include - - -static GLfloat Xpos = 0; -static GLboolean Anim = GL_TRUE; - - -static void -PrintString(const char *s) -{ - while (*s) { - glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); - s++; - } -} - - - -static void Idle(void) -{ - static int lastTime = 0; - static int sign = +1; - int time = glutGet(GLUT_ELAPSED_TIME); - float step; - - if (lastTime == 0) - lastTime = time; - else if (time - lastTime < 20) /* 50Hz update */ - return; - - step = (time - lastTime) / 1000.0 * sign; - lastTime = time; - - Xpos += step; - - if (Xpos > 2.5) { - Xpos = 2.5; - sign = -1; - } - else if (Xpos < -2.5) { - Xpos = -2.5; - sign = +1; - } - glutPostRedisplay(); -} - - -static void Display( void ) -{ - GLboolean result; - - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -15.0 ); - - /* draw the occluding polygons */ - glColor3f(0, 0.6, 0.8); - glBegin(GL_QUADS); - glVertex2f(-1.6, -1.5); - glVertex2f(-0.4, -1.5); - glVertex2f(-0.4, 1.5); - glVertex2f(-1.6, 1.5); - - glVertex2f( 0.4, -1.5); - glVertex2f( 1.6, -1.5); - glVertex2f( 1.6, 1.5); - glVertex2f( 0.4, 1.5); - glEnd(); - - /* draw the test polygon with occlusion testing */ - glPushMatrix(); - glTranslatef(Xpos, 0, -0.5); - glScalef(0.3, 0.3, 1.0); - glRotatef(-90.0 * Xpos, 0, 0, 1); - - glEnable(GL_OCCLUSION_TEST_HP); /* NOTE: enabling the occlusion test */ - /* doesn't clear the result flag! */ - glColorMask(0, 0, 0, 0); - glDepthMask(GL_FALSE); - /* this call clear's the result flag. Not really needed for this demo. */ - glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); - - glBegin(GL_POLYGON); - glVertex3f(-1, -1, 0); - glVertex3f( 1, -1, 0); - glVertex3f( 1, 1, 0); - glVertex3f(-1, 1, 0); - glEnd(); - - glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); - /* turn off occlusion testing */ - glDisable(GL_OCCLUSION_TEST_HP); - glColorMask(1, 1, 1, 1); - glDepthMask(GL_TRUE); - - /* draw the green rect, so we can see what's going on */ - glColor3f(0.8, 0.5, 0); - glBegin(GL_POLYGON); - glVertex3f(-1, -1, 0); - glVertex3f( 1, -1, 0); - glVertex3f( 1, 1, 0); - glVertex3f(-1, 1, 0); - glEnd(); - - glPopMatrix(); - - - /* Print result message */ - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - glColor3f(1, 1, 1); - glRasterPos3f(-0.25, -0.7, 0); - - if (result) - PrintString(" Visible"); - else - PrintString("Fully Occluded"); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc( Idle ); - else - glutIdleFunc( NULL ); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - const GLfloat step = 0.1; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_LEFT: - Xpos -= step; - break; - case GLUT_KEY_RIGHT: - Xpos += step; - break; - } - glutPostRedisplay(); -} - - -static void Init( void ) -{ - const char *ext = (const char *) glGetString(GL_EXTENSIONS); - if (!strstr(ext, "GL_HP_occlusion_test")) { - printf("Sorry, this demo requires the GL_HP_occlusion_test extension\n"); - exit(-1); - } - - glEnable(GL_DEPTH_TEST); -} - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 400, 400 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutIdleFunc( Idle ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/tests/occlude.c b/progs/tests/occlude.c new file mode 100644 index 0000000000..8f7b90984e --- /dev/null +++ b/progs/tests/occlude.c @@ -0,0 +1,234 @@ +/* + * GL_HP_occlustion_test demo + * + * Brian Paul + * 31 March 2000 + * + * Copyright (C) 2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include +#include +#include +#include +#include +#include + + +static GLfloat Xpos = 0; +static GLboolean Anim = GL_TRUE; + + +static void +PrintString(const char *s) +{ + while (*s) { + glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s); + s++; + } +} + + + +static void Idle(void) +{ + static int lastTime = 0; + static int sign = +1; + int time = glutGet(GLUT_ELAPSED_TIME); + float step; + + if (lastTime == 0) + lastTime = time; + else if (time - lastTime < 20) /* 50Hz update */ + return; + + step = (time - lastTime) / 1000.0 * sign; + lastTime = time; + + Xpos += step; + + if (Xpos > 2.5) { + Xpos = 2.5; + sign = -1; + } + else if (Xpos < -2.5) { + Xpos = -2.5; + sign = +1; + } + glutPostRedisplay(); +} + + +static void Display( void ) +{ + GLboolean result; + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -15.0 ); + + /* draw the occluding polygons */ + glColor3f(0, 0.6, 0.8); + glBegin(GL_QUADS); + glVertex2f(-1.6, -1.5); + glVertex2f(-0.4, -1.5); + glVertex2f(-0.4, 1.5); + glVertex2f(-1.6, 1.5); + + glVertex2f( 0.4, -1.5); + glVertex2f( 1.6, -1.5); + glVertex2f( 1.6, 1.5); + glVertex2f( 0.4, 1.5); + glEnd(); + + /* draw the test polygon with occlusion testing */ + glPushMatrix(); + glTranslatef(Xpos, 0, -0.5); + glScalef(0.3, 0.3, 1.0); + glRotatef(-90.0 * Xpos, 0, 0, 1); + + glEnable(GL_OCCLUSION_TEST_HP); /* NOTE: enabling the occlusion test */ + /* doesn't clear the result flag! */ + glColorMask(0, 0, 0, 0); + glDepthMask(GL_FALSE); + /* this call clear's the result flag. Not really needed for this demo. */ + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); + + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result); + /* turn off occlusion testing */ + glDisable(GL_OCCLUSION_TEST_HP); + glColorMask(1, 1, 1, 1); + glDepthMask(GL_TRUE); + + /* draw the green rect, so we can see what's going on */ + glColor3f(0.8, 0.5, 0); + glBegin(GL_POLYGON); + glVertex3f(-1, -1, 0); + glVertex3f( 1, -1, 0); + glVertex3f( 1, 1, 0); + glVertex3f(-1, 1, 0); + glEnd(); + + glPopMatrix(); + + + /* Print result message */ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glColor3f(1, 1, 1); + glRasterPos3f(-0.25, -0.7, 0); + + if (result) + PrintString(" Visible"); + else + PrintString("Fully Occluded"); + + glutSwapBuffers(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc( Idle ); + else + glutIdleFunc( NULL ); + break; + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void SpecialKey( int key, int x, int y ) +{ + const GLfloat step = 0.1; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_LEFT: + Xpos -= step; + break; + case GLUT_KEY_RIGHT: + Xpos += step; + break; + } + glutPostRedisplay(); +} + + +static void Init( void ) +{ + const char *ext = (const char *) glGetString(GL_EXTENSIONS); + if (!strstr(ext, "GL_HP_occlusion_test")) { + printf("Sorry, this demo requires the GL_HP_occlusion_test extension\n"); + exit(-1); + } + + glEnable(GL_DEPTH_TEST); +} + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 400, 400 ); + glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutSpecialFunc( SpecialKey ); + glutIdleFunc( Idle ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From d61070b65970c9ec14b3272a6c4c6b4b1a9280a2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:12:50 -0600 Subject: demos: move demos/texobj.c to tests/ --- progs/demos/Makefile | 1 - progs/demos/texobj.c | 284 --------------------------------------------------- progs/tests/Makefile | 1 + progs/tests/texobj.c | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 285 insertions(+), 285 deletions(-) delete mode 100644 progs/demos/texobj.c create mode 100644 progs/tests/texobj.c diff --git a/progs/demos/Makefile b/progs/demos/Makefile index 8febc14d41..c17595ec79 100644 --- a/progs/demos/Makefile +++ b/progs/demos/Makefile @@ -58,7 +58,6 @@ PROGS = \ tessdemo \ texcyl \ texenv \ - texobj \ textures \ trispd \ tunnel \ diff --git a/progs/demos/texobj.c b/progs/demos/texobj.c deleted file mode 100644 index 40bce6e569..0000000000 --- a/progs/demos/texobj.c +++ /dev/null @@ -1,284 +0,0 @@ - -/* - * Example of using the 1.1 texture object functions. - * Also, this demo utilizes Mesa's fast texture map path. - * - * Brian Paul June 1996 This file is in the public domain. - */ - -#include -#include -#include -#include -#include -#include "GL/glut.h" - -static GLuint Window = 0; - -static GLuint TexObj[2]; -static GLfloat Angle = 0.0f; -static GLboolean UseObj = GL_FALSE; - - -#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2) -# define TEXTURE_OBJECT 1 -#elif defined(GL_EXT_texture_object) -# define TEXTURE_OBJECT 1 -# define glBindTexture(A,B) glBindTextureEXT(A,B) -# define glGenTextures(A,B) glGenTexturesEXT(A,B) -# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B) -#endif - - - - -static void draw( void ) -{ - glClear( GL_COLOR_BUFFER_BIT ); - - glColor3f( 1.0, 1.0, 1.0 ); - - /* draw first polygon */ - glPushMatrix(); - glTranslatef( -1.0, 0.0, 0.0 ); - glRotatef( Angle, 0.0, 0.0, 1.0 ); - if (UseObj) { -#ifdef TEXTURE_OBJECT - glBindTexture( GL_TEXTURE_2D, TexObj[0] ); -#endif - } - else { - glCallList( TexObj[0] ); - } - glBegin( GL_POLYGON ); - glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); - glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); - glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); - glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); - glEnd(); - glPopMatrix(); - - /* draw second polygon */ - glPushMatrix(); - glTranslatef( 1.0, 0.0, 0.0 ); - glRotatef( Angle-90.0, 0.0, 1.0, 0.0 ); - if (UseObj) { -#ifdef TEXTURE_OBJECT - glBindTexture( GL_TEXTURE_2D, TexObj[1] ); -#endif - } - else { - glCallList( TexObj[1] ); - } - glBegin( GL_POLYGON ); - glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); - glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); - glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); - glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); - glEnd(); - glPopMatrix(); - - glutSwapBuffers(); -} - - - -static void idle( void ) -{ - static double t0 = -1.; - double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; - if (t0 < 0.0) - t0 = t; - dt = t - t0; - t0 = t; - Angle += 120.0*dt; - glutPostRedisplay(); -} - - - -/* change view Angle, exit upon ESC */ -static void key(unsigned char k, int x, int y) -{ - (void) x; - (void) y; - switch (k) { - case 27: -#ifdef TEXTURE_OBJECT - glDeleteTextures( 2, TexObj ); -#endif - glutDestroyWindow(Window); - exit(0); - } -} - - - -/* new window size or exposure */ -static void reshape( int width, int height ) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ - glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -8.0 ); -} - - -static void init( void ) -{ - static int width=8, height=8; - static GLubyte tex1[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - - static GLubyte tex2[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 2, 0, 0, 0, - 0, 0, 2, 0, 0, 2, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 2, 2, 2, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 }; - - GLubyte tex[64][3]; - GLint i, j; - - - glDisable( GL_DITHER ); - - /* Setup texturing */ - glEnable( GL_TEXTURE_2D ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); - glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); - - - /* generate texture object IDs */ - if (UseObj) { -#ifdef TEXTURE_OBJECT - glGenTextures( 2, TexObj ); -#endif - } - else { - TexObj[0] = glGenLists(2); - TexObj[1] = TexObj[0]+1; - } - - /* setup first texture object */ - if (UseObj) { -#ifdef TEXTURE_OBJECT - glBindTexture( GL_TEXTURE_2D, TexObj[0] ); - assert(glIsTexture(TexObj[0])); -#endif - } - else { - glNewList( TexObj[0], GL_COMPILE ); - } - /* red on white */ - for (i=0;i +#include +#include +#include +#include +#include "GL/glut.h" + +static GLuint Window = 0; + +static GLuint TexObj[2]; +static GLfloat Angle = 0.0f; +static GLboolean UseObj = GL_FALSE; + + +#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2) +# define TEXTURE_OBJECT 1 +#elif defined(GL_EXT_texture_object) +# define TEXTURE_OBJECT 1 +# define glBindTexture(A,B) glBindTextureEXT(A,B) +# define glGenTextures(A,B) glGenTexturesEXT(A,B) +# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B) +#endif + + + + +static void draw( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glColor3f( 1.0, 1.0, 1.0 ); + + /* draw first polygon */ + glPushMatrix(); + glTranslatef( -1.0, 0.0, 0.0 ); + glRotatef( Angle, 0.0, 0.0, 1.0 ); + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[0] ); +#endif + } + else { + glCallList( TexObj[0] ); + } + glBegin( GL_POLYGON ); + glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); + glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); + glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); + glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); + glEnd(); + glPopMatrix(); + + /* draw second polygon */ + glPushMatrix(); + glTranslatef( 1.0, 0.0, 0.0 ); + glRotatef( Angle-90.0, 0.0, 1.0, 0.0 ); + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[1] ); +#endif + } + else { + glCallList( TexObj[1] ); + } + glBegin( GL_POLYGON ); + glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 ); + glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 ); + glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 ); + glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 ); + glEnd(); + glPopMatrix(); + + glutSwapBuffers(); +} + + + +static void idle( void ) +{ + static double t0 = -1.; + double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; + if (t0 < 0.0) + t0 = t; + dt = t - t0; + t0 = t; + Angle += 120.0*dt; + glutPostRedisplay(); +} + + + +/* change view Angle, exit upon ESC */ +static void key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { + case 27: +#ifdef TEXTURE_OBJECT + glDeleteTextures( 2, TexObj ); +#endif + glutDestroyWindow(Window); + exit(0); + } +} + + + +/* new window size or exposure */ +static void reshape( int width, int height ) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/ + glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 ); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef( 0.0, 0.0, -8.0 ); +} + + +static void init( void ) +{ + static int width=8, height=8; + static GLubyte tex1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + static GLubyte tex2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 2, 0, 0, 0, + 0, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + GLubyte tex[64][3]; + GLint i, j; + + + glDisable( GL_DITHER ); + + /* Setup texturing */ + glEnable( GL_TEXTURE_2D ); + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); + + + /* generate texture object IDs */ + if (UseObj) { +#ifdef TEXTURE_OBJECT + glGenTextures( 2, TexObj ); +#endif + } + else { + TexObj[0] = glGenLists(2); + TexObj[1] = TexObj[0]+1; + } + + /* setup first texture object */ + if (UseObj) { +#ifdef TEXTURE_OBJECT + glBindTexture( GL_TEXTURE_2D, TexObj[0] ); + assert(glIsTexture(TexObj[0])); +#endif + } + else { + glNewList( TexObj[0], GL_COMPILE ); + } + /* red on white */ + for (i=0;i Date: Sat, 18 Apr 2009 13:16:35 -0600 Subject: docs: removed/added demo programs --- docs/relnotes-7.5.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index c75720b699..bfeea3f433 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -72,6 +72,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
    • Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture extensions. Superseded by the ARB versions. +
    • Omittd some old Mesa demos from the release tarballs, added some others.
    -- cgit v1.2.3 From 3595732f28b0b8fdca1724305f8e6f3377f1e7fe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 13:18:44 -0600 Subject: demos: updated .gitignore list --- progs/demos/.gitignore | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/progs/demos/.gitignore b/progs/demos/.gitignore index d59d175212..c6ff227391 100644 --- a/progs/demos/.gitignore +++ b/progs/demos/.gitignore @@ -5,10 +5,12 @@ bounce clearspd copypix cubemap +dinoshade drawpix engine extfuncs.h fbo_firecube +fbotexture fire fogcoord fplight @@ -19,7 +21,6 @@ gears geartrain glinfo gloss -glslnoise gltestperf glutfx ipers @@ -27,11 +28,9 @@ isosurf lodbias morph3d multiarb -occlude -osdemo paltex -pixeltex pointblast +projtex rain ray readpix @@ -46,14 +45,12 @@ singlebuffer spectex spriteblast stex3d -streaming_rect teapot terrain tessdemo texcyl texdown texenv -texobj textures trackball.c trackball.h -- cgit v1.2.3 From c0565e86b4d4375ed52b20d9464daace616b50a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 18 Apr 2009 14:18:59 -0600 Subject: demos: added glsl/texaaline.c program and overhaul the Makefile --- progs/glsl/Makefile | 278 +++++++++++++++++-------------------- progs/glsl/texaaline.c | 369 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 499 insertions(+), 148 deletions(-) create mode 100644 progs/glsl/texaaline.c diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 8e61ab690b..71db895d1d 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -5,48 +5,69 @@ include $(TOP)/configs/current INCDIR = $(TOP)/include -LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) +LIB_DEP = \ + $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) \ + $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ + $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) -PROGS = \ - array \ - bitmap \ - brick \ - bump \ - convolutions \ - deriv \ - identity \ - fragcoord \ - linktest \ - mandelbrot \ - multinoise \ - multitex \ - noise \ - noise2 \ - points \ - pointcoord \ - samplers \ - samplers_array \ - shadow_sampler \ - skinning \ - texdemo1 \ - toyball \ - twoside \ - trirast \ - vert-or-frag-only \ - vert-tex +INCLUDE_DIRS = -I$(TOP)/progs/util + +DEMO_SOURCES = \ + array.c \ + bitmap.c \ + brick.c \ + bump.c \ + convolutions.c \ + deriv.c \ + fragcoord.c \ + identity.c \ + linktest.c \ + mandelbrot.c \ + multinoise.c \ + multitex.c \ + noise.c \ + noise2.c \ + pointcoord.c \ + points.c \ + samplers.c \ + shadow_sampler.c \ + skinning.c \ + texaaline.c \ + texdemo1.c \ + toyball.c \ + trirast.c \ + twoside.c \ + vert-or-frag-only.c \ + vert-tex.c + +UTIL_HEADERS = \ + extfuncs.h \ + shaderutil.h \ + readtex.h + +UTIL_SOURCES = \ + shaderutil.c \ + readtex.c + +UTIL_OBJS = $(UTIL_SOURCES:.c=.o) + + +PROGS = $(DEMO_SOURCES:%.c=%) + ##### RULES ##### -.SUFFIXES: -.SUFFIXES: .c +# make .o file from .c file: +.c.o: + $(APP_CC) -c -I$(INCDIR) $(CFLAGS) $< -o $@ -# make executable from .c file: -.c: $(LIB_DEP) - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ +# make executable from .o files +.o: + $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(UTIL_OBJS) $(LIBS) -o $@ ##### TARGETS ##### @@ -54,202 +75,163 @@ PROGS = \ default: $(PROGS) +clean: + -rm -f $(PROGS) + -rm -f *.o *~ + -rm -f extfuncs.h + -rm -f shaderutil.* + + ##### Extra dependencies -extfuncs.h: $(TOP)/progs/util/extfuncs.h - cp $< . +extfuncs.h: + cp $(TOP)/progs/util/extfuncs.h . +readtex.c: + cp $(TOP)/progs/util/readtex.c . -readtex.c: $(TOP)/progs/util/readtex.c - cp $< . +readtex.h: + cp $(TOP)/progs/util/readtex.h . -readtex.h: $(TOP)/progs/util/readtex.h - cp $< . +shaderutil.c: + cp $(TOP)/progs/util/shaderutil.c . -readtex.o: readtex.c readtex.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) readtex.c +shaderutil.h: + cp $(TOP)/progs/util/shaderutil.h . -shaderutil.c: $(TOP)/progs/util/shaderutil.c - cp $< . -shaderutil.h: $(TOP)/progs/util/shaderutil.h - cp $< . +array.o: $(UTIL_HEADERS) -shaderutil.o: shaderutil.c shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c +array: array.o $(UTIL_OBJS) +bitmap.o: $(UTIL_HEADERS) -array.o: array.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) array.c +bitmap: bitmap.o $(UTIL_OBJS) -array: array.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) array.o shaderutil.o $(LIBS) -o $@ +brick.o: $(UTIL_HEADERS) -bitmap.o: bitmap.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c +brick: brick.o $(UTIL_OBJS) -bitmap: bitmap.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bitmap.o shaderutil.o $(LIBS) -o $@ +bump.o: $(UTIL_HEADERS) -brick.o: brick.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) brick.c +bump: bump.o $(UTIL_OBJS) -brick: brick.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) brick.o shaderutil.o $(LIBS) -o $@ +convolutions.o: $(UTIL_HEADERS) -bump.o: bump.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) bump.c +convolutions: convolutions.o $(UTIL_OBJS) -bump: bump.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bump.o shaderutil.o $(LIBS) -o $@ +deriv.o: deriv.c $(UTIL_HEADERS) -convolutions.o: convolutions.c readtex.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) convolutions.c +deriv: deriv.o $(UTIL_OBJS) -convolutions: convolutions.o readtex.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) convolutions.o readtex.o $(LIBS) -o $@ +identity.o: $(UTIL_HEADERS) -deriv.o: deriv.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) deriv.c +identity: identity.o $(UTIL_OBJS) -deriv: deriv.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) deriv.o shaderutil.o $(LIBS) -o $@ +fragcoord.o: $(UTIL_HEADERS) -identity.o: identity.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) identity.c +fragcoord: fragcoord.o $(UTIL_OBJS) -identity: identity.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) identity.o shaderutil.o $(LIBS) -o $@ +linktest.o: $(UTIL_HEADERS) -fragcoord.o: fragcoord.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) fragcoord.c +linktest: linktest.o $(UTIL_OBJS) -fragcoord: fragcoord.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) fragcoord.o shaderutil.o $(LIBS) -o $@ +mandelbrot.o: $(UTIL_HEADERS) -linktest.o: linktest.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) linktest.c +mandelbrot: mandelbrot.o $(UTIL_OBJS) -linktest: linktest.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) linktest.o shaderutil.o $(LIBS) -o $@ -mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c +multinoise.o: $(UTIL_HEADERS) -mandelbrot: mandelbrot.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@ +multinoise: multinoise.o $(UTIL_OBJS) -multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) multitex.c -multitex: multitex.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@ +multitex.o: $(UTIL_HEADERS) +multitex: multitex.o $(UTIL_OBJS) -noise.o: noise.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) noise.c -noise: noise.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@ +noise.o: $(UTIL_HEADERS) +noise: noise.o $(UTIL_OBJS) -noise2.o: noise2.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) noise2.c -noise2: noise2.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise2.o shaderutil.o $(LIBS) -o $@ +noise2.o: $(UTIL_HEADERS) +noise2: noise2.o $(UTIL_OBJS) -points.o: points.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) points.c -points: points.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) points.o shaderutil.o $(LIBS) -o $@ +points.o: $(UTIL_HEADERS) +points: points.o $(UTIL_OBJS) -pointcoord.o: pointcoord.c readtex.h extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) pointcoord.c -pointcoord: pointcoord.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) pointcoord.o readtex.o shaderutil.o $(LIBS) -o $@ +pointcoord.o: $(UTIL_HEADERS) +pointcoord: pointcoord.o $(UTIL_OBJS) -samplers.o: samplers.c readtex.h extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) samplers.c -samplers: samplers.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) samplers.o readtex.o shaderutil.o $(LIBS) -o $@ +samplers.o: $(UTIL_HEADERS) -samplers_array.o: samplers.c readtex.h extfuncs.h shaderutil.h - $(APP_CC) -c -DSAMPLERS_ARRAY -I$(INCDIR) $(CFLAGS) samplers.c -o samplers_array.o +samplers: samplers.o $(UTIL_OBJS) -samplers_array: samplers_array.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) samplers_array.o readtex.o shaderutil.o $(LIBS) -o $@ -skinning.o: skinning.c readtex.h extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) skinning.c +samplers_array.o: $(UTIL_HEADERS) -skinning: skinning.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) skinning.o readtex.o shaderutil.o $(LIBS) -o $@ +samplers_array: samplers_array.o $(UTIL_OBJS) -texdemo1.o: texdemo1.c readtex.h extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) texdemo1.c +shadow_sampler.o: $(UTIL_HEADERS) -texdemo1: texdemo1.o readtex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o shaderutil.o $(LIBS) -o $@ +shadow_sampler: shadow_sampler.o $(UTIL_OBJS) -toyball.o: toyball.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) toyball.c +skinning.o: $(UTIL_HEADERS) -toyball: toyball.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) toyball.o shaderutil.o $(LIBS) -o $@ +skinning: skinning.o $(UTIL_OBJS) -twoside.o: twoside.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) twoside.c +texaaline.o: $(UTIL_HEADERS) -twoside: twoside.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) twoside.o shaderutil.o $(LIBS) -o $@ +texaaline: texaaline.o $(UTIL_OBJS) -trirast.o: trirast.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) trirast.c +texdemo1.o: $(UTIL_HEADERS) -trirast: trirast.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) trirast.o shaderutil.o $(LIBS) -o $@ +texdemo1: texdemo1.o $(UTIL_OBJS) -vert-or-frag-only.o: vert-or-frag-only.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) vert-or-frag-only.c +toyball.o: $(UTIL_HEADERS) -vert-or-frag-only: vert-or-frag-only.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) vert-or-frag-only.o shaderutil.o $(LIBS) -o $@ +toyball: toyball.o $(UTIL_OBJS) -vert-tex.o: vert-tex.c extfuncs.h shaderutil.h - $(APP_CC) -c -I$(INCDIR) $(CFLAGS) vert-tex.c +twoside.o: $(UTIL_HEADERS) -vert-tex: vert-tex.o shaderutil.o - $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) vert-tex.o shaderutil.o $(LIBS) -o $@ +twoside: twoside.o $(UTIL_OBJS) +trirast.o: $(UTIL_HEADERS) +trirast: trirast.o $(UTIL_OBJS) -clean: - -rm -f $(PROGS) - -rm -f *.o *~ - -rm -f extfuncs.h - -rm -f shaderutil.* + +vert-or-frag-only.o: $(UTIL_HEADERS) + +vert-or-frag-only: vert-or-frag-only.o $(UTIL_OBJS) + + +vert-tex.o: $(UTIL_HEADERS) + +vert-tex: vert-tex.o $(UTIL_OBJS) diff --git a/progs/glsl/texaaline.c b/progs/glsl/texaaline.c new file mode 100644 index 0000000000..0b3cc84958 --- /dev/null +++ b/progs/glsl/texaaline.c @@ -0,0 +1,369 @@ +/** + * AA lines with texture mapped quads + * + * Brian Paul + * 9 Feb 2008 + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "extfuncs.h" + + +static GLint WinWidth = 300, WinHeight = 300; +static GLint win = 0; +static GLfloat Width = 8.; + +/* + * Quad strip for line from v0 to v1: + * + 1 3 5 7 + +---+---------------------+---+ + | | + | *v0 v1* | + | | + +---+---------------------+---+ + 0 2 4 6 + */ +static void +QuadLine(const GLfloat *v0, const GLfloat *v1, GLfloat width) +{ + GLfloat dx = v1[0] - v0[0]; + GLfloat dy = v1[1] - v0[1]; + GLfloat len = sqrt(dx*dx + dy*dy); + float dx0, dx1, dx2, dx3, dx4, dx5, dx6, dx7; + float dy0, dy1, dy2, dy3, dy4, dy5, dy6, dy7; + + dx /= len; + dy /= len; + + width *= 0.5; /* half width */ + dx = dx * (width + 0.0); + dy = dy * (width + 0.0); + + dx0 = -dx+dy; dy0 = -dy-dx; + dx1 = -dx-dy; dy1 = -dy+dx; + + dx2 = 0+dy; dy2 = -dx+0; + dx3 = 0-dy; dy3 = +dx+0; + + dx4 = 0+dy; dy4 = -dx+0; + dx5 = 0-dy; dy5 = +dx+0; + + dx6 = dx+dy; dy6 = dy-dx; + dx7 = dx-dy; dy7 = dy+dx; + + /* + printf("dx, dy = %g, %g\n", dx, dy); + printf(" dx0, dy0: %g, %g\n", dx0, dy0); + printf(" dx1, dy1: %g, %g\n", dx1, dy1); + printf(" dx2, dy2: %g, %g\n", dx2, dy2); + printf(" dx3, dy3: %g, %g\n", dx3, dy3); + */ + + glBegin(GL_QUAD_STRIP); + glTexCoord2f(0, 0); + glVertex2f(v0[0] + dx0, v0[1] + dy0); + glTexCoord2f(0, 1); + glVertex2f(v0[0] + dx1, v0[1] + dy1); + + glTexCoord2f(0.5, 0); + glVertex2f(v0[0] + dx2, v0[1] + dy2); + glTexCoord2f(0.5, 1); + glVertex2f(v0[0] + dx3, v0[1] + dy3); + + glTexCoord2f(0.5, 0); + glVertex2f(v1[0] + dx2, v1[1] + dy2); + glTexCoord2f(0.5, 1); + glVertex2f(v1[0] + dx3, v1[1] + dy3); + + glTexCoord2f(1, 0); + glVertex2f(v1[0] + dx6, v1[1] + dy6); + glTexCoord2f(1, 1); + glVertex2f(v1[0] + dx7, v1[1] + dy7); + glEnd(); +} + + +static float Cos(float a) +{ + return cos(a * M_PI / 180.); +} + +static float Sin(float a) +{ + return sin(a * M_PI / 180.); +} + +static void +Redisplay(void) +{ + int i; + + glClear(GL_COLOR_BUFFER_BIT); + + glColor3f(1, 1, 1); + + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + + for (i = 0; i < 360; i+=5) { + float v0[2], v1[2]; + v0[0] = 150 + 40 * Cos(i); + v0[1] = 150 + 40 * Sin(i); + v1[0] = 150 + 130 * Cos(i); + v1[1] = 150 + 130 * Sin(i); + QuadLine(v0, v1, Width); + } + + { + float v0[2], v1[2], x; + for (x = 0; x < 1.0; x += 0.2) { + v0[0] = 150 + x; + v0[1] = 150 + x * 40 - 20; + v1[0] = 150 + x + 5.0; + v1[1] = 150 + x * 40 - 20; + QuadLine(v0, v1, Width); + } + } + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, width, 0, height, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +static void +CleanUp(void) +{ + glutDestroyWindow(win); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + + switch(key) { + case 'w': + Width -= 0.5; + break; + case 'W': + Width += 0.5; + break; + case 27: + CleanUp(); + exit(0); + break; + } +#if 0 + if (Width < 3) + Width = 3; +#endif + printf("Width = %g\n", Width); + glutPostRedisplay(); +} + + +static float +ramp4(GLint i, GLint size) +{ + float d; + if (i < 4 ) { + d = i / 4.0; + } + else if (i >= size - 5) { + d = 1.0 - (i - (size - 5)) / 4.0; + } + else { + d = 1.0; + } + return d; +} + +static float +ramp2(GLint i, GLint size) +{ + float d; + if (i < 2 ) { + d = i / 2.0; + } + else if (i >= size - 3) { + d = 1.0 - (i - (size - 3)) / 2.0; + } + else { + d = 1.0; + } + return d; +} + +static float +ramp1(GLint i, GLint size) +{ + float d; + if (i == 0 || i == size-1) { + d = 0.0; + } + else { + d = 1.0; + } + return d; +} + + +/** + * Make an alpha texture for antialiasing lines. + * Just a linear fall-off ramp for now. + * Should have a number of different textures for different line widths. + * Could try a bell-like-curve.... + */ +static void +MakeTexture(void) +{ +#define SZ 8 + GLfloat tex[SZ][SZ]; /* alpha tex */ + int i, j; + for (i = 0; i < SZ; i++) { + for (j = 0; j < SZ; j++) { +#if 0 + float k = (SZ-1) / 2.0; + float dx = fabs(i - k) / k; + float dy = fabs(j - k) / k; + float d; + + dx = 1.0 - dx; + dy = 1.0 - dy; + d = dx * dy; + +#else + float d = ramp1(i, SZ) * ramp1(j, SZ); + printf("%d, %d: %g\n", i, j, d); +#endif + tex[i][j] = d; + } + } + + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, SZ, SZ, 0, GL_ALPHA, GL_FLOAT, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +#undef SZ +} + + +static void +MakeMipmap(void) +{ +#define SZ 64 + GLfloat tex[SZ][SZ]; /* alpha tex */ + int level; + + glPixelStorei(GL_UNPACK_ROW_LENGTH, SZ); + for (level = 0; level < 7; level++) { + int sz = 1 << (6 - level); + int i, j; + for (i = 0; i < sz; i++) { + for (j = 0; j < sz; j++) { + if (level == 6) + tex[i][j] = 1.0; + else if (level == 5) + tex[i][j] = 0.5; + else + tex[i][j] = ramp1(i, sz) * ramp1(j, sz); + } + } + + glTexImage2D(GL_TEXTURE_2D, level, GL_ALPHA, + sz, sz, 0, GL_ALPHA, GL_FLOAT, tex); + } + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4); + ////glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5); + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); +#undef SZ +} + + +static void +Init(void) +{ + const char *version; + + (void) MakeTexture; + (void) ramp4; + (void) ramp2; + + version = (const char *) glGetString(GL_VERSION); + if (version[0] != '2' || version[1] != '.') { + printf("This program requires OpenGL 2.x, found %s\n", version); + exit(1); + } + + GetExtensionFuncs(); + + glClearColor(0.3f, 0.3f, 0.3f, 0.0f); + + printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#if 0 + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +#elif 0 + MakeTexture(); +#else + MakeMipmap(); +#endif +} + + +static void +ParseOptions(int argc, char *argv[]) +{ +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition( 0, 0); + glutInitWindowSize(WinWidth, WinHeight); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Redisplay); + ParseOptions(argc, argv); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From eb63e8cc75f7ac0f4b8b89ceecc030b61789ea8c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 18 Apr 2009 21:22:32 +0100 Subject: softpipe: Remove softpipe_winsys. Not used by softpipe anyway. --- src/gallium/drivers/softpipe/sp_winsys.h | 12 --------- .../drm/radeon/core/radeon_winsys_softpipe.c | 31 +--------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index 4ab666486c..44720b7960 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -35,23 +35,11 @@ #define SP_WINSYS_H -#include "pipe/p_compiler.h" /* for boolean */ - - #ifdef __cplusplus extern "C" { #endif -enum pipe_format; - -struct softpipe_winsys { - /** test if the given format is supported for front/back color bufs */ - boolean (*is_format_supported)( struct softpipe_winsys *sws, - enum pipe_format format ); - -}; - struct pipe_screen; struct pipe_winsys; struct pipe_context; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c index 33f9ac15ab..3c0d6f11aa 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c @@ -31,42 +31,13 @@ #include "radeon_winsys_softpipe.h" -struct radeon_softpipe_winsys { - struct softpipe_winsys sp_winsys; - struct radeon_context *radeon_context; -}; - -/** - * Return list of surface formats supported by this driver. - */ -static boolean radeon_is_format_supported(struct softpipe_winsys *sws, - uint format) -{ - switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: - return TRUE; - default: - break; - } - return FALSE; -} - struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys) { - struct softpipe_winsys *sp_winsys; struct pipe_screen *pipe_screen; pipe_screen = softpipe_create_screen(winsys); - sp_winsys = CALLOC_STRUCT(softpipe_winsys); - if (sp_winsys == NULL) { - return NULL; - } - - sp_winsys->is_format_supported = radeon_is_format_supported; return softpipe_create(pipe_screen, winsys, - sp_winsys); + NULL); } -- cgit v1.2.3 From 876e95dcc83d05dfecb0dcb890f42af0a565e6a6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 18 Apr 2009 23:06:11 +0100 Subject: softpipe: Fix softpipe_is_texture_referenced prototype. --- src/gallium/drivers/softpipe/sp_context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 6ae4d1ad7b..2c6a0b53b0 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -124,8 +124,7 @@ static void softpipe_destroy( struct pipe_context *pipe ) static unsigned int softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, - unsigned face, unsigned level, - unsigned zslice) + unsigned face, unsigned level) { return PIPE_UNREFERENCED; } -- cgit v1.2.3 From dc1153ce83041a397b1d1815db4133ce8c53eaa1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 18 Apr 2009 23:14:42 +0100 Subject: softpipe: Simplify softpipe_create's prototype. --- src/gallium/drivers/softpipe/sp_context.c | 6 ++---- src/gallium/drivers/softpipe/sp_winsys.h | 4 +--- src/gallium/state_trackers/python/st_softpipe_winsys.c | 2 +- src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c | 4 +--- src/gallium/winsys/egl_xlib/egl_xlib.c | 2 +- src/gallium/winsys/g3dvl/xsp_winsys.c | 2 +- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 2 +- src/gallium/winsys/xlib/xlib_softpipe.c | 2 +- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 2c6a0b53b0..62e8d99cfd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -137,9 +137,7 @@ softpipe_is_buffer_referenced( struct pipe_context *pipe, } struct pipe_context * -softpipe_create( struct pipe_screen *screen, - struct pipe_winsys *pipe_winsys, - void *unused ) +softpipe_create( struct pipe_screen *screen ) { struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); uint i; @@ -154,7 +152,7 @@ softpipe_create( struct pipe_screen *screen, softpipe->dump_fs = debug_get_bool_option( "GALLIUM_DUMP_FS", FALSE ); - softpipe->pipe.winsys = pipe_winsys; + softpipe->pipe.winsys = screen->winsys; softpipe->pipe.screen = screen; softpipe->pipe.destroy = softpipe_destroy; diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index 44720b7960..cf91e7782b 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -45,9 +45,7 @@ struct pipe_winsys; struct pipe_context; -struct pipe_context *softpipe_create( struct pipe_screen *, - struct pipe_winsys *, - void *unused ); +struct pipe_context *softpipe_create( struct pipe_screen * ); struct pipe_screen * diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 41cdeaa6fd..f0a4826a00 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -260,7 +260,7 @@ st_softpipe_screen_create(void) static struct pipe_context * st_softpipe_context_create(struct pipe_screen *screen) { - return softpipe_create(screen, screen->winsys, NULL); + return softpipe_create(screen); } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c index 3c0d6f11aa..f038bfa40e 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c @@ -37,7 +37,5 @@ struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys) pipe_screen = softpipe_create_screen(winsys); - return softpipe_create(pipe_screen, - winsys, - NULL); + return softpipe_create(pipe_screen); } diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index 68fe64a52e..b52f427e4a 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -359,7 +359,7 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, /* fall-through */ case EGL_OPENGL_API: /* create a softpipe context */ - ctx->pipe = softpipe_create(xdrv->screen, xdrv->winsys, NULL); + ctx->pipe = softpipe_create(xdrv->screen); /* Now do xlib / state tracker inits here */ _eglConfigToContextModesRec(conf, &visual); ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx); diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c index 5b9fdb5c1f..698c2856a4 100644 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xsp_winsys.c @@ -261,7 +261,7 @@ struct pipe_context* create_pipe_context(Display *display, int screen) } sp_screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys); - sp_pipe = softpipe_create(sp_screen, (struct pipe_winsys*)xsp_winsys, NULL); + sp_pipe = softpipe_create(sp_screen); xsp_context = calloc(1, sizeof(struct xsp_context)); xsp_context->display = display; diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index df7e43d56b..33826524d7 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -263,7 +263,7 @@ gdi_softpipe_screen_create(void) static struct pipe_context * gdi_softpipe_context_create(struct pipe_screen *screen) { - return softpipe_create(screen, screen->winsys, NULL); + return softpipe_create(screen); } diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 762ebd9847..44b8464518 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -482,7 +482,7 @@ xlib_create_softpipe_context( struct pipe_screen *screen, { struct pipe_context *pipe; - pipe = softpipe_create(screen, screen->winsys, NULL); + pipe = softpipe_create(screen); if (pipe == NULL) goto fail; -- cgit v1.2.3 From 3230cb5f532c9df6a262b339d947bb71c71c510e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 19 Apr 2009 22:04:42 +1000 Subject: radeon: update clear state with latest intel code --- src/mesa/drivers/dri/radeon/radeon_common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 2449795ea9..dc281ee269 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1258,6 +1258,7 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | + GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT | GL_TRANSFORM_BIT | GL_CURRENT_BIT); @@ -1279,6 +1280,7 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) _mesa_Disable(GL_CLIP_PLANE3); _mesa_Disable(GL_CLIP_PLANE4); _mesa_Disable(GL_CLIP_PLANE5); + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) { saved_fp_enable = GL_TRUE; _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); @@ -1311,6 +1313,11 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) } } +#if FEATURE_ARB_vertex_buffer_object + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); +#endif + radeon_meta_set_passthrough_transform(rmesa); for (i = 0; i < 4; i++) { -- cgit v1.2.3 From 3fd0084154b377f4189bb8bc8eae21dbce735860 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 17 Apr 2009 23:42:37 +0200 Subject: r300: context creation cleanup - move constant values initialization to seperate function - remove obvious comments --- src/mesa/drivers/dri/r300/r300_context.c | 186 +++++++++++++------------------ 1 file changed, 76 insertions(+), 110 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 5f279d6629..f16e5486f6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -191,17 +191,6 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = { 0, }; -static void r300RunPipeline(GLcontext * ctx) -{ - _mesa_lock_context_textures(ctx); - - if (ctx->NewState) - _mesa_update_state_locked(ctx); - - _tnl_run_pipeline(ctx); - _mesa_unlock_context_textures(ctx); -} - static void r300_get_lock(radeonContextPtr rmesa) { drm_radeon_sarea_t *sarea = rmesa->sarea; @@ -211,7 +200,7 @@ static void r300_get_lock(radeonContextPtr rmesa) if (!rmesa->radeonScreen->kernel_mm) radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom); } -} +} static void r300_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa) { @@ -246,9 +235,9 @@ static void r300_vtbl_pre_emit_atoms(radeonContextPtr radeon) { r300ContextPtr r300 = (r300ContextPtr)radeon; BATCH_LOCALS(radeon); - + r300->vap_flush_needed = GL_TRUE; - + cp_wait(radeon, R300_WAIT_3D | R300_WAIT_3D_CLEAN); BEGIN_BATCH_NO_AUTOSTATE(2); OUT_BATCH_REGVAL(R300_TX_INVALTAGS, R300_TX_FLUSH); @@ -275,6 +264,60 @@ static void r300_init_vtbl(radeonContextPtr radeon) radeon->vtbl.fallback = r300_fallback; } +static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + + ctx->Const.MaxTextureImageUnits = + driQueryOptioni(&r300->radeon.optionCache, "texture_image_units"); + ctx->Const.MaxTextureCoordUnits = + driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units"); + ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits, + ctx->Const.MaxTextureCoordUnits); + ctx->Const.MaxTextureMaxAnisotropy = 16.0; + ctx->Const.MaxTextureLodBias = 16.0; + + if (screen->chip_family >= CHIP_FAMILY_RV515) + ctx->Const.MaxTextureLevels = 13; + else + ctx->Const.MaxTextureLevels = 12; + + ctx->Const.MinPointSize = 1.0; + ctx->Const.MinPointSizeAA = 1.0; + ctx->Const.MaxPointSize = R300_POINTSIZE_MAX; + ctx->Const.MaxPointSizeAA = R300_POINTSIZE_MAX; + + ctx->Const.MinLineWidth = 1.0; + ctx->Const.MinLineWidthAA = 1.0; + ctx->Const.MaxLineWidth = R300_LINESIZE_MAX; + ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX; + + ctx->Const.MaxDrawBuffers = 1; + + /* currently bogus data */ + if (screen->chip_flags & RADEON_CHIPSET_TCL) { + ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; + ctx->Const.VertexProgram.MaxNativeInstructions = + VSF_MAX_FRAGMENT_LENGTH / 4; + ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */ + ctx->Const.VertexProgram.MaxTemps = 32; + ctx->Const.VertexProgram.MaxNativeTemps = + /*VSF_MAX_FRAGMENT_TEMPS */ 32; + ctx->Const.VertexProgram.MaxNativeParameters = 256; /* r420 */ + ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; + } + + ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; + ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ + ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeInstructions = + PFS_MAX_ALU_INST + PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = + PFS_MAX_TEX_INDIRECT; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; +} /* Create the device specific rendering context. */ @@ -293,7 +336,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, assert(driContextPriv); assert(screen); - /* Allocate the R300 context */ r300 = (r300ContextPtr) CALLOC(sizeof(*r300)); if (!r300) return GL_FALSE; @@ -301,19 +343,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) hw_tcl_on = future_hw_tcl_on = 0; - r300_init_vtbl(&r300->radeon); - /* Parse configuration files. - * Do this here so that initialMaxAnisotropy is set before we create - * the default textures. - */ driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache, screen->driScreen->myNum, "r300"); - r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, - "def_max_anisotropy"); - /* Init default driver functions then plug in our R300-specific functions - * (the texture functions are especially important) - */ + r300_init_vtbl(&r300->radeon); + _mesa_init_driver_functions(&functions); r300InitIoctlFuncs(&functions); r300InitStateFuncs(&functions); @@ -327,46 +361,10 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, return GL_FALSE; } - /* Init r300 context data */ - /* Set the maximum texture size small enough that we can guarentee that - * all texture units can bind a maximal texture and have them both in - * texturable memory at once. - */ - ctx = r300->radeon.glCtx; - - ctx->Const.MaxTextureImageUnits = - driQueryOptioni(&r300->radeon.optionCache, "texture_image_units"); - ctx->Const.MaxTextureCoordUnits = - driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units"); - ctx->Const.MaxTextureUnits = - MIN2(ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxTextureCoordUnits); - ctx->Const.MaxTextureMaxAnisotropy = 16.0; - ctx->Const.MaxTextureLodBias = 16.0; - - if (screen->chip_family >= CHIP_FAMILY_RV515) - ctx->Const.MaxTextureLevels = 13; - else - ctx->Const.MaxTextureLevels = 12; - - ctx->Const.MinPointSize = 1.0; - ctx->Const.MinPointSizeAA = 1.0; - ctx->Const.MaxPointSize = R300_POINTSIZE_MAX; - ctx->Const.MaxPointSizeAA = R300_POINTSIZE_MAX; - - ctx->Const.MinLineWidth = 1.0; - ctx->Const.MinLineWidthAA = 1.0; - ctx->Const.MaxLineWidth = R300_LINESIZE_MAX; - ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX; - - /* Needs further modifications */ -#if 0 - ctx->Const.MaxArrayLockSize = - ( /*512 */ RADEON_BUFFER_SIZE * 16 * 1024) / (4 * 4); -#endif - - ctx->Const.MaxDrawBuffers = 1; + r300InitConstValues(ctx, screen); + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; /* Initialize the software rasterizer and helper modules. */ @@ -381,10 +379,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, */ _tnl_destroy_pipeline(ctx); _tnl_install_pipeline(ctx, r300_pipeline); - - /* Try and keep materials and vertices separate: - */ -/* _tnl_isolate_materials(ctx, GL_TRUE); */ + TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; /* Configure swrast and TNL to match hardware characteristics: */ @@ -393,61 +388,32 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); - /* currently bogus data */ - if (screen->chip_flags & RADEON_CHIPSET_TCL) { - ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeInstructions = - VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */ - ctx->Const.VertexProgram.MaxTemps = 32; - ctx->Const.VertexProgram.MaxNativeTemps = - /*VSF_MAX_FRAGMENT_TEMPS */ 32; - ctx->Const.VertexProgram.MaxNativeParameters = 256; /* r420 */ - ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; - } - - ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; - ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ - ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; - ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeInstructions = - PFS_MAX_ALU_INST + PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = - PFS_MAX_TEX_INDIRECT; - ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ - ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; - ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + radeon_fbo_init(&r300->radeon); + radeonInitSpanFuncs( ctx ); + r300InitCmdBuf(r300); + r300InitState(r300); + if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) + r300InitSwtcl(ctx); driInitExtensions(ctx, card_extensions, GL_TRUE); if (r300->radeon.radeonScreen->kernel_mm) driInitExtensions(ctx, mm_extensions, GL_FALSE); - if (driQueryOptionb - (&r300->radeon.optionCache, "disable_stencil_two_side")) + r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, + "def_max_anisotropy"); + + if (driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side")) _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); - if (r300->radeon.glCtx->Mesa_DXTn - && !driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc")) { + if (ctx->Mesa_DXTn && !driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc")) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(ctx, "GL_S3_s3tc"); - } else - if (driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable")) - { + } else if (driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable")) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } r300->disable_lowimpact_fallback = - driQueryOptionb(&r300->radeon.optionCache, - "disable_lowimpact_fallback"); - radeon_fbo_init(&r300->radeon); - radeonInitSpanFuncs( ctx ); - r300InitCmdBuf(r300); - r300InitState(r300); - if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) - r300InitSwtcl(ctx); - - TNL_CONTEXT(ctx)->Driver.RunPipeline = r300RunPipeline; + driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback"); tcl_mode = driQueryOptioni(&r300->radeon.optionCache, "tcl_mode"); if (driQueryOptionb(&r300->radeon.optionCache, "no_rast")) { -- cgit v1.2.3 From b552446b95baeece6bbb41afe64cdb2f5623e400 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 17 Apr 2009 23:54:20 +0200 Subject: r300: remove unnecessary forward function declaration --- src/mesa/drivers/dri/r300/r300_state.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 64ec870976..5ae999b73a 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -65,7 +65,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" extern int future_hw_tcl_on; -extern void _tnl_UpdateFixedFunctionProgram(GLcontext * ctx); static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) { -- cgit v1.2.3 From cb4bef7ae0b5fe8de82c380bc98f19067394d355 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 01:58:52 +0200 Subject: r300: general cleanup - remove unused fields - remove unused defines and macros - flatten one structure --- src/mesa/drivers/dri/r300/r300_context.h | 41 ++++-------------------- src/mesa/drivers/dri/r300/r300_emit.c | 9 ++---- src/mesa/drivers/dri/r300/r300_state.c | 16 ++++----- src/mesa/drivers/dri/r300/r300_swtcl.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 28 +++++++++++++--- 5 files changed, 41 insertions(+), 55 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 602f86ba66..c3d91187a7 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -37,24 +37,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __R300_CONTEXT_H__ #define __R300_CONTEXT_H__ -#include "tnl/t_vertex.h" #include "drm.h" #include "radeon_drm.h" #include "dri_util.h" -#include "texmem.h" #include "radeon_common.h" -#include "main/macros.h" #include "main/mtypes.h" -#include "main/colormac.h" struct r300_context; typedef struct r300_context r300ContextRec; typedef struct r300_context *r300ContextPtr; -#include "main/mm.h" - /* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble with other compilers ... GLUE! @@ -81,9 +75,6 @@ typedef struct r300_context *r300ContextPtr; #define R300_BLIT_WIDTH_BYTES 1024 #define R300_MAX_TEXTURE_UNITS 8 -struct r300_texture_state { - int tc_count; /* number of incoming texture coordinates from VAP */ -}; #define R300_VPT_CMD_0 0 @@ -303,7 +294,7 @@ struct r300_texture_state { struct r300_hw_state { struct radeon_state_atom vpt; /* viewport (1D98) */ struct radeon_state_atom vap_cntl; - struct radeon_state_atom vap_index_offset; /* 0x208c r5xx only */ + struct radeon_state_atom vap_index_offset; /* 0x208c r5xx only */ struct radeon_state_atom vof; /* VAP output format register 0x2090 */ struct radeon_state_atom vte; /* (20B0) */ struct radeon_state_atom vap_vf_max_vtx_indx; /* Maximum Vertex Indx Clamp (2134) */ @@ -425,12 +416,8 @@ extern int hw_tcl_on; #include "tnl_dd/t_dd_vertex.h" #undef TAG -//#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current) #define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->selected_vp) -/* Should but doesnt work */ -//#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp) - /* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday. * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly. */ @@ -623,20 +610,6 @@ struct r500_fragment_program { #define R300_MAX_AOS_ARRAYS 16 -#define REG_COORDS 0 -#define REG_COLOR0 1 -#define REG_TEX0 2 - -struct r300_state { - struct r300_texture_state texture; - int sw_tcl_inputs[VERT_ATTRIB_MAX]; - struct r300_vertex_shader_state vertex_shader; - - - DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for. - They are the same as tnl->render_inputs for fixed pipeline */ - -}; #define R300_FALLBACK_NONE 0 #define R300_FALLBACK_TCL 1 @@ -664,6 +637,8 @@ struct r300_swtcl_info { } vert_attrs[VERT_ATTRIB_MAX]; GLubyte vertex_attr_count; + + int sw_tcl_inputs[VERT_ATTRIB_MAX]; }; @@ -675,8 +650,7 @@ struct r300_context { struct r300_hw_state hw; - struct r300_state state; - struct gl_vertex_program *curr_vp; + struct r300_vertex_shader_state vertex_shader; struct r300_vertex_program *selected_vp; /* Vertex buffers @@ -688,6 +662,8 @@ struct r300_context { struct r300_swtcl_info swtcl; GLboolean vap_flush_needed; + + DECLARE_RENDERINPUTS(render_inputs_bitset); }; #define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx)) @@ -703,11 +679,6 @@ extern int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *vp, float *dst); -#define RADEON_D_CAPTURE 0 -#define RADEON_D_PLAYBACK 1 -#define RADEON_D_PLAYBACK_RAW 2 -#define RADEON_D_T 3 - #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 4fd6ba9b91..a19b0f1960 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -127,7 +127,6 @@ GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead) GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); GLuint i, vic_1 = 0; if (InputsRead & (1 << VERT_ATTRIB_POS)) @@ -139,10 +138,8 @@ GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) if (InputsRead & (1 << VERT_ATTRIB_COLOR0)) vic_1 |= R300_INPUT_CNTL_COLOR; - rmesa->state.texture.tc_count = 0; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) if (InputsRead & (1 << (VERT_ATTRIB_TEX0 + i))) { - rmesa->state.texture.tc_count++; vic_1 |= R300_INPUT_CNTL_TC0 << i; } @@ -222,7 +219,7 @@ int r300EmitArrays(GLcontext * ctx) InputsRead = prog->key.InputsRead; OutputsWritten = prog->key.OutputsWritten; } else { - inputs = rmesa->state.sw_tcl_inputs; + inputs = rmesa->swtcl.sw_tcl_inputs; DECLARE_RENDERINPUTS(render_inputs_bitset); RENDERINPUTS_COPY(render_inputs_bitset, tnl->render_inputs_bitset); @@ -275,7 +272,7 @@ int r300EmitArrays(GLcontext * ctx) if (InputsRead & (1 << i)) inputs[i] = 6 + (i - VERT_ATTRIB_TEX0); - RENDERINPUTS_COPY(rmesa->state.render_inputs_bitset, render_inputs_bitset); + RENDERINPUTS_COPY(rmesa->render_inputs_bitset, render_inputs_bitset); } assert(InputsRead); @@ -330,7 +327,7 @@ int r300EmitArrays(GLcontext * ctx) r300VAPInputRoute1(&rmesa->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle, nr); } - + /* Setup INPUT_CNTL. */ R300_STATECHANGE(rmesa, vic); rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 5ae999b73a..86b85d525f 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1432,7 +1432,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (hw_tcl_on) OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; else - RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->state.render_inputs_bitset); + RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); if (ctx->FragmentProgram._Current) InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; @@ -1583,7 +1583,7 @@ static void r500SetupRSUnit(GLcontext * ctx) if (hw_tcl_on) OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; else - RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->state.render_inputs_bitset); + RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); if (ctx->FragmentProgram._Current) InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; @@ -1853,7 +1853,7 @@ static void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) { - struct r300_vertex_shader_state *prog = &(rmesa->state.vertex_shader); + struct r300_vertex_shader_state *prog = &(rmesa->vertex_shader); GLuint o_reg = 0; GLuint i_reg = 0; int i; @@ -1862,11 +1862,11 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) int program_end = 0; for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { - if (rmesa->state.sw_tcl_inputs[i] != -1) { + if (rmesa->swtcl.sw_tcl_inputs[i] != -1) { prog->program.body.i[program_end + 0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); - prog->program.body.i[program_end + 1] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 2] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 3] = PVS_SRC_OPERAND(rmesa->state.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + prog->program.body.i[program_end + 1] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + prog->program.body.i[program_end + 2] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + prog->program.body.i[program_end + 3] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); program_end += 4; i_reg++; } @@ -2522,8 +2522,6 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) */ void r300InitState(r300ContextPtr r300) { - memset(&(r300->state.texture), 0, sizeof(r300->state.texture)); - r300ResetHwState(r300); } diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 553bdb12dd..934e1e2243 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -281,7 +281,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) rmesa->radeon.swtcl.vertex_size /= 4; - RENDERINPUTS_COPY(rmesa->state.render_inputs_bitset, tnl->render_inputs_bitset); + RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset); } diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 34d6261706..f7c50e9949 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -61,21 +61,21 @@ static int radeon_compressed_num_bytes(GLuint mesaFormat) { int bytes = 0; switch(mesaFormat) { - + case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: bytes = 2; break; - + case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: bytes = 4; default: break; } - + return bytes; } @@ -97,18 +97,38 @@ static void compute_tex_image_offset(radeon_mipmap_tree *mt, lvl->rowstride = (lvl->width * mt->bpp + 63) & ~63; lvl->size = radeon_compressed_texture_size(mt->radeon->glCtx, lvl->width, lvl->height, lvl->depth, mt->compressed); + if (lvl->size <= 0) { + int *i = 0; + *i = 0; + } + assert(lvl->size > 0); } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) { lvl->rowstride = (lvl->width * mt->bpp + 63) & ~63; lvl->size = lvl->rowstride * lvl->height; + if (lvl->size <= 0) { + int *i = 0; + *i = 0; + } + assert(lvl->size > 0); } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) { /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned, * though the actual offset may be different (if texture is less than * 32 bytes width) to the untiled case */ lvl->rowstride = (lvl->width * mt->bpp * 2 + 31) & ~31; lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth; + if (lvl->size <= 0) { + int *i = 0; + *i = 0; + } + assert(lvl->size > 0); } else { lvl->rowstride = (lvl->width * mt->bpp + 31) & ~31; lvl->size = lvl->rowstride * lvl->height * lvl->depth; + if (lvl->size <= 0) { + int *i = 0; + *i = 0; + } + assert(lvl->size > 0); } assert(lvl->size > 0); @@ -230,7 +250,7 @@ static void calculate_first_last_level(struct gl_texture_object *tObj, tObj->Image[face][level]; assert(baseImage); - + /* These must be signed values. MinLod and MaxLod can be negative numbers, * and having firstLevel and lastLevel as signed prevents the need for * extra sign checks. -- cgit v1.2.3 From 27d4546f600cb444f07a4d510a328540ff37f761 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 02:42:35 +0200 Subject: r300: r300/r500 fp shader merge WIP --- src/mesa/drivers/dri/r300/r300_context.c | 1 + src/mesa/drivers/dri/r300/r300_context.h | 9 ++++++ src/mesa/drivers/dri/r300/r300_fragprog.c | 46 +++++++++++++-------------- src/mesa/drivers/dri/r300/r300_fragprog.h | 4 +-- src/mesa/drivers/dri/r300/r300_render.c | 10 +++--- src/mesa/drivers/dri/r300/r300_shader.c | 9 +++--- src/mesa/drivers/dri/r300/r300_state.c | 53 +++++++++++++++++-------------- src/mesa/drivers/dri/r300/r500_fragprog.c | 44 ++++++++++++------------- src/mesa/drivers/dri/r300/r500_fragprog.h | 3 +- 9 files changed, 94 insertions(+), 85 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index f16e5486f6..10836bb16a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -392,6 +392,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, radeonInitSpanFuncs( ctx ); r300InitCmdBuf(r300); r300InitState(r300); + r300InitShaderFunctions(r300); if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) r300InitSwtcl(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index c3d91187a7..8d0f95e31e 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -641,6 +641,13 @@ struct r300_swtcl_info { int sw_tcl_inputs[VERT_ATTRIB_MAX]; }; +struct r300_vtable { + void (* SetupRSUnit)(GLcontext *ctx); + void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); + void ( *TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp); + GLboolean (* SetupPixelShader)(GLcontext *ctx); +}; + /** * \brief R300 context structure. @@ -648,6 +655,8 @@ struct r300_swtcl_info { struct r300_context { struct radeon_context radeon; /* parent class, must be first */ + struct r300_vtable vtbl; + struct r300_hw_state hw; struct r300_vertex_shader_state vertex_shader; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index f2d7cec5d3..2c3abb216b 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -401,25 +401,26 @@ static void build_state( } -void r300TranslateFragmentShader(r300ContextPtr r300, - struct r300_fragment_program *fp) +void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) { + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; struct r300_fragment_program_external_state state; - build_state(r300, fp, &state); - if (_mesa_memcmp(&fp->state, &state, sizeof(state))) { + build_state(r300, r300_fp, &state); + if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { /* TODO: cache compiled programs */ - fp->translated = GL_FALSE; - _mesa_memcpy(&fp->state, &state, sizeof(state)); + r300_fp->translated = GL_FALSE; + _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); } - if (!fp->translated) { + if (!r300_fp->translated) { struct r300_fragment_program_compiler compiler; compiler.r300 = r300; - compiler.fp = fp; - compiler.code = &fp->code; - compiler.program = _mesa_clone_program(r300->radeon.glCtx, &fp->mesa_program.Base); + compiler.fp = r300_fp; + compiler.code = &r300_fp->code; + compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Fragment Program: Initial program:\n"); @@ -433,10 +434,7 @@ void r300TranslateFragmentShader(r300ContextPtr r300, { &radeonTransformALU, 0 }, { &radeonTransformTrigSimple, 0 } }; - radeonLocalTransform( - r300->radeon.glCtx, - compiler.program, - 3, transformations); + radeonLocalTransform(ctx, compiler.program, 3, transformations); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Fragment Program: After native rewrite:\n"); @@ -449,7 +447,7 @@ void r300TranslateFragmentShader(r300ContextPtr r300, .BuildSwizzle = &r300FPBuildSwizzle, .RewriteDepthOut = GL_TRUE }; - radeonNqssaDce(r300->radeon.glCtx, compiler.program, &nqssadce); + radeonNqssaDce(ctx, compiler.program, &nqssadce); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Compiler: after NqSSA-DCE:\n"); @@ -457,23 +455,23 @@ void r300TranslateFragmentShader(r300ContextPtr r300, } if (!r300FragmentProgramEmit(&compiler)) - fp->error = GL_TRUE; + r300_fp->error = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ - _mesa_free_parameter_list(fp->mesa_program.Base.Parameters); - fp->mesa_program.Base.Parameters = compiler.program->Parameters; + _mesa_free_parameter_list(fp->Base.Parameters); + fp->Base.Parameters = compiler.program->Parameters; compiler.program->Parameters = 0; - _mesa_reference_program(r300->radeon.glCtx, &compiler.program, NULL); + _mesa_reference_program(ctx, &compiler.program, NULL); - fp->translated = GL_TRUE; + r300_fp->translated = GL_TRUE; - if (fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300FragmentProgramDump(fp, &fp->code); - r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); + if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) + r300FragmentProgramDump(r300_fp, &r300_fp->code); + r300UpdateStateParameters(ctx, _NEW_PROGRAM); } - update_params(r300, fp); + update_params(r300, r300_fp); } /* just some random things... */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 94fb554fb3..e1976277de 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -107,9 +107,7 @@ struct r300_fragment_program; -extern void r300TranslateFragmentShader(r300ContextPtr r300, - struct r300_fragment_program *fp); - +extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); /** * Used internally by the r300 fragment program code to store compile-time diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index d33396e150..ce333b8099 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -432,20 +432,18 @@ static int r300Fallback(GLcontext * ctx) /* Do we need to use new-style shaders? * Also is there a better way to do this? */ if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct r500_fragment_program *fp = (struct r500_fragment_program *) - (char *)ctx->FragmentProgram._Current; + struct r500_fragment_program *fp = (struct r500_fragment_program *) ctx->FragmentProgram._Current; if (fp) { if (!fp->translated) - r500TranslateFragmentShader(r300, fp); + r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); FALLBACK_IF(fp->error); } } else { - struct r300_fragment_program *fp = (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; if (fp) { if (!fp->translated) - r300TranslateFragmentShader(r300, fp); + r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); FALLBACK_IF(fp->error); } diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index d90658ba47..ef0b5d037f 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -83,19 +83,20 @@ r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { r300ContextPtr rmesa = R300_CONTEXT(ctx); + struct gl_fragment_program * fp = (struct gl_fragment_program *) prog; if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog; + struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)fp; if (!r500_fp->translated) - r500TranslateFragmentShader(rmesa, r500_fp); + rmesa->vtbl.TranslateFragmentShader(ctx, fp); return !r500_fp->error; } else { - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; if (!r300_fp->translated) - r300TranslateFragmentShader(rmesa, r300_fp); + rmesa->vtbl.TranslateFragmentShader(ctx, fp); return !r300_fp->error; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 86b85d525f..09f83f3d12 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1399,9 +1399,8 @@ static void r300SetupTextures(GLcontext * ctx) r300->hw.tex.filter.cmd[R300_TEX_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_TX_FILTER0_0, 1); } - r300SetupFragmentShaderTextures(ctx, tmu_mappings); - } else - r500SetupFragmentShaderTextures(ctx, tmu_mappings); + } + r300->vtbl.SetupFragmentShaderTextures(ctx, tmu_mappings); if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", @@ -2300,16 +2299,13 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, } -static GLboolean r300SetupPixelShader(r300ContextPtr rmesa) +static GLboolean r300SetupPixelShader(GLcontext *ctx) { - GLcontext *ctx = rmesa->radeon.glCtx; - struct r300_fragment_program *fp = (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; + r300ContextPtr rmesa = R300_CONTEXT(ctx); + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; struct r300_fragment_program_code *code; int i, k; - r300TranslateFragmentShader(rmesa, fp); - /* Program is not native, fallback to software */ if (fp->error) return GL_FALSE; @@ -2383,19 +2379,16 @@ static GLboolean r300SetupPixelShader(r300ContextPtr rmesa) if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ } while(0) -static GLboolean r500SetupPixelShader(r300ContextPtr rmesa) +static GLboolean r500SetupPixelShader(GLcontext *ctx) { - GLcontext *ctx = rmesa->radeon.glCtx; - struct r500_fragment_program *fp = (struct r500_fragment_program *) - (char *)ctx->FragmentProgram._Current; + r300ContextPtr rmesa = R300_CONTEXT(ctx); + struct r500_fragment_program *fp = (struct r500_fragment_program *) ctx->FragmentProgram._Current; int i; struct r500_fragment_program_code *code; ((drm_r300_cmd_header_t *) rmesa->hw.r500fp.cmd)->r500fp.count = 0; ((drm_r300_cmd_header_t *) rmesa->hw.r500fp_const.cmd)->r500fp.count = 0; - r500TranslateFragmentShader(rmesa, fp); - /* Program is not native, fallback to software */ if (fp->error) return GL_FALSE; @@ -2475,15 +2468,12 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; } - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - if (!r500SetupPixelShader(rmesa)) - return; - r500SetupRSUnit(ctx); - } else { - if (!r300SetupPixelShader(rmesa)) - return; - r300SetupRSUnit(ctx); - } + rmesa->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + + if (!rmesa->vtbl.SetupPixelShader(ctx)) + return; + + rmesa->vtbl.SetupRSUnit(ctx); if ((rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) r300SetupVertexProgram(rmesa); @@ -2595,3 +2585,18 @@ void r300InitStateFuncs(struct dd_function_table *functions) functions->DrawBuffer = radeonDrawBuffer; functions->ReadBuffer = radeonReadBuffer; } + +void r300InitShaderFunctions(r300ContextPtr r300) +{ + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + r300->vtbl.SetupRSUnit = r500SetupRSUnit; + r300->vtbl.SetupPixelShader = r500SetupPixelShader; + r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures; + r300->vtbl.TranslateFragmentShader = r500TranslateFragmentShader; + } else { + r300->vtbl.SetupRSUnit = r300SetupRSUnit; + r300->vtbl.SetupPixelShader = r300SetupPixelShader; + r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures; + r300->vtbl.TranslateFragmentShader = r300TranslateFragmentShader; + } +} diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 1b8343ab21..df507b674e 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -439,25 +439,26 @@ static void build_state( static void dump_program(struct r500_fragment_program_code *code); -void r500TranslateFragmentShader(r300ContextPtr r300, - struct r500_fragment_program *fp) +void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) { + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)fp; struct r500_fragment_program_external_state state; - build_state(r300, fp, &state); - if (_mesa_memcmp(&fp->state, &state, sizeof(state))) { + build_state(r300, r500_fp, &state); + if (_mesa_memcmp(&r500_fp->state, &state, sizeof(state))) { /* TODO: cache compiled programs */ - fp->translated = GL_FALSE; - _mesa_memcpy(&fp->state, &state, sizeof(state)); + r500_fp->translated = GL_FALSE; + _mesa_memcpy(&r500_fp->state, &state, sizeof(state)); } - if (!fp->translated) { + if (!r500_fp->translated) { struct r500_fragment_program_compiler compiler; compiler.r300 = r300; - compiler.fp = fp; - compiler.code = &fp->code; - compiler.program = _mesa_clone_program(r300->radeon.glCtx, &fp->mesa_program.Base); + compiler.fp = r500_fp; + compiler.code = &r500_fp->code; + compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Compiler: Initial program:\n"); @@ -472,8 +473,7 @@ void r500TranslateFragmentShader(r300ContextPtr r300, { &radeonTransformDeriv, 0 }, { &radeonTransformTrigScale, 0 } }; - radeonLocalTransform(r300->radeon.glCtx, compiler.program, - 4, transformations); + radeonLocalTransform(ctx, compiler.program, 4, transformations); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Compiler: after native rewrite:\n"); @@ -486,7 +486,7 @@ void r500TranslateFragmentShader(r300ContextPtr r300, .BuildSwizzle = &nqssadce_build_swizzle, .RewriteDepthOut = GL_TRUE }; - radeonNqssaDce(r300->radeon.glCtx, compiler.program, &nqssadce); + radeonNqssaDce(ctx, compiler.program, &nqssadce); if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Compiler: after NqSSA-DCE:\n"); @@ -494,29 +494,29 @@ void r500TranslateFragmentShader(r300ContextPtr r300, } if (!r500FragmentProgramEmit(&compiler)) - fp->error = GL_TRUE; + r500_fp->error = GL_TRUE; - fp->translated = GL_TRUE; + r500_fp->translated = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ - _mesa_free_parameter_list(fp->mesa_program.Base.Parameters); - fp->mesa_program.Base.Parameters = compiler.program->Parameters; + _mesa_free_parameter_list(fp->Base.Parameters); + fp->Base.Parameters = compiler.program->Parameters; compiler.program->Parameters = 0; - _mesa_reference_program(r300->radeon.glCtx, &compiler.program, 0); + _mesa_reference_program(ctx, &compiler.program, 0); - r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); + r300UpdateStateParameters(ctx, _NEW_PROGRAM); if (RADEON_DEBUG & DEBUG_PIXEL) { - if (!fp->error) { + if (!r500_fp->error) { _mesa_printf("Machine-readable code:\n"); - dump_program(&fp->code); + dump_program(&r500_fp->code); } } } - update_params(r300, fp); + update_params(r300, r500_fp); } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 1e45538f80..1456f7f467 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -47,8 +47,7 @@ struct r500_fragment_program; -extern void r500TranslateFragmentShader(r300ContextPtr r300, - struct r500_fragment_program *fp); +extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); struct r500_fragment_program_compiler { r300ContextPtr r300; -- cgit v1.2.3 From aa04e7d475f6d6028c06c42bedc3c7d37ee78a0e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 03:16:16 +0200 Subject: r300: merge r300/r500 fragment program structures --- src/mesa/drivers/dri/r300/r300_context.h | 60 ++++++-------------------- src/mesa/drivers/dri/r300/r300_fragprog.c | 18 ++++---- src/mesa/drivers/dri/r300/r300_fragprog_emit.c | 2 +- src/mesa/drivers/dri/r300/r300_render.c | 21 ++------- src/mesa/drivers/dri/r300/r300_shader.c | 55 +++++------------------ src/mesa/drivers/dri/r300/r300_state.c | 37 ++++++---------- src/mesa/drivers/dri/r300/r500_fragprog.c | 44 +++++++++---------- src/mesa/drivers/dri/r300/r500_fragprog.h | 2 +- 8 files changed, 70 insertions(+), 169 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 8d0f95e31e..0c7221b190 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -458,7 +458,7 @@ struct r300_vertex_program_cont { #define PFS_NUM_CONST_REGS 16 struct r300_pfs_compile_state; - +struct r500_pfs_compile_state; /** * Stores state that influences the compilation of a fragment program. @@ -528,47 +528,6 @@ struct r300_fragment_program_code { int max_temp_idx; }; -/** - * Store everything about a fragment program that is needed - * to render with that program. - */ -struct r300_fragment_program { - struct gl_fragment_program mesa_program; - - GLboolean translated; - GLboolean error; - - struct r300_fragment_program_external_state state; - struct r300_fragment_program_code code; - - GLboolean WritesDepth; - GLuint optimization; -}; - -struct r500_pfs_compile_state; - -struct r500_fragment_program_external_state { - struct { - /** - * If the sampler is used as a shadow sampler, - * this field is: - * 0 - GL_LUMINANCE - * 1 - GL_INTENSITY - * 2 - GL_ALPHA - * depending on the depth texture mode. - */ - GLuint depth_texture_mode : 2; - - /** - * If the sampler is used as a shadow sampler, - * this field is (texture_compare_func - GL_NEVER). - * [e.g. if compare function is GL_LEQUAL, this field is 3] - * - * Otherwise, this field is 0. - */ - GLuint texture_compare_func : 3; - } unit[16]; -}; struct r500_fragment_program_code { struct { @@ -593,18 +552,23 @@ struct r500_fragment_program_code { int max_temp_idx; }; -struct r500_fragment_program { - struct gl_fragment_program mesa_program; +/** +* Store everything about a fragment program that is needed +* to render with that program. +*/ +struct r300_fragment_program { + struct gl_fragment_program Base; - GLcontext *ctx; GLboolean translated; GLboolean error; - struct r500_fragment_program_external_state state; - struct r500_fragment_program_code code; + struct r300_fragment_program_external_state state; + union { + struct r300_fragment_program_code r300; + struct r500_fragment_program_code r500; + } code; GLboolean writes_depth; - GLuint optimization; }; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 2c3abb216b..30f1bac72e 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -247,13 +247,11 @@ static GLboolean transform_TEX( } -static void update_params(r300ContextPtr r300, struct r300_fragment_program *fp) +static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) { - struct gl_fragment_program *mp = &fp->mesa_program; - /* Ask Mesa nicely to fill in ParameterValues for us */ - if (mp->Base.Parameters) - _mesa_load_state_parameters(r300->radeon.glCtx, mp->Base.Parameters); + if (fp->Base.Parameters) + _mesa_load_state_parameters(ctx, fp->Base.Parameters); } @@ -270,7 +268,7 @@ static void update_params(r300ContextPtr r300, struct r300_fragment_program *fp) */ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) { - GLuint InputsRead = compiler->fp->mesa_program.Base.InputsRead; + GLuint InputsRead = compiler->fp->Base.Base.InputsRead; if (!(InputsRead & FRAG_BIT_WPOS)) return; @@ -391,7 +389,7 @@ static void build_state( _mesa_bzero(state, sizeof(*state)); for(unit = 0; unit < 16; ++unit) { - if (fp->mesa_program.Base.ShadowSamplers & (1 << unit)) { + if (fp->Base.Base.ShadowSamplers & (1 << unit)) { struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); @@ -419,7 +417,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) compiler.r300 = r300; compiler.fp = r300_fp; - compiler.code = &r300_fp->code; + compiler.code = &r300_fp->code.r300; compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { @@ -467,11 +465,11 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) r300_fp->translated = GL_TRUE; if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300FragmentProgramDump(r300_fp, &r300_fp->code); + r300FragmentProgramDump(r300_fp, &r300_fp->code.r300); r300UpdateStateParameters(ctx, _NEW_PROGRAM); } - update_params(r300, r300_fp); + update_params(ctx, fp); } /* just some random things... */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c index 9f0b7e3534..690734a1eb 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c @@ -201,7 +201,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) if (inst->Alpha.DepthWriteMask) { code->alu.inst[ip].inst3 |= R300_ALU_DSTA_DEPTH; code->node[code->cur_node].flags |= R300_W_OUT; - c->fp->WritesDepth = GL_TRUE; + c->fp->writes_depth = GL_TRUE; } return GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index ce333b8099..91f58ade59 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -429,24 +429,11 @@ static int r300Fallback(GLcontext * ctx) const unsigned back = ctx->Stencil._BackFace; FALLBACK_IF(r300->radeon.Fallback); - /* Do we need to use new-style shaders? - * Also is there a better way to do this? */ - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct r500_fragment_program *fp = (struct r500_fragment_program *) ctx->FragmentProgram._Current; - if (fp) { - if (!fp->translated) - r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - - FALLBACK_IF(fp->error); - } - } else { - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - if (fp) { - if (!fp->translated) - r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - FALLBACK_IF(fp->error); - } + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + if (fp && !fp->translated) { + r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + FALLBACK_IF(fp->error); } FALLBACK_IF(ctx->RenderMode != GL_RENDER); diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index ef0b5d037f..68fd8cd21e 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -9,10 +9,8 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp; - struct r300_fragment_program *r300_fp; - struct r500_fragment_program *r500_fp; + struct r300_fragment_program *fp; switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: @@ -20,28 +18,12 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, vp = CALLOC_STRUCT(r300_vertex_program_cont); return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id); - case GL_FRAGMENT_PROGRAM_ARB: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - r500_fp = CALLOC_STRUCT(r500_fragment_program); - r500_fp->ctx = ctx; - return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, - target, id); - } else { - r300_fp = CALLOC_STRUCT(r300_fragment_program); - return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, - target, id); - } case GL_FRAGMENT_PROGRAM_NV: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - r500_fp = CALLOC_STRUCT(r500_fragment_program); - return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, - target, id); - } else { - r300_fp = CALLOC_STRUCT(r300_fragment_program); - return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, - target, id); - } + case GL_FRAGMENT_PROGRAM_ARB: + fp = CALLOC_STRUCT(r300_fragment_program); + return _mesa_init_fragment_program(ctx, &fp->Base, target, id); + default: _mesa_problem(ctx, "Bad target in r300NewProgram"); } @@ -57,20 +39,15 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) static void r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp = (void *)prog; struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: vp->progs = NULL; break; case GL_FRAGMENT_PROGRAM_ARB: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) - r500_fp->translated = GL_FALSE; - else - r300_fp->translated = GL_FALSE; + r300_fp->translated = GL_FALSE; break; } @@ -83,23 +60,11 @@ r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct gl_fragment_program * fp = (struct gl_fragment_program *) prog; - - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)fp; - - if (!r500_fp->translated) - rmesa->vtbl.TranslateFragmentShader(ctx, fp); - - return !r500_fp->error; - } else { - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; - - if (!r300_fp->translated) - rmesa->vtbl.TranslateFragmentShader(ctx, fp); + struct r300_fragment_program *fp = (struct r300_fragment_program *)prog; + if (!fp->translated) + rmesa->vtbl.TranslateFragmentShader(ctx, &fp->Base); - return !r300_fp->error; - } + return !fp->error; } else return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 09f83f3d12..9304ffb342 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -449,18 +449,9 @@ static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state) static GLboolean current_fragment_program_writes_depth(GLcontext* ctx) { - r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { - struct r300_fragment_program *fp = (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; - return (fp && fp->WritesDepth); - } else { - struct r500_fragment_program* fp = - (struct r500_fragment_program*)(char*) - ctx->FragmentProgram._Current; - return (fp && fp->writes_depth); - } + return (fp && fp->writes_depth); } static void r300SetEarlyZState(GLcontext * ctx) @@ -1072,7 +1063,7 @@ void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) if (!fp) return; - paramList = fp->mesa_program.Base.Parameters; + paramList = fp->Base.Base.Parameters; if (!paramList) return; @@ -1191,9 +1182,8 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) { r300ContextPtr r300 = R300_CONTEXT(ctx); int i; - struct r300_fragment_program *fp = (struct r300_fragment_program *) - (char *)ctx->FragmentProgram._Current; - struct r300_fragment_program_code *code = &fp->code; + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + struct r300_fragment_program_code *code = &fp->code.r300; R300_STATECHANGE(r300, fpt); @@ -1234,9 +1224,8 @@ static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings) { int i; - struct r500_fragment_program *fp = (struct r500_fragment_program *) - (char *)ctx->FragmentProgram._Current; - struct r500_fragment_program_code *code = &fp->code; + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; + struct r500_fragment_program_code *code = &fp->code.r500; /* find all the texture instructions and relocate the texture units */ for (i = 0; i < code->inst_end + 1; i++) { @@ -1391,7 +1380,7 @@ static void r300SetupTextures(GLcontext * ctx) return; if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { - if (fp->mesa_program.UsesKill && last_hw_tmu < 0) { + if (fp->Base.UsesKill && last_hw_tmu < 0) { // The KILL operation requires the first texture unit // to be enabled. r300->hw.txe.cmd[R300_TXE_ENABLE] |= 1; @@ -2310,7 +2299,7 @@ static GLboolean r300SetupPixelShader(GLcontext *ctx) if (fp->error) return GL_FALSE; - code = &fp->code; + code = &fp->code.r300; r300SetupTextures(ctx); @@ -2355,7 +2344,7 @@ static GLboolean r300SetupPixelShader(GLcontext *ctx) rmesa->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(rmesa->radeon.radeonScreen, R300_PFS_PARAM_0_X, code->const_nr * 4); for (i = 0; i < code->const_nr; i++) { const GLfloat *constant = get_fragmentprogram_constant(ctx, - &fp->mesa_program.Base, code->constant[i]); + &fp->Base.Base, code->constant[i]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = r300PackFloat24(constant[0]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = r300PackFloat24(constant[1]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat24(constant[2]); @@ -2382,7 +2371,7 @@ static GLboolean r300SetupPixelShader(GLcontext *ctx) static GLboolean r500SetupPixelShader(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r500_fragment_program *fp = (struct r500_fragment_program *) ctx->FragmentProgram._Current; + struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; int i; struct r500_fragment_program_code *code; @@ -2393,7 +2382,7 @@ static GLboolean r500SetupPixelShader(GLcontext *ctx) if (fp->error) return GL_FALSE; - code = &fp->code; + code = &fp->code.r500; r300SetupTextures(ctx); @@ -2425,7 +2414,7 @@ static GLboolean r500SetupPixelShader(GLcontext *ctx) R300_STATECHANGE(rmesa, r500fp_const); for (i = 0; i < code->const_nr; i++) { const GLfloat *constant = get_fragmentprogram_constant(ctx, - &fp->mesa_program.Base, code->constant[i]); + &fp->Base.Base, code->constant[i]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 0] = r300PackFloat32(constant[0]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 1] = r300PackFloat32(constant[1]); rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat32(constant[2]); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index df507b674e..f5804521ee 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -189,13 +189,11 @@ static GLboolean transform_TEX( } -static void update_params(r300ContextPtr r300, struct r500_fragment_program *fp) +static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) { - struct gl_fragment_program *mp = &fp->mesa_program; - /* Ask Mesa nicely to fill in ParameterValues for us */ - if (mp->Base.Parameters) - _mesa_load_state_parameters(r300->radeon.glCtx, mp->Base.Parameters); + if (fp->Base.Parameters) + _mesa_load_state_parameters(ctx, fp->Base.Parameters); } @@ -212,7 +210,7 @@ static void update_params(r300ContextPtr r300, struct r500_fragment_program *fp) */ static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler) { - GLuint InputsRead = compiler->fp->mesa_program.Base.InputsRead; + GLuint InputsRead = compiler->fp->Base.Base.InputsRead; if (!(InputsRead & FRAG_BIT_WPOS)) return; @@ -420,15 +418,15 @@ static GLuint build_func(GLuint comparefunc) */ static void build_state( r300ContextPtr r300, - struct r500_fragment_program *fp, - struct r500_fragment_program_external_state *state) + struct r300_fragment_program *fp, + struct r300_fragment_program_external_state *state) { int unit; _mesa_bzero(state, sizeof(*state)); for(unit = 0; unit < 16; ++unit) { - if (fp->mesa_program.Base.ShadowSamplers & (1 << unit)) { + if (fp->Base.Base.ShadowSamplers & (1 << unit)) { struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); @@ -442,22 +440,22 @@ static void dump_program(struct r500_fragment_program_code *code); void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) { r300ContextPtr r300 = R300_CONTEXT(ctx); - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)fp; - struct r500_fragment_program_external_state state; + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; + struct r300_fragment_program_external_state state; - build_state(r300, r500_fp, &state); - if (_mesa_memcmp(&r500_fp->state, &state, sizeof(state))) { + build_state(r300, r300_fp, &state); + if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { /* TODO: cache compiled programs */ - r500_fp->translated = GL_FALSE; - _mesa_memcpy(&r500_fp->state, &state, sizeof(state)); + r300_fp->translated = GL_FALSE; + _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); } - if (!r500_fp->translated) { + if (!r300_fp->translated) { struct r500_fragment_program_compiler compiler; compiler.r300 = r300; - compiler.fp = r500_fp; - compiler.code = &r500_fp->code; + compiler.fp = r300_fp; + compiler.code = &r300_fp->code.r500; compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { @@ -494,9 +492,9 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) } if (!r500FragmentProgramEmit(&compiler)) - r500_fp->error = GL_TRUE; + r300_fp->error = GL_TRUE; - r500_fp->translated = GL_TRUE; + r300_fp->translated = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ _mesa_free_parameter_list(fp->Base.Parameters); @@ -508,15 +506,15 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) r300UpdateStateParameters(ctx, _NEW_PROGRAM); if (RADEON_DEBUG & DEBUG_PIXEL) { - if (!r500_fp->error) { + if (!r300_fp->error) { _mesa_printf("Machine-readable code:\n"); - dump_program(&r500_fp->code); + dump_program(&r300_fp->code.r500); } } } - update_params(r300, r500_fp); + update_params(ctx, fp); } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 1456f7f467..567a43cf61 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -51,7 +51,7 @@ extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_progr struct r500_fragment_program_compiler { r300ContextPtr r300; - struct r500_fragment_program *fp; + struct r300_fragment_program *fp; struct r500_fragment_program_code *code; struct gl_program *program; }; -- cgit v1.2.3 From 33af54af0da94e686ff6679d240a9ec246df3c7a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 03:34:21 +0200 Subject: r300: merge r300/r500 fragment program compiler structure --- src/mesa/drivers/dri/r300/r300_context.h | 12 +++++++++--- src/mesa/drivers/dri/r300/r300_fragprog.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.h | 8 -------- src/mesa/drivers/dri/r300/r300_fragprog_emit.c | 6 +++--- src/mesa/drivers/dri/r300/r300_state.c | 1 + src/mesa/drivers/dri/r300/r300_swtcl.c | 1 + src/mesa/drivers/dri/r300/r500_fragprog.c | 10 +++++----- src/mesa/drivers/dri/r300/r500_fragprog.h | 11 +---------- src/mesa/drivers/dri/r300/r500_fragprog_emit.c | 8 ++++---- 9 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 0c7221b190..ff59ae7ecf 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_common.h" #include "main/mtypes.h" +#include "shader/prog_instruction.h" struct r300_context; typedef struct r300_context r300ContextRec; @@ -66,8 +67,6 @@ typedef struct r300_context *r300ContextPtr; } #include "r300_vertprog.h" -#include "r500_fragprog.h" - /* The blit width for texture uploads @@ -563,7 +562,7 @@ struct r300_fragment_program { GLboolean error; struct r300_fragment_program_external_state state; - union { + union rX00_fragment_program_code { struct r300_fragment_program_code r300; struct r500_fragment_program_code r500; } code; @@ -572,6 +571,13 @@ struct r300_fragment_program { GLuint optimization; }; +struct r300_fragment_program_compiler { + r300ContextPtr r300; + struct r300_fragment_program *fp; + union rX00_fragment_program_code *code; + struct gl_program *program; +}; + #define R300_MAX_AOS_ARRAYS 16 diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 30f1bac72e..eae4c46f69 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -417,7 +417,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) compiler.r300 = r300; compiler.fp = r300_fp; - compiler.code = &r300_fp->code.r300; + compiler.code = &r300_fp->code; compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index e1976277de..631e40913c 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -105,20 +105,12 @@ #endif -struct r300_fragment_program; - extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); /** * Used internally by the r300 fragment program code to store compile-time * only data. */ -struct r300_fragment_program_compiler { - r300ContextPtr r300; - struct r300_fragment_program *fp; - struct r300_fragment_program_code *code; - struct gl_program *program; -}; extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c index 690734a1eb..693d485de9 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c @@ -47,7 +47,7 @@ #define PROG_CODE \ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)data; \ - struct r300_fragment_program_code *code = c->code + struct r300_fragment_program_code *code = &c->code->r300 #define error(fmt, args...) do { \ fprintf(stderr, "%s::%s(): " fmt "\n", \ @@ -213,7 +213,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) */ static GLboolean finish_node(struct r300_fragment_program_compiler *c) { - struct r300_fragment_program_code *code = c->code; + struct r300_fragment_program_code *code = &c->code->r300; struct r300_fragment_program_node *node = &code->node[code->cur_node]; if (node->alu_end < 0) { @@ -327,7 +327,7 @@ static const struct radeon_pair_handler pair_handler = { */ GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler) { - struct r300_fragment_program_code *code = compiler->code; + struct r300_fragment_program_code *code = &compiler->code->r300; _mesa_bzero(code, sizeof(struct r300_fragment_program_code)); code->node[0].alu_end = -1; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 9304ffb342..493c4be6a0 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -61,6 +61,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" #include "r300_fragprog.h" #include "r300_tex.h" +#include "r500_fragprog.h" #include "drirenderbuffer.h" diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 934e1e2243..256a2bb5cb 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/tnl.h" #include "tnl/t_pipeline.h" +#include "r300_state.h" #include "r300_swtcl.h" #include "r300_emit.h" #include "r300_tex.h" diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index f5804521ee..526a0ea928 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -62,8 +62,8 @@ static GLboolean transform_TEX( struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data) { - struct r500_fragment_program_compiler *compiler = - (struct r500_fragment_program_compiler*)data; + struct r300_fragment_program_compiler *compiler = + (struct r300_fragment_program_compiler*)data; struct prog_instruction inst = *orig_inst; struct prog_instruction* tgt; GLboolean destredirect = GL_FALSE; @@ -208,7 +208,7 @@ static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) * \todo if/when r5xx supports the radeon_program architecture, this is a * likely candidate for code sharing. */ -static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler) +static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) { GLuint InputsRead = compiler->fp->Base.Base.InputsRead; @@ -451,11 +451,11 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) } if (!r300_fp->translated) { - struct r500_fragment_program_compiler compiler; + struct r300_fragment_program_compiler compiler; compiler.r300 = r300; compiler.fp = r300_fp; - compiler.code = &r300_fp->code.r500; + compiler.code = &r300_fp->code; compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 567a43cf61..4e72ef7aac 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -45,17 +45,8 @@ #include "r300_state.h" #include "radeon_program.h" -struct r500_fragment_program; - extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); -struct r500_fragment_program_compiler { - r300ContextPtr r300; - struct r300_fragment_program *fp; - struct r500_fragment_program_code *code; - struct gl_program *program; -}; - -extern GLboolean r500FragmentProgramEmit(struct r500_fragment_program_compiler *compiler); +extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); #endif diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c index 4631235f0d..d9f81004e8 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c @@ -49,8 +49,8 @@ #define PROG_CODE \ - struct r500_fragment_program_compiler *c = (struct r500_fragment_program_compiler*)data; \ - struct r500_fragment_program_code *code = c->code + struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)data; \ + struct r500_fragment_program_code *code = &c->code->r500 #define error(fmt, args...) do { \ fprintf(stderr, "%s::%s(): " fmt "\n", \ @@ -299,9 +299,9 @@ static const struct radeon_pair_handler pair_handler = { .MaxHwTemps = 128 }; -GLboolean r500FragmentProgramEmit(struct r500_fragment_program_compiler *compiler) +GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler) { - struct r500_fragment_program_code *code = compiler->code; + struct r500_fragment_program_code *code = &compiler->code->r500; _mesa_bzero(code, sizeof(*code)); code->max_temp_idx = 1; -- cgit v1.2.3 From 97104c255942ee781777818633ca6c17b4fea312 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 03:44:36 +0200 Subject: r300: further r300/r500 merge preparation --- src/mesa/drivers/dri/r300/r300_context.h | 3 ++- src/mesa/drivers/dri/r300/r300_fragprog.c | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 2 ++ src/mesa/drivers/dri/r300/r500_fragprog.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index ff59ae7ecf..41417f3122 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -614,7 +614,8 @@ struct r300_swtcl_info { struct r300_vtable { void (* SetupRSUnit)(GLcontext *ctx); void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); - void ( *TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp); + void (* TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp); + GLboolean (* FragmentProgramEmit)(struct r300_fragment_program_compiler *compiler); GLboolean (* SetupPixelShader)(GLcontext *ctx); }; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index eae4c46f69..d58b092122 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -452,7 +452,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) _mesa_print_program(compiler.program); } - if (!r300FragmentProgramEmit(&compiler)) + if (!r300->vtbl.FragmentProgramEmit(&compiler)) r300_fp->error = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 493c4be6a0..95380a2870 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2583,10 +2583,12 @@ void r300InitShaderFunctions(r300ContextPtr r300) r300->vtbl.SetupPixelShader = r500SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures; r300->vtbl.TranslateFragmentShader = r500TranslateFragmentShader; + r300->vtbl.FragmentProgramEmit = r500FragmentProgramEmit; } else { r300->vtbl.SetupRSUnit = r300SetupRSUnit; r300->vtbl.SetupPixelShader = r300SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures; r300->vtbl.TranslateFragmentShader = r300TranslateFragmentShader; + r300->vtbl.FragmentProgramEmit = r300FragmentProgramEmit; } } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 526a0ea928..3e21e0f497 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -491,7 +491,7 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) _mesa_print_program(compiler.program); } - if (!r500FragmentProgramEmit(&compiler)) + if (!r300->vtbl.FragmentProgramEmit(&compiler)) r300_fp->error = GL_TRUE; r300_fp->translated = GL_TRUE; -- cgit v1.2.3 From 155cc1647fb7ec488fb1d93ba68bc2523ffee381 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 04:00:51 +0200 Subject: r300: more prepare for merge --- src/mesa/drivers/dri/r300/r300_context.h | 1 + src/mesa/drivers/dri/r300/r300_fragprog.c | 10 +++++----- src/mesa/drivers/dri/r300/r300_fragprog.h | 5 +---- src/mesa/drivers/dri/r300/r300_state.c | 2 ++ src/mesa/drivers/dri/r300/r500_fragprog.c | 21 +++++++-------------- src/mesa/drivers/dri/r300/r500_fragprog.h | 1 + 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 41417f3122..904218fde2 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -616,6 +616,7 @@ struct r300_vtable { void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); void (* TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp); GLboolean (* FragmentProgramEmit)(struct r300_fragment_program_compiler *compiler); + void (* FragmentProgramDump)(union rX00_fragment_program_code *code); GLboolean (* SetupPixelShader)(GLcontext *ctx); }; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index d58b092122..a8b885a4c6 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -464,19 +464,19 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) r300_fp->translated = GL_TRUE; - if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300FragmentProgramDump(r300_fp, &r300_fp->code.r300); r300UpdateStateParameters(ctx, _NEW_PROGRAM); + + if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) + r300->vtbl.FragmentProgramDump(&r300_fp->code); } update_params(ctx, fp); } /* just some random things... */ -void r300FragmentProgramDump( - struct r300_fragment_program *fp, - struct r300_fragment_program_code *code) +void r300FragmentProgramDump(union rX00_fragment_program_code *c) { + struct r300_fragment_program_code *code = &c->r300; int n, i, j; static int pc = 0; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 631e40913c..5c2cb312af 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -114,9 +114,6 @@ extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_progr extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); - -extern void r300FragmentProgramDump( - struct r300_fragment_program *fp, - struct r300_fragment_program_code *code); +extern void r300FragmentProgramDump(union rX00_fragment_program_code *c); #endif diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 95380a2870..64b462bc90 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2584,11 +2584,13 @@ void r300InitShaderFunctions(r300ContextPtr r300) r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures; r300->vtbl.TranslateFragmentShader = r500TranslateFragmentShader; r300->vtbl.FragmentProgramEmit = r500FragmentProgramEmit; + r300->vtbl.FragmentProgramDump = r500FragmentProgramDump; } else { r300->vtbl.SetupRSUnit = r300SetupRSUnit; r300->vtbl.SetupPixelShader = r300SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures; r300->vtbl.TranslateFragmentShader = r300TranslateFragmentShader; r300->vtbl.FragmentProgramEmit = r300FragmentProgramEmit; + r300->vtbl.FragmentProgramDump = r300FragmentProgramDump; } } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 3e21e0f497..3b45eee537 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -435,8 +435,6 @@ static void build_state( } } -static void dump_program(struct r500_fragment_program_code *code); - void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -494,24 +492,19 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) if (!r300->vtbl.FragmentProgramEmit(&compiler)) r300_fp->error = GL_TRUE; - r300_fp->translated = GL_TRUE; - /* Subtle: Rescue any parameters that have been added during transformations */ _mesa_free_parameter_list(fp->Base.Parameters); fp->Base.Parameters = compiler.program->Parameters; compiler.program->Parameters = 0; - _mesa_reference_program(ctx, &compiler.program, 0); + _mesa_reference_program(ctx, &compiler.program, NULL); - r300UpdateStateParameters(ctx, _NEW_PROGRAM); + r300_fp->translated = GL_TRUE; - if (RADEON_DEBUG & DEBUG_PIXEL) { - if (!r300_fp->error) { - _mesa_printf("Machine-readable code:\n"); - dump_program(&r300_fp->code.r500); - } - } + r300UpdateStateParameters(ctx, _NEW_PROGRAM); + if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) + r300->vtbl.FragmentProgramDump(&r300_fp->code); } update_params(ctx, fp); @@ -615,9 +608,9 @@ static char *to_texop(int val) return NULL; } -static void dump_program(struct r500_fragment_program_code *code) +void r500FragmentProgramDump(union rX00_fragment_program_code *c) { - + struct r500_fragment_program_code *code = &c->r500; fprintf(stderr, "R500 Fragment Program:\n--------\n"); int n; diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 4e72ef7aac..5bda0d1d0d 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -49,4 +49,5 @@ extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_progr extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); +extern void r500FragmentProgramDump(union rX00_fragment_program_code *c); #endif -- cgit v1.2.3 From 300661d12a1f0ab6c81b087a2ca8c4655abf7066 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 12:39:13 +0200 Subject: r300: more r300/r500 unification reuse insert_WPOS_trailer function --- src/mesa/drivers/dri/r300/r300_fragprog.c | 4 +- src/mesa/drivers/dri/r300/r300_fragprog.h | 7 +- src/mesa/drivers/dri/r300/r500_fragprog.c | 107 ++---------------------------- src/mesa/drivers/dri/r300/r500_fragprog.h | 5 ++ 4 files changed, 13 insertions(+), 110 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index a8b885a4c6..13a1c300dd 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -263,10 +263,8 @@ static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) * All other code pieces that reference that input will be rewritten * to read from a newly allocated temporary. * - * \todo if/when r5xx supports the radeon_program architecture, this is a - * likely candidate for code sharing. */ -static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) +void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) { GLuint InputsRead = compiler->fp->Base.Base.InputsRead; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 5c2cb312af..08f6584383 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -105,12 +105,9 @@ #endif -extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); +extern void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler); -/** - * Used internally by the r300 fragment program code to store compile-time - * only data. - */ +extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 3b45eee537..eb93648e2f 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -29,6 +29,7 @@ #include "radeon_nqssadce.h" #include "radeon_program_alu.h" +#include "r300_fragprog.h" static void reset_srcreg(struct prog_src_register* reg) @@ -197,110 +198,13 @@ static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) } -/** - * Transform the program to support fragment.position. - * - * Introduce a small fragment at the start of the program that will be - * the only code that directly reads the FRAG_ATTRIB_WPOS input. - * All other code pieces that reference that input will be rewritten - * to read from a newly allocated temporary. - * - * \todo if/when r5xx supports the radeon_program architecture, this is a - * likely candidate for code sharing. - */ -static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) -{ - GLuint InputsRead = compiler->fp->Base.Base.InputsRead; - - if (!(InputsRead & FRAG_BIT_WPOS)) - return; - - static gl_state_index tokens[STATE_LENGTH] = { - STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 - }; - struct prog_instruction *fpi; - GLuint window_index; - int i = 0; - GLuint tempregi = _mesa_find_free_register(compiler->program, PROGRAM_TEMPORARY); - - _mesa_insert_instructions(compiler->program, 0, 3); - fpi = compiler->program->Instructions; - - /* perspective divide */ - fpi[i].Opcode = OPCODE_RCP; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_W; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - fpi[i].SrcReg[0].Swizzle = SWIZZLE_WWWW; - i++; - - fpi[i].Opcode = OPCODE_MUL; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - fpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - - fpi[i].SrcReg[1].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[1].Index = tempregi; - fpi[i].SrcReg[1].Swizzle = SWIZZLE_WWWW; - i++; - - /* viewport transformation */ - window_index = _mesa_add_state_reference(compiler->program->Parameters, tokens); - - fpi[i].Opcode = OPCODE_MAD; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[0].Index = tempregi; - fpi[i].SrcReg[0].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - - fpi[i].SrcReg[1].File = PROGRAM_STATE_VAR; - fpi[i].SrcReg[1].Index = window_index; - fpi[i].SrcReg[1].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - - fpi[i].SrcReg[2].File = PROGRAM_STATE_VAR; - fpi[i].SrcReg[2].Index = window_index; - fpi[i].SrcReg[2].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - i++; - - for (; i < compiler->program->NumInstructions; ++i) { - int reg; - for (reg = 0; reg < 3; reg++) { - if (fpi[i].SrcReg[reg].File == PROGRAM_INPUT && - fpi[i].SrcReg[reg].Index == FRAG_ATTRIB_WPOS) { - fpi[i].SrcReg[reg].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[reg].Index = tempregi; - } - } - } -} - - static void nqssadce_init(struct nqssadce_state* s) { s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; } -static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) +GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) { GLuint relevant; int i; @@ -366,8 +270,7 @@ static GLboolean is_native_swizzle(GLuint opcode, struct prog_src_register reg) * The only thing we *cannot* do in an ALU instruction is per-component * negation. Therefore, we split the MOV into two instructions when necessary. */ -static void nqssadce_build_swizzle(struct nqssadce_state *s, - struct prog_dst_register dst, struct prog_src_register src) +void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src) { struct prog_instruction *inst; GLuint negatebase[2] = { 0, 0 }; @@ -478,8 +381,8 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) struct radeon_nqssadce_descr nqssadce = { .Init = &nqssadce_init, - .IsNativeSwizzle = &is_native_swizzle, - .BuildSwizzle = &nqssadce_build_swizzle, + .IsNativeSwizzle = &r500FPIsNativeSwizzle, + .BuildSwizzle = &r500FPBuildSwizzle, .RewriteDepthOut = GL_TRUE }; radeonNqssaDce(ctx, compiler.program, &nqssadce); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 5bda0d1d0d..2e14098f5d 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -44,10 +44,15 @@ #include "r300_context.h" #include "r300_state.h" #include "radeon_program.h" +#include "radeon_nqssadce.h" extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); extern void r500FragmentProgramDump(union rX00_fragment_program_code *c); + +extern GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg); + +extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src); #endif -- cgit v1.2.3 From a2d49eeaebcb9d5869e6f6d57d0aa050a825d8b6 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 13:35:43 +0200 Subject: r300: move common fp functions to seperate file --- src/mesa/drivers/dri/r300/Makefile | 1 + src/mesa/drivers/dri/r300/r300_context.h | 1 - src/mesa/drivers/dri/r300/r300_fragprog.c | 244 +------------------- src/mesa/drivers/dri/r300/r300_fragprog.h | 6 +- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 282 +++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_fragprog_common.h | 35 +++ src/mesa/drivers/dri/r300/r300_render.c | 5 +- src/mesa/drivers/dri/r300/r300_shader.c | 31 ++- src/mesa/drivers/dri/r300/r300_state.c | 7 +- src/mesa/drivers/dri/r300/r500_fragprog.c | 132 +---------- src/mesa/drivers/dri/r300/r500_fragprog.h | 4 +- 11 files changed, 358 insertions(+), 390 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/r300_fragprog_common.c create mode 100644 src/mesa/drivers/dri/r300/r300_fragprog_common.h diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 0dff9a1273..62715e3b50 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -48,6 +48,7 @@ DRIVER_SOURCES = \ radeon_program_pair.c \ radeon_nqssadce.c \ r300_vertprog.c \ + r300_fragprog_common.c \ r300_fragprog.c \ r300_fragprog_swizzle.c \ r300_fragprog_emit.c \ diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 904218fde2..949a3ca45a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -614,7 +614,6 @@ struct r300_swtcl_info { struct r300_vtable { void (* SetupRSUnit)(GLcontext *ctx); void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); - void (* TranslateFragmentShader)(GLcontext *ctx, struct gl_fragment_program *fp); GLboolean (* FragmentProgramEmit)(struct r300_fragment_program_compiler *compiler); void (* FragmentProgramDump)(union rX00_fragment_program_code *code); GLboolean (* SetupPixelShader)(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 13a1c300dd..825246687f 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -25,21 +25,6 @@ * */ -/** - * \file - * - * Fragment program compiler. Perform transformations on the intermediate - * representation until the program is in a form where we can translate - * it more or less directly into machine-readable form. - * - * \author Ben Skeggs - * \author Jerome Glisse - */ - -#include "main/glheader.h" -#include "main/macros.h" -#include "main/enums.h" -#include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" @@ -49,8 +34,6 @@ #include "r300_state.h" #include "radeon_nqssadce.h" -#include "radeon_program_alu.h" - static void reset_srcreg(struct prog_src_register* reg) { @@ -81,7 +64,7 @@ static struct prog_src_register shadow_ambient(struct gl_program *program, int t * \todo If/when r5xx uses the radeon_program architecture, this can probably * be reused. */ -static GLboolean transform_TEX( +GLboolean r300_transform_TEX( struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data) { @@ -246,231 +229,6 @@ static GLboolean transform_TEX( return GL_TRUE; } - -static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) -{ - /* Ask Mesa nicely to fill in ParameterValues for us */ - if (fp->Base.Parameters) - _mesa_load_state_parameters(ctx, fp->Base.Parameters); -} - - -/** - * Transform the program to support fragment.position. - * - * Introduce a small fragment at the start of the program that will be - * the only code that directly reads the FRAG_ATTRIB_WPOS input. - * All other code pieces that reference that input will be rewritten - * to read from a newly allocated temporary. - * - */ -void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) -{ - GLuint InputsRead = compiler->fp->Base.Base.InputsRead; - - if (!(InputsRead & FRAG_BIT_WPOS)) - return; - - static gl_state_index tokens[STATE_LENGTH] = { - STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 - }; - struct prog_instruction *fpi; - GLuint window_index; - int i = 0; - GLuint tempregi = _mesa_find_free_register(compiler->program, PROGRAM_TEMPORARY); - - _mesa_insert_instructions(compiler->program, 0, 3); - fpi = compiler->program->Instructions; - - /* perspective divide */ - fpi[i].Opcode = OPCODE_RCP; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_W; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - fpi[i].SrcReg[0].Swizzle = SWIZZLE_WWWW; - i++; - - fpi[i].Opcode = OPCODE_MUL; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_INPUT; - fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; - fpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; - - fpi[i].SrcReg[1].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[1].Index = tempregi; - fpi[i].SrcReg[1].Swizzle = SWIZZLE_WWWW; - i++; - - /* viewport transformation */ - window_index = _mesa_add_state_reference(compiler->program->Parameters, tokens); - - fpi[i].Opcode = OPCODE_MAD; - - fpi[i].DstReg.File = PROGRAM_TEMPORARY; - fpi[i].DstReg.Index = tempregi; - fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; - fpi[i].DstReg.CondMask = COND_TR; - - fpi[i].SrcReg[0].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[0].Index = tempregi; - fpi[i].SrcReg[0].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - - fpi[i].SrcReg[1].File = PROGRAM_STATE_VAR; - fpi[i].SrcReg[1].Index = window_index; - fpi[i].SrcReg[1].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - - fpi[i].SrcReg[2].File = PROGRAM_STATE_VAR; - fpi[i].SrcReg[2].Index = window_index; - fpi[i].SrcReg[2].Swizzle = - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); - i++; - - for (; i < compiler->program->NumInstructions; ++i) { - int reg; - for (reg = 0; reg < 3; reg++) { - if (fpi[i].SrcReg[reg].File == PROGRAM_INPUT && - fpi[i].SrcReg[reg].Index == FRAG_ATTRIB_WPOS) { - fpi[i].SrcReg[reg].File = PROGRAM_TEMPORARY; - fpi[i].SrcReg[reg].Index = tempregi; - } - } - } -} - - -static void nqssadce_init(struct nqssadce_state* s) -{ - s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; -} - - -static GLuint build_dtm(GLuint depthmode) -{ - switch(depthmode) { - default: - case GL_LUMINANCE: return 0; - case GL_INTENSITY: return 1; - case GL_ALPHA: return 2; - } -} - -static GLuint build_func(GLuint comparefunc) -{ - return comparefunc - GL_NEVER; -} - - -/** - * Collect all external state that is relevant for compiling the given - * fragment program. - */ -static void build_state( - r300ContextPtr r300, - struct r300_fragment_program *fp, - struct r300_fragment_program_external_state *state) -{ - int unit; - - _mesa_bzero(state, sizeof(*state)); - - for(unit = 0; unit < 16; ++unit) { - if (fp->Base.Base.ShadowSamplers & (1 << unit)) { - struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; - - state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); - state->unit[unit].texture_compare_func = build_func(tex->CompareFunc); - } - } -} - - -void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; - struct r300_fragment_program_external_state state; - - build_state(r300, r300_fp, &state); - if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { - /* TODO: cache compiled programs */ - r300_fp->translated = GL_FALSE; - _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); - } - - if (!r300_fp->translated) { - struct r300_fragment_program_compiler compiler; - - compiler.r300 = r300; - compiler.fp = r300_fp; - compiler.code = &r300_fp->code; - compiler.program = _mesa_clone_program(ctx, &fp->Base); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Fragment Program: Initial program:\n"); - _mesa_print_program(compiler.program); - } - - insert_WPOS_trailer(&compiler); - - struct radeon_program_transformation transformations[] = { - { &transform_TEX, &compiler }, - { &radeonTransformALU, 0 }, - { &radeonTransformTrigSimple, 0 } - }; - radeonLocalTransform(ctx, compiler.program, 3, transformations); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Fragment Program: After native rewrite:\n"); - _mesa_print_program(compiler.program); - } - - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r300FPIsNativeSwizzle, - .BuildSwizzle = &r300FPBuildSwizzle, - .RewriteDepthOut = GL_TRUE - }; - radeonNqssaDce(ctx, compiler.program, &nqssadce); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Compiler: after NqSSA-DCE:\n"); - _mesa_print_program(compiler.program); - } - - if (!r300->vtbl.FragmentProgramEmit(&compiler)) - r300_fp->error = GL_TRUE; - - /* Subtle: Rescue any parameters that have been added during transformations */ - _mesa_free_parameter_list(fp->Base.Parameters); - fp->Base.Parameters = compiler.program->Parameters; - compiler.program->Parameters = 0; - - _mesa_reference_program(ctx, &compiler.program, NULL); - - r300_fp->translated = GL_TRUE; - - r300UpdateStateParameters(ctx, _NEW_PROGRAM); - - if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300->vtbl.FragmentProgramDump(&r300_fp->code); - } - - update_params(ctx, fp); -} - /* just some random things... */ void r300FragmentProgramDump(union rX00_fragment_program_code *c) { diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 08f6584383..0713810ade 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -105,12 +105,10 @@ #endif -extern void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler); - -extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); - extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); extern void r300FragmentProgramDump(union rX00_fragment_program_code *c); +extern GLboolean r300_transform_TEX(struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data); + #endif diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c new file mode 100644 index 0000000000..953d920d1f --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +/** + * \file + * + * Fragment program compiler. Perform transformations on the intermediate + * representation until the program is in a form where we can translate + * it more or less directly into machine-readable form. + * + * \author Ben Skeggs + * \author Jerome Glisse + */ + +#include "r300_fragprog_common.h" + +#include "r300_fragprog.h" +#include "r300_fragprog_swizzle.h" +#include "r500_fragprog.h" + +#include "radeon_program.h" +#include "radeon_program_alu.h" + +static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) +{ + /* Ask Mesa nicely to fill in ParameterValues for us */ + if (fp->Base.Parameters) + _mesa_load_state_parameters(ctx, fp->Base.Parameters); +} + +static void nqssadce_init(struct nqssadce_state* s) +{ + s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; + s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; +} + +/** + * Transform the program to support fragment.position. + * + * Introduce a small fragment at the start of the program that will be + * the only code that directly reads the FRAG_ATTRIB_WPOS input. + * All other code pieces that reference that input will be rewritten + * to read from a newly allocated temporary. + * + */ +static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler) +{ + GLuint InputsRead = compiler->fp->Base.Base.InputsRead; + + if (!(InputsRead & FRAG_BIT_WPOS)) + return; + + static gl_state_index tokens[STATE_LENGTH] = { + STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 + }; + struct prog_instruction *fpi; + GLuint window_index; + int i = 0; + GLuint tempregi = _mesa_find_free_register(compiler->program, PROGRAM_TEMPORARY); + + _mesa_insert_instructions(compiler->program, 0, 3); + fpi = compiler->program->Instructions; + + /* perspective divide */ + fpi[i].Opcode = OPCODE_RCP; + + fpi[i].DstReg.File = PROGRAM_TEMPORARY; + fpi[i].DstReg.Index = tempregi; + fpi[i].DstReg.WriteMask = WRITEMASK_W; + fpi[i].DstReg.CondMask = COND_TR; + + fpi[i].SrcReg[0].File = PROGRAM_INPUT; + fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; + fpi[i].SrcReg[0].Swizzle = SWIZZLE_WWWW; + i++; + + fpi[i].Opcode = OPCODE_MUL; + + fpi[i].DstReg.File = PROGRAM_TEMPORARY; + fpi[i].DstReg.Index = tempregi; + fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; + fpi[i].DstReg.CondMask = COND_TR; + + fpi[i].SrcReg[0].File = PROGRAM_INPUT; + fpi[i].SrcReg[0].Index = FRAG_ATTRIB_WPOS; + fpi[i].SrcReg[0].Swizzle = SWIZZLE_XYZW; + + fpi[i].SrcReg[1].File = PROGRAM_TEMPORARY; + fpi[i].SrcReg[1].Index = tempregi; + fpi[i].SrcReg[1].Swizzle = SWIZZLE_WWWW; + i++; + + /* viewport transformation */ + window_index = _mesa_add_state_reference(compiler->program->Parameters, tokens); + + fpi[i].Opcode = OPCODE_MAD; + + fpi[i].DstReg.File = PROGRAM_TEMPORARY; + fpi[i].DstReg.Index = tempregi; + fpi[i].DstReg.WriteMask = WRITEMASK_XYZ; + fpi[i].DstReg.CondMask = COND_TR; + + fpi[i].SrcReg[0].File = PROGRAM_TEMPORARY; + fpi[i].SrcReg[0].Index = tempregi; + fpi[i].SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + + fpi[i].SrcReg[1].File = PROGRAM_STATE_VAR; + fpi[i].SrcReg[1].Index = window_index; + fpi[i].SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + + fpi[i].SrcReg[2].File = PROGRAM_STATE_VAR; + fpi[i].SrcReg[2].Index = window_index; + fpi[i].SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + i++; + + for (; i < compiler->program->NumInstructions; ++i) { + int reg; + for (reg = 0; reg < 3; reg++) { + if (fpi[i].SrcReg[reg].File == PROGRAM_INPUT && + fpi[i].SrcReg[reg].Index == FRAG_ATTRIB_WPOS) { + fpi[i].SrcReg[reg].File = PROGRAM_TEMPORARY; + fpi[i].SrcReg[reg].Index = tempregi; + } + } + } +} + +static GLuint build_dtm(GLuint depthmode) +{ + switch(depthmode) { + default: + case GL_LUMINANCE: return 0; + case GL_INTENSITY: return 1; + case GL_ALPHA: return 2; + } +} + +static GLuint build_func(GLuint comparefunc) +{ + return comparefunc - GL_NEVER; +} + +/** + * Collect all external state that is relevant for compiling the given + * fragment program. + */ +static void build_state( + r300ContextPtr r300, + struct r300_fragment_program *fp, + struct r300_fragment_program_external_state *state) +{ + int unit; + + _mesa_bzero(state, sizeof(*state)); + + for(unit = 0; unit < 16; ++unit) { + if (fp->Base.Base.ShadowSamplers & (1 << unit)) { + struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; + + state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); + state->unit[unit].texture_compare_func = build_func(tex->CompareFunc); + } + } +} + +void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; + struct r300_fragment_program_external_state state; + + build_state(r300, r300_fp, &state); + if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { + /* TODO: cache compiled programs */ + r300_fp->translated = GL_FALSE; + _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); + } + + if (!r300_fp->translated) { + struct r300_fragment_program_compiler compiler; + + compiler.r300 = r300; + compiler.fp = r300_fp; + compiler.code = &r300_fp->code; + compiler.program = _mesa_clone_program(ctx, &fp->Base); + + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Fragment Program: Initial program:\n"); + _mesa_print_program(compiler.program); + } + + insert_WPOS_trailer(&compiler); + + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct radeon_program_transformation transformations[] = { + { &r500_transform_TEX, &compiler }, + { &radeonTransformALU, 0 }, + { &radeonTransformDeriv, 0 }, + { &radeonTransformTrigScale, 0 } + }; + radeonLocalTransform(ctx, compiler.program, 4, transformations); + } else { + struct radeon_program_transformation transformations[] = { + { &r300_transform_TEX, &compiler }, + { &radeonTransformALU, 0 }, + { &radeonTransformTrigSimple, 0 } + }; + radeonLocalTransform(ctx, compiler.program, 3, transformations); + } + + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Fragment Program: After native rewrite:\n"); + _mesa_print_program(compiler.program); + } + + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + struct radeon_nqssadce_descr nqssadce = { + .Init = &nqssadce_init, + .IsNativeSwizzle = &r500FPIsNativeSwizzle, + .BuildSwizzle = &r500FPBuildSwizzle, + .RewriteDepthOut = GL_TRUE + }; + radeonNqssaDce(ctx, compiler.program, &nqssadce); + } else { + struct radeon_nqssadce_descr nqssadce = { + .Init = &nqssadce_init, + .IsNativeSwizzle = &r300FPIsNativeSwizzle, + .BuildSwizzle = &r300FPBuildSwizzle, + .RewriteDepthOut = GL_TRUE + }; + radeonNqssaDce(ctx, compiler.program, &nqssadce); + } + + if (RADEON_DEBUG & DEBUG_PIXEL) { + _mesa_printf("Compiler: after NqSSA-DCE:\n"); + _mesa_print_program(compiler.program); + } + + if (!r300->vtbl.FragmentProgramEmit(&compiler)) + r300_fp->error = GL_TRUE; + + /* Subtle: Rescue any parameters that have been added during transformations */ + _mesa_free_parameter_list(fp->Base.Parameters); + fp->Base.Parameters = compiler.program->Parameters; + compiler.program->Parameters = 0; + + _mesa_reference_program(ctx, &compiler.program, NULL); + + r300_fp->translated = GL_TRUE; + + r300UpdateStateParameters(ctx, _NEW_PROGRAM); + + if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) + r300->vtbl.FragmentProgramDump(&r300_fp->code); + } + + update_params(ctx, fp); +} diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.h b/src/mesa/drivers/dri/r300/r300_fragprog_common.h new file mode 100644 index 0000000000..85ea86fecb --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef __R300_FRAGPROG_COMMON_H_ +#define __R300_FRAGPROG_COMMON_H_ + +#include "main/mtypes.h" + +extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); + +#endif diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 91f58ade59..41b5e30be4 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -72,7 +72,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_reg.h" #include "r300_tex.h" #include "r300_emit.h" -#include "r300_fragprog.h" +#include "r300_fragprog_common.h" + extern int future_hw_tcl_on; /** @@ -432,7 +433,7 @@ static int r300Fallback(GLcontext * ctx) struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; if (fp && !fp->translated) { - r300->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); FALLBACK_IF(fp->error); } diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index 68fd8cd21e..0133b83796 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -1,10 +1,36 @@ +/* + * Copyright 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ #include "main/glheader.h" #include "shader/program.h" #include "tnl/tnl.h" #include "r300_context.h" -#include "r300_fragprog.h" +#include "r300_fragprog_common.h" static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) @@ -59,10 +85,9 @@ static GLboolean r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = (struct r300_fragment_program *)prog; if (!fp->translated) - rmesa->vtbl.TranslateFragmentShader(ctx, &fp->Base); + r300TranslateFragmentShader(ctx, &fp->Base); return !fp->error; } else diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 64b462bc90..4cbbfd49c9 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -59,8 +59,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "r300_reg.h" #include "r300_emit.h" -#include "r300_fragprog.h" #include "r300_tex.h" +#include "r300_fragprog_common.h" +#include "r300_fragprog.h" #include "r500_fragprog.h" #include "drirenderbuffer.h" @@ -2458,7 +2459,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; } - rmesa->vtbl.TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); if (!rmesa->vtbl.SetupPixelShader(ctx)) return; @@ -2582,14 +2583,12 @@ void r300InitShaderFunctions(r300ContextPtr r300) r300->vtbl.SetupRSUnit = r500SetupRSUnit; r300->vtbl.SetupPixelShader = r500SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures; - r300->vtbl.TranslateFragmentShader = r500TranslateFragmentShader; r300->vtbl.FragmentProgramEmit = r500FragmentProgramEmit; r300->vtbl.FragmentProgramDump = r500FragmentProgramDump; } else { r300->vtbl.SetupRSUnit = r300SetupRSUnit; r300->vtbl.SetupPixelShader = r300SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures; - r300->vtbl.TranslateFragmentShader = r300TranslateFragmentShader; r300->vtbl.FragmentProgramEmit = r300FragmentProgramEmit; r300->vtbl.FragmentProgramDump = r300FragmentProgramDump; } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index eb93648e2f..6de92effe6 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -31,7 +31,6 @@ #include "radeon_program_alu.h" #include "r300_fragprog.h" - static void reset_srcreg(struct prog_src_register* reg) { _mesa_bzero(reg, sizeof(*reg)); @@ -59,7 +58,7 @@ static struct prog_src_register shadow_ambient(struct gl_program *program, int t * - introduce a temporary register when write masks are needed * */ -static GLboolean transform_TEX( +GLboolean r500_transform_TEX( struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data) { @@ -189,21 +188,6 @@ static GLboolean transform_TEX( return GL_TRUE; } - -static void update_params(GLcontext *ctx, struct gl_fragment_program *fp) -{ - /* Ask Mesa nicely to fill in ParameterValues for us */ - if (fp->Base.Parameters) - _mesa_load_state_parameters(ctx, fp->Base.Parameters); -} - - -static void nqssadce_init(struct nqssadce_state* s) -{ - s->Outputs[FRAG_RESULT_COLOR].Sourced = WRITEMASK_XYZW; - s->Outputs[FRAG_RESULT_DEPTH].Sourced = WRITEMASK_W; -} - GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) { GLuint relevant; @@ -299,120 +283,6 @@ void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, } } -static GLuint build_dtm(GLuint depthmode) -{ - switch(depthmode) { - default: - case GL_LUMINANCE: return 0; - case GL_INTENSITY: return 1; - case GL_ALPHA: return 2; - } -} - -static GLuint build_func(GLuint comparefunc) -{ - return comparefunc - GL_NEVER; -} - - -/** - * Collect all external state that is relevant for compiling the given - * fragment program. - */ -static void build_state( - r300ContextPtr r300, - struct r300_fragment_program *fp, - struct r300_fragment_program_external_state *state) -{ - int unit; - - _mesa_bzero(state, sizeof(*state)); - - for(unit = 0; unit < 16; ++unit) { - if (fp->Base.Base.ShadowSamplers & (1 << unit)) { - struct gl_texture_object* tex = r300->radeon.glCtx->Texture.Unit[unit]._Current; - - state->unit[unit].depth_texture_mode = build_dtm(tex->DepthMode); - state->unit[unit].texture_compare_func = build_func(tex->CompareFunc); - } - } -} - -void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; - struct r300_fragment_program_external_state state; - - build_state(r300, r300_fp, &state); - if (_mesa_memcmp(&r300_fp->state, &state, sizeof(state))) { - /* TODO: cache compiled programs */ - r300_fp->translated = GL_FALSE; - _mesa_memcpy(&r300_fp->state, &state, sizeof(state)); - } - - if (!r300_fp->translated) { - struct r300_fragment_program_compiler compiler; - - compiler.r300 = r300; - compiler.fp = r300_fp; - compiler.code = &r300_fp->code; - compiler.program = _mesa_clone_program(ctx, &fp->Base); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Compiler: Initial program:\n"); - _mesa_print_program(compiler.program); - } - - insert_WPOS_trailer(&compiler); - - struct radeon_program_transformation transformations[] = { - { &transform_TEX, &compiler }, - { &radeonTransformALU, 0 }, - { &radeonTransformDeriv, 0 }, - { &radeonTransformTrigScale, 0 } - }; - radeonLocalTransform(ctx, compiler.program, 4, transformations); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Compiler: after native rewrite:\n"); - _mesa_print_program(compiler.program); - } - - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r500FPIsNativeSwizzle, - .BuildSwizzle = &r500FPBuildSwizzle, - .RewriteDepthOut = GL_TRUE - }; - radeonNqssaDce(ctx, compiler.program, &nqssadce); - - if (RADEON_DEBUG & DEBUG_PIXEL) { - _mesa_printf("Compiler: after NqSSA-DCE:\n"); - _mesa_print_program(compiler.program); - } - - if (!r300->vtbl.FragmentProgramEmit(&compiler)) - r300_fp->error = GL_TRUE; - - /* Subtle: Rescue any parameters that have been added during transformations */ - _mesa_free_parameter_list(fp->Base.Parameters); - fp->Base.Parameters = compiler.program->Parameters; - compiler.program->Parameters = 0; - - _mesa_reference_program(ctx, &compiler.program, NULL); - - r300_fp->translated = GL_TRUE; - - r300UpdateStateParameters(ctx, _NEW_PROGRAM); - - if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) - r300->vtbl.FragmentProgramDump(&r300_fp->code); - } - - update_params(ctx, fp); - -} static char *toswiz(int swiz_val) { switch(swiz_val) { diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 2e14098f5d..c7e313774c 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -46,8 +46,6 @@ #include "radeon_program.h" #include "radeon_nqssadce.h" -extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp); - extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); extern void r500FragmentProgramDump(union rX00_fragment_program_code *c); @@ -55,4 +53,6 @@ extern void r500FragmentProgramDump(union rX00_fragment_program_code *c); extern GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg); extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src); + +extern GLboolean r500_transform_TEX(struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data); #endif -- cgit v1.2.3 From 78878a13fe9cc5dea36c6427c99c7fe17391dbfb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 18 Apr 2009 13:37:30 +0200 Subject: r300: cleanup includes --- src/mesa/drivers/dri/r300/r300_fragprog.c | 7 ++----- src/mesa/drivers/dri/r300/r300_fragprog.h | 3 --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 5 +++++ src/mesa/drivers/dri/r300/r500_fragprog.c | 4 ---- src/mesa/drivers/dri/r300/r500_fragprog.h | 8 +------- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 825246687f..921ca33c75 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -25,15 +25,12 @@ * */ +#include "r300_fragprog.h" + #include "shader/prog_parameter.h" -#include "shader/prog_print.h" #include "r300_context.h" -#include "r300_fragprog.h" #include "r300_fragprog_swizzle.h" -#include "r300_state.h" - -#include "radeon_nqssadce.h" static void reset_srcreg(struct prog_src_register* reg) { diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index 0713810ade..affa022a5c 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -33,9 +33,6 @@ #ifndef __R300_FRAGPROG_H_ #define __R300_FRAGPROG_H_ -#include "main/glheader.h" -#include "main/macros.h" -#include "main/enums.h" #include "shader/program.h" #include "shader/prog_instruction.h" diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 953d920d1f..3d4bd5db21 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -38,6 +38,11 @@ #include "r300_fragprog_common.h" +#include "shader/program.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" + +#include "r300_state.h" #include "r300_fragprog.h" #include "r300_fragprog_swizzle.h" #include "r500_fragprog.h" diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 6de92effe6..e9c0d89dd4 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -27,10 +27,6 @@ #include "r500_fragprog.h" -#include "radeon_nqssadce.h" -#include "radeon_program_alu.h" -#include "r300_fragprog.h" - static void reset_srcreg(struct prog_src_register* reg) { _mesa_bzero(reg, sizeof(*reg)); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index c7e313774c..9ca2f9be51 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -33,17 +33,10 @@ #ifndef __R500_FRAGPROG_H_ #define __R500_FRAGPROG_H_ -#include "main/glheader.h" -#include "main/macros.h" -#include "main/enums.h" #include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/program.h" #include "shader/prog_instruction.h" #include "r300_context.h" -#include "r300_state.h" -#include "radeon_program.h" #include "radeon_nqssadce.h" extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); @@ -55,4 +48,5 @@ extern GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register r extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src); extern GLboolean r500_transform_TEX(struct radeon_transform_context *t, struct prog_instruction* orig_inst, void* data); + #endif -- cgit v1.2.3 From 59c8e738c4803545107dae85c412f258120903eb Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 18 Apr 2009 23:16:54 +0100 Subject: progs/glsl: Update ignore --- progs/glsl/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/progs/glsl/.gitignore b/progs/glsl/.gitignore index d3e31163d8..39d90c23ac 100644 --- a/progs/glsl/.gitignore +++ b/progs/glsl/.gitignore @@ -1,3 +1,4 @@ +array bitmap brick bump @@ -11,6 +12,7 @@ mandelbrot multinoise multitex noise +noise2 pointcoord points readtex.c @@ -21,6 +23,7 @@ shaderutil.c shaderutil.h shadow_sampler skinning +texaaline texdemo1 toyball trirast -- cgit v1.2.3 From 90a23e340fbfedd76f255fbcab88a07ece2b65db Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 19 Apr 2009 16:22:43 +0100 Subject: progs/demos: Update ignore --- progs/demos/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/progs/demos/.gitignore b/progs/demos/.gitignore index c6ff227391..f3c7091bcc 100644 --- a/progs/demos/.gitignore +++ b/progs/demos/.gitignore @@ -21,6 +21,7 @@ gears geartrain glinfo gloss +glslnoise gltestperf glutfx ipers @@ -45,12 +46,14 @@ singlebuffer spectex spriteblast stex3d +streaming_rect teapot terrain tessdemo texcyl texdown texenv +texobj textures trackball.c trackball.h @@ -58,4 +61,5 @@ trispd tunnel tunnel2 vao_demo +Windows winpos -- cgit v1.2.3 From 373e6716830c52377374458a3c655f32ae84b54f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 18 Apr 2009 23:13:56 +0100 Subject: autoconf: Build gallium softpipe when driver=xlib --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ce7507fd29..c4fe8a1a5f 100644 --- a/configure.ac +++ b/configure.ac @@ -424,12 +424,13 @@ GALLIUM_STATE_TRACKERS_DIRS="" case "$mesa_driver" in xlib) DRIVER_DIRS="x11" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib" ;; dri) SRC_DIRS="glx/x11 $SRC_DIRS" DRIVER_DIRS="dri" WINDOW_SYSTEM="dri" - GALLIUM_WINSYS_DIRS="drm $GALLIUM_WINSYS_DIRS" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm" ;; osmesa) DRIVER_DIRS="osmesa" @@ -1107,6 +1108,9 @@ no) yes) # look at what else is built case "$mesa_driver" in + xlib) + GALLIUM_STATE_TRACKERS_DIRS=glx + ;; dri) GALLIUM_STATE_TRACKERS_DIRS=egl ;; -- cgit v1.2.3 From 439c42ae8b652f4fce59e5157c7e598280959684 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 18 Apr 2009 23:14:58 +0100 Subject: st: Wait to create bitmap transfer until needed --- src/mesa/state_tracker/st_cb_bitmap.c | 38 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 31ff1f74c0..8709633557 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -573,8 +573,10 @@ reset_cache(struct st_context *st) cache->ymin = 1000000; cache->ymax = -1000000; - if (cache->trans) + if (cache->trans) { screen->tex_transfer_destroy(cache->trans); + cache->trans = NULL; + } assert(!cache->texture); @@ -584,6 +586,18 @@ reset_cache(struct st_context *st) BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, 1, PIPE_TEXTURE_USAGE_SAMPLER); +} + +static void +create_cache_trans(struct st_context *st) +{ + struct pipe_context *pipe = st->pipe; + struct pipe_screen *screen = pipe->screen; + struct bitmap_cache *cache = st->bitmap.cache; + + if (cache->trans) + return; + /* Map the texture transfer. * Subsequent glBitmap calls will write into the texture image. */ @@ -622,11 +636,13 @@ st_flush_bitmap_cache(struct st_context *st) /* The texture transfer has been mapped until now. * So unmap and release the texture transfer before drawing. */ - screen->transfer_unmap(screen, cache->trans); - cache->buffer = NULL; + if (cache->trans) { + screen->transfer_unmap(screen, cache->trans); + cache->buffer = NULL; - screen->tex_transfer_destroy(cache->trans); - cache->trans = NULL; + screen->tex_transfer_destroy(cache->trans); + cache->trans = NULL; + } draw_bitmap_quad(st->ctx, cache->xpos, @@ -711,6 +727,9 @@ accum_bitmap(struct st_context *st, if (y + height > cache->ymax) cache->ymax = y + height; + /* create the transfer if needed */ + create_cache_trans(st); + unpack_bitmap(st, px, py, width, height, unpack, bitmap, cache->buffer, BITMAP_CACHE_WIDTH); @@ -823,8 +842,7 @@ st_destroy_bitmap(struct st_context *st) struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; - screen->transfer_unmap(screen, cache->trans); - screen->tex_transfer_destroy(cache->trans); + if (st->bitmap.vs) { cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); @@ -836,7 +854,11 @@ st_destroy_bitmap(struct st_context *st) st->bitmap.vbuf = NULL; } - if (st->bitmap.cache) { + if (cache) { + if (cache->trans) { + screen->transfer_unmap(screen, cache->trans); + screen->tex_transfer_destroy(cache->trans); + } pipe_texture_reference(&st->bitmap.cache->texture, NULL); _mesa_free(st->bitmap.cache); st->bitmap.cache = NULL; -- cgit v1.2.3 From f2d2b3d8e2d9059c162ae7215344b9171f68632b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 19 Apr 2009 16:09:10 +0100 Subject: trace: Enable dumping to be turned on and off --- src/gallium/drivers/trace/tr_context.c | 2 +- src/gallium/drivers/trace/tr_dump.c | 159 ++++++++++++++++++++++++++++++++- src/gallium/drivers/trace/tr_dump.h | 33 ++++++- src/gallium/drivers/trace/tr_screen.c | 2 + 4 files changed, 191 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 38646f8aad..47280459a7 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1089,7 +1089,7 @@ trace_context_create(struct pipe_screen *_screen, if(!pipe) goto error1; - if(!trace_dump_enabled()) + if(!trace_dump_trace_enabled()) goto error1; tr_scr = trace_screen(_screen); diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index d2a7664ed9..63811b7c81 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -61,6 +61,7 @@ static struct util_stream *stream = NULL; static unsigned refcount = 0; static pipe_mutex call_mutex; static long unsigned call_no = 0; +static boolean dumping = FALSE; static INLINE void @@ -258,7 +259,7 @@ boolean trace_dump_trace_begin() return TRUE; } -boolean trace_dump_enabled(void) +boolean trace_dump_trace_enabled(void) { return stream ? TRUE : FALSE; } @@ -270,9 +271,71 @@ void trace_dump_trace_end(void) trace_dump_trace_close(); } -void trace_dump_call_begin(const char *klass, const char *method) +/* + * Call lock + */ + +void trace_dump_call_lock(void) +{ + pipe_mutex_lock(call_mutex); +} + +void trace_dump_call_unlock(void) +{ + pipe_mutex_unlock(call_mutex); +} + +/* + * Dumping control + */ + +void trace_dumping_start_locked(void) +{ + dumping = TRUE; +} + +void trace_dumping_stop_locked(void) +{ + dumping = FALSE; +} + +boolean trace_dumping_enabled_locked(void) +{ + return dumping; +} + +void trace_dumping_start(void) +{ + pipe_mutex_lock(call_mutex); + trace_dumping_start_locked(); + pipe_mutex_unlock(call_mutex); +} + +void trace_dumping_stop(void) { pipe_mutex_lock(call_mutex); + trace_dumping_stop_locked(); + pipe_mutex_unlock(call_mutex); +} + +boolean trace_dumping_enabled(void) +{ + boolean ret; + pipe_mutex_lock(call_mutex); + ret = trace_dumping_enabled_locked(); + pipe_mutex_unlock(call_mutex); + return ret; +} + +/* + * Dump functions + */ + +void trace_dump_call_begin_locked(const char *klass, const char *method) +{ + if (!dumping) + return; + ++call_no; trace_dump_indent(1); trace_dump_writes("%c", value ? '1' : '0'); } void trace_dump_int(long long int value) { + if (!dumping) + return; + trace_dump_writef("%lli", value); } void trace_dump_uint(long long unsigned value) { + if (!dumping) + return; + trace_dump_writef("%llu", value); } void trace_dump_float(double value) { + if (!dumping) + return; + trace_dump_writef("%g", value); } @@ -344,6 +445,10 @@ void trace_dump_bytes(const void *data, static const char hex_table[16] = "0123456789ABCDEF"; const uint8_t *p = data; long unsigned i; + + if (!dumping) + return; + trace_dump_writes(""); for(i = 0; i < size; ++i) { uint8_t byte = *p++; @@ -357,6 +462,9 @@ void trace_dump_bytes(const void *data, void trace_dump_string(const char *str) { + if (!dumping) + return; + trace_dump_writes(""); trace_dump_escape(str); trace_dump_writes(""); @@ -364,6 +472,9 @@ void trace_dump_string(const char *str) void trace_dump_enum(const char *value) { + if (!dumping) + return; + trace_dump_writes(""); trace_dump_escape(value); trace_dump_writes(""); @@ -371,51 +482,81 @@ void trace_dump_enum(const char *value) void trace_dump_array_begin(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_array_end(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_elem_begin(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_elem_end(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_struct_begin(const char *name) { + if (!dumping) + return; + trace_dump_writef("", name); } void trace_dump_struct_end(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_member_begin(const char *name) { + if (!dumping) + return; + trace_dump_writef("", name); } void trace_dump_member_end(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_null(void) { + if (!dumping) + return; + trace_dump_writes(""); } void trace_dump_ptr(const void *value) { + if (!dumping) + return; + if(value) trace_dump_writef("0x%08lx", (unsigned long)(uintptr_t)value); else @@ -424,6 +565,9 @@ void trace_dump_ptr(const void *value) void trace_dump_buffer_ptr(struct pipe_buffer *_buffer) { + if (!dumping) + return; + if (_buffer) { struct trace_buffer *tr_buf = trace_buffer(_buffer); trace_dump_ptr(tr_buf->buffer); @@ -434,6 +578,9 @@ void trace_dump_buffer_ptr(struct pipe_buffer *_buffer) void trace_dump_texture_ptr(struct pipe_texture *_texture) { + if (!dumping) + return; + if (_texture) { struct trace_texture *tr_tex = trace_texture(_texture); trace_dump_ptr(tr_tex->texture); @@ -444,6 +591,9 @@ void trace_dump_texture_ptr(struct pipe_texture *_texture) void trace_dump_surface_ptr(struct pipe_surface *_surface) { + if (!dumping) + return; + if (_surface) { struct trace_surface *tr_surf = trace_surface(_surface); trace_dump_ptr(tr_surf->surface); @@ -454,6 +604,9 @@ void trace_dump_surface_ptr(struct pipe_surface *_surface) void trace_dump_transfer_ptr(struct pipe_transfer *_transfer) { + if (!dumping) + return; + if (_transfer) { struct trace_transfer *tr_tran = trace_transfer(_transfer); trace_dump_ptr(tr_tran->transfer); diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 26409f26c6..8b72b5c9fc 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -42,11 +42,42 @@ struct pipe_texture; struct pipe_surface; struct pipe_transfer; +/* + * Low level dumping controls. + * + * Opening the trace file and checking if that is opened. + */ boolean trace_dump_trace_begin(void); -boolean trace_dump_enabled(void); +boolean trace_dump_trace_enabled(void); void trace_dump_trace_end(void); + +/* + * Lock and unlock the call mutex. + * + * It used by the none locked version of dumping control + * and begin/end call dump functions. + * + * Begin takes the lock while end unlocks it. Use the _locked + * version to avoid locking/unlocking it. + */ +void trace_dump_call_lock(void); +void trace_dump_call_unlock(void); + +/* + * High level dumping control. + */ +void trace_dumping_start_locked(void); +void trace_dumping_stop_locked(void); +boolean trace_dumping_enabled_locked(void); +void trace_dumping_start(void); +void trace_dumping_stop(void); +boolean trace_dumping_enabled(void); + +void trace_dump_call_begin_locked(const char *klass, const char *method); +void trace_dump_call_end_locked(void); void trace_dump_call_begin(const char *klass, const char *method); void trace_dump_call_end(void); + void trace_dump_arg_begin(const char *name); void trace_dump_arg_end(void); void trace_dump_ret_begin(void); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 7205dfd1d9..549525b82a 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -843,6 +843,8 @@ trace_screen_create(struct pipe_screen *screen) if(!trace_dump_trace_begin()) goto error1; + trace_dumping_start(); + trace_dump_call_begin("", "pipe_screen_create"); tr_scr = CALLOC_STRUCT(trace_screen); -- cgit v1.2.3 From bcef4b63eba3b6072df3a699d0c4d5128e2515b9 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 19 Apr 2009 15:26:51 +0200 Subject: r300: revert part of cb4bef7ae0b5fe8de82c380bc98f19067394d355 Some debugging code got there by accident --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 28 ++++-------------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index f7c50e9949..34d6261706 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -61,21 +61,21 @@ static int radeon_compressed_num_bytes(GLuint mesaFormat) { int bytes = 0; switch(mesaFormat) { - + case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: bytes = 2; break; - + case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: bytes = 4; default: break; } - + return bytes; } @@ -97,38 +97,18 @@ static void compute_tex_image_offset(radeon_mipmap_tree *mt, lvl->rowstride = (lvl->width * mt->bpp + 63) & ~63; lvl->size = radeon_compressed_texture_size(mt->radeon->glCtx, lvl->width, lvl->height, lvl->depth, mt->compressed); - if (lvl->size <= 0) { - int *i = 0; - *i = 0; - } - assert(lvl->size > 0); } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) { lvl->rowstride = (lvl->width * mt->bpp + 63) & ~63; lvl->size = lvl->rowstride * lvl->height; - if (lvl->size <= 0) { - int *i = 0; - *i = 0; - } - assert(lvl->size > 0); } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) { /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned, * though the actual offset may be different (if texture is less than * 32 bytes width) to the untiled case */ lvl->rowstride = (lvl->width * mt->bpp * 2 + 31) & ~31; lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth; - if (lvl->size <= 0) { - int *i = 0; - *i = 0; - } - assert(lvl->size > 0); } else { lvl->rowstride = (lvl->width * mt->bpp + 31) & ~31; lvl->size = lvl->rowstride * lvl->height * lvl->depth; - if (lvl->size <= 0) { - int *i = 0; - *i = 0; - } - assert(lvl->size > 0); } assert(lvl->size > 0); @@ -250,7 +230,7 @@ static void calculate_first_last_level(struct gl_texture_object *tObj, tObj->Image[face][level]; assert(baseImage); - + /* These must be signed values. MinLod and MaxLod can be negative numbers, * and having firstLevel and lastLevel as signed prevents the need for * extra sign checks. -- cgit v1.2.3 From 65fe0c86ffcff99f9f09606d462bf3731ea0c308 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 19 Apr 2009 15:28:10 +0200 Subject: r300: fix missing function declaration --- src/mesa/drivers/dri/r300/r300_context.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 949a3ca45a..1c7bfc819b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -659,6 +659,8 @@ extern int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *vp, float *dst); +extern void r300InitShaderFunctions(r300ContextPtr r300); + #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 -- cgit v1.2.3 From c76a2444a3db4fef4b7892cfd99aa41681b4eb0a Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 20 Apr 2009 12:52:56 +0200 Subject: gallium: Fix glDraw/CopyPixels fragment program leak. --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index acc9240b5d..703b465574 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -146,6 +146,8 @@ combined_drawpix_fragment_program(GLcontext *ctx) st->pixel_xfer.xfer_prog_sn = st->pixel_xfer.program->serialNo; st->pixel_xfer.user_prog_sn = st->fp->serialNo; st->pixel_xfer.combined_prog_sn = stfp->serialNo; + /* can't reference new program directly, already have a reference on it */ + st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL); st->pixel_xfer.combined_prog = stfp; } -- cgit v1.2.3 From 6900046aad77b3b01feb30af9e50375224747b7d Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 20 Apr 2009 07:31:44 -0600 Subject: r300: fix register-negate branch merge regression --- src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c | 16 ++++++-------- src/mesa/drivers/dri/r300/radeon_program_alu.c | 27 +++-------------------- src/mesa/drivers/dri/r300/radeon_program_pair.c | 8 ++----- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c index 191853ac1f..6f0d733d46 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c @@ -122,7 +122,7 @@ GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) if (GET_SWZ(reg.Swizzle, j) != SWIZZLE_NIL) relevant |= 1 << j; - if ((reg.Negate & relevant) && (reg.Negate & relevant) != relevant) + if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant)) return GL_FALSE; if (!lookup_native_swizzle(reg.Swizzle)) @@ -144,7 +144,6 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, const struct swizzle_data *best_swizzle = 0; GLuint best_matchcount = 0; GLuint best_matchmask = 0; - GLboolean rgbnegate; int i, comp; for(i = 0; i < num_native_swizzles; ++i) { @@ -158,6 +157,11 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, if (swz == SWIZZLE_NIL) continue; if (swz == GET_SWZ(sd->hash, comp)) { + /* check if the negate bit of current component + * is the same for already matched components */ + if (matchmask && (!!(src.Negate & matchmask) != !!(src.Negate & (1 << comp)))) + continue; + matchcount++; matchmask |= 1 << comp; } @@ -171,13 +175,6 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, } } - if ((src.Negate & best_matchmask) != 0) { - best_matchmask &= src.Negate; - rgbnegate = !src.Negate; - } else { - rgbnegate = src.Negate; - } - struct prog_instruction *inst; _mesa_insert_instructions(s->Program, s->IP, 1); @@ -186,6 +183,7 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, inst->DstReg = dst; inst->DstReg.WriteMask &= (best_matchmask | WRITEMASK_W); inst->SrcReg[0] = src; + inst->SrcReg[0].Negate = (best_matchmask & src.Negate) ? NEGATE_XYZW : NEGATE_NONE; /* Note: We rely on NqSSA/DCE to set unused swizzle components to NIL */ dst.WriteMask &= ~inst->DstReg.WriteMask; diff --git a/src/mesa/drivers/dri/r300/radeon_program_alu.c b/src/mesa/drivers/dri/r300/radeon_program_alu.c index ebc5c913b2..8283723bad 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/radeon_program_alu.c @@ -81,19 +81,6 @@ static struct prog_instruction *emit3(struct gl_program* p, return fpi; } -static void set_swizzle(struct prog_src_register *SrcReg, int coordinate, int swz) -{ - SrcReg->Swizzle &= ~(7 << (3*coordinate)); - SrcReg->Swizzle |= swz << (3*coordinate); -} - -static void set_negate_base(struct prog_src_register *SrcReg, int coordinate, int negate) -{ - /* XXX note sure about this negation logic here */ - SrcReg->Negate &= ~(1 << coordinate); - SrcReg->Negate |= (negate << coordinate); -} - static struct prog_dst_register dstreg(int file, int index) { struct prog_dst_register dst; @@ -197,17 +184,9 @@ static void transform_DPH(struct radeon_transform_context* t, struct prog_instruction* inst) { struct prog_src_register src0 = inst->SrcReg[0]; - if (src0.Negate) { - if (src0.Abs) { - int tempreg = radeonFindFreeTemporary(t); - emit1(t->Program, OPCODE_MOV, 0, dstreg(PROGRAM_TEMPORARY, tempreg), src0); - src0 = srcreg(src0.File, src0.Index); - } else { - src0.Negate ^= NEGATE_XYZW; - } - } - set_swizzle(&src0, 3, SWIZZLE_ONE); - set_negate_base(&src0, 3, 0); + src0.Negate &= ~NEGATE_W; + src0.Swizzle &= ~(7 << (3 * 3)); + src0.Swizzle |= SWIZZLE_ONE << (3 * 3); emit2(t->Program, OPCODE_DP4, inst->SaturateMode, inst->DstReg, src0, inst->SrcReg[1]); } diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index ecc82ff8a8..4aa2319a45 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -721,7 +721,6 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ if (pairinst->NeedRGB && !pairinst->IsTranscendent) { GLboolean srcrgb = GL_FALSE; GLboolean srcalpha = GL_FALSE; - GLuint negatebase = 0; int j; for(j = 0; j < 3; ++j) { GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); @@ -729,8 +728,6 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ srcrgb = GL_TRUE; else if (swz < 4) srcalpha = GL_TRUE; - if (swz != SWIZZLE_NIL && GET_BIT(inst->SrcReg[i].Negate, j)) - negatebase = 1; } source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); if (source < 0) @@ -738,12 +735,11 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ pair->RGB.Arg[i].Source = source; pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].Negate; + pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (NEGATE_X | NEGATE_Y | NEGATE_Z)); } if (pairinst->NeedAlpha) { GLboolean srcrgb = GL_FALSE; GLboolean srcalpha = GL_FALSE; - GLuint negatebase = GET_BIT(inst->SrcReg[i].Negate, pairinst->IsTranscendent ? 0 : 3); GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, pairinst->IsTranscendent ? 0 : 3); if (swz < 3) srcrgb = GL_TRUE; @@ -755,7 +751,7 @@ static GLboolean fill_instruction_into_pair(struct pair_state *s, struct radeon_ pair->Alpha.Arg[i].Source = source; pair->Alpha.Arg[i].Swizzle = swz; pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->Alpha.Arg[i].Negate = (negatebase & ~pair->RGB.Arg[i].Abs) ^ inst->SrcReg[i].Negate; + pair->Alpha.Arg[i].Negate = !!(inst->SrcReg[i].Negate & NEGATE_W); } } -- cgit v1.2.3 From 8ae52413c7883fa4e9bee303f7d28d6dd6953101 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 20 Apr 2009 16:05:01 +0200 Subject: trace: Add initializer for static variables --- src/gallium/drivers/trace/tr_dump.c | 15 +++++++++++++-- src/gallium/drivers/trace/tr_dump.h | 5 +++++ src/gallium/drivers/trace/tr_screen.c | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 63811b7c81..3a1409e95a 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -62,6 +62,7 @@ static unsigned refcount = 0; static pipe_mutex call_mutex; static long unsigned call_no = 0; static boolean dumping = FALSE; +static boolean initialized = FALSE; static INLINE void @@ -227,10 +228,22 @@ trace_dump_trace_close(void) } } +void trace_dump_init() +{ + if (initialized) + return; + + pipe_mutex_init(call_mutex); + dumping = FALSE; + initialized = TRUE; +} + boolean trace_dump_trace_begin() { const char *filename; + assert(initialized); + filename = debug_get_option("GALLIUM_TRACE", NULL); if(!filename) return FALSE; @@ -241,8 +254,6 @@ boolean trace_dump_trace_begin() if(!stream) return FALSE; - pipe_mutex_init(call_mutex); - trace_dump_writes("\n"); trace_dump_writes("\n"); trace_dump_writes("\n"); diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 8b72b5c9fc..31ac70802f 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -42,6 +42,11 @@ struct pipe_texture; struct pipe_surface; struct pipe_transfer; +/* + * Call before use. + */ +void trace_dump_init(void); + /* * Low level dumping controls. * diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 549525b82a..12a8535342 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -840,6 +840,8 @@ trace_screen_create(struct pipe_screen *screen) if(!screen) goto error1; + trace_dump_init(); + if(!trace_dump_trace_begin()) goto error1; -- cgit v1.2.3 From c7c76ba561197b15cf9ad9028335fbc8c2c48890 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 11:29:39 +0100 Subject: util: don't set unused blend state Try to avoid creating multiple blend atoms. --- src/gallium/auxiliary/util/u_blit.c | 4 ---- src/gallium/auxiliary/util/u_gen_mipmap.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 29c3f85194..414cf91025 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -89,10 +89,6 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) /* disabled blending/masking */ memset(&ctx->blend, 0, sizeof(ctx->blend)); - ctx->blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; - ctx->blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; - ctx->blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; - ctx->blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; ctx->blend.colormask = PIPE_MASK_RGBA; /* no-op depth/stencil/alpha */ diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index b32ad1cbe9..690412ae7d 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1278,10 +1278,6 @@ util_create_gen_mipmap(struct pipe_context *pipe, /* disabled blending/masking */ memset(&ctx->blend, 0, sizeof(ctx->blend)); - ctx->blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; - ctx->blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; - ctx->blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; - ctx->blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; ctx->blend.colormask = PIPE_MASK_RGBA; /* no-op depth/stencil/alpha */ -- cgit v1.2.3 From 70588fc83c5aa75754f7b090a63727f4791618ed Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 15:54:57 +0100 Subject: tests/mipmap_view: add linear/nearest key --- progs/tests/mipmap_view.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/progs/tests/mipmap_view.c b/progs/tests/mipmap_view.c index 16f3584f70..85fc67ac79 100644 --- a/progs/tests/mipmap_view.c +++ b/progs/tests/mipmap_view.c @@ -22,6 +22,7 @@ static int TexWidth = 256, TexHeight = 256; static int WinWidth = 1044, WinHeight = 900; static GLfloat Bias = 0.0; static GLboolean ScaleQuads = GL_FALSE; +static GLboolean Linear = GL_FALSE; static GLint Win = 0; @@ -53,6 +54,15 @@ Display(void) glColor3f(1,1,1); + if (Linear) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + y = WinHeight - 300; x = 4; @@ -132,6 +142,9 @@ Key(unsigned char key, int x, int y) case 'B': Bias += 10; break; + case 'l': + Linear = !Linear; + break; case '0': case '1': case '2': @@ -222,8 +235,6 @@ Init(void) /* mipmapping required for this extension */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias); -- cgit v1.2.3 From 53c6467aea129b03cf960a0854c1746ce52a2daa Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Apr 2009 17:11:09 +0100 Subject: st: assert on pipe_buffer_create failure This needs a proper fix to propogate the out-of-memory condition back up to Mesa and the app as a GL error. Until then, at least catch the problem at its source. --- src/mesa/state_tracker/st_cb_bufferobjects.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 1025265cb9..ea9f73ca7b 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -169,6 +169,11 @@ st_bufferobj_data(GLcontext *ctx, st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size ); + /* We don't seem to have any good way of passing failure to + * allocate up to Mesa?? + */ + assert(st_obj->buffer); + st_obj->size = size; if (data) -- cgit v1.2.3 From c691f96e9848d05947afc40ea5c14bc2989f00cf Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 20 Apr 2009 15:50:44 +0100 Subject: trivial/tri-viewport.c - add guide lines, more triangles, make interactive This is becoming more like a test than a trivial/ example. --- progs/trivial/tri-viewport.c | 132 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 118 insertions(+), 14 deletions(-) diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index 8e5f155c7d..4cd64e0781 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -29,6 +29,10 @@ GLenum doubleBuffer = 1; int win; +static float tx = 0; +static float ty = 0; +static float tw = 250; +static float th = 250; static void Init(void) { @@ -42,15 +46,11 @@ static void Init(void) static void Reshape(int width, int height) { - glViewport(width / -2.0, height / -2.0, width, height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + tw = width; + th = height; } + static void Key(unsigned char key, int x, int y) { switch (key) { @@ -62,19 +62,91 @@ static void Key(unsigned char key, int x, int y) } } + static void Draw(void) { + int i; + + fprintf(stderr, "%f %f\n", tx, ty); + fflush(stderr); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, tw, th); + + glBegin(GL_LINES); + glColor3f(1,1,0); + glVertex3f(-1, 0, -30.0); + glVertex3f(1, 0, -30.0); + + glVertex3f(0, -1, -30.0); + glVertex3f(0, 1, -30.0); + glEnd(); + + + /* + */ + glViewport(tx, ty, tw, th); + + glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, -0.9, -30.0); + glColor3f(1,0,0); + glVertex3f(-1, -1, -30.0); + glVertex3f(0, -1, -30.0); + glVertex3f(-.5, -.5, -30.0); + + glColor3f(1,1,1); + glVertex3f(0, -1, -30.0); + glVertex3f(1, -1, -30.0); + glVertex3f(.5, -.5, -30.0); + + glVertex3f(-.5, -.5, -30.0); + glVertex3f(.5, -.5, -30.0); + glVertex3f(0, 0, -30.0); + + + glColor3f(0,1,0); + glVertex3f(1, 1, -30.0); + glVertex3f(0, 1, -30.0); + glVertex3f(.5, .5, -30.0); + + glColor3f(1,1,1); + glVertex3f(0, 1, -30.0); + glVertex3f(-1, 1, -30.0); + glVertex3f(-.5, .5, -30.0); + + glVertex3f(.5, .5, -30.0); + glVertex3f(-.5, .5, -30.0); + glVertex3f( 0, 0, -30.0); + + glEnd(); + + + glViewport(0, 0, tw, th); + + glBegin(GL_LINES); + glColor3f(.5,.5,0); + for (i = -10; i < 10; i++) { + float f = i / 10.0; + + if (i == 0) + continue; + + glVertex3f(-1, f, -30.0); + glVertex3f(1, f, -30.0); + + glVertex3f(f, -1, -30.0); + glVertex3f(f, 1, -30.0); + } glEnd(); + + glFlush(); if (doubleBuffer) { @@ -86,6 +158,13 @@ static GLenum Args(int argc, char **argv) { GLint i; + if (getenv("VPX")) + tx = atof(getenv("VPX")); + + if (getenv("VPY")) + ty = atof(getenv("VPY")); + + for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-sb") == 0) { doubleBuffer = GL_FALSE; @@ -99,6 +178,30 @@ static GLenum Args(int argc, char **argv) return GL_TRUE; } + +static void +special(int k, int x, int y) +{ + switch (k) { + case GLUT_KEY_UP: + ty += 1.0; + break; + case GLUT_KEY_DOWN: + ty -= 1.0; + break; + case GLUT_KEY_LEFT: + tx -= 1.0; + break; + case GLUT_KEY_RIGHT: + tx += 1.0; + break; + default: + return; + } + glutPostRedisplay(); +} + + int main(int argc, char **argv) { GLenum type; @@ -123,7 +226,8 @@ int main(int argc, char **argv) Init(); glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); + glutKeyboardFunc(Key); + glutSpecialFunc(special); glutDisplayFunc(Draw); glutMainLoop(); return 0; -- cgit v1.2.3 From d017749b3ea07f2cc43bb5e8316b83471d1e13ec Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 20 Apr 2009 16:17:50 +0100 Subject: mesa/progs: fix scons build after recent demo moves --- progs/demos/SConscript | 10 ++++------ progs/tests/SConscript | 9 +++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/progs/demos/SConscript b/progs/demos/SConscript index bc166dd789..f851870bcf 100644 --- a/progs/demos/SConscript +++ b/progs/demos/SConscript @@ -39,11 +39,9 @@ progs = [ 'geartrain', 'glinfo', 'gloss', - 'glslnoise', 'gltestperf', - 'glutfx', - 'isosurf', 'ipers', + 'isosurf', 'lodbias', 'morph3d', 'multiarb', @@ -55,7 +53,6 @@ progs = [ 'renormal', 'shadowtex', 'singlebuffer', - 'streaming_rect', 'spectex', 'spriteblast', 'stex3d', @@ -63,15 +60,16 @@ progs = [ 'terrain', 'tessdemo', 'texcyl', - 'texdown', 'texenv', - 'texobj', 'textures', 'trispd', 'tunnel', 'tunnel2', 'vao_demo', 'winpos', + 'dinoshade', + 'fbotexture', + 'projtex', ] for prog in progs: diff --git a/progs/tests/SConscript b/progs/tests/SConscript index bf1e7f8a7d..4f22ca735c 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -42,8 +42,8 @@ progs = [ 'arbfptest1', 'arbfptexture', 'arbfptrig', - 'arbnpot-mipmap', 'arbnpot', + 'arbnpot-mipmap', 'arbvptest1', 'arbvptest3', 'arbvptorus', @@ -61,19 +61,18 @@ progs = [ 'copypixrate', 'crossbar', 'cva', - 'dinoshade', 'drawbuffers', 'exactrast', 'ext422square', 'fbotest1', 'fbotest2', - 'fbotexture', 'fillrate', 'floattex', 'fog', 'fogcoord', 'fptest1', 'fptexture', + 'glutfx', 'interleave', 'invert', 'lineclip', @@ -91,7 +90,6 @@ progs = [ 'packedpixels', 'pbo', 'prog_parameter', - 'projtex', 'quads', 'random', 'readrate', @@ -101,14 +99,17 @@ progs = [ 'stencil_twoside', 'stencil_wrap', 'stencilwrap', + 'streaming_rect', 'subtex', 'subtexrate', 'tex1d', 'texcmp', 'texcompress2', + 'texdown', 'texfilt', 'texgenmix', 'texline', + 'texobj', 'texrect', 'texwrap', 'unfilledclip', -- cgit v1.2.3 From 01397a66c77f8ebfe78b90ace59c095194a290cf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 20 Apr 2009 14:53:08 +0100 Subject: mesa: Handle failure to create a transfer. --- src/mesa/state_tracker/st_cb_texture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 94e340b7e9..c3e990e077 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -682,7 +682,8 @@ st_TexImage(GLcontext * ctx, PIPE_TRANSFER_WRITE, 0, 0, stImage->base.Width, stImage->base.Height); - dstRowStride = stImage->transfer->stride; + if(stImage->transfer) + dstRowStride = stImage->transfer->stride; } else { /* Allocate regular memory and store the image there temporarily. */ -- cgit v1.2.3 From 708218119b9eb6e96d167e98e364e467ebe00bea Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 20 Apr 2009 16:40:12 +0100 Subject: mesa: Correct the gl_dispatch_stub_xxx prototypes. --- src/mesa/glapi/gl_procs.py | 3 +- src/mesa/glapi/glprocs.h | 93 +++++++++++++++++++++++----------------------- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py index 96e59a58ca..cd1a68cee1 100644 --- a/src/mesa/glapi/gl_procs.py +++ b/src/mesa/glapi/gl_procs.py @@ -134,12 +134,11 @@ typedef struct { print "#endif /* USE_MGL_NAMESPACE */" print '' print '' - print '/* FIXME: Having these (incorrect) prototypes here is ugly. */' print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)' for func in api.functionIterateByOffset(): for n in func.entry_points: if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)): - print 'extern void gl_dispatch_stub_%u(void);' % (func.offset) + print '%s GLAPIENTRY gl_dispatch_stub_%u(%s);' % (func.return_type, func.offset, func.get_parameter_string()) break print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */' diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index 021a64efcd..680893cfc4 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -1178,54 +1178,53 @@ static const char gl_string_table[] = #endif /* USE_MGL_NAMESPACE */ -/* FIXME: Having these (incorrect) prototypes here is ugly. */ #if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) -extern void gl_dispatch_stub_343(void); -extern void gl_dispatch_stub_344(void); -extern void gl_dispatch_stub_345(void); -extern void gl_dispatch_stub_356(void); -extern void gl_dispatch_stub_357(void); -extern void gl_dispatch_stub_358(void); -extern void gl_dispatch_stub_359(void); -extern void gl_dispatch_stub_361(void); -extern void gl_dispatch_stub_362(void); -extern void gl_dispatch_stub_363(void); -extern void gl_dispatch_stub_364(void); -extern void gl_dispatch_stub_365(void); -extern void gl_dispatch_stub_366(void); -extern void gl_dispatch_stub_563(void); -extern void gl_dispatch_stub_564(void); -extern void gl_dispatch_stub_565(void); -extern void gl_dispatch_stub_566(void); -extern void gl_dispatch_stub_567(void); -extern void gl_dispatch_stub_568(void); -extern void gl_dispatch_stub_569(void); -extern void gl_dispatch_stub_570(void); -extern void gl_dispatch_stub_581(void); -extern void gl_dispatch_stub_582(void); -extern void gl_dispatch_stub_607(void); -extern void gl_dispatch_stub_649(void); -extern void gl_dispatch_stub_650(void); -extern void gl_dispatch_stub_651(void); -extern void gl_dispatch_stub_652(void); -extern void gl_dispatch_stub_653(void); -extern void gl_dispatch_stub_654(void); -extern void gl_dispatch_stub_655(void); -extern void gl_dispatch_stub_656(void); -extern void gl_dispatch_stub_657(void); -extern void gl_dispatch_stub_738(void); -extern void gl_dispatch_stub_739(void); -extern void gl_dispatch_stub_740(void); -extern void gl_dispatch_stub_741(void); -extern void gl_dispatch_stub_742(void); -extern void gl_dispatch_stub_749(void); -extern void gl_dispatch_stub_750(void); -extern void gl_dispatch_stub_768(void); -extern void gl_dispatch_stub_770(void); -extern void gl_dispatch_stub_771(void); -extern void gl_dispatch_stub_772(void); -extern void gl_dispatch_stub_773(void); -extern void gl_dispatch_stub_774(void); +void GLAPIENTRY gl_dispatch_stub_343(GLenum target, GLenum format, GLenum type, GLvoid * table); +void GLAPIENTRY gl_dispatch_stub_344(GLenum target, GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_345(GLenum target, GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, GLvoid * image); +void GLAPIENTRY gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_359(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); +void GLAPIENTRY gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); +void GLAPIENTRY gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); +void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_563(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_564(GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_565(GLenum pname, GLfloat param); +void GLAPIENTRY gl_dispatch_stub_566(GLenum pname, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_567(GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_568(GLenum pname, const GLint * params); +void GLAPIENTRY gl_dispatch_stub_569(GLclampf value, GLboolean invert); +void GLAPIENTRY gl_dispatch_stub_570(GLenum pattern); +void GLAPIENTRY gl_dispatch_stub_581(GLenum pname, GLdouble * params); +void GLAPIENTRY gl_dispatch_stub_582(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_607(GLenum mode); +void GLAPIENTRY gl_dispatch_stub_649(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_650(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_651(GLsizei n, const GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_652(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_653(GLsizei n, GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_654(GLuint fence, GLenum pname, GLint * params); +GLboolean GLAPIENTRY gl_dispatch_stub_655(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_656(GLuint fence, GLenum condition); +GLboolean GLAPIENTRY gl_dispatch_stub_657(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_738(GLenum face); +void GLAPIENTRY gl_dispatch_stub_739(GLuint array); +void GLAPIENTRY gl_dispatch_stub_740(GLsizei n, const GLuint * arrays); +void GLAPIENTRY gl_dispatch_stub_741(GLsizei n, GLuint * arrays); +GLboolean GLAPIENTRY gl_dispatch_stub_742(GLuint array); +void GLAPIENTRY gl_dispatch_stub_749(GLclampd zmin, GLclampd zmax); +void GLAPIENTRY gl_dispatch_stub_750(GLenum modeRGB, GLenum modeA); +void GLAPIENTRY gl_dispatch_stub_768(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void GLAPIENTRY gl_dispatch_stub_770(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +void GLAPIENTRY gl_dispatch_stub_771(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_772(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_773(GLuint id, GLenum pname, GLint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_774(GLuint id, GLenum pname, GLuint64EXT * params); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { -- cgit v1.2.3 From be6037d459e722732f1712598217912bad245249 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 20 Apr 2009 16:43:44 +0100 Subject: wgl: Don't implement broken gl_dispatch_stub_xxx. These don't respect the stdcall, so they crash upon return. --- src/gallium/state_trackers/wgl/SConscript | 1 - src/gallium/state_trackers/wgl/shared/stw_quirks.c | 116 --------------------- 2 files changed, 117 deletions(-) delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_quirks.c diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 038a7a31b3..61fd8bfc0c 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -26,7 +26,6 @@ if env['platform'] in ['windows']: 'shared/stw_device.c', 'shared/stw_framebuffer.c', 'shared/stw_pixelformat.c', - 'shared/stw_quirks.c', 'shared/stw_arbextensionsstring.c', 'shared/stw_getprocaddress.c', 'shared/stw_arbpixelformat.c', diff --git a/src/gallium/state_trackers/wgl/shared/stw_quirks.c b/src/gallium/state_trackers/wgl/shared/stw_quirks.c deleted file mode 100644 index 2f7091a52c..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_quirks.c +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -/** - * @file - * - * This is hopefully a temporary hack to define some needed dispatch - * table entries. Hopefully, I'll find a better solution. The - * dispatch table generation scripts ought to be making these dummy - * stubs as well. - */ - -void gl_dispatch_stub_543(void){} -void gl_dispatch_stub_544(void){} -void gl_dispatch_stub_545(void){} -void gl_dispatch_stub_546(void){} -void gl_dispatch_stub_547(void){} -void gl_dispatch_stub_548(void){} -void gl_dispatch_stub_549(void){} -void gl_dispatch_stub_550(void){} -void gl_dispatch_stub_551(void){} -void gl_dispatch_stub_552(void){} -void gl_dispatch_stub_553(void){} -void gl_dispatch_stub_554(void){} -void gl_dispatch_stub_555(void){} -void gl_dispatch_stub_556(void){} -void gl_dispatch_stub_557(void){} -void gl_dispatch_stub_558(void){} -void gl_dispatch_stub_559(void){} -void gl_dispatch_stub_560(void){} -void gl_dispatch_stub_561(void){} -void gl_dispatch_stub_565(void){} -void gl_dispatch_stub_566(void){} -void gl_dispatch_stub_570(void){} -void gl_dispatch_stub_577(void){} -void gl_dispatch_stub_578(void){} -void gl_dispatch_stub_582(void){} -void gl_dispatch_stub_603(void){} -void gl_dispatch_stub_607(void){} -void gl_dispatch_stub_645(void){} -void gl_dispatch_stub_646(void){} -void gl_dispatch_stub_647(void){} -void gl_dispatch_stub_648(void){} -void gl_dispatch_stub_649(void){} -void gl_dispatch_stub_650(void){} -void gl_dispatch_stub_651(void){} -void gl_dispatch_stub_652(void){} -void gl_dispatch_stub_653(void){} -void gl_dispatch_stub_657(void){} -void gl_dispatch_stub_733(void){} -void gl_dispatch_stub_734(void){} -void gl_dispatch_stub_735(void){} -void gl_dispatch_stub_736(void){} -void gl_dispatch_stub_737(void){} -void gl_dispatch_stub_738(void){} -void gl_dispatch_stub_744(void){} -void gl_dispatch_stub_745(void){} -void gl_dispatch_stub_746(void){} -void gl_dispatch_stub_760(void){} -void gl_dispatch_stub_761(void){} -void gl_dispatch_stub_763(void){} -void gl_dispatch_stub_764(void){} -void gl_dispatch_stub_765(void){} -void gl_dispatch_stub_766(void){} -void gl_dispatch_stub_767(void){} -void gl_dispatch_stub_768(void){} - -void gl_dispatch_stub_562(void){} -void gl_dispatch_stub_563(void){} -void gl_dispatch_stub_564(void){} -void gl_dispatch_stub_567(void){} -void gl_dispatch_stub_568(void){} -void gl_dispatch_stub_569(void){} -void gl_dispatch_stub_580(void){} -void gl_dispatch_stub_581(void){} -void gl_dispatch_stub_606(void){} -void gl_dispatch_stub_654(void){} -void gl_dispatch_stub_655(void){} -void gl_dispatch_stub_656(void){} -void gl_dispatch_stub_739(void){} -void gl_dispatch_stub_740(void){} -void gl_dispatch_stub_741(void){} -void gl_dispatch_stub_748(void){} -void gl_dispatch_stub_749(void){} -void gl_dispatch_stub_769(void){} -void gl_dispatch_stub_770(void){} -void gl_dispatch_stub_771(void){} -void gl_dispatch_stub_772(void){} -void gl_dispatch_stub_773(void){} -void gl_dispatch_stub_774(void){} -void gl_dispatch_stub_750(void){} -void gl_dispatch_stub_742(void){} -- cgit v1.2.3 From 29280ac69eeeb7ebddd07f027e65357e50508d93 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 20 Apr 2009 16:44:15 +0100 Subject: gdi: Don't implement broken gl_dispatch_stub_xxx. --- src/mesa/drivers/windows/gdi/wmesa.c | 77 ------------------------------------ 1 file changed, 77 deletions(-) diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index d1103f3167..e1971db693 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -1679,80 +1679,3 @@ void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx) _mesa_share_state(&ctx->gl_ctx, &ctx_to_share->gl_ctx); } -/* This is hopefully a temporary hack to define some needed dispatch - * table entries. Hopefully, I'll find a better solution. The - * dispatch table generation scripts ought to be making these dummy - * stubs as well. */ -#if !defined(__MINGW32__) || !defined(GL_NO_STDCALL) -void gl_dispatch_stub_543(void){} -void gl_dispatch_stub_544(void){} -void gl_dispatch_stub_545(void){} -void gl_dispatch_stub_546(void){} -void gl_dispatch_stub_547(void){} -void gl_dispatch_stub_548(void){} -void gl_dispatch_stub_549(void){} -void gl_dispatch_stub_550(void){} -void gl_dispatch_stub_551(void){} -void gl_dispatch_stub_552(void){} -void gl_dispatch_stub_553(void){} -void gl_dispatch_stub_554(void){} -void gl_dispatch_stub_555(void){} -void gl_dispatch_stub_556(void){} -void gl_dispatch_stub_557(void){} -void gl_dispatch_stub_558(void){} -void gl_dispatch_stub_559(void){} -void gl_dispatch_stub_560(void){} -void gl_dispatch_stub_561(void){} -void gl_dispatch_stub_565(void){} -void gl_dispatch_stub_566(void){} -void gl_dispatch_stub_577(void){} -void gl_dispatch_stub_578(void){} -void gl_dispatch_stub_603(void){} -void gl_dispatch_stub_645(void){} -void gl_dispatch_stub_646(void){} -void gl_dispatch_stub_647(void){} -void gl_dispatch_stub_648(void){} -void gl_dispatch_stub_649(void){} -void gl_dispatch_stub_650(void){} -void gl_dispatch_stub_651(void){} -void gl_dispatch_stub_652(void){} -void gl_dispatch_stub_653(void){} -void gl_dispatch_stub_733(void){} -void gl_dispatch_stub_734(void){} -void gl_dispatch_stub_735(void){} -void gl_dispatch_stub_736(void){} -void gl_dispatch_stub_737(void){} -void gl_dispatch_stub_738(void){} -void gl_dispatch_stub_744(void){} -void gl_dispatch_stub_745(void){} -void gl_dispatch_stub_746(void){} -void gl_dispatch_stub_760(void){} -void gl_dispatch_stub_761(void){} -void gl_dispatch_stub_763(void){} -void gl_dispatch_stub_765(void){} -void gl_dispatch_stub_766(void){} -void gl_dispatch_stub_767(void){} -void gl_dispatch_stub_768(void){} - -void gl_dispatch_stub_562(void){} -void gl_dispatch_stub_563(void){} -void gl_dispatch_stub_564(void){} -void gl_dispatch_stub_567(void){} -void gl_dispatch_stub_568(void){} -void gl_dispatch_stub_569(void){} -void gl_dispatch_stub_580(void){} -void gl_dispatch_stub_581(void){} -void gl_dispatch_stub_606(void){} -void gl_dispatch_stub_654(void){} -void gl_dispatch_stub_655(void){} -void gl_dispatch_stub_656(void){} -void gl_dispatch_stub_739(void){} -void gl_dispatch_stub_740(void){} -void gl_dispatch_stub_741(void){} -void gl_dispatch_stub_748(void){} -void gl_dispatch_stub_749(void){} -void gl_dispatch_stub_769(void){} -void gl_dispatch_stub_770(void){} -void gl_dispatch_stub_771(void){} - -#endif -- cgit v1.2.3 From 5d5db81076c6a6e07336f90fbfb7eeaeaf216278 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Apr 2009 14:14:26 -0600 Subject: swrast: fix pointer arithmetic error in get_texel_array() This came from commit 1b2ab023673261b4b942e1126c0b599d02fbd4a0 --- src/mesa/swrast/s_texcombine.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 08c49f5f2c..889164b986 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -49,8 +49,7 @@ typedef float (*float4_array)[4]; static INLINE float4_array get_texel_array(SWcontext *swrast, GLuint unit) { - return (float4_array) - (swrast->TexelBuffer + unit * MAX_WIDTH * 4 * sizeof(GLfloat)); + return (float4_array) (swrast->TexelBuffer + unit * MAX_WIDTH * 4); } -- cgit v1.2.3 From d27d79db4a52327e437146cde3fa3fb85b37de9a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Apr 2009 14:57:00 -0600 Subject: softpipe: fix softpipe_is_buffer/texture_referenced() regression Return the conservative PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE value for now. This fixes a bunch of regressions seen in piglit and glean. --- src/gallium/drivers/softpipe/sp_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 62e8d99cfd..11aff81479 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { - return PIPE_UNREFERENCED; + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } static unsigned int softpipe_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { - return PIPE_UNREFERENCED; + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } struct pipe_context * -- cgit v1.2.3 From 6bfcffa79e8b7999e8193e721e07dbb3de4a1658 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 20 Apr 2009 17:30:53 +0100 Subject: trivial/tri_viewport: add width/height keys --- progs/trivial/tri-viewport.c | 67 ++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index 4cd64e0781..c08089b9dd 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -31,8 +31,11 @@ GLenum doubleBuffer = 1; int win; static float tx = 0; static float ty = 0; -static float tw = 250; -static float th = 250; +static float tw = 0; +static float th = 0; + +static float win_width = 250; +static float win_height = 250; static void Init(void) { @@ -41,33 +44,49 @@ static void Init(void) fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); fflush(stderr); - glClearColor(0.3, 0.1, 0.3, 0.0); + glClearColor(0, 0, 0, 0.0); } static void Reshape(int width, int height) { - tw = width; - th = height; + win_width = width; + win_height = height; + glutPostRedisplay(); } static void Key(unsigned char key, int x, int y) { switch (key) { - case 27: - exit(0); - default: - glutPostRedisplay(); - return; + case 27: + exit(0); + case 'w': + tw += 1.0; + break; + case 'W': + tw -= 1.0; + break; + case 'h': + th += 1.0; + break; + case 'H': + th -= 1.0; + break; + + default: + break; } + glutPostRedisplay(); } static void Draw(void) { int i; + float w = tw + win_width; + float h = th + win_height; - fprintf(stderr, "%f %f\n", tx, ty); + fprintf(stderr, "glViewport(%f %f %f %f)\n", tx, ty, w, h); fflush(stderr); glMatrixMode(GL_PROJECTION); @@ -77,8 +96,22 @@ static void Draw(void) glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, tw, th); + /*********************************************************************** + * Should be clipped to be no larger than the triangles: + */ + glViewport(tx, ty, w, h); + glBegin(GL_POLYGON); + glColor3f(.5,.5,1); + glVertex3f(-2, -2, -30.0); + glVertex3f(-2, 2, -30.0); + glVertex3f(2, 2, -30.0); + glVertex3f(2, -2, -30.0); + glEnd(); + + /*********************************************************************** + */ + glViewport(0, 0, win_width, win_height); glBegin(GL_LINES); glColor3f(1,1,0); glVertex3f(-1, 0, -30.0); @@ -89,11 +122,9 @@ static void Draw(void) glEnd(); - /* + /*********************************************************************** */ - glViewport(tx, ty, tw, th); - - + glViewport(tx, ty, w, h); glBegin(GL_TRIANGLES); glColor3f(1,0,0); glVertex3f(-1, -1, -30.0); @@ -127,7 +158,7 @@ static void Draw(void) glEnd(); - glViewport(0, 0, tw, th); + glViewport(0, 0, win_width, win_height); glBegin(GL_LINES); glColor3f(.5,.5,0); @@ -196,7 +227,7 @@ special(int k, int x, int y) tx += 1.0; break; default: - return; + break; } glutPostRedisplay(); } -- cgit v1.2.3 From a38f7d9e689f0e12cb8eed6b96a140805b452ba1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 20 Apr 2009 17:32:15 +0100 Subject: trivial/tri_viewport: add space==reset key --- progs/trivial/tri-viewport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index c08089b9dd..37e424467b 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -72,7 +72,9 @@ static void Key(unsigned char key, int x, int y) case 'H': th -= 1.0; break; - + case ' ': + tw = th = tx = ty = 0; + break; default: break; } -- cgit v1.2.3 From 6e05224bc4d00ba05fee8651d2a9ecbf2a4b3ca8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Apr 2009 10:59:54 +0100 Subject: trivial/tri-viewport: add more out-of-bounds background quads --- progs/trivial/tri-viewport.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index 37e424467b..133744235f 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -103,14 +103,40 @@ static void Draw(void) * Should be clipped to be no larger than the triangles: */ glViewport(tx, ty, w, h); + glBegin(GL_POLYGON); - glColor3f(.5,.5,1); + glColor3f(1,1,0); + glVertex3f(-100, -100, -30.0); + glVertex3f(-100, 100, -30.0); + glVertex3f(100, 100, -30.0); + glVertex3f(100, -100, -30.0); + glEnd(); + + glBegin(GL_POLYGON); + glColor3f(0,1,1); + glVertex3f(-10, -10, -30.0); + glVertex3f(-10, 10, -30.0); + glVertex3f(10, 10, -30.0); + glVertex3f(10, -10, -30.0); + glEnd(); + + glBegin(GL_POLYGON); + glColor3f(1,0,0); glVertex3f(-2, -2, -30.0); glVertex3f(-2, 2, -30.0); glVertex3f(2, 2, -30.0); glVertex3f(2, -2, -30.0); glEnd(); + + glBegin(GL_POLYGON); + glColor3f(.5,.5,1); + glVertex3f(-1, -1, -30.0); + glVertex3f(-1, 1, -30.0); + glVertex3f(1, 1, -30.0); + glVertex3f(1, -1, -30.0); + glEnd(); + /*********************************************************************** */ glViewport(0, 0, win_width, win_height); -- cgit v1.2.3 From e20f837f672e43671890d5f62f9814487e15531f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Apr 2009 11:40:59 +0100 Subject: trivial/tri-viewport: add keys for frustrum/ortho and z coordinate --- progs/trivial/tri-viewport.c | 120 +++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 43 deletions(-) diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c index 133744235f..3e52449b47 100644 --- a/progs/trivial/tri-viewport.c +++ b/progs/trivial/tri-viewport.c @@ -33,9 +33,16 @@ static float tx = 0; static float ty = 0; static float tw = 0; static float th = 0; +static float z = -5; + static float win_width = 250; static float win_height = 250; +static enum { + ORTHO, + FRUSTUM, + MODE_MAX +} mode = ORTHO; static void Init(void) { @@ -72,8 +79,21 @@ static void Key(unsigned char key, int x, int y) case 'H': th -= 1.0; break; + + case 'z': + z += 1.0; + break; + case 'Z': + z -= 1.0; + break; + case 'm': + mode++; + mode %= MODE_MAX; + break; case ' ': tw = th = tx = ty = 0; + z = -5; + mode = ORTHO; break; default: break; @@ -89,12 +109,26 @@ static void Draw(void) float h = th + win_height; fprintf(stderr, "glViewport(%f %f %f %f)\n", tx, ty, w, h); + fprintf(stderr, "mode: %s\n", mode == FRUSTUM ? "FRUSTUM" : "ORTHO"); + fprintf(stderr, "z: %f\n", z); fflush(stderr); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + + switch (mode) { + case FRUSTUM: + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + break; + case ORTHO: + default: + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + break; + } + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glClear(GL_COLOR_BUFFER_BIT); @@ -106,35 +140,35 @@ static void Draw(void) glBegin(GL_POLYGON); glColor3f(1,1,0); - glVertex3f(-100, -100, -30.0); - glVertex3f(-100, 100, -30.0); - glVertex3f(100, 100, -30.0); - glVertex3f(100, -100, -30.0); + glVertex3f(-100, -100, z); + glVertex3f(-100, 100, z); + glVertex3f(100, 100, z); + glVertex3f(100, -100, z); glEnd(); glBegin(GL_POLYGON); glColor3f(0,1,1); - glVertex3f(-10, -10, -30.0); - glVertex3f(-10, 10, -30.0); - glVertex3f(10, 10, -30.0); - glVertex3f(10, -10, -30.0); + glVertex3f(-10, -10, z); + glVertex3f(-10, 10, z); + glVertex3f(10, 10, z); + glVertex3f(10, -10, z); glEnd(); glBegin(GL_POLYGON); glColor3f(1,0,0); - glVertex3f(-2, -2, -30.0); - glVertex3f(-2, 2, -30.0); - glVertex3f(2, 2, -30.0); - glVertex3f(2, -2, -30.0); + glVertex3f(-2, -2, z); + glVertex3f(-2, 2, z); + glVertex3f(2, 2, z); + glVertex3f(2, -2, z); glEnd(); glBegin(GL_POLYGON); glColor3f(.5,.5,1); - glVertex3f(-1, -1, -30.0); - glVertex3f(-1, 1, -30.0); - glVertex3f(1, 1, -30.0); - glVertex3f(1, -1, -30.0); + glVertex3f(-1, -1, z); + glVertex3f(-1, 1, z); + glVertex3f(1, 1, z); + glVertex3f(1, -1, z); glEnd(); /*********************************************************************** @@ -142,11 +176,11 @@ static void Draw(void) glViewport(0, 0, win_width, win_height); glBegin(GL_LINES); glColor3f(1,1,0); - glVertex3f(-1, 0, -30.0); - glVertex3f(1, 0, -30.0); + glVertex3f(-1, 0, z); + glVertex3f(1, 0, z); - glVertex3f(0, -1, -30.0); - glVertex3f(0, 1, -30.0); + glVertex3f(0, -1, z); + glVertex3f(0, 1, z); glEnd(); @@ -155,33 +189,33 @@ static void Draw(void) glViewport(tx, ty, w, h); glBegin(GL_TRIANGLES); glColor3f(1,0,0); - glVertex3f(-1, -1, -30.0); - glVertex3f(0, -1, -30.0); - glVertex3f(-.5, -.5, -30.0); + glVertex3f(-1, -1, z); + glVertex3f(0, -1, z); + glVertex3f(-.5, -.5, z); glColor3f(1,1,1); - glVertex3f(0, -1, -30.0); - glVertex3f(1, -1, -30.0); - glVertex3f(.5, -.5, -30.0); + glVertex3f(0, -1, z); + glVertex3f(1, -1, z); + glVertex3f(.5, -.5, z); - glVertex3f(-.5, -.5, -30.0); - glVertex3f(.5, -.5, -30.0); - glVertex3f(0, 0, -30.0); + glVertex3f(-.5, -.5, z); + glVertex3f(.5, -.5, z); + glVertex3f(0, 0, z); glColor3f(0,1,0); - glVertex3f(1, 1, -30.0); - glVertex3f(0, 1, -30.0); - glVertex3f(.5, .5, -30.0); + glVertex3f(1, 1, z); + glVertex3f(0, 1, z); + glVertex3f(.5, .5, z); glColor3f(1,1,1); - glVertex3f(0, 1, -30.0); - glVertex3f(-1, 1, -30.0); - glVertex3f(-.5, .5, -30.0); + glVertex3f(0, 1, z); + glVertex3f(-1, 1, z); + glVertex3f(-.5, .5, z); - glVertex3f(.5, .5, -30.0); - glVertex3f(-.5, .5, -30.0); - glVertex3f( 0, 0, -30.0); + glVertex3f(.5, .5, z); + glVertex3f(-.5, .5, z); + glVertex3f( 0, 0, z); glEnd(); @@ -196,11 +230,11 @@ static void Draw(void) if (i == 0) continue; - glVertex3f(-1, f, -30.0); - glVertex3f(1, f, -30.0); + glVertex3f(-1, f, z); + glVertex3f(1, f, z); - glVertex3f(f, -1, -30.0); - glVertex3f(f, 1, -30.0); + glVertex3f(f, -1, z); + glVertex3f(f, 1, z); } glEnd(); -- cgit v1.2.3 From 25e3a534035e71bb319d2e11906d376734941a21 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Apr 2009 15:03:38 -0600 Subject: st: report GL_OUT_OF_MEMORY instead of asserting --- src/mesa/state_tracker/st_cb_bufferobjects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index ea9f73ca7b..a94e11fff1 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -169,10 +169,10 @@ st_bufferobj_data(GLcontext *ctx, st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size ); - /* We don't seem to have any good way of passing failure to - * allocate up to Mesa?? - */ - assert(st_obj->buffer); + if (!st_obj->buffer) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB"); + return; + } st_obj->size = size; -- cgit v1.2.3 From dad1c1be18dc4e8e7f51cdb91652124e9427e644 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 07:27:12 -0600 Subject: demos: check that GL version is 2.0 or higher --- progs/tests/shader_api.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/progs/tests/shader_api.c b/progs/tests/shader_api.c index a513ca6ba1..6453856345 100644 --- a/progs/tests/shader_api.c +++ b/progs/tests/shader_api.c @@ -321,10 +321,18 @@ static void run_test(const char *name, void (*callback)(void)) int main(int argc, char **argv) { + const char *version; + glutInit(&argc, argv); glutCreateWindow("Mesa bug demo"); glewInit(); + version = (const char *) glGetString(GL_VERSION); + if (version[0] == '1') { + printf("Sorry, this test requires OpenGL 2.x GLSL support\n"); + exit(0); + } + RUN_TEST(test_uniform_size_type); RUN_TEST(test_attrib_size_type); RUN_TEST(test_uniform_array_overflow); -- cgit v1.2.3 From b8fff1f9f17a2488aa45e875104353814bf59da2 Mon Sep 17 00:00:00 2001 From: Mathias Gottschlag Date: Tue, 21 Apr 2009 09:52:30 -0600 Subject: r300-gallium: Fix CS size mismatch This fixes some warnings which appear because the driver assumes a wrong cs size (13 vs 16 register writes in some cases). --- src/gallium/drivers/r300/r300_emit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index a3d83376b6..417d5f6307 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -340,7 +340,11 @@ void r300_emit_vertex_shader(struct r300_context* r300, return; } - BEGIN_CS(13 + (vs->instruction_count * 4) + (constants->count * 4)); + if (constants->count) { + BEGIN_CS(16 + (vs->instruction_count * 4) + (constants->count * 4)); + } else { + BEGIN_CS(13 + (vs->instruction_count * 4) + (constants->count * 4)); + } OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) | R300_PVS_LAST_INST(vs->instruction_count - 1)); -- cgit v1.2.3 From 584303ac8ef60129a9e4281963ebb3b3e16e96ac Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 21 Apr 2009 01:55:06 +0200 Subject: r300: r300 hw doesn't support any input modifiers in tex insts --- src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c index 6f0d733d46..fc9d855bce 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_swizzle.c @@ -100,8 +100,7 @@ GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) opcode == OPCODE_TXP) { int j; - if (reg.Abs || (reg.Negate != NEGATE_XYZW && - reg.Negate != NEGATE_NONE)) + if (reg.Abs || reg.Negate) return GL_FALSE; for(j = 0; j < 4; ++j) { -- cgit v1.2.3 From 6bd4bc785e587ac86231349648595fc0e136f10d Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 21 Apr 2009 18:32:42 +0100 Subject: Update GALLIUM_AUXILIARY_DIRS in configure.ac to match configs/default. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c4fe8a1a5f..8412cdce7f 100644 --- a/configure.ac +++ b/configure.ac @@ -417,7 +417,7 @@ WINDOW_SYSTEM="" GALLIUM_DIRS="auxiliary drivers state_trackers" GALLIUM_WINSYS_DIRS="" GALLIUM_WINSYS_DRM_DIRS="" -GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util" +GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices" GALLIUM_DRIVERS_DIRS="softpipe failover trace" GALLIUM_STATE_TRACKERS_DIRS="" -- cgit v1.2.3 From 08e7f09f34b1590b6e68b351e1ecb5f8f405fb75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Apr 2009 11:58:09 -0600 Subject: i965: const correctness --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 98 ++++++++++++++++----------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 2d13088ddb..22e17622c6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -56,7 +56,7 @@ static void set_reg(struct brw_wm_compile *c, int file, int index, * Examine instruction's write mask to find index of first component * enabled for writing. */ -static int get_scalar_dst_index(struct prog_instruction *inst) +static int get_scalar_dst_index(const struct prog_instruction *inst) { int i; for (i = 0; i < 4; i++) @@ -482,7 +482,7 @@ static void invoke_subroutine( struct brw_wm_compile *c, } static void emit_abs( struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { int i; struct brw_compile *p = &c->func; @@ -499,7 +499,7 @@ static void emit_abs( struct brw_wm_compile *c, } static void emit_trunc( struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { int i; struct brw_compile *p = &c->func; @@ -517,7 +517,7 @@ static void emit_trunc( struct brw_wm_compile *c, } static void emit_mov( struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { int i; struct brw_compile *p = &c->func; @@ -537,7 +537,7 @@ static void emit_mov( struct brw_wm_compile *c, } static void emit_pixel_xy(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_reg r1 = brw_vec1_grf(1, 0); struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); @@ -567,7 +567,7 @@ static void emit_pixel_xy(struct brw_wm_compile *c, } static void emit_delta_xy(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_reg r1 = brw_vec1_grf(1, 0); struct brw_reg dst0, dst1, src0, src1; @@ -627,7 +627,7 @@ static void fire_fb_write( struct brw_wm_compile *c, } static void emit_fb_write(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; int nr = 2; @@ -696,7 +696,7 @@ static void emit_fb_write(struct brw_wm_compile *c, } static void emit_pixel_w( struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -726,7 +726,7 @@ static void emit_pixel_w( struct brw_wm_compile *c, } static void emit_linterp(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -755,7 +755,7 @@ static void emit_linterp(struct brw_wm_compile *c, } static void emit_cinterp(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -781,7 +781,7 @@ static void emit_cinterp(struct brw_wm_compile *c, } static void emit_pinterp(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -815,7 +815,7 @@ static void emit_pinterp(struct brw_wm_compile *c, /* Sets the destination channels to 1.0 or 0.0 according to glFrontFacing. */ static void emit_frontfacing(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD); @@ -844,7 +844,7 @@ static void emit_frontfacing(struct brw_wm_compile *c, } static void emit_xpd(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { int i; struct brw_compile *p = &c->func; @@ -869,7 +869,7 @@ static void emit_xpd(struct brw_wm_compile *c, } static void emit_dp3(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_reg src0[3], src1[3], dst; int i; @@ -888,7 +888,7 @@ static void emit_dp3(struct brw_wm_compile *c, } static void emit_dp4(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_reg src0[4], src1[4], dst; int i; @@ -907,7 +907,7 @@ static void emit_dp4(struct brw_wm_compile *c, } static void emit_dph(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_reg src0[4], src1[4], dst; int i; @@ -931,7 +931,7 @@ static void emit_dph(struct brw_wm_compile *c, * register's X, Y, Z and W channels (subject to writemasking of course). */ static void emit_math1(struct brw_wm_compile *c, - struct prog_instruction *inst, GLuint func) + const struct prog_instruction *inst, GLuint func) { struct brw_compile *p = &c->func; struct brw_reg src0, dst, tmp; @@ -968,43 +968,43 @@ static void emit_math1(struct brw_wm_compile *c, } static void emit_rcp(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_INV); } static void emit_rsq(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_RSQ); } static void emit_sin(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_SIN); } static void emit_cos(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_COS); } static void emit_ex2(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_EXP); } static void emit_lg2(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_math1(c, inst, BRW_MATH_FUNCTION_LOG); } static void emit_add(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, dst; @@ -1023,7 +1023,7 @@ static void emit_add(struct brw_wm_compile *c, } static void emit_arl(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, addr_reg; @@ -1036,7 +1036,7 @@ static void emit_arl(struct brw_wm_compile *c, } static void emit_sub(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, dst; @@ -1055,7 +1055,7 @@ static void emit_sub(struct brw_wm_compile *c, } static void emit_mul(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, dst; @@ -1074,7 +1074,7 @@ static void emit_mul(struct brw_wm_compile *c, } static void emit_frc(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, dst; @@ -1093,7 +1093,7 @@ static void emit_frc(struct brw_wm_compile *c, } static void emit_flr(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg src0, dst; @@ -1160,7 +1160,7 @@ static void emit_min_max(struct brw_wm_compile *c, } static void emit_pow(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg dst, src0, src1; @@ -1182,7 +1182,7 @@ static void emit_pow(struct brw_wm_compile *c, } static void emit_lrp(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -1235,7 +1235,7 @@ static void emit_kil(struct brw_wm_compile *c) } static void emit_mad(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -1258,7 +1258,7 @@ static void emit_mad(struct brw_wm_compile *c, } static void emit_sop(struct brw_wm_compile *c, - struct prog_instruction *inst, GLuint cond) + const struct prog_instruction *inst, GLuint cond) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -1282,43 +1282,43 @@ static void emit_sop(struct brw_wm_compile *c, } static void emit_slt(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_L); } static void emit_sle(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_LE); } static void emit_sgt(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_G); } static void emit_sge(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_GE); } static void emit_seq(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_EQ); } static void emit_sne(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { emit_sop(c, inst, BRW_CONDITIONAL_NEQ); } static void emit_ddx(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -1345,7 +1345,7 @@ static void emit_ddx(struct brw_wm_compile *c, } static void emit_ddy(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -1488,7 +1488,7 @@ static void noise1_sub( struct brw_wm_compile *c ) { } static void emit_noise1( struct brw_wm_compile *c, - struct prog_instruction *inst ) + const struct prog_instruction *inst ) { struct brw_compile *p = &c->func; struct brw_reg src, param, dst; @@ -1658,7 +1658,7 @@ static void noise2_sub( struct brw_wm_compile *c ) { } static void emit_noise2( struct brw_wm_compile *c, - struct prog_instruction *inst ) + const struct prog_instruction *inst ) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, param0, param1, dst; @@ -1961,7 +1961,7 @@ static void noise3_sub( struct brw_wm_compile *c ) { } static void emit_noise3( struct brw_wm_compile *c, - struct prog_instruction *inst ) + const struct prog_instruction *inst ) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, src2, param0, param1, param2, dst; @@ -2384,7 +2384,7 @@ static void noise4_sub( struct brw_wm_compile *c ) } static void emit_noise4( struct brw_wm_compile *c, - struct prog_instruction *inst ) + const struct prog_instruction *inst ) { struct brw_compile *p = &c->func; struct brw_reg src0, src1, src2, src3, param0, param1, param2, param3, dst; @@ -2426,7 +2426,7 @@ static void emit_noise4( struct brw_wm_compile *c, } static void emit_wpos_xy(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; @@ -2462,7 +2462,7 @@ static void emit_wpos_xy(struct brw_wm_compile *c, BIAS on SIMD8 not working yet... */ static void emit_txb(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg dst[4], src[4], payload_reg; @@ -2511,7 +2511,7 @@ static void emit_txb(struct brw_wm_compile *c, static void emit_tex(struct brw_wm_compile *c, - struct prog_instruction *inst) + const struct prog_instruction *inst) { struct brw_compile *p = &c->func; struct brw_reg dst[4], src[4], payload_reg; @@ -2601,7 +2601,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); for (i = 0; i < c->nr_fp_insns; i++) { - struct prog_instruction *inst = &c->prog_instructions[i]; + const struct prog_instruction *inst = &c->prog_instructions[i]; #if 0 _mesa_printf("Inst %d: ", i); -- cgit v1.2.3 From ac1fc3f46511a449c812651dda686d4aaac39753 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 14:44:03 -0600 Subject: mesa: print parameter list dirty state flag mask --- src/mesa/shader/prog_print.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index d73c619fea..9967f2978d 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -873,6 +873,7 @@ _mesa_fprint_parameter_list(FILE *f, return; _mesa_fprintf(f, "param list %p\n", (void *) list); + _mesa_fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags); for (i = 0; i < list->NumParameters; i++){ struct gl_program_parameter *param = list->Parameters + i; const GLfloat *v = list->ParameterValues[i]; -- cgit v1.2.3 From 8a22e24faef918a0f6d05ef6e6417a65cb3eaeb1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 14:47:57 -0600 Subject: mesa: print internal.current[i] attrib --- src/mesa/shader/prog_statevars.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 37a3f1fc8c..058d4bbafb 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -816,7 +816,10 @@ append_token(char *dst, gl_state_index k) break; /* BEGIN internal state vars */ case STATE_INTERNAL: - append(dst, "(internal)"); + append(dst, ".internal."); + break; + case STATE_CURRENT_ATTRIB: + append(dst, "current"); break; case STATE_NORMAL_SCALE: append(dst, "normalScale"); @@ -986,7 +989,9 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) break; case STATE_INTERNAL: append_token(str, state[1]); - break; + if (state[1] == STATE_CURRENT_ATTRIB) + append_index(str, state[2]); + break; default: _mesa_problem(NULL, "Invalid state in _mesa_program_state_string"); break; -- cgit v1.2.3 From 64e331eb529e66ef678804594c8a3266c97e645f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 15:56:45 -0600 Subject: mesa: new _NEW_PROGRAM_CONSTANTS flag This state flag will be used to indicate that vertex/fragment program constants have changed. _NEW_PROGRAM will be used to indicate changes to the vertex/fragment shader itself, or misc related state. _NEW_PROGRAM_CONSTANTS is also set whenever a program parameter that's tracking GL state has changed. For example, if the projection matrix is in the parameter list, calling glFrustum() will cause _NEW_PROGRAM_CONSTANTS to be set. This will let to remove the need for dynamic state atoms in some drivers. For now, we still set _NEW_PROGRAM in all the places we used to. We'll no longer set _NEW_PROGRAM in glUniform() after drivers/etc have been updated. --- src/mesa/main/mtypes.h | 1 + src/mesa/main/state.c | 36 +++++++++++++++++++++++++++++++++++- src/mesa/shader/arbprogram.c | 10 ++++------ src/mesa/shader/nvprogram.c | 2 +- src/mesa/shader/shader_api.c | 4 ++-- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3f31590000..30c7cca3b5 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2615,6 +2615,7 @@ struct gl_matrix_stack #define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */ +#define _NEW_PROGRAM_CONSTANTS 0x20000000 #define _NEW_ALL ~0 /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4f9088dd22..f18fc8f683 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -44,6 +44,7 @@ #include "pixel.h" #endif #include "shader/program.h" +#include "shader/prog_parameter.h" #include "state.h" #include "stencil.h" #include "texenvprogram.h" @@ -303,6 +304,36 @@ update_program(GLcontext *ctx) } +/** + * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0. + */ +static GLbitfield +update_program_constants(GLcontext *ctx) +{ + GLbitfield new_state = 0x0; + + if (ctx->FragmentProgram._Current) { + const struct gl_program_parameter_list *params = + ctx->FragmentProgram._Current->Base.Parameters; + if (params && params->StateFlags & ctx->NewState) { + new_state |= _NEW_PROGRAM_CONSTANTS; + } + } + + if (ctx->VertexProgram._Current) { + const struct gl_program_parameter_list *params = + ctx->VertexProgram._Current->Base.Parameters; + if (params && params->StateFlags & ctx->NewState) { + new_state |= _NEW_PROGRAM_CONSTANTS; + } + } + + return new_state; +} + + + + static void update_viewport_matrix(GLcontext *ctx) { @@ -554,6 +585,10 @@ _mesa_update_state_locked( GLcontext *ctx ) new_prog_state |= update_program( ctx ); } + + out: + new_prog_state |= update_program_constants(ctx); + /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. @@ -563,7 +598,6 @@ _mesa_update_state_locked( GLcontext *ctx ) * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ - out: new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 329c0ea0b0..981565ab8f 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -489,7 +489,7 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { @@ -537,7 +537,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GLfloat * dest; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)"); @@ -595,8 +595,6 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, { GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_FRAGMENT_PROGRAM_ARB @@ -633,7 +631,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, struct gl_program *prog; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if ((target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) || @@ -687,7 +685,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)"); diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 50358cf107..5142c2a4a5 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -706,7 +706,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); prog = _mesa_lookup_program(ctx, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 9038f7d1de..644cd39185 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1789,7 +1789,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); uniform = &shProg->Uniforms->Uniforms[location]; @@ -1929,7 +1929,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); uniform = &shProg->Uniforms->Uniforms[location]; -- cgit v1.2.3 From f4f39902fd0241162c06065e521151cd2572a34d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 16:47:30 -0600 Subject: st: do away with dynamic state atom for const buffers Just use the new _NEW_PROGRAM_CONSTANTS flag instead. --- src/mesa/state_tracker/st_atom.c | 23 ++--------------------- src/mesa/state_tracker/st_atom_constbuf.c | 10 ++-------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index f79092291b..ff7d388dde 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -37,11 +37,8 @@ -/* This is used to initialize st->atoms[]. We could use this list - * directly except for a single atom, st_update_constants, which has a - * .dirty value which changes according to the parameters of the - * current fragment and vertex programs, and so cannot be a static - * value. +/** + * This is used to initialize st->atoms[]. */ static const struct st_tracked_state *atoms[] = { @@ -67,25 +64,9 @@ static const struct st_tracked_state *atoms[] = void st_init_atoms( struct st_context *st ) { - GLuint i; - st->atoms = _mesa_malloc(sizeof(atoms)); st->nr_atoms = sizeof(atoms)/sizeof(*atoms); memcpy(st->atoms, atoms, sizeof(atoms)); - - /* Patch in a pointer to the dynamic state atom: - */ - for (i = 0; i < st->nr_atoms; i++) { - if (st->atoms[i] == &st_update_vs_constants) { - st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_VERTEX]; - st->atoms[i][0] = st_update_vs_constants; - } - - if (st->atoms[i] == &st_update_fs_constants) { - st->atoms[i] = &st->constants.tracked_state[PIPE_SHADER_FRAGMENT]; - st->atoms[i][0] = st_update_fs_constants; - } - } } diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index ec3605e4d6..c31b120ed1 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -62,12 +62,6 @@ void st_upload_constants( struct st_context *st, if (params && params->NumParameters) { const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4; - /* Update our own dependency flags. This works because this - * function will also be called whenever the program changes. - */ - st->constants.tracked_state[id].dirty.mesa = - (params->StateFlags | _NEW_PROGRAM); - _mesa_load_state_parameters(st->ctx, params); /* We always need to get a new buffer, to keep the drivers simple and @@ -111,7 +105,7 @@ static void update_vs_constants(struct st_context *st ) const struct st_tracked_state st_update_vs_constants = { "st_update_vs_constants", /* name */ { /* dirty */ - 0, /* set dynamically above */ /* mesa */ + _NEW_PROGRAM_CONSTANTS, ST_NEW_VERTEX_PROGRAM, /* st */ }, update_vs_constants /* update */ @@ -130,7 +124,7 @@ static void update_fs_constants(struct st_context *st ) const struct st_tracked_state st_update_fs_constants = { "st_update_fs_constants", /* name */ { /* dirty */ - 0, /* set dynamically above */ /* mesa */ + _NEW_PROGRAM_CONSTANTS, ST_NEW_FRAGMENT_PROGRAM, /* st */ }, update_fs_constants /* update */ -- cgit v1.2.3 From 3eeefa47d08c91e4d3c14343dd0cab1be4252b8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 16:50:34 -0600 Subject: st: use the static atoms[] array directly We can simplify this now that we no longer have any dynamic atoms. --- src/mesa/state_tracker/st_atom.c | 23 ++++++++--------------- src/mesa/state_tracker/st_context.h | 5 ----- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index ff7d388dde..ca15ce1b47 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -64,18 +64,13 @@ static const struct st_tracked_state *atoms[] = void st_init_atoms( struct st_context *st ) { - st->atoms = _mesa_malloc(sizeof(atoms)); - st->nr_atoms = sizeof(atoms)/sizeof(*atoms); - memcpy(st->atoms, atoms, sizeof(atoms)); + /* no-op */ } void st_destroy_atoms( struct st_context *st ) { - if (st->atoms) { - _mesa_free(st->atoms); - st->atoms = NULL; - } + /* no-op */ } @@ -153,8 +148,8 @@ void st_validate_state( struct st_context *st ) memset(&examined, 0, sizeof(examined)); prev = *state; - for (i = 0; i < st->nr_atoms; i++) { - const struct st_tracked_state *atom = st->atoms[i]; + for (i = 0; i < Elements(atoms); i++) { + const struct st_tracked_state *atom = atoms[i]; struct st_state_flags generated; // _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st); @@ -166,7 +161,7 @@ void st_validate_state( struct st_context *st ) } if (check_state(state, &atom->dirty)) { - st->atoms[i]->update( st ); + atoms[i]->update( st ); // _mesa_printf("after: %x\n", atom->dirty.mesa); } @@ -184,11 +179,9 @@ void st_validate_state( struct st_context *st ) } else { - const GLuint nr = st->nr_atoms; - - for (i = 0; i < nr; i++) { - if (check_state(state, &st->atoms[i]->dirty)) - st->atoms[i]->update( st ); + for (i = 0; i < Elements(atoms); i++) { + if (check_state(state, &atoms[i]->dirty)) + atoms[i]->update( st ); } } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index ae8c2978bf..f840579a40 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -116,11 +116,6 @@ struct st_context char vendor[100]; char renderer[100]; - /* State to be validated: - */ - struct st_tracked_state **atoms; - GLuint nr_atoms; - struct st_state_flags dirty; GLboolean missing_textures; -- cgit v1.2.3 From 7872b8e37e13719fbea71b3a92507eb00e7fc9db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 17:00:01 -0600 Subject: swrast: simplify state update logic for fragment shader const buffers --- src/mesa/swrast/s_context.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index a7eaf76a0a..f24f4fc59b 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -264,13 +264,7 @@ _swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState) { const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; if (fp) { -#if 0 - /* XXX Need a way to trigger the initial loading of parameters - * even when there's no recent state changes. - */ - if (fp->Base.Parameters->StateFlags & newState) -#endif - _mesa_load_state_parameters(ctx, fp->Base.Parameters); + _mesa_load_state_parameters(ctx, fp->Base.Parameters); } } @@ -524,13 +518,6 @@ _swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state ) new_state = ~0; } - { - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; - if (fp && (fp->Base.Parameters->StateFlags & new_state)) { - _mesa_load_state_parameters(ctx, fp->Base.Parameters); - } - } - if (new_state & swrast->InvalidateTriangleMask) swrast->Triangle = _swrast_validate_triangle; @@ -647,17 +634,7 @@ _swrast_validate_derived( GLcontext *ctx ) if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM)) _swrast_update_fog_state( ctx ); - if (swrast->NewState & (_NEW_MODELVIEW | - _NEW_PROJECTION | - _NEW_TEXTURE_MATRIX | - _NEW_FOG | - _NEW_LIGHT | - _NEW_LINE | - _NEW_TEXTURE | - _NEW_TRANSFORM | - _NEW_POINT | - _NEW_VIEWPORT | - _NEW_PROGRAM)) + if (swrast->NewState & (_NEW_PROGRAM_CONSTANTS | _NEW_PROGRAM)) _swrast_update_fragment_program( ctx, swrast->NewState ); if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM)) { -- cgit v1.2.3 From c1a3b852807fb160f0cd246c1364b7336b4b947e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 21 Apr 2009 17:00:54 -0600 Subject: st: play it safe for now and check _NEW_PROGRAM for shader const buffer atom When a new program is bound but no constants are updated we still need to update the Gallium const buffer. --- src/mesa/state_tracker/st_atom_constbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index c31b120ed1..77ecd0719e 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -124,7 +124,7 @@ static void update_fs_constants(struct st_context *st ) const struct st_tracked_state st_update_fs_constants = { "st_update_fs_constants", /* name */ { /* dirty */ - _NEW_PROGRAM_CONSTANTS, + (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ ST_NEW_FRAGMENT_PROGRAM, /* st */ }, update_fs_constants /* update */ -- cgit v1.2.3 From 009749b4a8c3ec54f47f3f85552e5ae275ab6ae6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Apr 2009 16:55:57 +0100 Subject: mesa: protect driver.flush() with FLUSH_CURRENT Need to do this to ensure vbo code unmaps its buffers before calling the driver, which may be sitting on top of a memory manager which objects to firing commands from a mapped buffer. --- src/mesa/main/context.c | 3 ++- src/mesa/main/fbobject.c | 13 ++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4cff36adfa..5726dbd983 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -187,7 +187,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256]; void _mesa_notifySwapBuffers(__GLcontext *ctx) { - FLUSH_VERTICES( ctx, 0 ); + FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Flush) { ctx->Driver.Flush(ctx); } @@ -1514,6 +1514,7 @@ _mesa_Flush(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Flush) { ctx->Driver.Flush(ctx); } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 151e29053a..9c5a5908a2 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -692,7 +692,7 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: */ @@ -1187,8 +1187,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); - + FLUSH_CURRENT(ctx, _NEW_BUFFERS); if (ctx->Driver.Flush) { ctx->Driver.Flush(ctx); } @@ -1269,7 +1268,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: */ @@ -1507,7 +1506,7 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, } } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: */ @@ -1688,7 +1687,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: */ @@ -1769,7 +1768,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, } } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: */ -- cgit v1.2.3 From f057f6543da469f231d551cb5728d98df8add4fa Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 20 Apr 2009 20:43:56 +0200 Subject: gallium: Reinstate unconditional flushes. Lost in commit e50dd26ca6d0eb0d0f97c2780020ea16e3d4a687. Signed-off-by: Thomas Hellstrom --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 ++ src/mesa/state_tracker/st_cb_readpixels.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 703b465574..08dc7c930e 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -906,6 +906,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, GLfloat *color; enum pipe_format srcFormat, texFormat; + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + st_validate_state(st); if (type == GL_STENCIL) { diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 85adcb785e..7a4bbf5ce3 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -357,6 +357,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (!dest) return; + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + if (format == GL_STENCIL_INDEX || format == GL_DEPTH_STENCIL) { st_read_stencil_pixels(ctx, x, y, width, height, -- cgit v1.2.3 From 7843243deedd66b0c94c8874e732ed7e8c6617ff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 07:58:25 -0600 Subject: st: also check _NEW_PROGRAM flag for vertex shader constant buffers This is a follow-on to commit c1a3b852807fb160f0cd246c1364b7336b4b947e. Note that (at this time) wherever _NEW_PROGRAM_CONSTANTS is set we're still setting _NEW_PROGRAM so this won't really make any difference (for now). --- src/mesa/state_tracker/st_atom_constbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 77ecd0719e..3ba7b26928 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -105,7 +105,7 @@ static void update_vs_constants(struct st_context *st ) const struct st_tracked_state st_update_vs_constants = { "st_update_vs_constants", /* name */ { /* dirty */ - _NEW_PROGRAM_CONSTANTS, + (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */ ST_NEW_VERTEX_PROGRAM, /* st */ }, update_vs_constants /* update */ -- cgit v1.2.3 From f48473e42511f8d37a239a07f791bc0a87209e5b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 08:59:47 -0600 Subject: r200/r300/r500: add _NEW_PROGRAM_CONSTANTS flag Make sure we detect constant buffer changes indicated by the new flag. Should be able to remove _NEW_PROGRAM (and _NEW_MODELVIEW, _NEW_LIGHT, etc) from several places (someday. --- src/mesa/drivers/dri/r200/r200_state.c | 3 ++- src/mesa/drivers/dri/r300/r300_fragprog.c | 3 ++- src/mesa/drivers/dri/r300/r300_state.c | 7 ++++--- src/mesa/drivers/dri/r300/r500_fragprog.c | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 2fcc87c0f5..28ba5f49bc 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2484,7 +2484,7 @@ void r200ValidateState( GLcontext *ctx ) r200UpdateDrawBuffer(ctx); } - if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM)) { + if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)) { r200UpdateTextureState( ctx ); new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */ r200UpdateLocalViewer( ctx ); @@ -2523,6 +2523,7 @@ void r200ValidateState( GLcontext *ctx ) } if (new_state & (_NEW_PROGRAM| + _NEW_PROGRAM_CONSTANTS | /* need to test for pretty much anything due to possible parameter bindings */ _NEW_MODELVIEW|_NEW_PROJECTION|_NEW_TRANSFORM| _NEW_LIGHT|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX| diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 873cde4414..2f45429cf2 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -470,7 +470,8 @@ void r300TranslateFragmentShader(r300ContextPtr r300, fp->translated = GL_TRUE; if (fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) r300FragmentProgramDump(fp, &fp->code); - r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); + r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM | + _NEW_PROGRAM_CONSTANTS); } update_params(r300, fp); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 8095538ff9..2589f09cc8 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1107,7 +1107,7 @@ void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state) struct gl_program_parameter_list *paramList; GLuint i; - if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM))) + if (!(new_state & (_NEW_BUFFERS | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))) return; fp = (struct r300_fragment_program *)ctx->FragmentProgram._Current; @@ -2355,11 +2355,12 @@ void r300UpdateShaders(r300ContextPtr rmesa) hw_tcl_on = future_hw_tcl_on = 0; r300ResetHwState(rmesa); - r300UpdateStateParameters(ctx, _NEW_PROGRAM); + r300UpdateStateParameters(ctx, _NEW_PROGRAM | + _NEW_PROGRAM_CONSTANTS); return; } } - r300UpdateStateParameters(ctx, _NEW_PROGRAM); + r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); } static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 292573de89..300559d0b4 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -501,7 +501,8 @@ void r500TranslateFragmentShader(r300ContextPtr r300, _mesa_reference_program(r300->radeon.glCtx, &compiler.program, 0); - r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM); + r300UpdateStateParameters(r300->radeon.glCtx, _NEW_PROGRAM | + _NEW_PROGRAM_CONSTANTS); if (RADEON_DEBUG & DEBUG_PIXEL) { if (fp->translated) { -- cgit v1.2.3 From 817dcdd280cd749c3186bd3f00c06f41270aa884 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:07:02 -0600 Subject: i965: use new _NEW_PROGRAM_CONSTANTS flag instead of dynamic flags --- src/mesa/drivers/dri/i965/brw_curbe.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 18b187ed1d..3c81899672 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -188,13 +188,6 @@ static void prepare_constant_buffer(struct brw_context *brw) GLfloat *buf; GLuint i; - /* Update our own dependency flags. This works because this - * function will also be called whenever fp or vp changes. - */ - brw->curbe.tracked_state.dirty.mesa = (_NEW_TRANSFORM|_NEW_PROJECTION); - brw->curbe.tracked_state.dirty.mesa |= vp->program.Base.Parameters->StateFlags; - brw->curbe.tracked_state.dirty.mesa |= fp->program.Base.Parameters->StateFlags; - if (sz == 0) { if (brw->curbe.last_buf) { free(brw->curbe.last_buf); @@ -422,7 +415,7 @@ static void emit_constant_buffer(struct brw_context *brw) */ const struct brw_tracked_state brw_constant_buffer = { .dirty = { - .mesa = (_NEW_TRANSFORM|_NEW_PROJECTION), /* plus fp and vp flags */ + .mesa = _NEW_PROGRAM_CONSTANTS, .brw = (BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_VERTEX_PROGRAM | BRW_NEW_URB_FENCE | /* Implicit - hardware requires this, not used above */ -- cgit v1.2.3 From 6b6a23c0f7e042d71764a2028f3d33b59076ac7c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:07:46 -0600 Subject: i965: updates to some debug code --- src/mesa/drivers/dri/i965/brw_curbe.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 3c81899672..da746e4aa0 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -352,11 +352,7 @@ update_constant_buffer(struct brw_context *brw, dri_bo_unmap(const_buffer); if (0) { - int i; - for (i = 0; i < params->NumParameters; i++) { - float *p = params->ParameterValues[i]; - printf("%d: %f %f %f %f\n", i, p[0], p[1], p[2], p[3]); - } + _mesa_print_parameter_list(params); } } } @@ -369,7 +365,7 @@ update_vertex_constant_buffer(struct brw_context *brw) struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; if (0) { - printf("update VS constants in buffer %p\n", vp->const_buffer); + printf("update VS constants in buffer %p vp = %p\n", vp->const_buffer, vp); printf("program %u\n", vp->program.Base.Id); } update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); @@ -382,6 +378,10 @@ update_fragment_constant_buffer(struct brw_context *brw) { struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; + if (0) { + printf("update WM constants in buffer %p\n", fp->const_buffer); + printf("program %u\n", fp->program.Base.Id); + } update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); } -- cgit v1.2.3 From 1dbab84e21cad81e971265db3dbc8dc6c344b340 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:14:16 -0600 Subject: i965: use _NEW_PROGRAM_CONSTANTS and always create new const buffers When program constants change we create a new VS constant buffer instead of re-using the old one. This allows us to have several const buffers in flight with vertex rendering. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 71840d1e4e..89c456e62c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -456,17 +456,14 @@ brw_update_vs_constant_surface( GLcontext *ctx, assert(surf == 0); - /* free old const buffer if too small */ - if (const_buffer && const_buffer->size < size) { - dri_bo_unreference(const_buffer); - const_buffer = NULL; - } + /* We always create a new VS constant buffer so that several can be + * in flight at a time. Free the old one first... + */ + dri_bo_unreference(const_buffer); - /* alloc new buffer if needed */ - if (!const_buffer) { - const_buffer = - drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64); - } + /* alloc new buffer */ + const_buffer = + drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64); memset(&key, 0, sizeof(key)); @@ -783,8 +780,7 @@ brw_vs_get_binding_table(struct brw_context *brw) /** - * Vertex shader surfaces. Just constant buffer for now. Could add vertex - * shader textures in the future. + * Vertex shader surfaces (constant buffer). */ static void prepare_vs_surfaces(struct brw_context *brw ) { @@ -820,8 +816,12 @@ prepare_surfaces(struct brw_context *brw) const struct brw_tracked_state brw_wm_surfaces = { .dirty = { - .mesa = _NEW_COLOR | _NEW_TEXTURE | _NEW_BUFFERS | _NEW_PROGRAM, - .brw = BRW_NEW_CONTEXT, + .mesa = (_NEW_COLOR | + _NEW_TEXTURE | + _NEW_BUFFERS | + _NEW_PROGRAM | + _NEW_PROGRAM_CONSTANTS), + .brw = (BRW_NEW_CONTEXT), .cache = 0 }, .prepare = prepare_surfaces, -- cgit v1.2.3 From a36dd5d54e3de5662c694e764d1c49795ddb6814 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:14:53 -0600 Subject: i915: check the new _NEW_PROGRAM_CONSTANT flag --- src/mesa/drivers/dri/i915/i915_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index fdd2cf6109..45ba2d14a5 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -73,7 +73,7 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state) p->params_uptodate = 0; } - if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM)) + if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)) i915_update_fog(ctx); } -- cgit v1.2.3 From e5681fc176bc43bc6c7804bd1e8d8557cdcab345 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:16:21 -0600 Subject: i965: add _NEW_PROGRAM_CONSTANTS to mesa_bits[] list --- src/mesa/drivers/dri/i965/brw_state_upload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 5de1450e61..197efeb1b7 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -218,6 +218,7 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_MULTISAMPLE), DEFINE_BIT(_NEW_TRACK_MATRIX), DEFINE_BIT(_NEW_PROGRAM), + DEFINE_BIT(_NEW_PROGRAM_CONSTANTS), {0, 0, 0} }; -- cgit v1.2.3 From f428255bde93a452a7cdd48fba21839c99beb6cb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 09:23:15 -0600 Subject: i965: the brw_constant_buffer state atom is no longer dynamic No more dynamic atoms so we can simplify the state validation code a little. --- src/mesa/drivers/dri/i965/brw_context.h | 7 ------- src/mesa/drivers/dri/i965/brw_state_upload.c | 31 +++++----------------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a0b3b06309..af9fef5e22 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -448,8 +448,6 @@ struct brw_context struct { struct brw_state_flags dirty; - struct brw_tracked_state **atoms; - GLuint nr_atoms; GLuint nr_color_regions; struct intel_region *color_regions[MAX_DRAW_BUFFERS]; @@ -553,11 +551,6 @@ struct brw_context GLuint vs_size; GLuint total_size; - /* Dynamic tracker which changes to reflect the state referenced - * by active fp and vp program parameters: - */ - struct brw_tracked_state tracked_state; - dri_bo *curbe_bo; /** Offset within curbe_bo of space for current curbe entry */ GLuint curbe_offset; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 197efeb1b7..491e2e2452 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -102,39 +102,18 @@ const struct brw_tracked_state *atoms[] = &brw_indices, &brw_vertices, - NULL, /* brw_constant_buffer */ + &brw_constant_buffer }; void brw_init_state( struct brw_context *brw ) { - GLuint i; - brw_init_cache(brw); - - brw->state.atoms = _mesa_malloc(sizeof(atoms)); - brw->state.nr_atoms = sizeof(atoms)/sizeof(*atoms); - _mesa_memcpy(brw->state.atoms, atoms, sizeof(atoms)); - - /* Patch in a pointer to the dynamic state atom: - */ - for (i = 0; i < brw->state.nr_atoms; i++) - if (brw->state.atoms[i] == NULL) - brw->state.atoms[i] = &brw->curbe.tracked_state; - - _mesa_memcpy(&brw->curbe.tracked_state, - &brw_constant_buffer, - sizeof(brw_constant_buffer)); } void brw_destroy_state( struct brw_context *brw ) { - if (brw->state.atoms) { - _mesa_free(brw->state.atoms); - brw->state.atoms = NULL; - } - brw_destroy_cache(brw); brw_destroy_batch_cache(brw); } @@ -337,7 +316,7 @@ void brw_validate_state( struct brw_context *brw ) /* do prepare stage for all atoms */ for (i = 0; i < Elements(atoms); i++) { - const struct brw_tracked_state *atom = brw->state.atoms[i]; + const struct brw_tracked_state *atom = atoms[i]; if (brw->intel.Fallback) break; @@ -368,8 +347,8 @@ void brw_upload_state(struct brw_context *brw) _mesa_memset(&examined, 0, sizeof(examined)); prev = *state; - for (i = 0; i < brw->state.nr_atoms; i++) { - const struct brw_tracked_state *atom = brw->state.atoms[i]; + for (i = 0; i < Elements(atoms); i++) { + const struct brw_tracked_state *atom = atoms[i]; struct brw_state_flags generated; assert(atom->dirty.mesa || @@ -398,7 +377,7 @@ void brw_upload_state(struct brw_context *brw) } else { for (i = 0; i < Elements(atoms); i++) { - const struct brw_tracked_state *atom = brw->state.atoms[i]; + const struct brw_tracked_state *atom = atoms[i]; if (brw->intel.Fallback) break; -- cgit v1.2.3 From 50853be894aa3edd1e9271f7d625f319209e340f Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 22 Apr 2009 17:37:18 +0200 Subject: intel: fix max anisotropy supported i915 actually supports up to 4 (according to header file - not tested), i965 up to 16 (code already handled this but slightly broken), so don't use 2 for all chips, even though angular dependency is very high. --- src/mesa/drivers/dri/i915/i830_context.c | 2 ++ src/mesa/drivers/dri/i915/i915_context.c | 2 ++ src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 2 +- src/mesa/drivers/dri/intel/intel_context.c | 2 -- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 10b9bf371c..840946f908 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -98,6 +98,8 @@ i830CreateContext(const __GLcontextModes * mesaVis, ctx->Const.MaxTextureRectSize = (1 << 11); ctx->Const.MaxTextureUnits = I830_TEX_UNITS; + ctx->Const.MaxTextureMaxAnisotropy = 2.0; + ctx->Const.MaxDrawBuffers = 1; _tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12, diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index fdd2cf6109..1f9f363df9 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -145,6 +145,8 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.MaxTextureRectSize = (1 << 11); ctx->Const.MaxTextureUnits = I915_TEX_UNITS; + ctx->Const.MaxTextureMaxAnisotropy = 4.0; + /* GL_ARB_fragment_program limits - don't think Mesa actually * validates programs against these, and in any case one ARB * instruction can translate to more than one HW instruction, so diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d96ff29310..4dbe551d83 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -118,6 +118,8 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxCubeTextureLevels = 12; ctx->Const.MaxTextureRectSize = (1<<12); + ctx->Const.MaxTextureMaxAnisotropy = 16.0; + /* if conformance mode is set, swrast can handle any size AA point */ ctx->Const.MaxPointSizeAA = 255.0; diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 1fc9f01372..c604ef0162 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -152,7 +152,7 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC; if (key->max_aniso > 2.0) { - sampler->ss3.max_aniso = MAX2((key->max_aniso - 2) / 2, + sampler->ss3.max_aniso = MIN2((key->max_aniso - 2) / 2, BRW_ANISORATIO_16); } } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 3436b8ecd3..9b628dbc8e 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -528,8 +528,6 @@ intelInitContext(struct intel_context *intel, } } - ctx->Const.MaxTextureMaxAnisotropy = 2.0; - /* This doesn't yet catch all non-conformant rendering, but it's a * start. */ -- cgit v1.2.3 From a071a8d2e72e52e6a8906448b171756c8920ce96 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 10:44:36 -0600 Subject: i965: remove unused state atom entries --- src/mesa/drivers/dri/i965/brw_state_upload.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 491e2e2452..20892cdf32 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -59,7 +59,6 @@ const struct brw_tracked_state *atoms[] = &brw_curbe_offsets, &brw_recalculate_urb_fence, - &brw_cc_vp, &brw_cc_unit, @@ -88,15 +87,8 @@ const struct brw_tracked_state *atoms[] = &brw_line_stipple, &brw_aa_line_parameters, - /* Ordering of the commands below is documented as fixed. - */ -#if 0 - &brw_pipelined_state_pointers, - &brw_urb_fence, - &brw_constant_buffer_state, -#else + &brw_psp_urb_cbs, -#endif &brw_drawing_rect, &brw_indices, -- cgit v1.2.3 From f9af97c7a5d81226a87d79baf8fb00231c96398d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:08:46 -0600 Subject: i965: checkpoint commit: use two state caches instead of one The new, second cache will only be used for surface-related items. Since we can create many surfaces the original, single cache could get filled quickly. When we cleared it, we had to regenerate shaders, etc. With two caches, we can avoid doing that. --- src/mesa/drivers/dri/i965/brw_context.h | 3 +- src/mesa/drivers/dri/i965/brw_state.h | 4 +- src/mesa/drivers/dri/i965/brw_state_cache.c | 122 ++++++++++++++++++--------- src/mesa/drivers/dri/i965/brw_state_upload.c | 4 +- 4 files changed, 88 insertions(+), 45 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index af9fef5e22..cad711d18a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -467,7 +467,8 @@ struct brw_context int validated_bo_count; } state; - struct brw_cache cache; + struct brw_cache cache; /** non-surface items */ + struct brw_cache surface_cache; /* surface items */ struct brw_cached_batch_item *cached_batch_items; struct { diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 81b0a45998..7ea2fc113c 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -135,8 +135,8 @@ dri_bo *brw_search_cache( struct brw_cache *cache, void *aux_return); void brw_state_cache_check_size( struct brw_context *brw ); -void brw_init_cache( struct brw_context *brw ); -void brw_destroy_cache( struct brw_context *brw ); +void brw_init_caches( struct brw_context *brw ); +void brw_destroy_caches( struct brw_context *brw ); /*********************************************************************** * brw_state_batch.c diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index d5b5166406..3b23a8b755 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -320,20 +320,20 @@ enum pool_type { }; static void -brw_init_cache_id( struct brw_context *brw, - const char *name, - enum brw_cache_id id, - GLuint key_size, - GLuint aux_size) +brw_init_cache_id(struct brw_cache *cache, + const char *name, + enum brw_cache_id id, + GLuint key_size, + GLuint aux_size) { - struct brw_cache *cache = &brw->cache; - cache->name[id] = strdup(name); cache->key_size[id] = key_size; cache->aux_size[id] = aux_size; } -void brw_init_cache( struct brw_context *brw ) + +static void +brw_init_non_surface_cache( struct brw_context *brw ) { struct brw_cache *cache = &brw->cache; @@ -342,114 +342,145 @@ void brw_init_cache( struct brw_context *brw ) cache->size = 7; cache->n_items = 0; cache->items = (struct brw_cache_item **) - _mesa_calloc(cache->size * - sizeof(struct brw_cache_item)); + _mesa_calloc(cache->size * sizeof(struct brw_cache_item)); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "CC_VP", BRW_CC_VP, sizeof(struct brw_cc_viewport), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "CC_UNIT", BRW_CC_UNIT, sizeof(struct brw_cc_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "WM_PROG", BRW_WM_PROG, sizeof(struct brw_wm_prog_key), sizeof(struct brw_wm_prog_data)); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SAMPLER_DEFAULT_COLOR", BRW_SAMPLER_DEFAULT_COLOR, sizeof(struct brw_sampler_default_color), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SAMPLER", BRW_SAMPLER, 0, /* variable key/data size */ 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "WM_UNIT", BRW_WM_UNIT, sizeof(struct brw_wm_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SF_PROG", BRW_SF_PROG, sizeof(struct brw_sf_prog_key), sizeof(struct brw_sf_prog_data)); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SF_VP", BRW_SF_VP, sizeof(struct brw_sf_viewport), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SF_UNIT", BRW_SF_UNIT, sizeof(struct brw_sf_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "VS_UNIT", BRW_VS_UNIT, sizeof(struct brw_vs_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "VS_PROG", BRW_VS_PROG, sizeof(struct brw_vs_prog_key), sizeof(struct brw_vs_prog_data)); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "CLIP_UNIT", BRW_CLIP_UNIT, sizeof(struct brw_clip_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "CLIP_PROG", BRW_CLIP_PROG, sizeof(struct brw_clip_prog_key), sizeof(struct brw_clip_prog_data)); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "GS_UNIT", BRW_GS_UNIT, sizeof(struct brw_gs_unit_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "GS_PROG", BRW_GS_PROG, sizeof(struct brw_gs_prog_key), sizeof(struct brw_gs_prog_data)); +#if 1 + brw_init_cache_id(cache, + "SS_SURFACE", + BRW_SS_SURFACE, + sizeof(struct brw_surface_state), + 0); + + brw_init_cache_id(cache, + "SS_SURF_BIND", + BRW_SS_SURF_BIND, + 0, + 0); +#endif +} + +static void +brw_init_surface_cache( struct brw_context *brw ) +{ + struct brw_cache *cache = &brw->surface_cache; - brw_init_cache_id(brw, + cache->brw = brw; + + cache->size = 7; + cache->n_items = 0; + cache->items = (struct brw_cache_item **) + _mesa_calloc(cache->size * sizeof(struct brw_cache_item)); + + brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE, sizeof(struct brw_surface_state), 0); - brw_init_cache_id(brw, + brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND, 0, 0); } +void brw_init_caches( struct brw_context *brw ) +{ + brw_init_non_surface_cache(brw); + brw_init_surface_cache(brw); +} + static void -brw_clear_cache( struct brw_context *brw ) +brw_clear_cache( struct brw_context *brw, struct brw_cache *cache ) { struct brw_cache_item *c, *next; GLuint i; @@ -457,8 +488,8 @@ brw_clear_cache( struct brw_context *brw ) if (INTEL_DEBUG & DEBUG_STATE) _mesa_printf("%s\n", __FUNCTION__); - for (i = 0; i < brw->cache.size; i++) { - for (c = brw->cache.items[i]; c; c = next) { + for (i = 0; i < cache->size; i++) { + for (c = cache->items[i]; c; c = next) { int j; next = c->next; @@ -468,10 +499,10 @@ brw_clear_cache( struct brw_context *brw ) free((void *)c->key); free(c); } - brw->cache.items[i] = NULL; + cache->items[i] = NULL; } - brw->cache.n_items = 0; + cache->n_items = 0; if (brw->curbe.last_buf) { _mesa_free(brw->curbe.last_buf); @@ -489,19 +520,30 @@ void brw_state_cache_check_size( struct brw_context *brw ) * 32k, so 1000 of them is around 1.5MB. */ if (brw->cache.n_items > 1000) - brw_clear_cache(brw); + brw_clear_cache(brw, &brw->cache); + + if (brw->surface_cache.n_items > 1000) + brw_clear_cache(brw, &brw->surface_cache); } -void brw_destroy_cache( struct brw_context *brw ) + +static void +brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache) { GLuint i; - brw_clear_cache(brw); + brw_clear_cache(brw, cache); for (i = 0; i < BRW_MAX_CACHE; i++) { - dri_bo_unreference(brw->cache.last_bo[i]); - free(brw->cache.name[i]); + dri_bo_unreference(cache->last_bo[i]); + free(cache->name[i]); } - free(brw->cache.items); - brw->cache.items = NULL; - brw->cache.size = 0; + free(cache->items); + cache->items = NULL; + cache->size = 0; +} + +void brw_destroy_caches( struct brw_context *brw ) +{ + brw_destroy_cache(brw, &brw->cache); + brw_destroy_cache(brw, &brw->surface_cache); } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 20892cdf32..2641bcb2aa 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -100,13 +100,13 @@ const struct brw_tracked_state *atoms[] = void brw_init_state( struct brw_context *brw ) { - brw_init_cache(brw); + brw_init_caches(brw); } void brw_destroy_state( struct brw_context *brw ) { - brw_destroy_cache(brw); + brw_destroy_caches(brw); brw_destroy_batch_cache(brw); } -- cgit v1.2.3 From 4843e54fc69daf379dea9899673b3df92b44049c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:12:07 -0600 Subject: i965: actually use the new, second surface state cache --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 39 +++++++++++++----------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 89c456e62c..74f3f1791e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -268,7 +268,7 @@ brw_create_texture_surface( struct brw_context *brw, surf.ss0.cube_neg_z = 1; } - bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, + bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE, key, sizeof(*key), &key->bo, key->bo ? 1 : 0, &surf, sizeof(surf), @@ -321,10 +321,11 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) key.tiling = intelObj->mt->region->tiling; dri_bo_unreference(brw->wm.surf_bo[surf]); - brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, - &key, sizeof(key), - &key.bo, key.bo ? 1 : 0, - NULL); + brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); if (brw->wm.surf_bo[surf] == NULL) { brw->wm.surf_bo[surf] = brw_create_texture_surface(brw, &key); } @@ -362,7 +363,7 @@ brw_create_constant_surface( struct brw_context *brw, surf.ss3.pitch = (key->pitch * key->cpp) - 1; /* ignored?? */ brw_set_surface_tiling(&surf, key->tiling); /* tiling now allowed */ - bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, + bo = brw_upload_cache(&brw->surface_cache, BRW_SS_SURFACE, key, sizeof(*key), &key->bo, key->bo ? 1 : 0, &surf, sizeof(surf), @@ -427,7 +428,8 @@ brw_update_wm_constant_surface( GLcontext *ctx, */ dri_bo_unreference(brw->wm.surf_bo[surf]); - brw->wm.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + brw->wm.surf_bo[surf] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, &key, sizeof(key), &key.bo, key.bo ? 1 : 0, NULL); @@ -484,7 +486,8 @@ brw_update_vs_constant_surface( GLcontext *ctx, */ dri_bo_unreference(brw->vs.surf_bo[surf]); - brw->vs.surf_bo[surf] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, + brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, &key, sizeof(key), &key.bo, key.bo ? 1 : 0, NULL); @@ -563,10 +566,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw, dri_bo_unreference(brw->wm.surf_bo[unit]); brw->wm.surf_bo[unit] = NULL; if (cached) - brw->wm.surf_bo[unit] = brw_search_cache(&brw->cache, BRW_SS_SURFACE, - &key, sizeof(key), - ®ion_bo, 1, - NULL); + brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, + &key, sizeof(key), + ®ion_bo, 1, + NULL); if (brw->wm.surf_bo[unit] == NULL) { struct brw_surface_state surf; @@ -591,7 +595,8 @@ brw_update_renderbuffer_surface(struct brw_context *brw, surf.ss0.writedisable_alpha = !key.color_mask[3]; /* Key size will never match key size for textures, so we're safe. */ - brw->wm.surf_bo[unit] = brw_upload_cache(&brw->cache, BRW_SS_SURFACE, + brw->wm.surf_bo[unit] = brw_upload_cache(&brw->surface_cache, + BRW_SS_SURFACE, &key, sizeof(key), ®ion_bo, 1, &surf, sizeof(surf), @@ -623,7 +628,7 @@ brw_wm_get_binding_table(struct brw_context *brw) assert(brw->wm.nr_surfaces <= BRW_WM_MAX_SURF); - bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND, + bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND, NULL, 0, brw->wm.surf_bo, brw->wm.nr_surfaces, NULL); @@ -639,7 +644,7 @@ brw_wm_get_binding_table(struct brw_context *brw) else data[i] = 0; - bind_bo = brw_upload_cache( &brw->cache, BRW_SS_SURF_BIND, + bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND, NULL, 0, brw->wm.surf_bo, brw->wm.nr_surfaces, data, data_size, @@ -739,7 +744,7 @@ brw_vs_get_binding_table(struct brw_context *brw) assert(brw->vs.nr_surfaces <= BRW_VS_MAX_SURF); - bind_bo = brw_search_cache(&brw->cache, BRW_SS_SURF_BIND, + bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND, NULL, 0, brw->vs.surf_bo, brw->vs.nr_surfaces, NULL); @@ -755,7 +760,7 @@ brw_vs_get_binding_table(struct brw_context *brw) else data[i] = 0; - bind_bo = brw_upload_cache( &brw->cache, BRW_SS_SURF_BIND, + bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND, NULL, 0, brw->vs.surf_bo, brw->vs.nr_surfaces, data, data_size, -- cgit v1.2.3 From fa92756400ccfbb3f0201df634feb45ab4f98352 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 18:16:03 +0100 Subject: mesa: Fix buffer overflow when parsing generic vertex attributes. --- src/mesa/shader/arbprogparse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index b47bf360cf..c7a031067e 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1513,10 +1513,16 @@ generic_attrib_check(struct var_cache *vc_head) curr = vc_head; while (curr) { if (curr->type == vt_attrib) { - if (curr->attrib_is_generic) - genericAttrib[ curr->attrib_binding ] = GL_TRUE; - else + if (curr->attrib_is_generic) { + GLuint attr = (curr->attrib_binding == 0) + ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0); + assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + genericAttrib[attr] = GL_TRUE; + } + else { + assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS); explicitAttrib[ curr->attrib_binding ] = GL_TRUE; + } } curr = curr->next; -- cgit v1.2.3 From c0c58cf5cfc11b9256287871660cc16966e662ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:28:24 -0600 Subject: i965: comments, reformatting --- src/mesa/drivers/dri/i965/brw_state_cache.c | 55 ++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 3b23a8b755..cbae68798c 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -56,9 +56,9 @@ * incorrect program is run for the other instance. */ +#include "main/imports.h" #include "brw_state.h" #include "intel_batchbuffer.h" -#include "main/imports.h" /* XXX: Fixme - have to include these to get the sizes of the prog_key * structs: @@ -69,8 +69,10 @@ #include "brw_sf.h" #include "brw_gs.h" -static GLuint hash_key( const void *key, GLuint key_size, - dri_bo **reloc_bufs, GLuint nr_reloc_bufs) + +static GLuint +hash_key(const void *key, GLuint key_size, + dri_bo **reloc_bufs, GLuint nr_reloc_bufs) { GLuint *ikey = (GLuint *)key; GLuint hash = 0, i; @@ -95,6 +97,7 @@ static GLuint hash_key( const void *key, GLuint key_size, return hash; } + /** * Marks a new buffer as being chosen for the given cache id. */ @@ -111,6 +114,7 @@ update_cache_last(struct brw_cache *cache, enum brw_cache_id cache_id, cache->brw->state.dirty.cache |= 1 << cache_id; } + static struct brw_cache_item * search_cache(struct brw_cache *cache, enum brw_cache_id cache_id, GLuint hash, const void *key, GLuint key_size, @@ -143,7 +147,8 @@ search_cache(struct brw_cache *cache, enum brw_cache_id cache_id, } -static void rehash( struct brw_cache *cache ) +static void +rehash(struct brw_cache *cache) { struct brw_cache_item **items; struct brw_cache_item *c, *next; @@ -164,15 +169,17 @@ static void rehash( struct brw_cache *cache ) cache->size = size; } + /** * Returns the buffer object matching cache_id and key, or NULL. */ -dri_bo *brw_search_cache( struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *key, - GLuint key_size, - dri_bo **reloc_bufs, GLuint nr_reloc_bufs, - void *aux_return ) +dri_bo * +brw_search_cache(struct brw_cache *cache, + enum brw_cache_id cache_id, + const void *key, + GLuint key_size, + dri_bo **reloc_bufs, GLuint nr_reloc_bufs, + void *aux_return) { struct brw_cache_item *item; GLuint hash = hash_key(key, key_size, reloc_bufs, nr_reloc_bufs); @@ -192,6 +199,7 @@ dri_bo *brw_search_cache( struct brw_cache *cache, return item->bo; } + dri_bo * brw_upload_cache( struct brw_cache *cache, enum brw_cache_id cache_id, @@ -265,7 +273,9 @@ brw_upload_cache( struct brw_cache *cache, return bo; } -/* This doesn't really work with aux data. Use search/upload instead + +/** + * This doesn't really work with aux data. Use search/upload instead */ dri_bo * brw_cache_data_sz(struct brw_cache *cache, @@ -296,6 +306,7 @@ brw_cache_data_sz(struct brw_cache *cache, return bo; } + /** * Wrapper around brw_cache_data_sz using the cache_id's canonical key size. * @@ -319,6 +330,7 @@ enum pool_type { DW_GENERAL_STATE }; + static void brw_init_cache_id(struct brw_cache *cache, const char *name, @@ -333,7 +345,7 @@ brw_init_cache_id(struct brw_cache *cache, static void -brw_init_non_surface_cache( struct brw_context *brw ) +brw_init_non_surface_cache(struct brw_context *brw) { struct brw_cache *cache = &brw->cache; @@ -433,6 +445,7 @@ brw_init_non_surface_cache( struct brw_context *brw ) BRW_GS_PROG, sizeof(struct brw_gs_prog_key), sizeof(struct brw_gs_prog_data)); + #if 1 brw_init_cache_id(cache, "SS_SURFACE", @@ -448,8 +461,9 @@ brw_init_non_surface_cache( struct brw_context *brw ) #endif } + static void -brw_init_surface_cache( struct brw_context *brw ) +brw_init_surface_cache(struct brw_context *brw) { struct brw_cache *cache = &brw->surface_cache; @@ -473,14 +487,17 @@ brw_init_surface_cache( struct brw_context *brw ) 0); } -void brw_init_caches( struct brw_context *brw ) + +void +brw_init_caches(struct brw_context *brw) { brw_init_non_surface_cache(brw); brw_init_surface_cache(brw); } + static void -brw_clear_cache( struct brw_context *brw, struct brw_cache *cache ) +brw_clear_cache(struct brw_context *brw, struct brw_cache *cache) { struct brw_cache_item *c, *next; GLuint i; @@ -514,7 +531,9 @@ brw_clear_cache( struct brw_context *brw, struct brw_cache *cache ) brw->state.dirty.cache |= ~0; } -void brw_state_cache_check_size( struct brw_context *brw ) + +void +brw_state_cache_check_size(struct brw_context *brw) { /* un-tuned guess. We've got around 20 state objects for a total of around * 32k, so 1000 of them is around 1.5MB. @@ -542,7 +561,9 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache) cache->size = 0; } -void brw_destroy_caches( struct brw_context *brw ) + +void +brw_destroy_caches(struct brw_context *brw) { brw_destroy_cache(brw, &brw->cache); brw_destroy_cache(brw, &brw->surface_cache); -- cgit v1.2.3 From 21a422d97e501f4ca68ab24ad3fe5f5eb1393349 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:29:49 -0600 Subject: i965: remove old code to init surface-related cache IDs These types are only found in the new surface state cache now. --- src/mesa/drivers/dri/i965/brw_state_cache.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index cbae68798c..320d886c99 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -445,20 +445,6 @@ brw_init_non_surface_cache(struct brw_context *brw) BRW_GS_PROG, sizeof(struct brw_gs_prog_key), sizeof(struct brw_gs_prog_data)); - -#if 1 - brw_init_cache_id(cache, - "SS_SURFACE", - BRW_SS_SURFACE, - sizeof(struct brw_surface_state), - 0); - - brw_init_cache_id(cache, - "SS_SURF_BIND", - BRW_SS_SURF_BIND, - 0, - 0); -#endif } -- cgit v1.2.3 From 5c8fb6acc10662c9e71078c9f273db6c7808e9ff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:47:59 -0600 Subject: i965: define BRW_MAX_GRF --- src/mesa/drivers/dri/i965/brw_context.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index cad711d18a..f0d4993e11 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -243,6 +243,9 @@ struct brw_vs_ouput_sizes { }; +/** Number of general purpose registers (VS, WM, etc) */ +#define BRW_MAX_GRF 128 + /** Number of texture sampler units */ #define BRW_MAX_TEX_UNIT 16 -- cgit v1.2.3 From ac22178eb049126003db40b0a77a111498a12ab7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 11:52:16 -0600 Subject: i965: enable VS constant buffers In the VS constants can now be handled in two different ways: 1. If there's room in the GRF, put constants there. They're preloaded from the CURBE prior to VS execution. This is the historical approach. The problem is the GRF may not have room for all the shader's constants and temps and misc registers. Hence... 2. Use a separate constant buffer which is read from using a READ message. This allows a very large number of constants and frees up GRF regs for shader temporaries. This is the new approach. May be a little slower than 1. 1 vs. 2 is chosen according to how many constants and temps the shader needs. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 524f1211ce..1da5a3f502 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -69,13 +69,17 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) { GLuint i, reg = 0, mrf; -#if 0 - if (c->vp->program.Base.Parameters->NumParameters >= 6) - c->use_const_buffer = 1; + /* Determine whether to use a real constant buffer or use a block + * of GRF registers for constants. The later is faster but only + * works if everything fits in the GRF. + * XXX this heuristic/check may need some fine tuning... + */ + if (c->vp->program.Base.Parameters->NumParameters + + c->vp->program.Base.NumTemporaries + 20 > BRW_MAX_GRF) + c->use_const_buffer = GL_TRUE; else -#endif c->use_const_buffer = GL_FALSE; - /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ + printf("use_const_buffer = %d\n", c->use_const_buffer); /* r0 -- reserved as usual */ -- cgit v1.2.3 From ebfbd8c4fef78e3cd9604660e5bb96e3c6df07e5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 13:46:58 -0600 Subject: i965: disable debug printf --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 1da5a3f502..c2b3702798 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -79,7 +79,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) c->use_const_buffer = GL_TRUE; else c->use_const_buffer = GL_FALSE; - printf("use_const_buffer = %d\n", c->use_const_buffer); + /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ /* r0 -- reserved as usual */ -- cgit v1.2.3 From 8ee6ab6acb8f89fbc87865751573fcbffb4695ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 15:02:01 -0600 Subject: mesa: fix _mesa_dump_textures(), add null ptr check Calling _mesa_dump_textures() deleted the textures... oops!!! --- src/mesa/main/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index fdd10dd307..2eabcdaf49 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -3,6 +3,7 @@ * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -262,7 +263,7 @@ static void write_texture_image(struct gl_texture_object *texObj) { const struct gl_texture_image *img = texObj->Image[0][0]; - if (img) { + if (img && img->Data) { char s[100]; /* make filename */ @@ -338,5 +339,5 @@ _mesa_dump_textures(GLboolean dumpImages) { GET_CURRENT_CONTEXT(ctx); DumpImages = dumpImages; - _mesa_HashDeleteAll(ctx->Shared->TexObjects, dump_texture_cb, ctx); + _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx); } -- cgit v1.2.3 From 984f2bb629bb742c6d11d4c8434a2cb32a5b8b75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 15:10:36 -0600 Subject: st: comments, license, copyright --- src/mesa/state_tracker/st_inlines.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h index 0322d5dfa6..a41cfeb96f 100644 --- a/src/mesa/state_tracker/st_inlines.h +++ b/src/mesa/state_tracker/st_inlines.h @@ -1,3 +1,35 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * Functions for checking if buffers/textures are referenced when we need + * to read/write from/to them. Flush when needed. + */ + #ifndef ST_INLINES_H #define ST_INLINES_H -- cgit v1.2.3 From c5a97eda32d37de7d1154288bf4298dff3542551 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 15:12:22 -0600 Subject: gallium: license, copyright --- src/gallium/auxiliary/util/u_linear.c | 31 +++++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_linear.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/src/gallium/auxiliary/util/u_linear.c b/src/gallium/auxiliary/util/u_linear.c index 6be365e53b..a1dce3f5cf 100644 --- a/src/gallium/auxiliary/util/u_linear.c +++ b/src/gallium/auxiliary/util/u_linear.c @@ -1,3 +1,34 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * Functions for converting tiled data to linear and vice versa. + */ + #include "util/u_debug.h" #include "u_linear.h" diff --git a/src/gallium/auxiliary/util/u_linear.h b/src/gallium/auxiliary/util/u_linear.h index 1589f029bc..b74308ffa3 100644 --- a/src/gallium/auxiliary/util/u_linear.h +++ b/src/gallium/auxiliary/util/u_linear.h @@ -1,3 +1,34 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * Functions for converting tiled data to linear and vice versa. + */ + #ifndef U_LINEAR_H #define U_LINEAR_H -- cgit v1.2.3 From 725d50601c2c010ce427a23a6e023f79df8a3a22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 16:38:04 -0600 Subject: mesa: fix comment typo --- src/mesa/main/pixel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 52781e048e..57ae9c721a 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -819,7 +819,7 @@ update_image_transfer_state(GLcontext *ctx) /** - * Update meas pixel transfer derived state. + * Update mesa pixel transfer derived state. */ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) { -- cgit v1.2.3 From 6b0c9366a3f13d74c00666cb7c26b65732f6b1aa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Apr 2009 16:41:05 -0600 Subject: mesa: minor state-update changes in histogram code Call FLUSH_VERTICES() in _mesa_Histogram(). No need to signal _NEW_PIXEL in ResetHistogram(), ResetMinmax(). --- src/mesa/main/histogram.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 905c1ad830..5fee4fd0e3 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -975,6 +975,8 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s } } + FLUSH_VERTICES(ctx, _NEW_PIXEL); + /* reset histograms */ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { ctx->Histogram.Count[i][0] = 0; @@ -1002,8 +1004,6 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s ctx->Histogram.AlphaSize = 8 * sizeof(GLuint); ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint); } - - ctx->NewState |= _NEW_PIXEL; } @@ -1058,8 +1058,6 @@ _mesa_ResetHistogram(GLenum target) ctx->Histogram.Count[i][2] = 0; ctx->Histogram.Count[i][3] = 0; } - - ctx->NewState |= _NEW_PIXEL; } @@ -1083,7 +1081,6 @@ _mesa_ResetMinmax(GLenum target) ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; - ctx->NewState |= _NEW_PIXEL; } -- cgit v1.2.3 From 17ee25ba6f846d08521f22c5ec2a6e59a5383cf4 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 23 Apr 2009 12:17:28 +0100 Subject: gallium: Fix up xorg state tracker build. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 2 -- src/gallium/state_trackers/xorg/xorg_exa.c | 1 - 2 files changed, 3 deletions(-) diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index d04204e1bf..0d29b1e572 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -85,7 +85,6 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; - template.compressed = 0; template.format = PIPE_FORMAT_S8Z24_UNORM; pf_get_block(template.format, &template.block); template.width[0] = pDraw->width; @@ -98,7 +97,6 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) struct pipe_texture template; memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; - template.compressed = 0; template.format = PIPE_FORMAT_A8R8G8B8_UNORM; pf_get_block(template.format, &template.block); template.width[0] = pDraw->width; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 56c8fdccb2..ee61de1ea7 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -425,7 +425,6 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; - template.compressed = 0; exa_get_pipe_format(depth, &template.format, &bitsPerPixel); pf_get_block(template.format, &template.block); template.width[0] = width; -- cgit v1.2.3 From 49ba80dff335226a54dae60477b256384005b393 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 23 Apr 2009 12:20:22 +0100 Subject: gallium: Always include xorg-server.h before other X server headers. Various breakage otherwise, e.g. _XSERVER64 not being defined on 64 bit leading to inconsistent definitions of X server internal structs. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 1 + src/gallium/state_trackers/xorg/xorg_exa.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 0d29b1e572..401bd39dac 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -28,6 +28,7 @@ * */ +#include "xorg-server.h" #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index ee61de1ea7..d743e1e300 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -28,6 +28,7 @@ * */ +#include "xorg-server.h" #include "xf86.h" #include "xorg_tracker.h" -- cgit v1.2.3 From 13cb8264d81f09ce046c73fd751596572d13512e Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 23 Apr 2009 12:57:46 +0100 Subject: gallium/intel/gem: Use softpipe rather than i915simple if INTEL_SOFTPIPE is set. --- src/gallium/drivers/softpipe/sp_texture.c | 19 +++++++++++++++++++ src/gallium/drivers/softpipe/sp_winsys.h | 6 ++++++ src/gallium/winsys/drm/intel/gem/intel_be_context.c | 14 ++++++++------ src/gallium/winsys/drm/intel/gem/intel_be_device.c | 7 ++++++- src/gallium/winsys/drm/intel/xorg/Makefile | 3 ++- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index c0113c47ad..9e19745889 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -399,3 +399,22 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->transfer_map = softpipe_transfer_map; screen->transfer_unmap = softpipe_transfer_unmap; } + + +boolean +softpipe_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ) +{ + struct softpipe_texture *tex = (struct softpipe_texture *)texture; + + if (!tex) + return FALSE; + + pipe_buffer_reference(buf, tex->buffer); + + if (stride) + *stride = tex->stride[0]; + + return TRUE; +} diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index cf91e7782b..9e571862b7 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -52,6 +52,12 @@ struct pipe_screen * softpipe_create_screen(struct pipe_winsys *); +boolean +softpipe_get_texture_buffer( struct pipe_texture *texture, + struct pipe_buffer **buf, + unsigned *stride ); + + #ifdef __cplusplus } #endif diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c index bb6f1b916c..cfe8c88466 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c @@ -1,6 +1,8 @@ #include "pipe/p_screen.h" +#include "softpipe/sp_winsys.h" + #include "intel_be_device.h" #include "intel_be_context.h" #include "intel_be_batchbuffer.h" @@ -106,13 +108,13 @@ intel_be_create_context(struct pipe_screen *screen) intel_be_init_context(intel, device); -#if 0 - pipe = intel_create_softpipe(intel, screen->winsys); -#else - pipe = i915_create_context(screen, &device->base, &intel->base); -#endif + if (getenv("INTEL_SOFTPIPE")) + pipe = softpipe_create(screen); + else + pipe = i915_create_context(screen, &device->base, &intel->base); - pipe->priv = intel; + if (pipe) + pipe->priv = intel; return pipe; } diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 0f6300323b..8979f0ae15 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -10,6 +10,7 @@ #include "intel_be_fence.h" #include "i915simple/i915_winsys.h" +#include "softpipe/sp_winsys.h" #include "intel_be_api.h" @@ -302,7 +303,11 @@ intel_be_create_screen(int drmFD, int deviceID) intel_be_init_device(dev, drmFD, deviceID); - screen = i915_create_screen(&dev->base, deviceID); + if (getenv("INTEL_SOFTPIPE")) { + screen = softpipe_create_screen(&dev->base); + drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer; + } else + screen = i915_create_screen(&dev->base, deviceID); return screen; } diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile index a45ca570db..b1b6b9362b 100644 --- a/src/gallium/winsys/drm/intel/xorg/Makefile +++ b/src/gallium/winsys/drm/intel/xorg/Makefile @@ -21,6 +21,7 @@ LIBS = \ $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \ $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) ############################################# @@ -29,7 +30,7 @@ LIBS = \ all default: $(TARGET) -$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a +$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS) $(TOP)/bin/mklib -noprefix -o $@ \ $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel -- cgit v1.2.3 From e0da812c5bdb7ffdd3450f614a4b73e44cd7feca Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 23 Apr 2009 13:19:56 +0100 Subject: gallium: Make the intel xorg winsys start up with any Intel chipset. For unsupported devices the screen/context creation should fail cleanly later on. --- src/gallium/winsys/drm/intel/xorg/intel_xorg.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c index aea39247e5..46a7971f60 100644 --- a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c +++ b/src/gallium/winsys/drm/intel/xorg/intel_xorg.c @@ -37,20 +37,17 @@ static Bool intel_xorg_pci_probe(DriverPtr driver, intptr_t match_data); static const struct pci_id_match intel_xorg_device_match[] = { - {0x8086, 0x2592, 0xffff, 0xffff, 0, 0, 0}, - {0x8086, 0x27A2, 0xffff, 0xffff, 0, 0, 0}, + {0x8086, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0}, {0, 0, 0}, }; static SymTabRec intel_xorg_chipsets[] = { - {0x2592, "Intel Graphics Device"}, - {0x27A2, "Intel Graphics Device"}, + {PCI_MATCH_ANY, "Intel Graphics Device"}, {-1, NULL} }; static PciChipsets intel_xorg_pci_devices[] = { - {0x2592, 0x2592, RES_SHARED_VGA}, - {0x27A2, 0x27A2, RES_SHARED_VGA}, + {PCI_MATCH_ANY, PCI_MATCH_ANY, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED} }; -- cgit v1.2.3 From f3c7d6ff866cdd96cdd55baee94f58698a9656a3 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 23 Apr 2009 14:47:31 +0100 Subject: gallium: Handle non-NULL data pointer in EXA ModifyPixmapHeader hook. Need to use the data pointed to for pixmap contents in that case. Fixes RENDER based text rendering. --- src/gallium/state_trackers/xorg/xorg_exa.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index d743e1e300..7913174354 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -37,6 +37,8 @@ #include "pipe/p_state.h" #include "pipe/p_inlines.h" +#include "util/u_rect.h" + struct exa_entity { ExaDriverPtr pExa; @@ -436,6 +438,18 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, priv->tex = exa->scrn->texture_create(exa->scrn, &template); } + if (pPixData) { + struct pipe_transfer *transfer = + exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, + PIPE_TRANSFER_WRITE, + 0, 0, width, height); + pipe_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer), + &priv->tex->block, transfer->stride, 0, 0, + width, height, pPixData, pPixmap->devKind, 0, 0); + exa->scrn->transfer_unmap(exa->scrn, transfer); + exa->scrn->tex_transfer_destroy(transfer); + } + return TRUE; } -- cgit v1.2.3 From 4f4907d69f9020ce17aef21b6431d2dd65e01982 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 22 Apr 2009 16:24:42 -0700 Subject: intel: Take advantage of GL_READ_ONLY_ARB to map to GEM bo_map write flag. This is a CPU win in general, but in particular reduces the pain of Mesa's calculation of min/max indices in DrawElements (wtf?). --- src/mesa/drivers/dri/i965/brw_curbe.c | 4 ++-- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 18b187ed1d..03371564e1 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -353,10 +353,10 @@ update_constant_buffer(struct brw_context *brw, assert(const_buffer); assert(const_buffer->size >= size); - dri_bo_map(const_buffer, GL_TRUE); + drm_intel_gem_bo_map_gtt(const_buffer); map = const_buffer->virtual; memcpy(map, params->ParameterValues, size); - dri_bo_unmap(const_buffer); + drm_intel_gem_bo_unmap_gtt(const_buffer); if (0) { int i; diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index b7c7eeb368..c849e4869e 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -204,9 +204,8 @@ intel_bufferobj_map(GLcontext * ctx, { struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); + GLboolean read_only = (access == GL_READ_ONLY_ARB); - /* XXX: Translate access to flags arg below: - */ assert(intel_obj); if (intel_obj->region) @@ -217,7 +216,7 @@ intel_bufferobj_map(GLcontext * ctx, return NULL; } - dri_bo_map(intel_obj->buffer, GL_TRUE); + dri_bo_map(intel_obj->buffer, !read_only); obj->Pointer = intel_obj->buffer->virtual; return obj->Pointer; } -- cgit v1.2.3 From 8374379572d1c541a804990bc926108360f67c02 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 23 Apr 2009 09:37:55 -0700 Subject: i965: Support drawing to FBO cube faces other than positive X. Also fixes drawing to 3D texture depth levels. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 71840d1e4e..805df8a4af 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -520,6 +520,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, GLubyte color_mask[4]; GLboolean color_blend; uint32_t tiling; + uint32_t draw_offset; } key; memset(&key, 0, sizeof(key)); @@ -550,6 +551,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.height = region->height; key.pitch = region->pitch; key.cpp = region->cpp; + key.draw_offset = region->draw_offset; /* cur 3d or cube face offset */ } else { key.surface_type = BRW_SURFACE_NULL; key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; @@ -557,6 +559,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.width = 1; key.height = 1; key.cpp = 4; + key.draw_offset = 0; } memcpy(key.color_mask, ctx->Color.ColorMask, sizeof(key.color_mask)); @@ -578,8 +581,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, surf.ss0.surface_format = key.surface_format; surf.ss0.surface_type = key.surface_type; + surf.ss1.base_addr = key.draw_offset; if (region_bo != NULL) - surf.ss1.base_addr = region_bo->offset; /* reloc */ + surf.ss1.base_addr += region_bo->offset; /* reloc */ surf.ss2.width = key.width - 1; surf.ss2.height = key.height - 1; @@ -604,12 +608,12 @@ brw_update_renderbuffer_surface(struct brw_context *brw, * them both. We might be able to figure out from other state * a more restrictive relocation to emit. */ - dri_bo_emit_reloc(brw->wm.surf_bo[unit], - I915_GEM_DOMAIN_RENDER, - I915_GEM_DOMAIN_RENDER, - 0, - offsetof(struct brw_surface_state, ss1), - region_bo); + drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit], + offsetof(struct brw_surface_state, ss1), + region_bo, + key.draw_offset, + I915_GEM_DOMAIN_RENDER, + I915_GEM_DOMAIN_RENDER); } } } -- cgit v1.2.3 From ae69a046505d8c94cd3a59a9376310a904c35b3c Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 23 Apr 2009 21:55:25 +0200 Subject: i915: fix fix for anisotropic filtering forgot to commit the changes to actually support 4x aniso filtering... --- src/mesa/drivers/dri/i915/i915_texstate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 43f65392b5..a37dd7f4fb 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -132,7 +132,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) struct intel_texture_object *intelObj = intel_texture_object(tObj); struct gl_texture_image *firstImage; GLuint *state = i915->state.Tex[unit], format, pitch; - GLint lodbias; + GLint lodbias, aniso = 0; GLubyte border[4]; memset(state, 0, sizeof(state)); @@ -230,6 +230,10 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) if (tObj->MaxAnisotropy > 1.0) { minFilt = FILTER_ANISOTROPIC; magFilt = FILTER_ANISOTROPIC; + if (tObj->MaxAnisotropy > 2.0) + aniso = SS2_MAX_ANISO_4; + else + aniso = SS2_MAX_ANISO_2; } else { switch (tObj->MagFilter) { @@ -275,7 +279,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) state[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) | (mipFilt << SS2_MIP_FILTER_SHIFT) | - (magFilt << SS2_MAG_FILTER_SHIFT)); + (magFilt << SS2_MAG_FILTER_SHIFT) | + aniso); } { -- cgit v1.2.3 From a9a363f8298e9d534e60e3d2869f8677138a1e7e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 23 Apr 2009 17:41:23 -0600 Subject: i965: revert part of commit 4f4907d69f9020ce17aef21b6431d2dd65e01982 The drm_intel_gem_bo_map_gtt() call that replaced dri_bo_map() is producing errors like: intel_bufmgr_gem.c:689: Error preparing buffer map 39 (vp_const_buffer): Invalid argument . and returning NULL, causing a segfault in the memcpy(). Just reverting until we can get to the root issue... --- src/mesa/drivers/dri/i965/brw_curbe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 03371564e1..18b187ed1d 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -353,10 +353,10 @@ update_constant_buffer(struct brw_context *brw, assert(const_buffer); assert(const_buffer->size >= size); - drm_intel_gem_bo_map_gtt(const_buffer); + dri_bo_map(const_buffer, GL_TRUE); map = const_buffer->virtual; memcpy(map, params->ParameterValues, size); - drm_intel_gem_bo_unmap_gtt(const_buffer); + dri_bo_unmap(const_buffer); if (0) { int i; -- cgit v1.2.3 From 1d0039959302fddd560dc7f9642f312e588cce0e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 23 Apr 2009 17:54:34 -0600 Subject: mesa: more informative error messages --- src/mesa/main/texparam.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 515a35cdfc..e60ab6aa12 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -69,7 +69,7 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) return GL_TRUE; } - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", wrap ); return GL_FALSE; } @@ -209,7 +209,8 @@ set_tex_parameteri(GLcontext *ctx, } /* fall-through */ default: - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", + params[0] ); } return GL_FALSE; @@ -223,7 +224,8 @@ set_tex_parameteri(GLcontext *ctx, texObj->MagFilter = params[0]; return GL_TRUE; default: - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param=0x%x)", + params[0]); } return GL_FALSE; @@ -262,7 +264,8 @@ set_tex_parameteri(GLcontext *ctx, return GL_FALSE; if (params[0] < 0 || (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexParameter(param=%d)", params[0]); return GL_FALSE; } flush(ctx, texObj); @@ -273,7 +276,8 @@ set_tex_parameteri(GLcontext *ctx, if (texObj->MaxLevel == params[0]) return GL_FALSE; if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexParameter(param=%d)", params[0]); return GL_FALSE; } flush(ctx, texObj); @@ -340,7 +344,7 @@ set_tex_parameteri(GLcontext *ctx, } } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); } return GL_FALSE; -- cgit v1.2.3 From ff71587b27beaf288d535e14c75e58425d7efc7a Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 23 Apr 2009 23:41:41 +0200 Subject: i965: fix point size issue need to clamp point size to user set min/max values, even for constant point size. Fixes glean pointAtten test. --- src/mesa/drivers/dri/i965/brw_sf_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index fc4eddda0a..68fa9820b6 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -147,7 +147,7 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key) key->line_smooth = ctx->Line.SmoothFlag; key->point_sprite = ctx->Point.PointSprite; - key->point_size = ctx->Point.Size; + key->point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize); key->point_attenuated = ctx->Point._Attenuated; key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0; -- cgit v1.2.3 From 510a44eea799f2370b79e5da532b3004e94bb005 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Apr 2009 19:49:29 +0100 Subject: tests/mipmap_view: add a bunch of keystrokes for testing render-to-texture Move between mipmaps, render a triangle, reload textures with either the original arch (and GenMipmaps) or via straightforward glTexImage. --- progs/tests/mipmap_view.c | 267 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 219 insertions(+), 48 deletions(-) diff --git a/progs/tests/mipmap_view.c b/progs/tests/mipmap_view.c index 85fc67ac79..808d348699 100644 --- a/progs/tests/mipmap_view.c +++ b/progs/tests/mipmap_view.c @@ -18,12 +18,27 @@ #define TEXTURE_FILE "../images/arch.rgb" -static int TexWidth = 256, TexHeight = 256; +#define LEVELS 8 +#define SIZE (1< Date: Wed, 22 Apr 2009 15:19:44 +0100 Subject: demos/readpix: add option to draw triangle instead of drawpix --- progs/demos/readpix.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c index c0aac2272f..bbb3a68eff 100644 --- a/progs/demos/readpix.c +++ b/progs/demos/readpix.c @@ -17,6 +17,7 @@ #define IMAGE_FILE "../images/girl.rgb" static int ImgWidth, ImgHeight; +static int WinWidth, WinHeight; static GLenum ImgFormat; static GLubyte *Image = NULL; @@ -27,6 +28,7 @@ static int CPosX, CPosY; /* copypixels */ static GLboolean DrawFront = GL_FALSE; static GLboolean ScaleAndBias = GL_FALSE; static GLboolean Benchmark = GL_FALSE; +static GLboolean Triangle = GL_FALSE; static GLubyte *TempImage = NULL; #define COMBO 1 @@ -150,11 +152,60 @@ Display( void ) /* draw original image */ glRasterPos2i(APosX, 5); PrintString("Original"); - glRasterPos2i(APosX, APosY); - glEnable(GL_DITHER); - SetupPixelTransfer(GL_FALSE); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); + if (!Triangle) { + glRasterPos2i(APosX, APosY); + glEnable(GL_DITHER); + SetupPixelTransfer(GL_FALSE); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image); + } + else { + float z = 0; + + glViewport(APosX, APosY, ImgWidth, ImgHeight); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); + glDisable(GL_CULL_FACE); + + /* Red should never be seen + */ + glBegin(GL_POLYGON); + glColor3f(1,0,0); + glVertex3f(-2, -2, z); + glVertex3f(-2, 2, z); + glVertex3f(2, 2, z); + glVertex3f(2, -2, z); + glEnd(); + + /* Blue background + */ + glBegin(GL_POLYGON); + glColor3f(.5,.5,1); + glVertex3f(-1, -1, z); + glVertex3f(-1, 1, z); + glVertex3f(1, 1, z); + glVertex3f(1, -1, z); + glEnd(); + + /* Triangle + */ + glBegin(GL_TRIANGLES); + glColor3f(.8,0,0); + glVertex3f(-0.9, -0.9, z); + glColor3f(0,.9,0); + glVertex3f( 0.9, -0.9, z); + glColor3f(0,0,.7); + glVertex3f( 0.0, 0.9, z); + glEnd(); + + glColor3f(1,1,1); + + glViewport( 0, 0, WinWidth, WinHeight ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, WinWidth, 0.0, WinHeight, -1.0, 1.0 ); + } /* might try alignment=4 here for testing */ glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -218,6 +269,9 @@ Display( void ) static void Reshape( int width, int height ) { + WinWidth = width; + WinHeight = height; + glViewport( 0, 0, width, height ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); @@ -236,6 +290,9 @@ Key( unsigned char key, int x, int y ) case 'b': Benchmark = GL_TRUE; break; + case 't': + Triangle = !Triangle; + break; case 's': ScaleAndBias = !ScaleAndBias; break; -- cgit v1.2.3 From f4a286e5f5ac11b2e5266ef39db5d1d1cb5f77ce Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 23 Apr 2009 05:42:26 +0200 Subject: util: Add more entry points for dumping to bmp --- src/gallium/auxiliary/util/u_debug.c | 56 ++++++++++++++++++++++++------------ src/gallium/auxiliary/util/u_debug.h | 5 ++++ 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index ae47a274a6..18597ef839 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -721,6 +721,7 @@ void debug_dump_surface_bmp(const char *filename, struct pipe_surface *surface) { +#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT struct pipe_transfer *transfer; struct pipe_texture *texture = surface->texture; struct pipe_screen *screen = texture->screen; @@ -733,6 +734,7 @@ debug_dump_surface_bmp(const char *filename, debug_dump_transfer_bmp(filename, transfer); screen->tex_transfer_destroy(transfer); +#endif } void @@ -740,32 +742,56 @@ debug_dump_transfer_bmp(const char *filename, struct pipe_transfer *transfer) { #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT - struct util_stream *stream; - struct bmp_file_header bmfh; - struct bmp_info_header bmih; float *rgba; - unsigned x, y; if (!transfer) goto error1; rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float)); + if(!rgba) + goto error1; + + pipe_get_tile_rgba(transfer, 0, 0, + transfer->width, transfer->height, + rgba); + + debug_dump_float_rgba_bmp(filename, + transfer->width, transfer->height, + rgba, transfer->width); + + FREE(rgba); +error1: + ; +#endif +} + +void +debug_dump_float_rgba_bmp(const char *filename, + unsigned width, unsigned height, + float *rgba, unsigned stride) +{ +#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT + struct util_stream *stream; + struct bmp_file_header bmfh; + struct bmp_info_header bmih; + unsigned x, y; + if(!rgba) goto error1; bmfh.bfType = 0x4d42; - bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4; + bmfh.bfSize = 14 + 40 + height*width*4; bmfh.bfReserved1 = 0; bmfh.bfReserved2 = 0; bmfh.bfOffBits = 14 + 40; bmih.biSize = 40; - bmih.biWidth = transfer->width; - bmih.biHeight = transfer->height; + bmih.biWidth = width; + bmih.biHeight = height; bmih.biPlanes = 1; bmih.biBitCount = 32; bmih.biCompression = 0; - bmih.biSizeImage = transfer->height*transfer->width*4; + bmih.biSizeImage = height*width*4; bmih.biXPelsPerMeter = 0; bmih.biYPelsPerMeter = 0; bmih.biClrUsed = 0; @@ -773,19 +799,15 @@ debug_dump_transfer_bmp(const char *filename, stream = util_stream_create(filename, bmfh.bfSize); if(!stream) - goto error2; + goto error1; util_stream_write(stream, &bmfh, 14); util_stream_write(stream, &bmih, 40); - pipe_get_tile_rgba(transfer, 0, 0, - transfer->width, transfer->height, - rgba); - - y = transfer->height; + y = height; while(y--) { - float *ptr = rgba + (transfer->width * y * 4); - for(x = 0; x < transfer->width; ++x) + float *ptr = rgba + (stride * y * 4); + for(x = 0; x < width; ++x) { struct bmp_rgb_quad pixel; pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]); @@ -797,8 +819,6 @@ debug_dump_transfer_bmp(const char *filename, } util_stream_close(stream); -error2: - FREE(rgba); error1: ; #endif diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 8d703e47fc..bcd8f0f3cf 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -347,10 +347,15 @@ void debug_dump_surface_bmp(const char *filename, struct pipe_surface *surface); void debug_dump_transfer_bmp(const char *filename, struct pipe_transfer *transfer); +void debug_dump_float_rgba_bmp(const char *filename, + unsigned width, unsigned height, + float *rgba, unsigned stride); #else #define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0) #define debug_dump_surface(prefix, surface) ((void)0) #define debug_dump_surface_bmp(filename, surface) ((void)0) +#define debug_dump_transfer_bmp(filename, transfer) ((void)0) +#define debug_dump_rgba_float_bmp(filename, width, height, rgba, stride) ((void)0) #endif -- cgit v1.2.3 From a86ef37655c25e0e5a7cb0e41ba7b1c2dcdc1a90 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Apr 2009 12:16:29 +0100 Subject: shadowtex: fflush stdout for cygwin --- progs/demos/shadowtex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c index f10a01ec26..dc5a4bbc48 100644 --- a/progs/demos/shadowtex.c +++ b/progs/demos/shadowtex.c @@ -788,6 +788,7 @@ Key(unsigned char key, int x, int y) exit(0); break; } + fflush(stdout); glutPostRedisplay(); } @@ -1014,6 +1015,7 @@ PrintHelp(void) printf(" + cursor keys = rotate light source\n"); if (HaveEXTshadowFuncs) printf(" o = cycle through comparison modes\n"); + fflush(stdout); } -- cgit v1.2.3 From 29d9abf72d73c4ccd3ad605f68ab1adf5e13c67a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Apr 2009 12:43:04 +0100 Subject: pipebuffer: don't fail when validating mapped buffers This can be almost impossible to avoid - hopefully we won't encounter a situation where this is a true requirement. Would probably require drivers to flush between hardware and software vertex processing. --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 2cd0b8a8cd..044e8e1dd3 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -365,21 +365,22 @@ fenced_buffer_validate(struct pb_buffer *buf, if(fenced_buf->vl && fenced_buf->vl != vl) return PIPE_ERROR_RETRY; +#if 0 /* Do not validate if buffer is still mapped */ if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) { /* TODO: wait for the thread that mapped the buffer to unmap it */ return PIPE_ERROR_RETRY; } + /* Final sanity checking */ + assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE)); + assert(!fenced_buf->mapcount); +#endif if(fenced_buf->vl == vl && (fenced_buf->validation_flags & flags) == flags) { /* Nothing to do -- buffer already validated */ return PIPE_OK; } - - /* Final sanity checking */ - assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE)); - assert(!fenced_buf->mapcount); ret = pb_validate(fenced_buf->buffer, vl, flags); if (ret != PIPE_OK) -- cgit v1.2.3 From 5dec94696e67ca5a1d008530cbfea90f03aeff16 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Apr 2009 15:03:23 +0200 Subject: r300: emit cliprect when in dri2 mode --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index c575c9ac49..850ba37022 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -215,6 +215,7 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) uint32_t cbpitch; uint32_t offset = r300->radeon.state.color.draw_offset; uint32_t dw = 6; + int i; rrb = radeon_get_colorbuffer(&r300->radeon); if (!rrb || !rrb->bo) { @@ -250,6 +251,17 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) OUT_BATCH((rrb->width << R300_SCISSORS_X_SHIFT) | (rrb->height << R300_SCISSORS_Y_SHIFT)); END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(16); + for (i = 0; i < 4; i++) { + OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); + OUT_BATCH((0 << R300_CLIPRECT_X_SHIFT) | (0 << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH((rrb->width << R300_CLIPRECT_X_SHIFT) | (rrb->height << R300_CLIPRECT_Y_SHIFT)); + } + OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); + OUT_BATCH(0xAAAA); + OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); + OUT_BATCH(0xffffff); + END_BATCH(); } else { BEGIN_BATCH_NO_AUTOSTATE(3); OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); @@ -258,6 +270,17 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) OUT_BATCH(((rrb->width + R300_SCISSORS_OFFSET) << R300_SCISSORS_X_SHIFT) | ((rrb->height + R300_SCISSORS_OFFSET) << R300_SCISSORS_Y_SHIFT)); END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(16); + for (i = 0; i < 4; i++) { + OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); + OUT_BATCH((1088 << R300_CLIPRECT_X_SHIFT) | (1088 << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((1088 + rrb->width) << R300_CLIPRECT_X_SHIFT) | ((1088 + rrb->height) << R300_CLIPRECT_Y_SHIFT)); + } + OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); + OUT_BATCH(0xAAAA); + OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); + OUT_BATCH(0xffffff); + END_BATCH(); } } } -- cgit v1.2.3 From 027ed1b505a1bf6e3f5ad4412734d7edf337c08b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 09:43:44 -0600 Subject: mesa: signal _NEW_PROGRAM_CONSTANTS instead of _NEW_PROGRAM Use _NEW_PROGRAM_CONSTANTS when changing constant/uniform buffer values. Binding a new program/shader sets both _NEW_PROGRAM and _NEW_PROGRAM_CONSTANTS. --- src/mesa/shader/arbprogram.c | 13 +++++++------ src/mesa/shader/nvprogram.c | 2 +- src/mesa/shader/shader_api.c | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 981565ab8f..317d623a22 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -74,8 +74,6 @@ _mesa_BindProgram(GLenum target, GLuint id) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - /* Error-check target and get curProg */ if ((target == GL_VERTEX_PROGRAM_ARB) && /* == GL_VERTEX_PROGRAM_NV */ (ctx->Extensions.NV_vertex_program || @@ -132,6 +130,9 @@ _mesa_BindProgram(GLenum target, GLuint id) return; } + /* signal new program (and its new constants) */ + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + /* bind newProg */ if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */ _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, @@ -489,7 +490,7 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { @@ -537,7 +538,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GLfloat * dest; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)"); @@ -631,7 +632,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, struct gl_program *prog; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if ((target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) || @@ -685,7 +686,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)"); diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 5142c2a4a5..8ba521182b 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -706,7 +706,7 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); prog = _mesa_lookup_program(ctx, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 644cd39185..8f414a0889 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1487,7 +1487,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if (program) { shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram"); @@ -1789,7 +1789,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); uniform = &shProg->Uniforms->Uniforms[location]; @@ -1929,7 +1929,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); uniform = &shProg->Uniforms->Uniforms[location]; -- cgit v1.2.3 From b2a69ae879a3ddb1f0ca1ea184ba24587cf25786 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 24 Apr 2009 16:44:58 +0100 Subject: demos: ensure display lists are destroyed for next generation --- progs/xdemos/glxcontexts.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/progs/xdemos/glxcontexts.c b/progs/xdemos/glxcontexts.c index a9ff326ed5..a97b62a908 100644 --- a/progs/xdemos/glxcontexts.c +++ b/progs/xdemos/glxcontexts.c @@ -385,6 +385,10 @@ draw( Display *dpy, Window win ) } else do_draw(); + glDeleteLists(gear1, 1); + glDeleteLists(gear2, 1); + glDeleteLists(gear3, 1); + glXSwapBuffers(dpy, win); glXDestroyContext(dpy, ctx); } -- cgit v1.2.3 From 3321b6984ecd96ba466d8d010e390fff71a799d7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 09:50:11 -0600 Subject: i965: use drm_intel_gem_bo_map/unmap_gtt() when possible, otherwise dri_bo_subdata() This wraps up the unfinished business from commit a9a363f8298e9d534e60e3d2869f8677138a1e7e --- src/mesa/drivers/dri/i965/brw_curbe.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 18b187ed1d..2d15793078 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -344,19 +344,23 @@ update_constant_buffer(struct brw_context *brw, const struct gl_program_parameter_list *params, dri_bo *const_buffer) { + struct intel_context *intel = &brw->intel; const int size = params->NumParameters * 4 * sizeof(GLfloat); /* copy Mesa program constants into the buffer */ if (const_buffer && size > 0) { - GLubyte *map; assert(const_buffer); assert(const_buffer->size >= size); - dri_bo_map(const_buffer, GL_TRUE); - map = const_buffer->virtual; - memcpy(map, params->ParameterValues, size); - dri_bo_unmap(const_buffer); + if (intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(const_buffer); + memcpy(const_buffer->virtual, params->ParameterValues, size); + drm_intel_gem_bo_unmap_gtt(const_buffer); + } + else { + dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); + } if (0) { int i; -- cgit v1.2.3 From 1c9786894cc3ce66665ca507a6daf6a829e5af89 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 10:46:40 -0600 Subject: mesa: fix up error/warning/debug output newlines As of commit 23ad86cfb91c294ce85a3116d4b825aaa3988a6e all messages go through output_if_debug(). Add new parameter to output_if_debug() to indicate whether to emit a newline. _mesa_warning() and _mesa_error() calls should not end their strings with \n. _mesa_debug() calls should end their text with \n. --- src/mesa/main/context.c | 2 +- src/mesa/main/imports.c | 35 ++++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5726dbd983..4469c8e1fa 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -434,7 +434,7 @@ one_time_init( GLcontext *ctx ) } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - _mesa_debug(ctx, "Mesa %s DEBUG build %s %s", + _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", MESA_VERSION_STRING, __DATE__, __TIME__); #endif diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 2ac93a5237..8797f36695 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -980,7 +980,8 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args ) /*@{*/ static void -output_if_debug(const char *prefixString, const char *outputString) +output_if_debug(const char *prefixString, const char *outputString, + GLboolean newline) { static int debug = -1; @@ -1004,16 +1005,19 @@ output_if_debug(const char *prefixString, const char *outputString) /* Now only print the string if we're required to do so. */ if (debug) { - fprintf(stderr, "%s: %s\n", prefixString, outputString); + fprintf(stderr, "%s: %s", prefixString, outputString); + if (newline) + fprintf(stderr, "\n"); } } + /** * Report a warning (a recoverable error condition) to stderr if * either DEBUG is defined or the MESA_DEBUG env var is set. * * \param ctx GL context. - * \param fmtString printf() alike format string. + * \param fmtString printf()-like format string. */ void _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) @@ -1025,11 +1029,12 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) (void) vsnprintf( str, MAXSTRING, fmtString, args ); va_end( args ); - output_if_debug("Mesa warning", str); + output_if_debug("Mesa warning", str, GL_TRUE); } + /** - * Report an internla implementation problem. + * Report an internal implementation problem. * Prints the message to stderr via fprintf(). * * \param ctx GL context. @@ -1050,8 +1055,9 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); } + /** - * Record an OpenGL state error. These usually occur when the users + * Record an OpenGL state error. These usually occur when the user * passes invalid parameters to a GL function. * * If debugging is enabled (either at compile-time via the DEBUG macro, or @@ -1123,11 +1129,22 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) errstr = "unknown"; break; } - _mesa_debug(ctx, "User error: %s in %s\n", errstr, where); + + { + char s[MAXSTRING], s2[MAXSTRING]; + va_list args; + va_start(args, fmtString); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end(args); + + snprintf(s2, MAXSTRING, "%s in %s", errstr, s); + output_if_debug("Mesa: User error", s2, GL_TRUE); + } } _mesa_record_error(ctx, error); -} +} + /** * Report debug information. Print error message to stderr via fprintf(). @@ -1145,7 +1162,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) va_start(args, fmtString); vsnprintf(s, MAXSTRING, fmtString, args); va_end(args); - output_if_debug("Mesa", s); + output_if_debug("Mesa", s, GL_FALSE); #endif /* DEBUG */ (void) ctx; (void) fmtString; -- cgit v1.2.3 From 32d185eb60ea7d0d1a67429055f7544129d52276 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 24 Apr 2009 19:54:01 +0200 Subject: r300: fix cliprect values --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 850ba37022..4c6108cc63 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -248,14 +248,14 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) BEGIN_BATCH_NO_AUTOSTATE(3); OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); OUT_BATCH(0); - OUT_BATCH((rrb->width << R300_SCISSORS_X_SHIFT) | - (rrb->height << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH(((rrb->width - 1) << R300_SCISSORS_X_SHIFT) | + ((rrb->height - 1) << R300_SCISSORS_Y_SHIFT)); END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(16); for (i = 0; i < 4; i++) { OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); OUT_BATCH((0 << R300_CLIPRECT_X_SHIFT) | (0 << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH((rrb->width << R300_CLIPRECT_X_SHIFT) | (rrb->height << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((rrb->width - 1) << R300_CLIPRECT_X_SHIFT) | ((rrb->height - 1) << R300_CLIPRECT_Y_SHIFT)); } OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); OUT_BATCH(0xAAAA); @@ -267,14 +267,15 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); OUT_BATCH((R300_SCISSORS_OFFSET << R300_SCISSORS_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_SCISSORS_Y_SHIFT)); - OUT_BATCH(((rrb->width + R300_SCISSORS_OFFSET) << R300_SCISSORS_X_SHIFT) | - ((rrb->height + R300_SCISSORS_OFFSET) << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH(((rrb->width + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_X_SHIFT) | + ((rrb->height + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_Y_SHIFT)); END_BATCH(); BEGIN_BATCH_NO_AUTOSTATE(16); for (i = 0; i < 4; i++) { OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); - OUT_BATCH((1088 << R300_CLIPRECT_X_SHIFT) | (1088 << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH(((1088 + rrb->width) << R300_CLIPRECT_X_SHIFT) | ((1088 + rrb->height) << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH((R300_SCISSORS_OFFSET << R300_CLIPRECT_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((R300_SCISSORS_OFFSET + rrb->width - 1) << R300_CLIPRECT_X_SHIFT) | + ((R300_SCISSORS_OFFSET + rrb->height - 1) << R300_CLIPRECT_Y_SHIFT)); } OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); OUT_BATCH(0xAAAA); -- cgit v1.2.3 From d8d7b2c3955fa2204bb031fea17afae994de79f7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 20 Apr 2009 20:52:56 -0700 Subject: DRI2: Implement protocol for DRI2GetBuffersWithFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- src/glx/x11/dri2.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/glx/x11/dri2.h | 10 ++++++++ 2 files changed, 80 insertions(+) diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c index f967432b99..ebb2985924 100644 --- a/src/glx/x11/dri2.c +++ b/src/glx/x11/dri2.c @@ -39,6 +39,16 @@ #include "xf86drm.h" #include "dri2.h" +/* Allow the build to work with an older versions of dri2proto.h and + * dri2tokens.h. + */ +#if DRI2_MINOR < 1 +#undef DRI2_MINOR +#define DRI2_MINOR 1 +#define X_DRI2GetBuffersWithFormat 7 +#endif + + static char dri2ExtensionName[] = DRI2_NAME; static XExtensionInfo *dri2Info; static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info) @@ -276,6 +286,66 @@ DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable, return buffers; } + +DRI2Buffer *DRI2GetBuffersWithFormat(Display *dpy, XID drawable, + int *width, int *height, + unsigned int *attachments, int count, + int *outCount) +{ + XExtDisplayInfo *info = DRI2FindDisplay(dpy); + xDRI2GetBuffersReply rep; + xDRI2GetBuffersReq *req; + DRI2Buffer *buffers; + xDRI2Buffer repBuffer; + CARD32 *p; + int i; + + XextCheckExtension (dpy, info, dri2ExtensionName, False); + + LockDisplay(dpy); + GetReqExtra(DRI2GetBuffers, count * (4 * 2), req); + req->reqType = info->codes->major_opcode; + req->dri2ReqType = X_DRI2GetBuffersWithFormat; + req->drawable = drawable; + req->count = count; + p = (CARD32 *) &req[1]; + for (i = 0; i < (count * 2); i++) + p[i] = attachments[i]; + + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + *width = rep.width; + *height = rep.height; + *outCount = rep.count; + + buffers = Xmalloc(rep.count * sizeof buffers[0]); + if (buffers == NULL) { + _XEatData(dpy, rep.count * sizeof repBuffer); + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + for (i = 0; i < rep.count; i++) { + _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer); + buffers[i].attachment = repBuffer.attachment; + buffers[i].name = repBuffer.name; + buffers[i].pitch = repBuffer.pitch; + buffers[i].cpp = repBuffer.cpp; + buffers[i].flags = repBuffer.flags; + } + + UnlockDisplay(dpy); + SyncHandle(); + + return buffers; +} + + void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region, CARD32 dest, CARD32 src) { diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h index 356c6bcb55..b0e61f80d7 100644 --- a/src/glx/x11/dri2.h +++ b/src/glx/x11/dri2.h @@ -63,6 +63,16 @@ DRI2GetBuffers(Display *dpy, XID drawable, unsigned int *attachments, int count, int *outCount); +/** + * \note + * This function is only supported with DRI2 version 1.1 or later. + */ +extern DRI2Buffer * +DRI2GetBuffersWithFormat(Display *dpy, XID drawable, + int *width, int *height, + unsigned int *attachments, int count, + int *outCount); + extern void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region, CARD32 dest, CARD32 src); -- cgit v1.2.3 From dbf87f23126cc869637575e9ea2cb58774efe888 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 20 Apr 2009 20:55:56 -0700 Subject: DRI2: Implement interface for drivers to access DRI2GetBuffersWithFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- include/GL/internal/dri_interface.h | 28 +++++++++- src/glx/x11/dri2_glx.c | 104 +++++++++++++++++++++++++++++------- 2 files changed, 112 insertions(+), 20 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 335bf62a80..bfa8a33b3c 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -649,6 +649,7 @@ struct __DRIswrastExtensionRec { #define __DRI_BUFFER_ACCUM 6 #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 */ struct __DRIbufferRec { unsigned int attachment; @@ -659,7 +660,7 @@ struct __DRIbufferRec { }; #define __DRI_DRI2_LOADER "DRI_DRI2Loader" -#define __DRI_DRI2_LOADER_VERSION 2 +#define __DRI_DRI2_LOADER_VERSION 3 struct __DRIdri2LoaderExtensionRec { __DRIextension base; @@ -680,6 +681,31 @@ struct __DRIdri2LoaderExtensionRec { * into __DRIdri2ExtensionRec::createNewDrawable */ void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); + + + /** + * Get list of buffers from the server + * + * Gets a list of buffer for the specified set of attachments. Unlike + * \c ::getBuffers, this function takes a list of attachments paired with + * opaque \c unsigned \c int value describing the format of the buffer. + * It is the responsibility of the caller to know what the service that + * allocates the buffers will expect to receive for the format. + * + * \param driDrawable Drawable whose buffers are being queried. + * \param width Output where the width of the buffers is stored. + * \param height Output where the height of the buffers is stored. + * \param attachments List of pairs of attachment ID and opaque format + * requested for the drawable. + * \param count Number of attachment / format pairs stored in + * \c attachments. + * \param loaderPrivate Loader's private data that was previously passed + * into __DRIdri2ExtensionRec::createNewDrawable. + */ + __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate); }; /** diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index b6eeb913b6..fb31898db2 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -47,6 +47,9 @@ #include "dri2.h" #include "dri_common.h" +#undef DRI2_MINOR +#define DRI2_MINOR 1 + typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate; @@ -289,30 +292,25 @@ static void dri2DestroyScreen(__GLXscreenConfigs *psc) psc->__driScreen = NULL; } -static __DRIbuffer * -dri2GetBuffers(__DRIdrawable *driDrawable, - int *width, int *height, - unsigned int *attachments, int count, - int *out_count, void *loaderPrivate) +/** + * Process list of buffer received from the server + * + * Processes the list of buffers received in a reply from the server to either + * \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat. + */ +static void +process_buffers(__GLXDRIdrawablePrivate *pdraw, DRI2Buffer *buffers, + unsigned count) { - __GLXDRIdrawablePrivate *pdraw = loaderPrivate; - DRI2Buffer *buffers; int i; - buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable, - width, height, attachments, count, out_count); - if (buffers == NULL) - return NULL; - - pdraw->width = *width; - pdraw->height = *height; - pdraw->bufferCount = *out_count; + pdraw->bufferCount = count; pdraw->have_fake_front = 0; pdraw->have_back = 0; /* This assumes the DRI2 buffer attachment tokens matches the * __DRIbuffer tokens. */ - for (i = 0; i < *out_count; i++) { + for (i = 0; i < count; i++) { pdraw->buffers[i].attachment = buffers[i].attachment; pdraw->buffers[i].name = buffers[i].name; pdraw->buffers[i].pitch = buffers[i].pitch; @@ -324,6 +322,51 @@ dri2GetBuffers(__DRIdrawable *driDrawable, pdraw->have_back = 1; } +} + +static __DRIbuffer * +dri2GetBuffers(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate) +{ + __GLXDRIdrawablePrivate *pdraw = loaderPrivate; + DRI2Buffer *buffers; + + buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable, + width, height, attachments, count, out_count); + if (buffers == NULL) + return NULL; + + pdraw->width = *width; + pdraw->height = *height; + process_buffers(pdraw, buffers, *out_count); + + Xfree(buffers); + + return pdraw->buffers; +} + +static __DRIbuffer * +dri2GetBuffersWithFormat(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate) +{ + __GLXDRIdrawablePrivate *pdraw = loaderPrivate; + DRI2Buffer *buffers; + + buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy, + pdraw->base.xDrawable, + width, height, attachments, + count, out_count); + if (buffers == NULL) + return NULL; + + pdraw->width = *width; + pdraw->height = *height; + process_buffers(pdraw, buffers, *out_count); + Xfree(buffers); return pdraw->buffers; @@ -332,7 +375,15 @@ dri2GetBuffers(__DRIdrawable *driDrawable, static const __DRIdri2LoaderExtension dri2LoaderExtension = { { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION }, dri2GetBuffers, - dri2FlushFrontBuffer + dri2FlushFrontBuffer, + dri2GetBuffersWithFormat, +}; + +static const __DRIdri2LoaderExtension dri2LoaderExtension_old = { + { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION }, + dri2GetBuffers, + dri2FlushFrontBuffer, + NULL, }; static const __DRIextension *loader_extensions[] = { @@ -341,11 +392,19 @@ static const __DRIextension *loader_extensions[] = { NULL }; +static const __DRIextension *loader_extensions_old[] = { + &dri2LoaderExtension_old.base, + &systemTimeExtension.base, + NULL +}; + static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, __GLXdisplayPrivate *priv) { const __DRIconfig **driver_configs; const __DRIextension **extensions; + const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *) + priv->dri2Display; __GLXDRIscreen *psp; char *driverName, *deviceName; drm_magic_t magic; @@ -402,9 +461,16 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, return NULL; } + /* If the server does not support the protocol for + * DRI2GetBuffersWithFormat, don't supply that interface to the driver. + */ psc->__driScreen = - psc->dri2->createNewScreen(screen, psc->fd, - loader_extensions, &driver_configs, psc); + psc->dri2->createNewScreen(screen, psc->fd, + ((pdp->driMinor < 1) + ? loader_extensions_old + : loader_extensions), + &driver_configs, psc); + if (psc->__driScreen == NULL) { ErrorMessageF("failed to create dri screen\n"); return NULL; -- cgit v1.2.3 From f2272b5b2fd9195fe8f9eccfdd2e3c13d18a35e7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 20 Apr 2009 20:56:45 -0700 Subject: intel / DRI2: When available, use DRI2GetBuffersWithFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This interface gives the driver two important features. First, it can allocate the (fake) front-buffer only when needed. Second, it can tell the buffer allocator the format of buffers being allocated. This enables support for back-buffer and depth-buffer with different bits per pixel. Signed-off-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- src/mesa/drivers/dri/intel/intel_buffers.c | 10 +++ src/mesa/drivers/dri/intel/intel_context.c | 105 ++++++++++++++++++++++++----- 2 files changed, 99 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 90964df355..ecac5bf020 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -323,8 +323,18 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) { if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { struct intel_context *const intel = intel_context(ctx); + const GLboolean was_front_buffer_rendering = + intel->is_front_buffer_rendering; intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT); + + /* If we weren't front-buffer rendering before but we are now, make sure + * that the front-buffer has actually been allocated. + */ + if (!was_front_buffer_rendering && intel->is_front_buffer_rendering) { + intel_update_renderbuffers(intel->driContext, + intel->driContext->driDrawablePriv); + } } intel_draw_buffer(ctx, ctx->DrawBuffer); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 9b628dbc8e..7fda793373 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -173,6 +173,24 @@ intelGetString(GLcontext * ctx, GLenum name) } } +static unsigned +intel_bits_per_pixel(const struct intel_renderbuffer *rb) +{ + switch (rb->Base._ActualFormat) { + case GL_RGB5: + case GL_DEPTH_COMPONENT16: + return 16; + case GL_RGB8: + case GL_RGBA8: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH24_STENCIL8_EXT: + case GL_STENCIL_INDEX8_EXT: + return 32; + default: + return 0; + } +} + void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) { @@ -192,22 +210,62 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) screen = intel->intelScreen->driScrnPriv; - i = 0; - if (intel_fb->color_rb[0]) - attachments[i++] = __DRI_BUFFER_FRONT_LEFT; - if (intel_fb->color_rb[1]) - attachments[i++] = __DRI_BUFFER_BACK_LEFT; - if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH)) - attachments[i++] = __DRI_BUFFER_DEPTH; - if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL)) - attachments[i++] = __DRI_BUFFER_STENCIL; - - buffers = (*screen->dri2.loader->getBuffers)(drawable, - &drawable->w, - &drawable->h, - attachments, i, - &count, - drawable->loaderPrivate); + if ((screen->dri2.loader->base.version > 2) + && (screen->dri2.loader->getBuffersWithFormat != NULL)) { + struct intel_renderbuffer *depth_rb; + struct intel_renderbuffer *stencil_rb; + + i = 0; + if ((intel->is_front_buffer_rendering || !intel_fb->color_rb[1]) + && intel_fb->color_rb[0]) { + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; + attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[0]); + } + + if (intel_fb->color_rb[1]) { + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + attachments[i++] = intel_bits_per_pixel(intel_fb->color_rb[1]); + } + + depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); + stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); + + 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 { + i = 0; + if (intel_fb->color_rb[0]) + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; + if (intel_fb->color_rb[1]) + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH)) + attachments[i++] = __DRI_BUFFER_DEPTH; + if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL)) + attachments[i++] = __DRI_BUFFER_STENCIL; + + buffers = (*screen->dri2.loader->getBuffers)(drawable, + &drawable->w, + &drawable->h, + attachments, i, + &count, + drawable->loaderPrivate); + } if (buffers == NULL) return; @@ -250,6 +308,11 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) region_name = "dri2 depth buffer"; break; + case __DRI_BUFFER_DEPTH_STENCIL: + rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); + region_name = "dri2 depth / stencil buffer"; + break; + case __DRI_BUFFER_STENCIL: rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); region_name = "dri2 stencil buffer"; @@ -296,6 +359,16 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_renderbuffer_set_region(rb, region); intel_region_release(®ion); + + if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) { + struct intel_region *stencil_region; + + intel_region_reference(&stencil_region, region); + + rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); + intel_renderbuffer_set_region(rb, stencil_region); + intel_region_release(&stencil_region); + } } driUpdateFramebufferSize(&intel->ctx, drawable); -- cgit v1.2.3 From 91eb8baaca21d24bfd3640c9f6b316610a7c5910 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 17:08:59 -0600 Subject: tgis: SSE code generator doesn't yet support indirect addressing of temp regs Fall back to interpreter in this case. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 4b4e34b29e..ba2bfdef06 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1466,6 +1466,31 @@ emit_cmp( } } + +/** + * Check if inst src/dest regs use indirect addressing into temporary + * register file. + */ +static boolean +indirect_temp_reference(const struct tgsi_full_instruction *inst) +{ + uint i; + for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { + const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[i]; + if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && + reg->SrcRegister.Indirect) + return TRUE; + } + for (i = 0; i < inst->Instruction.NumDstRegs; i++) { + const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[i]; + if (reg->DstRegister.File == TGSI_FILE_TEMPORARY && + reg->DstRegister.Indirect) + return TRUE; + } + return FALSE; +} + + static int emit_instruction( struct x86_function *func, @@ -1473,6 +1498,10 @@ emit_instruction( { unsigned chan_index; + /* we can't handle indirect addressing into temp register file yet */ + if (indirect_temp_reference(inst)) + return FALSE; + switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ARL: FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { -- cgit v1.2.3 From 302ba83116a24dbcd09a5f8d10edaaf862127873 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Apr 2009 16:14:51 -0700 Subject: intel: Initialize region ptr to prevent assertion in intel_region_reference --- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 7fda793373..8446032742 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -361,7 +361,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_region_release(®ion); if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) { - struct intel_region *stencil_region; + struct intel_region *stencil_region = NULL; intel_region_reference(&stencil_region, region); -- cgit v1.2.3 From 022319b92ccd2f3bfc4aca54ebc7e39aeddd8b21 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Apr 2009 16:39:00 -0700 Subject: intel: Fix more issues with the combined depth-stencil attachment --- src/mesa/drivers/dri/intel/intel_context.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 8446032742..eb224a8a41 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -361,13 +361,20 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_region_release(®ion); if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) { - struct intel_region *stencil_region = NULL; - - intel_region_reference(&stencil_region, region); - rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); - intel_renderbuffer_set_region(rb, stencil_region); - intel_region_release(&stencil_region); + if (rb != NULL) { + struct intel_region *stencil_region = NULL; + + if (rb->region) { + dri_bo_flink(rb->region->buffer, &name); + if (name == buffers[i].name) + continue; + } + + intel_region_reference(&stencil_region, region); + intel_renderbuffer_set_region(rb, stencil_region); + intel_region_release(&stencil_region); + } } } -- cgit v1.2.3 From d18dd6ad11268c7a6c2835f4f5fa999c735da300 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 23 Apr 2009 05:43:22 -0700 Subject: GNU/Hurd fixes Here is a couple of fixes for GNU/Hurd: - dri_interface.h: no libdrm support either. - configure.ac: - GNU/Hurd is a GNU OS with _GNU_SOURCE and PTHREADS. - GNU needs a couple of flags like other OSes Signed-off-by: Dan Nicholson --- configure.ac | 6 +++++- include/GL/internal/dri_interface.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8412cdce7f..7b07f0fa7c 100644 --- a/configure.ac +++ b/configure.ac @@ -87,7 +87,7 @@ dnl Compiler macros DEFINES="" AC_SUBST([DEFINES]) case "$host_os" in -linux*|*-gnu*) +linux*|*-gnu*|gnu*) DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" ;; solaris*) @@ -742,6 +742,10 @@ if test "$mesa_driver" = dri; then unichrome savage sis swrast" fi ;; + gnu*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + ;; solaris*) DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index bfa8a33b3c..910c9166b5 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -41,7 +41,7 @@ #define DRI_INTERFACE_H /* For archs with no drm.h */ -#if !defined(__APPLE__) && !defined(__CYGWIN__) +#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__) #include #else typedef unsigned int drm_context_t; -- cgit v1.2.3 From f44f1155a9d1539bc5173928af20f5a2541ec6be Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 25 Apr 2009 12:52:04 +0100 Subject: gallium-intel: Link dri2 driver with softpipe --- src/gallium/winsys/drm/intel/dri2/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile index 1a02109274..e7c57afc34 100644 --- a/src/gallium/winsys/drm/intel/dri2/Makefile +++ b/src/gallium/winsys/drm/intel/dri2/Makefile @@ -6,6 +6,7 @@ LIBNAME = i915_dri.so PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a -- cgit v1.2.3 From 5f701f22f00ea17e0aba91c9995c9f559963d591 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 25 Apr 2009 12:55:21 +0100 Subject: gallium-intel: Cache software switch --- src/gallium/winsys/drm/intel/gem/intel_be_context.c | 2 +- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 5 ++++- src/gallium/winsys/drm/intel/gem/intel_be_device.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c index cfe8c88466..fe0b138fbe 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c @@ -108,7 +108,7 @@ intel_be_create_context(struct pipe_screen *screen) intel_be_init_context(intel, device); - if (getenv("INTEL_SOFTPIPE")) + if (device->softpipe) pipe = softpipe_create(screen); else pipe = i915_create_context(screen, &device->base, &intel->base); diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 8979f0ae15..4fa7a5e1a2 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -6,6 +6,7 @@ #include "pipe/p_state.h" #include "pipe/p_inlines.h" #include "util/u_memory.h" +#include "util/u_debug.h" #include "intel_be_fence.h" @@ -286,6 +287,8 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id) dev->pools.gem = drm_intel_bufmgr_gem_init(dev->fd, dev->max_batch_size); + dev->softpipe = debug_get_bool_option("INTEL_SOFTPIPE", FALSE); + return true; } @@ -303,7 +306,7 @@ intel_be_create_screen(int drmFD, int deviceID) intel_be_init_device(dev, drmFD, deviceID); - if (getenv("INTEL_SOFTPIPE")) { + if (dev->softpipe) { screen = softpipe_create_screen(&dev->base); drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer; } else diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h index 47d2176cb4..b32637ece2 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -16,6 +16,8 @@ struct intel_be_device { struct pipe_winsys base; + boolean softpipe; + int fd; /**< Drm file discriptor */ unsigned id; -- cgit v1.2.3 From a098e6090319e618f71e2ff5ee9b6a993571fddf Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 25 Apr 2009 12:56:07 +0100 Subject: gallium-intel: Fix warning --- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index 4fa7a5e1a2..c866c2a2f1 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -177,8 +177,6 @@ intel_be_handle_from_buffer(struct pipe_screen *screen, struct pipe_buffer *buffer, unsigned *handle) { - drm_intel_bo *bo; - if (!buffer) return FALSE; -- cgit v1.2.3 From d9f2d0752b087b0d39748b005bc4f795a3d05404 Mon Sep 17 00:00:00 2001 From: Mathias Gottschlag Date: Sat, 25 Apr 2009 01:27:23 +0200 Subject: r300-gallium: Set framebuffer pitch on every framebuffer change. Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_emit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 417d5f6307..cce5c591f1 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -160,7 +160,7 @@ void r300_emit_fb_state(struct r300_context* r300, struct r300_texture* tex; CS_LOCALS(r300); - BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4); + BEGIN_CS((7 * fb->nr_cbufs) + (fb->zsbuf ? 7 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { tex = (struct r300_texture*)fb->cbufs[i]->texture; OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); @@ -168,6 +168,9 @@ void r300_emit_fb_state(struct r300_context* r300, OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), r300_translate_out_fmt(fb->cbufs[i]->format)); + unsigned pixpitch = tex->stride / tex->tex.block.size; + OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch | + r300_translate_colorformat(tex->tex.format)); } if (fb->zsbuf) { @@ -180,6 +183,8 @@ void r300_emit_fb_state(struct r300_context* r300, } else { OUT_CS_REG(R300_ZB_FORMAT, 0x0); } + unsigned pixpitch = tex->stride / tex->tex.block.size; + OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch); } OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, -- cgit v1.2.3 From f45a7a1d1f8a576daf02e94ecabfd42f556dd9b4 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 24 Apr 2009 16:53:38 -0700 Subject: r300-gallium: Clean up FB state emit. --- src/gallium/drivers/r300/r300_emit.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index cce5c591f1..74d63ffe41 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -152,38 +152,38 @@ void r500_emit_fragment_shader(struct r300_context* r300, END_CS; } -/* XXX add pitch, stride, clean up */ void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb) { - int i; struct r300_texture* tex; + unsigned pixpitch; + int i; CS_LOCALS(r300); - BEGIN_CS((7 * fb->nr_cbufs) + (fb->zsbuf ? 7 : 0) + 4); + BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { tex = (struct r300_texture*)fb->cbufs[i]->texture; + pixpitch = tex->stride / tex->tex.block.size; + OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), - r300_translate_out_fmt(fb->cbufs[i]->format)); - unsigned pixpitch = tex->stride / tex->tex.block.size; OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch | r300_translate_colorformat(tex->tex.format)); + + OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), + r300_translate_out_fmt(fb->cbufs[i]->format)); } if (fb->zsbuf) { tex = (struct r300_texture*)fb->zsbuf->texture; + pixpitch = (tex->stride / tex->tex.block.size); + OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - if (fb->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) { - OUT_CS_REG(R300_ZB_FORMAT, - R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL); - } else { - OUT_CS_REG(R300_ZB_FORMAT, 0x0); - } - unsigned pixpitch = tex->stride / tex->tex.block.size; + + OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format)); + OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch); } -- cgit v1.2.3 From 233c6fb694ebd946ae76cb48701adf4d2086b1c1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 25 Apr 2009 16:53:38 -0700 Subject: r300-gallium: Fix vertex shader OVM counting. Attribs must be packed: position, point size, colors, texcoords. Thanks to osiris for pointing it out. --- src/gallium/drivers/r300/r300_state_tcl.c | 38 ++++++++++++++++++++++++++++--- src/gallium/drivers/r300/r300_state_tcl.h | 12 +++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index bb96e2ad67..d84912de48 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -34,14 +34,20 @@ static void r300_vs_declare(struct r300_vs_asm* assembler, assembler->tab[decl->DeclarationRange.First] = 0; break; case TGSI_SEMANTIC_COLOR: - assembler->tab[decl->DeclarationRange.First] = 2; + assembler->tab[decl->DeclarationRange.First] = + (assembler->point_size ? 1 : 0) + + assembler->out_colors; break; + case TGSI_SEMANTIC_FOG: case TGSI_SEMANTIC_GENERIC: /* XXX multiple? */ - assembler->tab[decl->DeclarationRange.First] = 6; + assembler->tab[decl->DeclarationRange.First] = + (assembler->point_size ? 1 : 0) + + assembler->out_colors + + assembler->out_texcoords; break; case TGSI_SEMANTIC_PSIZE: - assembler->tab[decl->DeclarationRange.First] = 15; + assembler->tab[decl->DeclarationRange.First] = 1; break; default: debug_printf("r300: vs: Bad semantic declaration %d\n", @@ -252,6 +258,28 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, } } +static void r300_vs_init(struct r300_vertex_shader* vs, + struct r300_vs_asm* assembler) +{ + struct tgsi_shader_info* info = &vs->info; + int i; + + for (i = 0; i < info->num_outputs; i++) { + switch (info->output_semantic_name[i]) { + case TGSI_SEMANTIC_PSIZE: + assembler->point_size = TRUE; + break; + case TGSI_SEMANTIC_COLOR: + assembler->out_colors++; + break; + case TGSI_SEMANTIC_FOG: + case TGSI_SEMANTIC_GENERIC: + assembler->out_texcoords++; + break; + } + } +} + void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs) { @@ -264,6 +292,10 @@ void r300_translate_vertex_shader(struct r300_context* r300, if (assembler == NULL) { return; } + + /* Init assembler. */ + r300_vs_init(vs, assembler); + /* Setup starting offset for immediates. */ assembler->imm_offset = consts->user_count; diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index de944028ba..e2e1357d43 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -99,7 +99,13 @@ struct r300_vs_asm { unsigned imm_offset; /* Number of immediate constants. */ unsigned imm_count; - /* Offsets into vertex output memory. */ + /* Number of colors to write. */ + unsigned out_colors; + /* Number of texcoords to write. */ + unsigned out_texcoords; + /* Whether to emit point size. */ + boolean point_size; + /* Tab of declared outputs to OVM outputs. */ unsigned tab[16]; }; @@ -115,7 +121,7 @@ static struct r300_vertex_shader r300_passthrough_vertex_shader = { .instructions[0].inst3 = 0x0, .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | - R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW, + R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW, .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW, .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, @@ -134,7 +140,7 @@ static struct r300_vertex_shader r300_texture_vertex_shader = { .instructions[0].inst3 = 0x0, .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) | R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | - R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW, + R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW, .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW, .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO, -- cgit v1.2.3 From 86d2144412915b0052a468806c4fba81d72a682d Mon Sep 17 00:00:00 2001 From: Mathias Gottschlag Date: Sun, 26 Apr 2009 12:04:35 +0200 Subject: r300-gallium: Add a draw_flush() to r300_flush(). This fixes some missing primitives which had been drawn right before the next glClear(). --- src/gallium/drivers/r300/r300_flush.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 20ca6905ad..89a5f2b20c 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -29,6 +29,8 @@ static void r300_flush(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); CS_LOCALS(r300); + draw_flush(r300->draw); + if (r300->dirty_hw) { FLUSH_CS; r300_emit_invariant_state(r300); -- cgit v1.2.3 From 904b563fd027c05a9755bc07719c55099ab5a9fd Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 26 Apr 2009 10:06:02 -0700 Subject: r300-gallium: Correctly flush Draw. Should help with a few non-TCL bugs. --- src/gallium/drivers/r300/r300_state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index c9507ae193..184a23c9e6 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -421,6 +421,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) struct r300_context* r300 = r300_context(pipe); struct r300_rs_state* rs = (struct r300_rs_state*)state; + draw_flush(r300->draw); draw_set_rasterizer_state(r300->draw, &rs->rs); r300->rs_state = rs; @@ -528,7 +529,6 @@ static void r300_set_scissor_state(struct pipe_context* pipe, const struct pipe_scissor_state* state) { struct r300_context* r300 = r300_context(pipe); - draw_flush(r300->draw); if (r300_screen(r300->context.screen)->caps->is_r500) { r300->scissor_state->scissor_top_left = @@ -555,6 +555,8 @@ static void r300_set_viewport_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); + draw_flush(r300->draw); + if (r300_screen(r300->context.screen)->caps->has_tcl) { /* Do the transform in HW. */ r300->viewport_state->vte_control = R300_VTX_W0_FMT; @@ -642,6 +644,8 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) { struct r300_context* r300 = r300_context(pipe); + draw_flush(r300->draw); + if (r300_screen(pipe->screen)->caps->has_tcl) { struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; -- cgit v1.2.3 From 4486e40143d16b7a6d28b4c652e671a198603131 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 21 Apr 2009 02:38:08 +0200 Subject: r300: always emit output insts after all KIL insts --- src/mesa/drivers/dri/r300/r300_state.c | 4 ++- src/mesa/drivers/dri/r300/radeon_program_pair.c | 45 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 8095538ff9..6b79aa4313 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -472,7 +472,9 @@ static void r300SetEarlyZState(GLcontext * ctx) if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) topZ = R300_ZTOP_DISABLE; - if (current_fragment_program_writes_depth(ctx)) + else if (current_fragment_program_writes_depth(ctx)) + topZ = R300_ZTOP_DISABLE; + else if (ctx->FragmentProgram._Current && ctx->FragmentProgram._Current->UsesKill) topZ = R300_ZTOP_DISABLE; if (topZ != r300->hw.zstencil_format.cmd[2]) { diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index 4aa2319a45..2e21f7bf66 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -47,6 +47,7 @@ struct pair_state_instruction { GLuint IsTex:1; /**< Is a texture instruction */ + GLuint IsOutput:1; /**< Is output instruction */ GLuint NeedRGB:1; /**< Needs the RGB ALU */ GLuint NeedAlpha:1; /**< Needs the Alpha ALU */ GLuint IsTranscendent:1; /**< Is a special transcendent instruction */ @@ -123,6 +124,7 @@ struct pair_state { GLboolean Debug; GLboolean Verbose; void *UserData; + GLubyte NumKillInsts; /** * Translate Mesa registers to hardware registers @@ -148,6 +150,11 @@ struct pair_state { struct pair_state_instruction *ReadyAlpha; struct pair_state_instruction *ReadyTEX; + /** + * Linked list of deferred instructions + */ + struct pair_state_instruction *DeferredInsts; + /** * Pool of @ref reg_value structures for fast allocation. */ @@ -231,7 +238,9 @@ static void instruction_ready(struct pair_state *s, int ip) if (s->Verbose) _mesa_printf("instruction_ready(%i)\n", ip); - if (pairinst->IsTex) + if (s->NumKillInsts > 0 && pairinst->IsOutput) + add_pairinst_to_list(&s->DeferredInsts, pairinst); + else if (pairinst->IsTex) add_pairinst_to_list(&s->ReadyTEX, pairinst); else if (!pairinst->NeedAlpha) add_pairinst_to_list(&s->ReadyRGB, pairinst); @@ -339,6 +348,8 @@ static void classify_instruction(struct pair_state *s, error("Unknown opcode %d\n", inst->Opcode); break; } + + pairinst->IsOutput = (inst->DstReg.File == PROGRAM_OUTPUT); } @@ -602,8 +613,11 @@ static void emit_all_tex(struct pair_state *s) struct prog_instruction *inst = s->Program->Instructions + ip; commit_instruction(s, ip); - if (inst->Opcode != OPCODE_KIL) + if (inst->Opcode == OPCODE_KIL) + --s->NumKillInsts; + else inst->DstReg.Index = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); + inst->SrcReg[0].Index = get_hw_reg(s, inst->SrcReg[0].File, inst->SrcReg[0].Index); if (s->Debug) { @@ -861,6 +875,17 @@ static void emit_alu(struct pair_state *s) s->Error = s->Error || !s->Handler->EmitPaired(s->UserData, &pair); } +static GLubyte countKillInsts(struct gl_program *prog) +{ + GLubyte i, count = 0; + + for (i = 0; i < prog->NumInstructions; ++i) { + if (prog->Instructions[i].Opcode == OPCODE_KIL) + ++count; + } + + return count; +} GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, const struct radeon_pair_handler* handler, void *userdata) @@ -874,6 +899,7 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, s.UserData = userdata; s.Debug = (RADEON_DEBUG & DEBUG_PIXEL) ? GL_TRUE : GL_FALSE; s.Verbose = GL_FALSE && s.Debug; + s.NumKillInsts = countKillInsts(program); s.Instructions = (struct pair_state_instruction*)_mesa_calloc( sizeof(struct pair_state_instruction)*s.Program->NumInstructions); @@ -892,6 +918,21 @@ GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program, if (s.ReadyTEX) emit_all_tex(&s); + if (!s.NumKillInsts) { + struct pair_state_instruction *pairinst = s.DeferredInsts; + while (pairinst) { + if (!pairinst->NeedAlpha) + add_pairinst_to_list(&s.ReadyRGB, pairinst); + else if (!pairinst->NeedRGB) + add_pairinst_to_list(&s.ReadyAlpha, pairinst); + else + add_pairinst_to_list(&s.ReadyFullALU, pairinst); + + pairinst = pairinst->NextReady; + } + s.DeferredInsts = NULL; + } + while(s.ReadyFullALU || s.ReadyRGB || s.ReadyAlpha) emit_alu(&s); } -- cgit v1.2.3 From b504721cc7fdfd9420e80c0f7ab78a3f92abeb58 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 23 Apr 2009 13:20:06 +0100 Subject: stw: Use a statically initiallized gl proc table. It doesn't change anyway. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 703 +++++++++++++-------------- 1 file changed, 347 insertions(+), 356 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index faf7f2f410..3711982fd2 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -38,9 +38,6 @@ #define DBG 0 -static GLCLTPROCTABLE cpt; -static boolean cpt_initialized = FALSE; - BOOL APIENTRY DrvCopyContext( @@ -165,351 +162,352 @@ DrvSetCallbackProcs( } -static void init_proc_table( GLCLTPROCTABLE *cpt ) -{ - GLDISPATCHTABLE *disp = &cpt->glDispatchTable; - - memset( cpt, 0, sizeof *cpt ); - cpt->cEntries = OPENGL_VERSION_110_ENTRIES; - -#define GPA_GL( NAME ) disp->NAME = gl##NAME - GPA_GL( NewList ); - GPA_GL( EndList ); - GPA_GL( CallList ); - GPA_GL( CallLists ); - GPA_GL( DeleteLists ); - GPA_GL( GenLists ); - GPA_GL( ListBase ); - GPA_GL( Begin ); - GPA_GL( Bitmap ); - GPA_GL( Color3b ); - GPA_GL( Color3bv ); - GPA_GL( Color3d ); - GPA_GL( Color3dv ); - GPA_GL( Color3f ); - GPA_GL( Color3fv ); - GPA_GL( Color3i ); - GPA_GL( Color3iv ); - GPA_GL( Color3s ); - GPA_GL( Color3sv ); - GPA_GL( Color3ub ); - GPA_GL( Color3ubv ); - GPA_GL( Color3ui ); - GPA_GL( Color3uiv ); - GPA_GL( Color3us ); - GPA_GL( Color3usv ); - GPA_GL( Color4b ); - GPA_GL( Color4bv ); - GPA_GL( Color4d ); - GPA_GL( Color4dv ); - GPA_GL( Color4f ); - GPA_GL( Color4fv ); - GPA_GL( Color4i ); - GPA_GL( Color4iv ); - GPA_GL( Color4s ); - GPA_GL( Color4sv ); - GPA_GL( Color4ub ); - GPA_GL( Color4ubv ); - GPA_GL( Color4ui ); - GPA_GL( Color4uiv ); - GPA_GL( Color4us ); - GPA_GL( Color4usv ); - GPA_GL( EdgeFlag ); - GPA_GL( EdgeFlagv ); - GPA_GL( End ); - GPA_GL( Indexd ); - GPA_GL( Indexdv ); - GPA_GL( Indexf ); - GPA_GL( Indexfv ); - GPA_GL( Indexi ); - GPA_GL( Indexiv ); - GPA_GL( Indexs ); - GPA_GL( Indexsv ); - GPA_GL( Normal3b ); - GPA_GL( Normal3bv ); - GPA_GL( Normal3d ); - GPA_GL( Normal3dv ); - GPA_GL( Normal3f ); - GPA_GL( Normal3fv ); - GPA_GL( Normal3i ); - GPA_GL( Normal3iv ); - GPA_GL( Normal3s ); - GPA_GL( Normal3sv ); - GPA_GL( RasterPos2d ); - GPA_GL( RasterPos2dv ); - GPA_GL( RasterPos2f ); - GPA_GL( RasterPos2fv ); - GPA_GL( RasterPos2i ); - GPA_GL( RasterPos2iv ); - GPA_GL( RasterPos2s ); - GPA_GL( RasterPos2sv ); - GPA_GL( RasterPos3d ); - GPA_GL( RasterPos3dv ); - GPA_GL( RasterPos3f ); - GPA_GL( RasterPos3fv ); - GPA_GL( RasterPos3i ); - GPA_GL( RasterPos3iv ); - GPA_GL( RasterPos3s ); - GPA_GL( RasterPos3sv ); - GPA_GL( RasterPos4d ); - GPA_GL( RasterPos4dv ); - GPA_GL( RasterPos4f ); - GPA_GL( RasterPos4fv ); - GPA_GL( RasterPos4i ); - GPA_GL( RasterPos4iv ); - GPA_GL( RasterPos4s ); - GPA_GL( RasterPos4sv ); - GPA_GL( Rectd ); - GPA_GL( Rectdv ); - GPA_GL( Rectf ); - GPA_GL( Rectfv ); - GPA_GL( Recti ); - GPA_GL( Rectiv ); - GPA_GL( Rects ); - GPA_GL( Rectsv ); - GPA_GL( TexCoord1d ); - GPA_GL( TexCoord1dv ); - GPA_GL( TexCoord1f ); - GPA_GL( TexCoord1fv ); - GPA_GL( TexCoord1i ); - GPA_GL( TexCoord1iv ); - GPA_GL( TexCoord1s ); - GPA_GL( TexCoord1sv ); - GPA_GL( TexCoord2d ); - GPA_GL( TexCoord2dv ); - GPA_GL( TexCoord2f ); - GPA_GL( TexCoord2fv ); - GPA_GL( TexCoord2i ); - GPA_GL( TexCoord2iv ); - GPA_GL( TexCoord2s ); - GPA_GL( TexCoord2sv ); - GPA_GL( TexCoord3d ); - GPA_GL( TexCoord3dv ); - GPA_GL( TexCoord3f ); - GPA_GL( TexCoord3fv ); - GPA_GL( TexCoord3i ); - GPA_GL( TexCoord3iv ); - GPA_GL( TexCoord3s ); - GPA_GL( TexCoord3sv ); - GPA_GL( TexCoord4d ); - GPA_GL( TexCoord4dv ); - GPA_GL( TexCoord4f ); - GPA_GL( TexCoord4fv ); - GPA_GL( TexCoord4i ); - GPA_GL( TexCoord4iv ); - GPA_GL( TexCoord4s ); - GPA_GL( TexCoord4sv ); - GPA_GL( Vertex2d ); - GPA_GL( Vertex2dv ); - GPA_GL( Vertex2f ); - GPA_GL( Vertex2fv ); - GPA_GL( Vertex2i ); - GPA_GL( Vertex2iv ); - GPA_GL( Vertex2s ); - GPA_GL( Vertex2sv ); - GPA_GL( Vertex3d ); - GPA_GL( Vertex3dv ); - GPA_GL( Vertex3f ); - GPA_GL( Vertex3fv ); - GPA_GL( Vertex3i ); - GPA_GL( Vertex3iv ); - GPA_GL( Vertex3s ); - GPA_GL( Vertex3sv ); - GPA_GL( Vertex4d ); - GPA_GL( Vertex4dv ); - GPA_GL( Vertex4f ); - GPA_GL( Vertex4fv ); - GPA_GL( Vertex4i ); - GPA_GL( Vertex4iv ); - GPA_GL( Vertex4s ); - GPA_GL( Vertex4sv ); - GPA_GL( ClipPlane ); - GPA_GL( ColorMaterial ); - GPA_GL( CullFace ); - GPA_GL( Fogf ); - GPA_GL( Fogfv ); - GPA_GL( Fogi ); - GPA_GL( Fogiv ); - GPA_GL( FrontFace ); - GPA_GL( Hint ); - GPA_GL( Lightf ); - GPA_GL( Lightfv ); - GPA_GL( Lighti ); - GPA_GL( Lightiv ); - GPA_GL( LightModelf ); - GPA_GL( LightModelfv ); - GPA_GL( LightModeli ); - GPA_GL( LightModeliv ); - GPA_GL( LineStipple ); - GPA_GL( LineWidth ); - GPA_GL( Materialf ); - GPA_GL( Materialfv ); - GPA_GL( Materiali ); - GPA_GL( Materialiv ); - GPA_GL( PointSize ); - GPA_GL( PolygonMode ); - GPA_GL( PolygonStipple ); - GPA_GL( Scissor ); - GPA_GL( ShadeModel ); - GPA_GL( TexParameterf ); - GPA_GL( TexParameterfv ); - GPA_GL( TexParameteri ); - GPA_GL( TexParameteriv ); - GPA_GL( TexImage1D ); - GPA_GL( TexImage2D ); - GPA_GL( TexEnvf ); - GPA_GL( TexEnvfv ); - GPA_GL( TexEnvi ); - GPA_GL( TexEnviv ); - GPA_GL( TexGend ); - GPA_GL( TexGendv ); - GPA_GL( TexGenf ); - GPA_GL( TexGenfv ); - GPA_GL( TexGeni ); - GPA_GL( TexGeniv ); - GPA_GL( FeedbackBuffer ); - GPA_GL( SelectBuffer ); - GPA_GL( RenderMode ); - GPA_GL( InitNames ); - GPA_GL( LoadName ); - GPA_GL( PassThrough ); - GPA_GL( PopName ); - GPA_GL( PushName ); - GPA_GL( DrawBuffer ); - GPA_GL( Clear ); - GPA_GL( ClearAccum ); - GPA_GL( ClearIndex ); - GPA_GL( ClearColor ); - GPA_GL( ClearStencil ); - GPA_GL( ClearDepth ); - GPA_GL( StencilMask ); - GPA_GL( ColorMask ); - GPA_GL( DepthMask ); - GPA_GL( IndexMask ); - GPA_GL( Accum ); - GPA_GL( Disable ); - GPA_GL( Enable ); - GPA_GL( Finish ); - GPA_GL( Flush ); - GPA_GL( PopAttrib ); - GPA_GL( PushAttrib ); - GPA_GL( Map1d ); - GPA_GL( Map1f ); - GPA_GL( Map2d ); - GPA_GL( Map2f ); - GPA_GL( MapGrid1d ); - GPA_GL( MapGrid1f ); - GPA_GL( MapGrid2d ); - GPA_GL( MapGrid2f ); - GPA_GL( EvalCoord1d ); - GPA_GL( EvalCoord1dv ); - GPA_GL( EvalCoord1f ); - GPA_GL( EvalCoord1fv ); - GPA_GL( EvalCoord2d ); - GPA_GL( EvalCoord2dv ); - GPA_GL( EvalCoord2f ); - GPA_GL( EvalCoord2fv ); - GPA_GL( EvalMesh1 ); - GPA_GL( EvalPoint1 ); - GPA_GL( EvalMesh2 ); - GPA_GL( EvalPoint2 ); - GPA_GL( AlphaFunc ); - GPA_GL( BlendFunc ); - GPA_GL( LogicOp ); - GPA_GL( StencilFunc ); - GPA_GL( StencilOp ); - GPA_GL( DepthFunc ); - GPA_GL( PixelZoom ); - GPA_GL( PixelTransferf ); - GPA_GL( PixelTransferi ); - GPA_GL( PixelStoref ); - GPA_GL( PixelStorei ); - GPA_GL( PixelMapfv ); - GPA_GL( PixelMapuiv ); - GPA_GL( PixelMapusv ); - GPA_GL( ReadBuffer ); - GPA_GL( CopyPixels ); - GPA_GL( ReadPixels ); - GPA_GL( DrawPixels ); - GPA_GL( GetBooleanv ); - GPA_GL( GetClipPlane ); - GPA_GL( GetDoublev ); - GPA_GL( GetError ); - GPA_GL( GetFloatv ); - GPA_GL( GetIntegerv ); - GPA_GL( GetLightfv ); - GPA_GL( GetLightiv ); - GPA_GL( GetMapdv ); - GPA_GL( GetMapfv ); - GPA_GL( GetMapiv ); - GPA_GL( GetMaterialfv ); - GPA_GL( GetMaterialiv ); - GPA_GL( GetPixelMapfv ); - GPA_GL( GetPixelMapuiv ); - GPA_GL( GetPixelMapusv ); - GPA_GL( GetPolygonStipple ); - GPA_GL( GetString ); - GPA_GL( GetTexEnvfv ); - GPA_GL( GetTexEnviv ); - GPA_GL( GetTexGendv ); - GPA_GL( GetTexGenfv ); - GPA_GL( GetTexGeniv ); - GPA_GL( GetTexImage ); - GPA_GL( GetTexParameterfv ); - GPA_GL( GetTexParameteriv ); - GPA_GL( GetTexLevelParameterfv ); - GPA_GL( GetTexLevelParameteriv ); - GPA_GL( IsEnabled ); - GPA_GL( IsList ); - GPA_GL( DepthRange ); - GPA_GL( Frustum ); - GPA_GL( LoadIdentity ); - GPA_GL( LoadMatrixf ); - GPA_GL( LoadMatrixd ); - GPA_GL( MatrixMode ); - GPA_GL( MultMatrixf ); - GPA_GL( MultMatrixd ); - GPA_GL( Ortho ); - GPA_GL( PopMatrix ); - GPA_GL( PushMatrix ); - GPA_GL( Rotated ); - GPA_GL( Rotatef ); - GPA_GL( Scaled ); - GPA_GL( Scalef ); - GPA_GL( Translated ); - GPA_GL( Translatef ); - GPA_GL( Viewport ); - GPA_GL( ArrayElement ); - GPA_GL( BindTexture ); - GPA_GL( ColorPointer ); - GPA_GL( DisableClientState ); - GPA_GL( DrawArrays ); - GPA_GL( DrawElements ); - GPA_GL( EdgeFlagPointer ); - GPA_GL( EnableClientState ); - GPA_GL( IndexPointer ); - GPA_GL( Indexub ); - GPA_GL( Indexubv ); - GPA_GL( InterleavedArrays ); - GPA_GL( NormalPointer ); - GPA_GL( PolygonOffset ); - GPA_GL( TexCoordPointer ); - GPA_GL( VertexPointer ); - GPA_GL( AreTexturesResident ); - GPA_GL( CopyTexImage1D ); - GPA_GL( CopyTexImage2D ); - GPA_GL( CopyTexSubImage1D ); - GPA_GL( CopyTexSubImage2D ); - GPA_GL( DeleteTextures ); - GPA_GL( GenTextures ); - GPA_GL( GetPointerv ); - GPA_GL( IsTexture ); - GPA_GL( PrioritizeTextures ); - GPA_GL( TexSubImage1D ); - GPA_GL( TexSubImage2D ); - GPA_GL( PopClientAttrib ); - GPA_GL( PushClientAttrib ); -} +/** + * Although WGL allows different dispatch entrypoints per context + */ +static const GLCLTPROCTABLE cpt = +{ + OPENGL_VERSION_110_ENTRIES, + { + &glNewList, + &glEndList, + &glCallList, + &glCallLists, + &glDeleteLists, + &glGenLists, + &glListBase, + &glBegin, + &glBitmap, + &glColor3b, + &glColor3bv, + &glColor3d, + &glColor3dv, + &glColor3f, + &glColor3fv, + &glColor3i, + &glColor3iv, + &glColor3s, + &glColor3sv, + &glColor3ub, + &glColor3ubv, + &glColor3ui, + &glColor3uiv, + &glColor3us, + &glColor3usv, + &glColor4b, + &glColor4bv, + &glColor4d, + &glColor4dv, + &glColor4f, + &glColor4fv, + &glColor4i, + &glColor4iv, + &glColor4s, + &glColor4sv, + &glColor4ub, + &glColor4ubv, + &glColor4ui, + &glColor4uiv, + &glColor4us, + &glColor4usv, + &glEdgeFlag, + &glEdgeFlagv, + &glEnd, + &glIndexd, + &glIndexdv, + &glIndexf, + &glIndexfv, + &glIndexi, + &glIndexiv, + &glIndexs, + &glIndexsv, + &glNormal3b, + &glNormal3bv, + &glNormal3d, + &glNormal3dv, + &glNormal3f, + &glNormal3fv, + &glNormal3i, + &glNormal3iv, + &glNormal3s, + &glNormal3sv, + &glRasterPos2d, + &glRasterPos2dv, + &glRasterPos2f, + &glRasterPos2fv, + &glRasterPos2i, + &glRasterPos2iv, + &glRasterPos2s, + &glRasterPos2sv, + &glRasterPos3d, + &glRasterPos3dv, + &glRasterPos3f, + &glRasterPos3fv, + &glRasterPos3i, + &glRasterPos3iv, + &glRasterPos3s, + &glRasterPos3sv, + &glRasterPos4d, + &glRasterPos4dv, + &glRasterPos4f, + &glRasterPos4fv, + &glRasterPos4i, + &glRasterPos4iv, + &glRasterPos4s, + &glRasterPos4sv, + &glRectd, + &glRectdv, + &glRectf, + &glRectfv, + &glRecti, + &glRectiv, + &glRects, + &glRectsv, + &glTexCoord1d, + &glTexCoord1dv, + &glTexCoord1f, + &glTexCoord1fv, + &glTexCoord1i, + &glTexCoord1iv, + &glTexCoord1s, + &glTexCoord1sv, + &glTexCoord2d, + &glTexCoord2dv, + &glTexCoord2f, + &glTexCoord2fv, + &glTexCoord2i, + &glTexCoord2iv, + &glTexCoord2s, + &glTexCoord2sv, + &glTexCoord3d, + &glTexCoord3dv, + &glTexCoord3f, + &glTexCoord3fv, + &glTexCoord3i, + &glTexCoord3iv, + &glTexCoord3s, + &glTexCoord3sv, + &glTexCoord4d, + &glTexCoord4dv, + &glTexCoord4f, + &glTexCoord4fv, + &glTexCoord4i, + &glTexCoord4iv, + &glTexCoord4s, + &glTexCoord4sv, + &glVertex2d, + &glVertex2dv, + &glVertex2f, + &glVertex2fv, + &glVertex2i, + &glVertex2iv, + &glVertex2s, + &glVertex2sv, + &glVertex3d, + &glVertex3dv, + &glVertex3f, + &glVertex3fv, + &glVertex3i, + &glVertex3iv, + &glVertex3s, + &glVertex3sv, + &glVertex4d, + &glVertex4dv, + &glVertex4f, + &glVertex4fv, + &glVertex4i, + &glVertex4iv, + &glVertex4s, + &glVertex4sv, + &glClipPlane, + &glColorMaterial, + &glCullFace, + &glFogf, + &glFogfv, + &glFogi, + &glFogiv, + &glFrontFace, + &glHint, + &glLightf, + &glLightfv, + &glLighti, + &glLightiv, + &glLightModelf, + &glLightModelfv, + &glLightModeli, + &glLightModeliv, + &glLineStipple, + &glLineWidth, + &glMaterialf, + &glMaterialfv, + &glMateriali, + &glMaterialiv, + &glPointSize, + &glPolygonMode, + &glPolygonStipple, + &glScissor, + &glShadeModel, + &glTexParameterf, + &glTexParameterfv, + &glTexParameteri, + &glTexParameteriv, + &glTexImage1D, + &glTexImage2D, + &glTexEnvf, + &glTexEnvfv, + &glTexEnvi, + &glTexEnviv, + &glTexGend, + &glTexGendv, + &glTexGenf, + &glTexGenfv, + &glTexGeni, + &glTexGeniv, + &glFeedbackBuffer, + &glSelectBuffer, + &glRenderMode, + &glInitNames, + &glLoadName, + &glPassThrough, + &glPopName, + &glPushName, + &glDrawBuffer, + &glClear, + &glClearAccum, + &glClearIndex, + &glClearColor, + &glClearStencil, + &glClearDepth, + &glStencilMask, + &glColorMask, + &glDepthMask, + &glIndexMask, + &glAccum, + &glDisable, + &glEnable, + &glFinish, + &glFlush, + &glPopAttrib, + &glPushAttrib, + &glMap1d, + &glMap1f, + &glMap2d, + &glMap2f, + &glMapGrid1d, + &glMapGrid1f, + &glMapGrid2d, + &glMapGrid2f, + &glEvalCoord1d, + &glEvalCoord1dv, + &glEvalCoord1f, + &glEvalCoord1fv, + &glEvalCoord2d, + &glEvalCoord2dv, + &glEvalCoord2f, + &glEvalCoord2fv, + &glEvalMesh1, + &glEvalPoint1, + &glEvalMesh2, + &glEvalPoint2, + &glAlphaFunc, + &glBlendFunc, + &glLogicOp, + &glStencilFunc, + &glStencilOp, + &glDepthFunc, + &glPixelZoom, + &glPixelTransferf, + &glPixelTransferi, + &glPixelStoref, + &glPixelStorei, + &glPixelMapfv, + &glPixelMapuiv, + &glPixelMapusv, + &glReadBuffer, + &glCopyPixels, + &glReadPixels, + &glDrawPixels, + &glGetBooleanv, + &glGetClipPlane, + &glGetDoublev, + &glGetError, + &glGetFloatv, + &glGetIntegerv, + &glGetLightfv, + &glGetLightiv, + &glGetMapdv, + &glGetMapfv, + &glGetMapiv, + &glGetMaterialfv, + &glGetMaterialiv, + &glGetPixelMapfv, + &glGetPixelMapuiv, + &glGetPixelMapusv, + &glGetPolygonStipple, + &glGetString, + &glGetTexEnvfv, + &glGetTexEnviv, + &glGetTexGendv, + &glGetTexGenfv, + &glGetTexGeniv, + &glGetTexImage, + &glGetTexParameterfv, + &glGetTexParameteriv, + &glGetTexLevelParameterfv, + &glGetTexLevelParameteriv, + &glIsEnabled, + &glIsList, + &glDepthRange, + &glFrustum, + &glLoadIdentity, + &glLoadMatrixf, + &glLoadMatrixd, + &glMatrixMode, + &glMultMatrixf, + &glMultMatrixd, + &glOrtho, + &glPopMatrix, + &glPushMatrix, + &glRotated, + &glRotatef, + &glScaled, + &glScalef, + &glTranslated, + &glTranslatef, + &glViewport, + &glArrayElement, + &glBindTexture, + &glColorPointer, + &glDisableClientState, + &glDrawArrays, + &glDrawElements, + &glEdgeFlagPointer, + &glEnableClientState, + &glIndexPointer, + &glIndexub, + &glIndexubv, + &glInterleavedArrays, + &glNormalPointer, + &glPolygonOffset, + &glTexCoordPointer, + &glVertexPointer, + &glAreTexturesResident, + &glCopyTexImage1D, + &glCopyTexImage2D, + &glCopyTexSubImage1D, + &glCopyTexSubImage2D, + &glDeleteTextures, + &glGenTextures, + &glGetPointerv, + &glIsTexture, + &glPrioritizeTextures, + &glTexSubImage1D, + &glTexSubImage2D, + &glPopClientAttrib, + &glPushClientAttrib + } +}; + PGLCLTPROCTABLE APIENTRY DrvSetContext( @@ -521,17 +519,10 @@ DrvSetContext( debug_printf( "%s( 0x%p, %u, 0x%p )\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable ); - /* Although WGL allows different dispatch entrypoints per - */ - if (!cpt_initialized) { - init_proc_table( &cpt ); - cpt_initialized = TRUE; - } - if (!stw_make_current( hdc, dhglrc )) return NULL; - return &cpt; + return (GLCLTPROCTABLE *)&cpt; } int APIENTRY -- cgit v1.2.3 From 99b77d05d2e8c4af5f7d752d6827c21fd6c4d5ee Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 27 Apr 2009 13:09:58 +0100 Subject: mesa: Call _mesa_snprintf instead of snprintf. snprintf not directly available on Windows. --- src/mesa/main/imports.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 8797f36695..615f7c9a6d 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1137,7 +1137,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) vsnprintf(s, MAXSTRING, fmtString, args); va_end(args); - snprintf(s2, MAXSTRING, "%s in %s", errstr, s); + _mesa_snprintf(s2, MAXSTRING, "%s in %s", errstr, s); output_if_debug("Mesa: User error", s2, GL_TRUE); } } -- cgit v1.2.3 From b618827fac84ca12a354da5808f30e96bedbc92a Mon Sep 17 00:00:00 2001 From: Micah Dowty Date: Fri, 24 Apr 2009 23:45:16 +0200 Subject: util: Add debug_printf_once --- src/gallium/auxiliary/util/u_debug.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index bcd8f0f3cf..d42b65ce28 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -102,6 +102,22 @@ debug_printf(const char *format, ...) } +/* + * ... isn't portable so we need to pass arguments in parentheses. + * + * usage: + * debug_printf_once(("awnser: %i\n", 42)); + */ +#define debug_printf_once(args) \ + do { \ + static boolean once = TRUE; \ + if (once) { \ + once = FALSE; \ + debug_printf args; \ + } \ + } while (0) + + #ifdef DEBUG #define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap) #else -- cgit v1.2.3 From 7da3f9403b235394a5c7e9456e34a0c9dad7dd15 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 16:28:36 -0600 Subject: mesa: refactor code and make _mesa_find_temp_intervals() public --- src/mesa/shader/prog_optimize.c | 154 ++++++++++++++++++++++++++++++++++------ src/mesa/shader/prog_optimize.h | 12 ++++ 2 files changed, 144 insertions(+), 22 deletions(-) diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 6ba2e76ff9..a02f5efa41 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -547,15 +547,13 @@ update_interval(GLint intBegin[], GLint intEnd[], GLuint index, GLuint ic) /** - * Find the live intervals for each temporary register in the program. - * For register R, the interval [A,B] indicates that R is referenced - * from instruction A through instruction B. - * Special consideration is needed for loops and subroutines. - * \return GL_TRUE if success, GL_FALSE if we cannot proceed for some reason + * Find first/last instruction that references each temporary register. */ -static GLboolean -find_live_intervals(struct gl_program *prog, - struct interval_list *liveIntervals) +GLboolean +_mesa_find_temp_intervals(const struct prog_instruction *instructions, + GLuint numInstructions, + GLint intBegin[MAX_PROGRAM_TEMPS], + GLint intEnd[MAX_PROGRAM_TEMPS]) { struct loop_info { @@ -563,26 +561,15 @@ find_live_intervals(struct gl_program *prog, }; struct loop_info loopStack[MAX_LOOP_NESTING]; GLuint loopStackDepth = 0; - GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; GLuint i; - /* - * Note: we'll return GL_FALSE below if we find relative indexing - * into the TEMP register file. We can't handle that yet. - * We also give up on subroutines for now. - */ - - if (dbg) { - _mesa_printf("Optimize: Begin find intervals\n"); - } - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ intBegin[i] = intEnd[i] = -1; } /* Scan instructions looking for temporary registers */ - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; + for (i = 0; i < numInstructions; i++) { + const struct prog_instruction *inst = instructions + i; if (inst->Opcode == OPCODE_BGNLOOP) { loopStack[loopStackDepth].Start = i; loopStack[loopStackDepth].End = inst->BranchTarget; @@ -595,7 +582,7 @@ find_live_intervals(struct gl_program *prog, return GL_FALSE; } else { - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); + const GLuint numSrc = 3;/*_mesa_num_inst_src_regs(inst->Opcode);*/ GLuint j; for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { @@ -624,6 +611,39 @@ find_live_intervals(struct gl_program *prog, } } + return GL_TRUE; +} + + +/** + * Find the live intervals for each temporary register in the program. + * For register R, the interval [A,B] indicates that R is referenced + * from instruction A through instruction B. + * Special consideration is needed for loops and subroutines. + * \return GL_TRUE if success, GL_FALSE if we cannot proceed for some reason + */ +static GLboolean +find_live_intervals(struct gl_program *prog, + struct interval_list *liveIntervals) +{ + GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; + GLuint i; + + /* + * Note: we'll return GL_FALSE below if we find relative indexing + * into the TEMP register file. We can't handle that yet. + * We also give up on subroutines for now. + */ + + if (dbg) { + _mesa_printf("Optimize: Begin find intervals\n"); + } + + /* build intermediate arrays */ + if (!_mesa_find_temp_intervals(prog->Instructions, prog->NumInstructions, + intBegin, intEnd)) + return GL_FALSE; + /* Build live intervals list from intermediate arrays */ liveIntervals->Num = 0; for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { @@ -794,6 +814,96 @@ _mesa_reallocate_registers(struct gl_program *prog) + + + + +#if 0 +static void +_mesa_find_temporary_live_intervals(struct gl_program *prog, + GLint firstInst[MAX_PROGRAM_TEMPS], + GLint lastInst[MAX_PROGRAM_TEMPS]) +{ + GLuint i; + + for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + firstInst[i] = lastInst[i] = -1; + } + + struct loop_info loopStack[MAX_LOOP_NESTING]; + GLuint loopStackDepth = 0; + GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; + GLuint i; + + /* + * Note: we'll return GL_FALSE below if we find relative indexing + * into the TEMP register file. We can't handle that yet. + * We also give up on subroutines for now. + */ + + if (dbg) { + _mesa_printf("Optimize: Begin find intervals\n"); + } + + for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ + intBegin[i] = intEnd[i] = -1; + } + + /* Scan instructions looking for temporary registers */ + for (i = 0; i < prog->NumInstructions; i++) { + const struct prog_instruction *inst = prog->Instructions + i; + if (inst->Opcode == OPCODE_BGNLOOP) { + loopStack[loopStackDepth].Start = i; + loopStack[loopStackDepth].End = inst->BranchTarget; + loopStackDepth++; + } + else if (inst->Opcode == OPCODE_ENDLOOP) { + loopStackDepth--; + } + else if (inst->Opcode == OPCODE_CAL) { + return GL_FALSE; + } + else { + const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); + GLuint j; + for (j = 0; j < numSrc; j++) { + if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { + const GLuint index = inst->SrcReg[j].Index; + if (inst->SrcReg[j].RelAddr) + return GL_FALSE; + update_interval(intBegin, intEnd, index, i); + if (loopStackDepth > 0) { + /* extend temp register's interval to end of loop */ + GLuint loopEnd = loopStack[loopStackDepth - 1].End; + update_interval(intBegin, intEnd, index, loopEnd); + } + } + } + if (inst->DstReg.File == PROGRAM_TEMPORARY) { + const GLuint index = inst->DstReg.Index; + if (inst->DstReg.RelAddr) + return GL_FALSE; + update_interval(intBegin, intEnd, index, i); + if (loopStackDepth > 0) { + /* extend temp register's interval to end of loop */ + GLuint loopEnd = loopStack[loopStackDepth - 1].End; + update_interval(intBegin, intEnd, index, loopEnd); + } + } + } + } + + + + +#endif + + + + + + + /** * Apply optimizations to the given program to eliminate unnecessary * instructions, temp regs, etc. diff --git a/src/mesa/shader/prog_optimize.h b/src/mesa/shader/prog_optimize.h index d102cfd9fc..43894a2723 100644 --- a/src/mesa/shader/prog_optimize.h +++ b/src/mesa/shader/prog_optimize.h @@ -25,7 +25,19 @@ #ifndef PROG_OPT_H #define PROG_OPT_H + +#include "main/config.h" + + struct gl_program; +struct prog_instruction; + + +extern GLboolean +_mesa_find_temp_intervals(const struct prog_instruction *instructions, + GLuint numInstructions, + GLint intBegin[MAX_PROGRAM_TEMPS], + GLint intEnd[MAX_PROGRAM_TEMPS]); extern void _mesa_optimize_program(GLcontext *ctx, struct gl_program *program); -- cgit v1.2.3 From b58b3a786aa38dcc9d72144c2cc691151e46e3d5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 24 Apr 2009 16:33:46 -0600 Subject: i965: rework GLSL/WM register allocation Use a bitvector of used/free flags. If we run out of temps, examine the live intervals of the temp regs in the program and free those which are no longer alive. Also, enable the new WM const buffer code. --- src/mesa/drivers/dri/i965/brw_wm.h | 5 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 211 +++++++++++++++++++++++++------- 2 files changed, 168 insertions(+), 48 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index d0ab3bdc65..75205fddb7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -240,15 +240,18 @@ struct brw_wm_compile { GLuint max_wm_grf; GLuint last_scratch; + GLuint cur_inst; /**< index of current instruction */ + /** Mapping from Mesa registers to hardware registers */ struct { GLboolean inited; struct brw_reg reg; } wm_regs[PROGRAM_PAYLOAD+1][256][4]; + GLboolean used_grf[BRW_WM_MAX_GRF]; + GLuint first_free_grf; struct brw_reg stack; struct brw_reg emit_mask_reg; - GLuint reg_index; /**< Index of next free GRF register */ GLuint tmp_regs[BRW_WM_MAX_GRF]; GLuint tmp_index; GLuint tmp_max; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 22e17622c6..3471c1946e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1,5 +1,7 @@ #include "main/macros.h" #include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_optimize.h" #include "brw_context.h" #include "brw_eu.h" #include "brw_wm.h" @@ -42,6 +44,76 @@ GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp) } + +static void +reclaim_temps(struct brw_wm_compile *c); + + +/** Mark GRF register as used. */ +static void +prealloc_grf(struct brw_wm_compile *c, int r) +{ + c->used_grf[r] = GL_TRUE; +} + + +/** Mark given GRF register as not in use. */ +static void +release_grf(struct brw_wm_compile *c, int r) +{ + /*assert(c->used_grf[r]);*/ + c->used_grf[r] = GL_FALSE; + c->first_free_grf = MIN2(c->first_free_grf, r); +} + + +/** Return index of a free GRF, mark it as used. */ +static int +alloc_grf(struct brw_wm_compile *c) +{ + GLuint r; + for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) { + if (!c->used_grf[r]) { + c->used_grf[r] = GL_TRUE; + c->first_free_grf = r + 1; /* a guess */ + return r; + } + } + + /* no free temps, try to reclaim some */ + reclaim_temps(c); + c->first_free_grf = 0; + + /* try alloc again */ + for (r = c->first_free_grf; r < BRW_WM_MAX_GRF; r++) { + if (!c->used_grf[r]) { + c->used_grf[r] = GL_TRUE; + c->first_free_grf = r + 1; /* a guess */ + return r; + } + } + + for (r = 0; r < BRW_WM_MAX_GRF; r++) { + assert(c->used_grf[r]); + } + /*printf("Really out of temp regs!\n");*/ + return 60; +} + + +/** Return number of GRF registers used */ +static int +num_grf_used(const struct brw_wm_compile *c) +{ + int r; + for (r = BRW_WM_MAX_GRF - 1; r >= 0; r--) + if (c->used_grf[r]) + return r + 1; + return 0; +} + + + /** * Record the mapping of a Mesa register to a hardware register. */ @@ -68,11 +140,18 @@ static int get_scalar_dst_index(const struct prog_instruction *inst) static struct brw_reg alloc_tmp(struct brw_wm_compile *c) { struct brw_reg reg; - if(c->tmp_index == c->tmp_max) - c->tmp_regs[ c->tmp_max++ ] = c->reg_index++; - + + /* if we need to allocate another temp, grow the tmp_regs[] array */ + if (c->tmp_index == c->tmp_max) { + c->tmp_regs[ c->tmp_max++ ] = alloc_grf(c); + } + + /* form the GRF register */ reg = brw_vec8_grf(c->tmp_regs[ c->tmp_index++ ], 0); + /*printf("alloc_temp %d\n", reg.nr);*/ + assert(reg.nr < BRW_WM_MAX_GRF); return reg; + } /** @@ -130,35 +209,26 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, return brw_null_reg(); } + assert(index < 256); /* see if we've already allocated a HW register for this Mesa register */ if (c->wm_regs[file][index][component].inited) { - /* yes, re-use */ - reg = c->wm_regs[file][index][component].reg; + /* yes, re-use */ + reg = c->wm_regs[file][index][component].reg; } else { /* no, allocate new register */ - reg = brw_vec8_grf(c->reg_index, 0); - } + int grf = alloc_grf(c); + if (grf < 0) { + /* totally out of temps */ + grf = 70; /* XXX !!!! */ + } - /* if this is a new register allocation, record it in the table */ - if (!c->wm_regs[file][index][component].inited) { - set_reg(c, file, index, component, reg); - c->reg_index++; - } + reg = brw_vec8_grf(grf, 0); + /*printf("Alloc new grf %d for %d.%d\n", reg.nr, index, component);*/ - if (c->reg_index >= BRW_WM_MAX_GRF - 12) { - /* ran out of temporary registers! */ -#if 1 - /* This is a big hack for now. - * Return bad register index, just don't hang the GPU. - */ - _mesa_fprintf(stderr, "out of regs %d\n", c->reg_index); - c->reg_index = BRW_WM_MAX_GRF - 13; -#else - return brw_null_reg(); -#endif + set_reg(c, file, index, component, reg); } - + if (neg & (1 << component)) { reg = negate(reg); } @@ -168,6 +238,46 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, } + +/** + * This is called if we run out of GRF registers. Examine the live intervals + * of temp regs in the program and free those which won't be used again. + */ +static void +reclaim_temps(struct brw_wm_compile *c) +{ + GLint intBegin[MAX_PROGRAM_TEMPS]; + GLint intEnd[MAX_PROGRAM_TEMPS]; + int index; + + /*printf("Reclaim temps:\n");*/ + + _mesa_find_temp_intervals(c->prog_instructions, c->nr_fp_insns, + intBegin, intEnd); + + for (index = 0; index < MAX_PROGRAM_TEMPS; index++) { + if (intEnd[index] != -1 && intEnd[index] < c->cur_inst) { + /* program temp[i] can be freed */ + int component; + /*printf(" temp[%d] is dead\n", index);*/ + for (component = 0; component < 4; component++) { + if (c->wm_regs[PROGRAM_TEMPORARY][index][component].inited) { + int r = c->wm_regs[PROGRAM_TEMPORARY][index][component].reg.nr; + release_grf(c, r); + /* + printf(" Reclaim temp %d, reg %d at inst %d\n", + index, r, c->cur_inst); + */ + c->wm_regs[PROGRAM_TEMPORARY][index][component].inited = GL_FALSE; + } + } + } + } +} + + + + /** * Preallocate registers. This sets up the Mesa to hardware register * mapping for certain registers, such as constants (uniforms/state vars) @@ -179,6 +289,10 @@ static void prealloc_reg(struct brw_wm_compile *c) struct brw_reg reg; int nr_interp_regs = 0; GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted; + GLuint reg_index = 0; + + memset(c->used_grf, GL_FALSE, sizeof(c->used_grf)); + c->first_free_grf = 0; for (i = 0; i < 4; i++) { if (i < c->key.nr_depth_regs) @@ -187,14 +301,20 @@ static void prealloc_reg(struct brw_wm_compile *c) reg = brw_vec8_grf(0, 0); set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg); } - c->reg_index += 2 * c->key.nr_depth_regs; + reg_index += 2 * c->key.nr_depth_regs; /* constants */ { - const int nr_params = c->fp->program.Base.Parameters->NumParameters; + const GLuint nr_params = c->fp->program.Base.Parameters->NumParameters; + const GLuint nr_temps = c->fp->program.Base.NumTemporaries; /* use a real constant buffer, or just use a section of the GRF? */ - c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ + /* XXX this heuristic may need adjustment... */ + if ((nr_params + nr_temps) * 4 + reg_index > 80) + c->use_const_buffer = GL_TRUE; + else + c->use_const_buffer = GL_FALSE; + /*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/ if (c->use_const_buffer) { /* We'll use a real constant buffer and fetch constants from @@ -216,7 +336,7 @@ static void prealloc_reg(struct brw_wm_compile *c) for (i = 0; i < nr_params; i++) { /* loop over XYZW channels */ for (j = 0; j < 4; j++, index++) { - reg = brw_vec1_grf(c->reg_index + index / 8, index % 8); + reg = brw_vec1_grf(reg_index + index / 8, index % 8); /* Save pointer to parameter/constant value. * Constants will be copied in prepare_constant_buffer() */ @@ -226,7 +346,7 @@ static void prealloc_reg(struct brw_wm_compile *c) } /* number of constant regs used (each reg is float[8]) */ c->nr_creg = 2 * ((4 * nr_params + 15) / 16); - c->reg_index += c->nr_creg; + reg_index += c->nr_creg; } } @@ -234,20 +354,24 @@ static void prealloc_reg(struct brw_wm_compile *c) for (i = 0; i < FRAG_ATTRIB_MAX; i++) { if (inputs & (1<reg_index, 0); + reg = brw_vec8_grf(reg_index, 0); for (j = 0; j < 4; j++) set_reg(c, PROGRAM_PAYLOAD, i, j, reg); - c->reg_index += 2; + reg_index += 2; } } c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; c->prog_data.urb_read_length = nr_interp_regs * 2; c->prog_data.curb_read_length = c->nr_creg; - c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); - c->reg_index++; - c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); - c->reg_index += 2; + c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0); + reg_index++; + c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0); + reg_index += 2; + + /* mark GRF regs [0..reg_index-1] as in-use */ + for (i = 0; i < reg_index; i++) + prealloc_grf(c, i); /* An instruction may reference up to three constants. * They'll be found in these registers. @@ -256,13 +380,9 @@ static void prealloc_reg(struct brw_wm_compile *c) if (c->use_const_buffer) { for (i = 0; i < 3; i++) { c->current_const[i].index = -1; - c->current_const[i].reg = alloc_tmp(c); + c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0); } } -#if 0 - printf("USE CONST BUFFER? %d\n", c->use_const_buffer); - printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); -#endif } @@ -2595,7 +2715,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) struct brw_compile *p = &c->func; struct brw_indirect stack_index = brw_indirect(0, 0); - c->reg_index = 0; prealloc_reg(c); brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); @@ -2603,6 +2722,8 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) for (i = 0; i < c->nr_fp_insns; i++) { const struct prog_instruction *inst = &c->prog_instructions[i]; + c->cur_inst = i; + #if 0 _mesa_printf("Inst %d: ", i); _mesa_print_instruction(inst); @@ -2833,17 +2954,13 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) _mesa_printf("unsupported IR in fragment shader %d\n", inst->Opcode); } + if (inst->CondUpdate) brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); else brw_set_predicate_control(p, BRW_PREDICATE_NONE); } post_wm_emit(c); - - if (c->reg_index >= BRW_WM_MAX_GRF) { - _mesa_problem(NULL, "Ran out of registers in brw_wm_emit_glsl()"); - /* XXX we need to do some proper error recovery here */ - } } @@ -2867,6 +2984,6 @@ void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c) brw_wm_print_program(c, "brw_wm_glsl_emit done"); } - c->prog_data.total_grf = c->reg_index; + c->prog_data.total_grf = num_grf_used(c); c->prog_data.total_scratch = 0; } -- cgit v1.2.3 From 931c89f6f6f1f8449ed9d7b41f84e6948774b368 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 19 Apr 2009 21:13:18 +0200 Subject: r300: remove unnecessary function calls r300SetEarlyZState is called during r300UpdateShaderStates which is called for every rendering operation. --- src/mesa/drivers/dri/r300/r300_state.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 4cbbfd49c9..c86c16bfa7 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -524,8 +524,6 @@ static void r300SetAlphaState(GLcontext * ctx) R300_STATECHANGE(r300, at); r300->hw.at.cmd[R300_AT_ALPHA_TEST] = pp_misc; r300->hw.at.cmd[R300_AT_UNKNOWN] = 0; - - r300SetEarlyZState(ctx); } static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) @@ -573,8 +571,6 @@ static void r300SetDepthState(GLcontext * ctx) r300->hw.zs.cmd[R300_ZS_CNTL_1] |= translate_func(ctx->Depth.Func) << R300_Z_FUNC_SHIFT; } - - r300SetEarlyZState(ctx); } static void r300SetStencilState(GLcontext * ctx, GLboolean state) -- cgit v1.2.3 From 607c6cf1885c8f5fad7ff4a7baf919aa1d24050c Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 19 Apr 2009 21:25:01 +0200 Subject: r300: rename state According to r300_reg.h from radeon drm module 0x4f30 is ZB_ZMASK_OFFSET. Also cleanup as trailing whitespaces. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 12 ++++++------ src/mesa/drivers/dri/r300/r300_context.h | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 6 ++++++ src/mesa/drivers/dri/r300/r300_state.c | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 4c6108cc63..afca0e24a6 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -83,7 +83,7 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom) BATCH_LOCALS(&r300->radeon); drm_r300_cmd_header_t cmd; uint32_t addr, ndw, i; - + if (!r300->radeon.radeonScreen->kernel_mm) { uint32_t dwords; dwords = (*atom->check) (ctx, atom); @@ -92,7 +92,7 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom) END_BATCH(); return; } - + cmd.u = atom->cmd[0]; addr = (cmd.vpu.adrhi << 8) | cmd.vpu.adrlo; ndw = cmd.vpu.count * 4; @@ -175,7 +175,7 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) for(i = 0; i < numtmus; ++i) { radeonTexObj *t = r300->hw.textures[i]; - + if (!t) notexture = 1; } @@ -304,7 +304,7 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) if (rrb->bo->flags & RADEON_BO_FLAGS_MICRO_TILE){ zbpitch |= R300_DEPTHMICROTILE_TILED; } - + BEGIN_BATCH_NO_AUTOSTATE(6); OUT_BATCH_REGSEQ(R300_ZB_DEPTHOFFSET, 1); OUT_BATCH_RELOC(0, rrb->bo, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); @@ -606,8 +606,8 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.zb.emit = emit_zb_offset; ALLOC_STATE(zb_depthclearvalue, always, 2, 0); r300->hw.zb_depthclearvalue.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_ZB_DEPTHCLEARVALUE, 1); - ALLOC_STATE(unk4F30, always, 3, 0); - r300->hw.unk4F30.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, 0x4F30, 2); + ALLOC_STATE(zb_zmask, always, 3, 0); + r300->hw.zb_zmask.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_ZB_ZMASK_OFFSET, 2); ALLOC_STATE(zb_hiz_offset, always, 2, 0); r300->hw.zb_hiz_offset.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_ZB_HIZ_OFFSET, 1); ALLOC_STATE(zb_hiz_pitch, always, 2, 0); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 1c7bfc819b..f8d914e7ac 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -351,7 +351,7 @@ struct r300_hw_state { struct radeon_state_atom zstencil_format; struct radeon_state_atom zb; /* z buffer (4F20) */ struct radeon_state_atom zb_depthclearvalue; /* (4F28) */ - struct radeon_state_atom unk4F30; /* (4F30) */ + struct radeon_state_atom zb_zmask; /* (4F30) */ struct radeon_state_atom zb_hiz_offset; /* (4F44) */ struct radeon_state_atom zb_hiz_pitch; /* (4F54) */ diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index ed552d09bb..79dd1e1fa2 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -2432,6 +2432,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Z Buffer Clear Value */ #define R300_ZB_DEPTHCLEARVALUE 0x4f28 +#define R300_ZB_ZMASK_OFFSET 0x4f30 +#define R300_ZB_ZMASK_PITCH 0x4f34 +#define R300_ZB_ZMASK_WRINDEX 0x4f38 +#define R300_ZB_ZMASK_DWORD 0x4f3c +#define R300_ZB_ZMASK_RDINDEX 0x4f40 + /* Hierarchical Z Memory Offset */ #define R300_ZB_HIZ_OFFSET 0x4f44 diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c86c16bfa7..14749bf2c7 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2205,8 +2205,8 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.zstencil_format.cmd[4] = 0x00000000; r300SetEarlyZState(ctx); - r300->hw.unk4F30.cmd[1] = 0; - r300->hw.unk4F30.cmd[2] = 0; + r300->hw.zb_zmask.cmd[1] = 0; + r300->hw.zb_zmask.cmd[2] = 0; r300->hw.zb_hiz_offset.cmd[1] = 0; -- cgit v1.2.3 From 199710914ab15926d19c5a848453674715bce334 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 23 Apr 2009 15:35:29 +0200 Subject: r300: remove unnecessary function calls ae_create_context is called by vbo_CreateContext ae_invalidate_state is called by vbo_InvalidateState --- src/mesa/drivers/dri/r300/r300_context.c | 1 - src/mesa/drivers/dri/r300/r300_state.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 10836bb16a..3bde9ca30a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -373,7 +373,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, _tnl_CreateContext(ctx); _swsetup_CreateContext(ctx); _swsetup_Wakeup(ctx); - _ae_create_context(ctx); /* Install the customized pipeline: */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 14749bf2c7..a1f78c5244 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2477,7 +2477,6 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) _swsetup_InvalidateState(ctx, new_state); _vbo_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); - _ae_invalidate_state(ctx, new_state); if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { _mesa_update_framebuffer(ctx); -- cgit v1.2.3 From 25dd867c58e5008029dbb5277a82acbcc961a05a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 23 Apr 2009 15:41:08 +0200 Subject: r300: handle texcoords properly add 1D texture case and setup default Q value to 1.0 --- src/mesa/drivers/dri/r300/r300_swtcl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 256a2bb5cb..55187d4bc8 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -211,15 +211,19 @@ static void r300SetVertexFormat( GLcontext *ctx ) if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) { switch (VB->TexCoordPtr[i]->size) { case 1: + format = EMIT_1F; + swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); + mask = MASK_X; + break; case 2: format = EMIT_2F; - swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ZERO); + swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE); mask = MASK_X | MASK_Y; size = 2; break; case 3: format = EMIT_3F; - swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); mask = MASK_X | MASK_Y | MASK_Z; size = 3; break; -- cgit v1.2.3 From 7ff2dcbbdc74bf5e9650d4a94a253a0cab3e8863 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 23 Apr 2009 16:08:48 +0200 Subject: r300: add atom print function for kernel mm path --- src/mesa/drivers/dri/radeon/radeon_common.c | 64 +++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index dc281ee269..312c2a72e9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -851,20 +851,57 @@ void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei he radeon_window_moved(radeon); radeon_draw_buffer(ctx, radeon->glCtx->DrawBuffer); ctx->Driver.Viewport = old_viewport; - - } -static void radeon_print_state_atom(radeonContextPtr radeon, struct radeon_state_atom *state ) -{ - int i; - int dwords = (*state->check)(radeon->glCtx, state); - fprintf(stderr, "emit %s %d/%d\n", state->name, state->cmd_size, dwords); - - if (RADEON_DEBUG & DEBUG_VERBOSE) - for (i = 0 ; i < dwords; i++) - fprintf(stderr, "\t%s[%d]: %x\n", state->name, i, state->cmd[i]); +static void radeon_print_state_atom(radeonContextPtr radeon, struct radeon_state_atom *state) +{ + int i, j, reg; + int dwords = (*state->check) (radeon->glCtx, state); + drm_r300_cmd_header_t cmd; + + fprintf(stderr, " emit %s %d/%d\n", state->name, dwords, state->cmd_size); + + if (RADEON_DEBUG & DEBUG_VERBOSE) { + for (i = 0; i < dwords;) { + cmd = *((drm_r300_cmd_header_t *) &state->cmd[i]); + reg = (cmd.packet0.reghi << 8) | cmd.packet0.reglo; + fprintf(stderr, " %s[%d]: cmdpacket0 (first reg=0x%04x, count=%d)\n", + state->name, i, reg, cmd.packet0.count); + ++i; + for (j = 0; j < cmd.packet0.count && i < dwords; j++) { + fprintf(stderr, " %s[%d]: 0x%04x = %08x\n", + state->name, i, reg, state->cmd[i]); + reg += 4; + ++i; + } + } + } +} +static void radeon_print_state_atom_kmm(radeonContextPtr radeon, struct radeon_state_atom *state) +{ + int i, j, reg, count; + int dwords = (*state->check) (radeon->glCtx, state); + uint32_t packet0; + + fprintf(stderr, " emit %s %d/%d\n", state->name, dwords, state->cmd_size); + + if (RADEON_DEBUG & DEBUG_VERBOSE) { + for (i = 0; i < dwords;) { + packet0 = state->cmd[i]; + reg = (packet0 & 0x1FFF) << 2; + count = ((packet0 & 0x3FFF0000) >> 16) + 1; + fprintf(stderr, " %s[%d]: cmdpacket0 (first reg=0x%04x, count=%d)\n", + state->name, i, reg, count); + ++i; + for (j = 0; j < count && i < dwords; j++) { + fprintf(stderr, " %s[%d]: 0x%04x = %08x\n", + state->name, i, reg, state->cmd[i]); + reg += 4; + ++i; + } + } + } } static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean dirty) @@ -882,7 +919,10 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean dirty) dwords = (*atom->check) (radeon->glCtx, atom); if (dwords) { if (DEBUG_CMDBUF && RADEON_DEBUG & DEBUG_STATE) { - radeon_print_state_atom(radeon, atom); + if (radeon->radeonScreen->kernel_mm) + radeon_print_state_atom_kmm(radeon, atom); + else + radeon_print_state_atom(radeon, atom); } if (atom->emit) { (*atom->emit)(radeon->glCtx, atom); -- cgit v1.2.3 From 22c0652c381e6773ff48e4c70ef5439a949919ae Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 23 Apr 2009 16:12:09 +0200 Subject: r300: flush stdout to get consistent debugging info --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 4 ++++ src/mesa/drivers/dri/r300/radeon_program_pair.c | 1 + 2 files changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 3d4bd5db21..6eaad76550 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -214,8 +214,10 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) compiler.program = _mesa_clone_program(ctx, &fp->Base); if (RADEON_DEBUG & DEBUG_PIXEL) { + fflush(stdout); _mesa_printf("Fragment Program: Initial program:\n"); _mesa_print_program(compiler.program); + fflush(stdout); } insert_WPOS_trailer(&compiler); @@ -240,6 +242,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Fragment Program: After native rewrite:\n"); _mesa_print_program(compiler.program); + fflush(stdout); } if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { @@ -263,6 +266,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) if (RADEON_DEBUG & DEBUG_PIXEL) { _mesa_printf("Compiler: after NqSSA-DCE:\n"); _mesa_print_program(compiler.program); + fflush(stdout); } if (!r300->vtbl.FragmentProgramEmit(&compiler)) diff --git a/src/mesa/drivers/dri/r300/radeon_program_pair.c b/src/mesa/drivers/dri/r300/radeon_program_pair.c index 5c6594bc2e..906d36e522 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/radeon_program_pair.c @@ -609,6 +609,7 @@ static void emit_all_tex(struct pair_state *s) if (s->Debug) { _mesa_printf(" "); _mesa_print_instruction(inst); + fflush(stdout); } s->Error = s->Error || !s->Handler->EmitTex(s->UserData, inst); } -- cgit v1.2.3 From d014d7d1bb33592f89fb08e8b656c27d67f9a3d3 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 24 Apr 2009 16:15:19 +0200 Subject: r300: always route 4 texcoord components to RS Routing <4 components may lead to lock up. Thanks to Alex Deucher for suggestion. --- src/mesa/drivers/dri/r300/r300_state.c | 64 +++++----------------------------- src/mesa/drivers/dri/r300/r300_swtcl.c | 19 +++++----- 2 files changed, 17 insertions(+), 66 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index a1f78c5244..9c8b8adbe3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1482,6 +1482,7 @@ static void r300SetupRSUnit(GLcontext * ctx) } } + /* We always route 4 texcoord components */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (! ( InputsRead & FRAG_BIT_TEX(i) ) ) continue; @@ -1491,26 +1492,10 @@ static void r300SetupRSUnit(GLcontext * ctx) continue; } - int swiz; - - /* with TCL we always seem to route 4 components */ - if (hw_tcl_on) - count = 4; - else - count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size; - - switch(count) { - case 4: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3); break; - case 3: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(R300_RS_SEL_K1); break; - default: - case 1: - case 2: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(R300_RS_SEL_K0) | R300_RS_SEL_Q(R300_RS_SEL_K1); break; - }; - - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= swiz | R300_RS_TEX_PTR(rs_tex_count); + r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) | R300_RS_TEX_PTR(rs_tex_count); r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg); InputsRead &= ~(FRAG_BIT_TEX0 << i); - rs_tex_count += count; + rs_tex_count += 4; ++tex_ip; ++fp_reg; } @@ -1633,7 +1618,7 @@ static void r500SetupRSUnit(GLcontext * ctx) } } - + /* We always route 4 texcoord components */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (! ( InputsRead & FRAG_BIT_TEX(i) ) ) continue; @@ -1643,45 +1628,14 @@ static void r500SetupRSUnit(GLcontext * ctx) continue; } - int swiz = 0; - - /* with TCL we always seem to route 4 components */ - if (hw_tcl_on) - count = 4; - else - count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size; - - if (count == 4) { - swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT; - swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT; - swiz |= (rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT; - swiz |= (rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT; - } else if (count == 3) { - swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT; - swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT; - swiz |= (rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT; - swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT; - } else if (count == 2) { - swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT; - swiz |= (rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT; - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT; - swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT; - } else if (count == 1) { - swiz |= (rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT; - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT; - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT; - swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT; - } else { - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT; - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT; - swiz |= R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT; - swiz |= R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT; - } + r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= ((rs_tex_count + 0) << R500_RS_IP_TEX_PTR_S_SHIFT) | + ((rs_tex_count + 1) << R500_RS_IP_TEX_PTR_T_SHIFT) | + ((rs_tex_count + 2) << R500_RS_IP_TEX_PTR_R_SHIFT) | + ((rs_tex_count + 3) << R500_RS_IP_TEX_PTR_Q_SHIFT); - r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= swiz; r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); InputsRead &= ~(FRAG_BIT_TEX0 << i); - rs_tex_count += count; + rs_tex_count += 4; ++tex_ip; ++fp_reg; } diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 55187d4bc8..fc849889b6 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -204,34 +204,31 @@ static void r300SetVertexFormat( GLcontext *ctx ) ADD_ATTR(VERT_ATTRIB_POINT_SIZE, EMIT_1F, SWTCL_OVM_POINT_SIZE, swiz, MASK_X); } + /** + * Sending only one texcoord component may lead to lock up, + * so for all textures always output 4 texcoord components to RS. + */ if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { - int i, size; - GLuint swiz, mask, format; + int i; + GLuint swiz, format; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) { switch (VB->TexCoordPtr[i]->size) { case 1: format = EMIT_1F; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); - mask = MASK_X; break; case 2: format = EMIT_2F; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE); - mask = MASK_X | MASK_Y; - size = 2; break; case 3: format = EMIT_3F; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); - mask = MASK_X | MASK_Y | MASK_Z; - size = 3; break; case 4: format = EMIT_4F; swiz = SWIZZLE_XYZW; - mask = MASK_XYZW; - size = 4; break; default: continue; @@ -239,8 +236,8 @@ static void r300SetVertexFormat( GLcontext *ctx ) InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i); OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); EMIT_ATTR(_TNL_ATTRIB_TEX(i), format); - ADD_ATTR(VERT_ATTRIB_TEX0 + i, format, SWTCL_OVM_TEX(i), swiz, mask); - vap_out_fmt_1 |= size << (i * 3); + ADD_ATTR(VERT_ATTRIB_TEX0 + i, format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW); + vap_out_fmt_1 |= 4 << (i * 3); ++first_free_tex; } } -- cgit v1.2.3 From 7f6b13be86884486baad1e7750511ce4a2eedde6 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 24 Apr 2009 16:52:33 +0200 Subject: r300: add point attenuation stage for TCL fallbacks --- src/mesa/drivers/dri/r300/r300_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 3bde9ca30a..5119890157 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -172,6 +172,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = { &_tnl_fog_coordinate_stage, &_tnl_texgen_stage, &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, &_tnl_vertex_program_stage, /* Try again to go to tcl? -- cgit v1.2.3 From 033d1365e6fa6e57bc11b47831af0cb4b7ad2edf Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 24 Apr 2009 16:28:47 +0200 Subject: r300: fix performance regression This performance regression on non TCL hw was introduced by ed4c6cbe017b4e8bacb7e012d4baaf77a20a2c33. This patch depends on "r300: always route 4 texcoord components to RS" and "r300: add point attenuation stage for TCL fallbacks". --- src/mesa/drivers/dri/r300/r300_context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 5119890157..c80dcd8420 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -364,7 +364,10 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, ctx = r300->radeon.glCtx; r300InitConstValues(ctx, screen); - ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + + if (hw_tcl_on) + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; /* Initialize the software rasterizer and helper modules. -- cgit v1.2.3 From e32660060954c0d1a1f7636c6365970348f3be24 Mon Sep 17 00:00:00 2001 From: Shuang He Date: Mon, 27 Apr 2009 07:13:33 -0600 Subject: demos: Clean up allocated Textures and Display Lists when demo quit --- progs/demos/ipers.c | 18 ++++++++++++++++++ progs/demos/teapot.c | 11 +++++++++++ progs/demos/tunnel.c | 9 +++++++++ progs/demos/tunnel2.c | 9 +++++++++ 4 files changed, 47 insertions(+) diff --git a/progs/demos/ipers.c b/progs/demos/ipers.c index 6e153c04e1..5d82b0dc92 100644 --- a/progs/demos/ipers.c +++ b/progs/demos/ipers.c @@ -236,11 +236,28 @@ special(int k, int x, int y) } } +static void +cleanup(void) +{ + int i; + + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); + + glDeleteLists(skydlist, 1); + for (i = 0; i < MAX_LOD; i++) { + glDeleteLists(LODdlist[i], 1); + glDeleteLists(LODnumpoly[i], 1); + } +} + + static void key(unsigned char k, int x, int y) { switch (k) { case 27: + cleanup(); exit(0); break; @@ -707,6 +724,7 @@ main(int ac, char **av) glutIdleFunc(draw); glutMainLoop(); + cleanup(); return 0; } diff --git a/progs/demos/teapot.c b/progs/demos/teapot.c index 38ede7ac3e..6bf6e06409 100644 --- a/progs/demos/teapot.c +++ b/progs/demos/teapot.c @@ -173,10 +173,20 @@ static void special(int k, int x, int y) } } +static void cleanup(void) +{ + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); + glDeleteLists(teapotdlist, 1); + glDeleteLists(basedlist, 1); + glDeleteLists(lightdlist, 1); +} + static void key(unsigned char k, int x, int y) { switch(k) { case 27: + cleanup(); exit(0); break; @@ -670,6 +680,7 @@ int main(int ac, char **av) glutIdleFunc(draw); glutMainLoop(); + cleanup(); return 0; } diff --git a/progs/demos/tunnel.c b/progs/demos/tunnel.c index 6a240580e8..6981da3298 100644 --- a/progs/demos/tunnel.c +++ b/progs/demos/tunnel.c @@ -202,11 +202,19 @@ special(int k, int x, int y) } } +static void +cleanup(void) +{ + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); +} + static void key(unsigned char k, int x, int y) { switch (k) { case 27: + cleanup(); exit(0); break; @@ -531,5 +539,6 @@ main(int ac, char **av) glutMainLoop(); + cleanup(); return 0; } diff --git a/progs/demos/tunnel2.c b/progs/demos/tunnel2.c index f4171a8346..0288ea0f8c 100644 --- a/progs/demos/tunnel2.c +++ b/progs/demos/tunnel2.c @@ -200,6 +200,13 @@ special(int k, int x, int y) } } +static void +cleanup(void) +{ + glDeleteTextures(1, &t1id); + glDeleteTextures(1, &t2id); +} + static void key(unsigned char k, int x, int y) { @@ -207,6 +214,7 @@ key(unsigned char k, int x, int y) case 27: glutDestroyWindow(channel[0]); glutDestroyWindow(channel[1]); + cleanup(); exit(0); break; @@ -602,6 +610,7 @@ main(int ac, char **av) calcposobs(); glutMainLoop(); + cleanup(); return 0; } -- cgit v1.2.3 From 5ed7764fd6354da8e2be15d6fb724c2d6be9be4a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Apr 2009 14:42:23 +0100 Subject: mesa/st: fix incorrect face, level in compress_with_blit We were incorrectly applying the destination texture face and level when requesting a transfer to the temporary texture, which has only one face and level. This would obviously cause problems uploading to compressed cube and mipmap textures. --- src/mesa/state_tracker/st_cb_texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index c3e990e077..aeb75117ec 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -418,7 +418,6 @@ compress_with_blit(GLcontext * ctx, const GLuint dstImageOffsets[1] = {0}; struct st_texture_image *stImage = st_texture_image(texImage); struct pipe_screen *screen = ctx->st->pipe->screen; - const GLuint face = _mesa_tex_target_to_face(target); const struct gl_texture_format *mesa_format; struct pipe_texture templ; struct pipe_texture *src_tex; @@ -467,7 +466,7 @@ compress_with_blit(GLcontext * ctx, /* Put user's tex data into the temporary texture */ tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex, - face, level, 0, + 0, 0, 0, /* face, level are zero */ PIPE_TRANSFER_WRITE, 0, 0, width, height); /* x, y, w, h */ map = screen->transfer_map(screen, tex_xfer); -- cgit v1.2.3 From 5250eec652af46d20261624fd043992355a0b4ba Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Apr 2009 14:43:31 +0100 Subject: util/time: add util_time_sleep() for windows userspace Somebody with a clue could probably do a better implemenation... --- src/gallium/auxiliary/util/u_time.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index 8afe4fccf7..8e167d3c42 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -217,4 +217,13 @@ void util_time_sleep(unsigned usecs) } while(start <= curr && curr < end || end < start && (curr < end || start <= curr)); } +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) +#include +#include + + +void util_time_sleep(unsigned usecs) +{ + Sleep((usecs + 999)/ 1000); +} #endif -- cgit v1.2.3 From dc9705d12d162ba6d087eb762e315de9f97bc456 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Apr 2009 09:51:46 -0600 Subject: i965: only upload constant buffer data when we actually need the const buffer Make the use_const_buffer field per-program and only call the code which updates the constant buffer's data if the flag is set. This should undo the perf regression from 20f3497e4b6756e330f7b3f54e8acaa1d6c92052 --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_curbe.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_vs.h | 2 -- src/mesa/drivers/dri/i965/brw_vs_emit.c | 10 +++++----- src/mesa/drivers/dri/i965/brw_wm.h | 2 -- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 12 ++++++------ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a0b3b06309..aef2ff5f86 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -161,6 +161,7 @@ struct brw_vertex_program { struct gl_vertex_program program; GLuint id; dri_bo *const_buffer; /** Program constant buffer/surface */ + GLboolean use_const_buffer; }; @@ -171,6 +172,7 @@ struct brw_fragment_program { GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */ dri_bo *const_buffer; /** Program constant buffer/surface */ + GLboolean use_const_buffer; }; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 2d15793078..9197fede2d 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -383,7 +383,8 @@ update_vertex_constant_buffer(struct brw_context *brw) printf("update VS constants in buffer %p\n", vp->const_buffer); printf("program %u\n", vp->program.Base.Id); } - update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); + if (vp->use_const_buffer) + update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); } @@ -393,7 +394,8 @@ update_fragment_constant_buffer(struct brw_context *brw) { struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; - update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); + if (fp->use_const_buffer) + update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index d20cf78b8a..1e4f66091e 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -75,8 +75,6 @@ struct brw_vs_compile { struct brw_reg userplane[6]; - /** using a real constant buffer? */ - GLboolean use_const_buffer; /** we may need up to 3 constants per instruction (if use_const_buffer) */ struct { GLint index; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 524f1211ce..b69616d6e5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -71,10 +71,10 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) #if 0 if (c->vp->program.Base.Parameters->NumParameters >= 6) - c->use_const_buffer = 1; + c->vp->use_const_buffer = 1; else #endif - c->use_const_buffer = GL_FALSE; + c->vp->use_const_buffer = GL_FALSE; /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ /* r0 -- reserved as usual @@ -96,7 +96,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* Vertex program parameters from curbe: */ - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { /* get constants from a real constant buffer */ c->prog_data.curb_read_length = 0; c->prog_data.nr_params = 4; /* XXX 0 causes a bug elsewhere... */ @@ -172,7 +172,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) reg++; } - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { for (i = 0; i < 3; i++) { c->current_const[i].index = -1; c->current_const[i].reg = brw_vec8_grf(reg, 0); @@ -869,7 +869,7 @@ get_src_reg( struct brw_vs_compile *c, case PROGRAM_STATE_VAR: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { return get_constant(c, inst, argIndex); } else if (relAddr) { diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index d0ab3bdc65..f0d31fc1dd 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -254,8 +254,6 @@ struct brw_wm_compile { GLuint tmp_max; GLuint subroutines[BRW_WM_MAX_SUBROUTINE]; - /** using a real constant buffer? */ - GLboolean use_const_buffer; /** we may need up to 3 constants per instruction (if use_const_buffer) */ struct { GLint index; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 22e17622c6..117460842a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -194,9 +194,9 @@ static void prealloc_reg(struct brw_wm_compile *c) const int nr_params = c->fp->program.Base.Parameters->NumParameters; /* use a real constant buffer, or just use a section of the GRF? */ - c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ + c->fp->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/ - if (c->use_const_buffer) { + if (c->fp->use_const_buffer) { /* We'll use a real constant buffer and fetch constants from * it with a dataport read message. */ @@ -253,14 +253,14 @@ static void prealloc_reg(struct brw_wm_compile *c) * They'll be found in these registers. * XXX alloc these on demand! */ - if (c->use_const_buffer) { + if (c->fp->use_const_buffer) { for (i = 0; i < 3; i++) { c->current_const[i].index = -1; c->current_const[i].reg = alloc_tmp(c); } } #if 0 - printf("USE CONST BUFFER? %d\n", c->use_const_buffer); + printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer); printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); #endif } @@ -368,7 +368,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, const GLuint nr = 1; const GLuint component = GET_SWZ(src->Swizzle, channel); - if (c->use_const_buffer && + if (c->fp->use_const_buffer && (src->File == PROGRAM_STATE_VAR || src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM)) { @@ -2609,7 +2609,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) #endif /* fetch any constants that this instruction needs */ - if (c->use_const_buffer) + if (c->fp->use_const_buffer) fetch_constants(c, inst); if (inst->CondUpdate) -- cgit v1.2.3 From 3ebcf2dd7489ecaf19a7167892069c4d58c285d8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 27 Apr 2009 17:13:40 +0100 Subject: util: Remove unix includes. --- src/gallium/auxiliary/util/u_time.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gallium/auxiliary/util/u_time.c b/src/gallium/auxiliary/util/u_time.c index 8e167d3c42..5268cbf79c 100644 --- a/src/gallium/auxiliary/util/u_time.c +++ b/src/gallium/auxiliary/util/u_time.c @@ -218,10 +218,6 @@ void util_time_sleep(unsigned usecs) end < start && (curr < end || start <= curr)); } #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) -#include -#include - - void util_time_sleep(unsigned usecs) { Sleep((usecs + 999)/ 1000); -- cgit v1.2.3 From c384ccb0c4f50f72bafdfb693d0aa36b4304a064 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 27 Apr 2009 17:30:05 +0100 Subject: wgl: Implement WGL_EXT_extensions_string extension. --- src/gallium/state_trackers/wgl/SConscript | 2 +- .../wgl/shared/stw_arbextensionsstring.c | 46 ----------------- .../wgl/shared/stw_extensionsstring.c | 58 ++++++++++++++++++++++ .../state_trackers/wgl/shared/stw_getprocaddress.c | 3 ++ 4 files changed, 62 insertions(+), 47 deletions(-) delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c create mode 100644 src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 61fd8bfc0c..5bbcc7175f 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -26,7 +26,7 @@ if env['platform'] in ['windows']: 'shared/stw_device.c', 'shared/stw_framebuffer.c', 'shared/stw_pixelformat.c', - 'shared/stw_arbextensionsstring.c', + 'shared/stw_extensionsstring.c', 'shared/stw_getprocaddress.c', 'shared/stw_arbpixelformat.c', 'shared/stw_tls.c', diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c deleted file mode 100644 index cd9fe93eee..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_arbextensionsstring.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#define WGL_WGLEXT_PROTOTYPES - -#include -#include - - -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringARB( - HDC hdc ) -{ - (void) hdc; - - return - "WGL_ARB_extensions_string " - "WGL_ARB_multisample " - "WGL_ARB_pixel_format"; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c new file mode 100644 index 0000000000..2660c591f9 --- /dev/null +++ b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c @@ -0,0 +1,58 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + + +static const char *stw_extension_string = + "WGL_ARB_extensions_string " + "WGL_ARB_multisample " + "WGL_ARB_pixel_format " + "WGL_EXT_extensions_string"; + + +WINGDIAPI const char * APIENTRY +wglGetExtensionsStringARB( + HDC hdc ) +{ + (void) hdc; + + return stw_extension_string; +} + + +WINGDIAPI const char * APIENTRY +wglGetExtensionsStringEXT( void ) +{ + return stw_extension_string; +} diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c index aa43120955..4070cbd5c0 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c @@ -53,6 +53,9 @@ static const struct stw_extension_entry stw_extension_entries[] = { STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ), STW_EXTENSION_ENTRY( wglGetPixelFormatAttribivARB ), + /* WGL_EXT_extensions_string */ + STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ), + { NULL, NULL } }; -- cgit v1.2.3 From 777b9ff43e88e456d686208c83712f26aba2dd95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Apr 2009 10:45:41 -0600 Subject: i965: only upload constant buffer data when we actually need the const buffer Make the use_const_buffer field per-program and only call the code which updates the constant buffer's data if the flag is set. This should undo the perf regression from 20f3497e4b6756e330f7b3f54e8acaa1d6c92052 (cherry picked from master, commit dc9705d12d162ba6d087eb762e315de9f97bc456) --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_curbe.c | 6 ++++-- src/mesa/drivers/dri/i965/brw_vs.h | 2 -- src/mesa/drivers/dri/i965/brw_vs_emit.c | 11 ++++++----- src/mesa/drivers/dri/i965/brw_wm.h | 2 -- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 16 ++++++++++------ 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index f0d4993e11..838e718d0d 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -161,6 +161,7 @@ struct brw_vertex_program { struct gl_vertex_program program; GLuint id; dri_bo *const_buffer; /** Program constant buffer/surface */ + GLboolean use_const_buffer; }; @@ -171,6 +172,7 @@ struct brw_fragment_program { GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */ dri_bo *const_buffer; /** Program constant buffer/surface */ + GLboolean use_const_buffer; }; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index da746e4aa0..e6e26cdc40 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -368,7 +368,8 @@ update_vertex_constant_buffer(struct brw_context *brw) printf("update VS constants in buffer %p vp = %p\n", vp->const_buffer, vp); printf("program %u\n", vp->program.Base.Id); } - update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); + if (vp->use_const_buffer) + update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); } @@ -382,7 +383,8 @@ update_fragment_constant_buffer(struct brw_context *brw) printf("update WM constants in buffer %p\n", fp->const_buffer); printf("program %u\n", fp->program.Base.Id); } - update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); + if (fp->use_const_buffer) + update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index d20cf78b8a..1e4f66091e 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -75,8 +75,6 @@ struct brw_vs_compile { struct brw_reg userplane[6]; - /** using a real constant buffer? */ - GLboolean use_const_buffer; /** we may need up to 3 constants per instruction (if use_const_buffer) */ struct { GLint index; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index c2b3702798..b9a338b1cd 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -76,9 +76,10 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) */ if (c->vp->program.Base.Parameters->NumParameters + c->vp->program.Base.NumTemporaries + 20 > BRW_MAX_GRF) - c->use_const_buffer = GL_TRUE; + c->vp->use_const_buffer = GL_TRUE; else - c->use_const_buffer = GL_FALSE; + c->vp->use_const_buffer = GL_FALSE; + /*printf("use_const_buffer = %d\n", c->use_const_buffer);*/ /* r0 -- reserved as usual @@ -100,7 +101,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) /* Vertex program parameters from curbe: */ - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { /* get constants from a real constant buffer */ c->prog_data.curb_read_length = 0; c->prog_data.nr_params = 4; /* XXX 0 causes a bug elsewhere... */ @@ -176,7 +177,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) reg++; } - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { for (i = 0; i < 3; i++) { c->current_const[i].index = -1; c->current_const[i].reg = brw_vec8_grf(reg, 0); @@ -873,7 +874,7 @@ get_src_reg( struct brw_vs_compile *c, case PROGRAM_STATE_VAR: case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: - if (c->use_const_buffer) { + if (c->vp->use_const_buffer) { return get_constant(c, inst, argIndex); } else if (relAddr) { diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 75205fddb7..2f80a60c12 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -257,8 +257,6 @@ struct brw_wm_compile { GLuint tmp_max; GLuint subroutines[BRW_WM_MAX_SUBROUTINE]; - /** using a real constant buffer? */ - GLboolean use_const_buffer; /** we may need up to 3 constants per instruction (if use_const_buffer) */ struct { GLint index; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 3471c1946e..eca4ca2c82 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -311,12 +311,12 @@ static void prealloc_reg(struct brw_wm_compile *c) /* use a real constant buffer, or just use a section of the GRF? */ /* XXX this heuristic may need adjustment... */ if ((nr_params + nr_temps) * 4 + reg_index > 80) - c->use_const_buffer = GL_TRUE; + c->fp->use_const_buffer = GL_TRUE; else - c->use_const_buffer = GL_FALSE; + c->fp->use_const_buffer = GL_FALSE; /*printf("WM use_const_buffer = %d\n", c->use_const_buffer);*/ - if (c->use_const_buffer) { + if (c->fp->use_const_buffer) { /* We'll use a real constant buffer and fetch constants from * it with a dataport read message. */ @@ -377,12 +377,16 @@ static void prealloc_reg(struct brw_wm_compile *c) * They'll be found in these registers. * XXX alloc these on demand! */ - if (c->use_const_buffer) { + if (c->fp->use_const_buffer) { for (i = 0; i < 3; i++) { c->current_const[i].index = -1; c->current_const[i].reg = brw_vec8_grf(alloc_grf(c), 0); } } +#if 0 + printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer); + printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); +#endif } @@ -488,7 +492,7 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, const GLuint nr = 1; const GLuint component = GET_SWZ(src->Swizzle, channel); - if (c->use_const_buffer && + if (c->fp->use_const_buffer && (src->File == PROGRAM_STATE_VAR || src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM)) { @@ -2730,7 +2734,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) #endif /* fetch any constants that this instruction needs */ - if (c->use_const_buffer) + if (c->fp->use_const_buffer) fetch_constants(c, inst); if (inst->CondUpdate) -- cgit v1.2.3 From dd4802176f7751e8c38c000687ff9cb9633649aa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Apr 2009 10:46:30 -0600 Subject: i965: #include prog_print.h to silence warning --- src/mesa/drivers/dri/i965/brw_curbe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index e6e26cdc40..f6d2014fb1 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -36,6 +36,7 @@ #include "main/macros.h" #include "main/enums.h" #include "shader/prog_parameter.h" +#include "shader/prog_print.h" #include "shader/prog_statevars.h" #include "intel_batchbuffer.h" #include "intel_regions.h" -- cgit v1.2.3 From 76b9da9e98bad4bf22fe6610394236203b620bd9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 27 Apr 2009 18:48:11 +0100 Subject: wgl: Cope with pre-existing threads. DllMain is called with DLL_THREAD_ATTACH only by threads created after the DLL is loaded by the process. --- src/gallium/state_trackers/wgl/shared/stw_tls.c | 39 ++++++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.c b/src/gallium/state_trackers/wgl/shared/stw_tls.c index e72bafb880..95863ca9cf 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.c +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.c @@ -44,6 +44,20 @@ stw_tls_init(void) return TRUE; } +static INLINE struct stw_tls_data * +stw_tls_data_create() +{ + struct stw_tls_data *data; + + data = CALLOC_STRUCT(stw_tls_data); + if (!data) + return NULL; + + data->currentPixelFormat = 0; + + return data; +} + boolean stw_tls_init_thread(void) { @@ -53,14 +67,9 @@ stw_tls_init_thread(void) return FALSE; } - data = MALLOC(sizeof(*data)); - if (!data) { + data = stw_tls_data_create(); + if(!data) return FALSE; - } - - data->currentPixelFormat = 0; - data->currentDC = NULL; - data->currentGLRC = 0; TlsSetValue(tlsIndex, data); @@ -93,9 +102,23 @@ stw_tls_cleanup(void) struct stw_tls_data * stw_tls_get_data(void) { + struct stw_tls_data *data; + if (tlsIndex == TLS_OUT_OF_INDEXES) { return NULL; } + + data = (struct stw_tls_data *) TlsGetValue(tlsIndex); + if(!data) { + /* DllMain is called with DLL_THREAD_ATTACH only by threads created after + * the DLL is loaded by the process */ + + data = stw_tls_data_create(); + if(!data) + return NULL; + + TlsSetValue(tlsIndex, data); + } - return (struct stw_tls_data *) TlsGetValue(tlsIndex); + return data; } -- cgit v1.2.3 From 359a58230e0644a39c1904a74bc25803dc6cab6f Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Mon, 27 Apr 2009 12:08:34 -0600 Subject: Avoid a segfault in shader compilation If a shader reaches an out-of-memory condition while adding a new function (reallocating the function list), a segfault will occur during cleanup (because the num_functions field is non-zero, but the functions pointer is NULL). This fixes that segfault by zeroing out the num_functions field if reallocation fails. --- src/mesa/shader/slang/slang_compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index ba2fc4f85c..d7ad879e97 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2161,6 +2161,12 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, (O->funs->num_functions + 1) * sizeof(slang_function)); if (O->funs->functions == NULL) { + /* Make sure that there are no functions marked, as the + * allocation is currently NULL, in order to avoid + * a potental segfault as we clean up later. + */ + O->funs->num_functions = 0; + slang_info_log_memory(C->L); slang_function_destruct(&parsed_func); return GL_FALSE; -- cgit v1.2.3 From 78c0e6aefcef442f035494b6fc9f6b599fe75e7e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 25 Apr 2009 13:48:53 +0200 Subject: r300: fix point size clamping when point is not attenuated --- src/mesa/drivers/dri/r300/r300_state.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 9c8b8adbe3..99441a22fd 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -728,7 +728,12 @@ static void r300ColorMask(GLcontext * ctx, static void r300PointSize(GLcontext * ctx, GLfloat size) { r300ContextPtr r300 = R300_CONTEXT(ctx); - /* same size limits for AA, non-AA points */ + + /* We need to clamp to user defined range here, because + * the HW clamping happens only for per vertex point size. */ + size = CLAMP(size, ctx->Point.MinSize, ctx->Point.MaxSize); + + /* same size limits for AA, non-AA points */ size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); R300_STATECHANGE(r300, ps); -- cgit v1.2.3 From 3d83a709b94e72608a061449bc30edc8af7c9ecc Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 25 Apr 2009 13:50:49 +0200 Subject: r300: fix valgrind warnings --- src/mesa/drivers/dri/radeon/radeon_common.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 312c2a72e9..8b5b892f0d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1186,7 +1186,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, rmesa->radeonScreen->texSize[0]); radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_GTT, rmesa->radeonScreen->gartTextures.size); } else { - struct drm_radeon_gem_info mminfo; + struct drm_radeon_gem_info mminfo = { 0 }; if (!drmCommandWriteRead(rmesa->dri.fd, DRM_RADEON_GEM_INFO, &mminfo, sizeof(mminfo))) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index e24be0c9bb..1541412028 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -249,8 +249,8 @@ static int radeonGetParam(__DRIscreenPrivate *sPriv, int param, void *value) { int ret; - drm_radeon_getparam_t gp; - struct drm_radeon_info info; + drm_radeon_getparam_t gp = { 0 }; + struct drm_radeon_info info = { 0 }; if (sPriv->drm_version.major >= 2) { info.value = (uint64_t)value; @@ -869,7 +869,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ ); return NULL; } - + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { screen->gartTextures.handle = dri_priv->gartTexHandle; screen->gartTextures.size = dri_priv->gartTexMapSize; @@ -884,7 +884,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__); return NULL; } - + screen->gart_texture_offset = dri_priv->gartTexOffset + screen->gart_base; } } @@ -1064,7 +1064,7 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv) radeonScreenPtr screen; int i; int ret; - uint32_t device_id; + uint32_t device_id = 0; uint32_t temp = 0; /* Allocate the private area */ -- cgit v1.2.3 From e33e28f52acca27a0cd594c6474fdea1b61fd615 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 27 Apr 2009 14:53:20 +0200 Subject: r300: do front/back color selection in HW for software TCL path --- src/mesa/drivers/dri/r300/r300_swtcl.c | 44 +++++++++++++++++++++------------- src/mesa/drivers/dri/r300/r300_swtcl.h | 2 ++ 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index fc849889b6..a40d0378db 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -196,6 +196,29 @@ static void r300SetVertexFormat( GLcontext *ctx ) rmesa->swtcl.specoffset = rmesa->swtcl.coloroffset + 1; } + if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { + VB->AttribPtr[VERT_ATTRIB_GENERIC0] = VB->ColorPtr[1]; + OutputsWritten |= 1 << VERT_RESULT_BFC0; +#if MESA_LITTLE_ENDIAN + EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA ); + ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW); +#else + EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR ); + ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW); +#endif + if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) { + GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); + OutputsWritten |= 1 << VERT_RESULT_BFC1; +#if MESA_LITTLE_ENDIAN + EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA ); + ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR3, swiz, MASK_XYZW); +#else + EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR ); + ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR3, swiz, MASK_XYZW); +#endif + } + } + if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE )) { GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO); InputsRead |= 1 << VERT_ATTRIB_POINT_SIZE; @@ -349,9 +372,8 @@ static void r300RenderPrimitive( GLcontext *ctx, GLenum prim ); * Build render functions from dd templates * ***********************************************************************/ -#define R300_TWOSIDE_BIT 0x01 -#define R300_UNFILLED_BIT 0x02 -#define R300_MAX_TRIFUNC 0x04 +#define R300_UNFILLED_BIT 0x01 +#define R300_MAX_TRIFUNC 0x02 static struct { tnl_points_func points; @@ -362,9 +384,9 @@ static struct { #define DO_FALLBACK 0 #define DO_UNFILLED (IND & R300_UNFILLED_BIT) -#define DO_TWOSIDE (IND & R300_TWOSIDE_BIT) +#define DO_TWOSIDE 0 #define DO_FLAT 0 -#define DO_OFFSET 0 +#define DO_OFFSET 0 #define DO_TRI 1 #define DO_QUAD 1 #define DO_LINE 1 @@ -452,26 +474,15 @@ do { \ #define TAG(x) x #include "tnl_dd/t_dd_tritmp.h" -#define IND (R300_TWOSIDE_BIT) -#define TAG(x) x##_twoside -#include "tnl_dd/t_dd_tritmp.h" - #define IND (R300_UNFILLED_BIT) #define TAG(x) x##_unfilled #include "tnl_dd/t_dd_tritmp.h" -#define IND (R300_TWOSIDE_BIT|R300_UNFILLED_BIT) -#define TAG(x) x##_twoside_unfilled -#include "tnl_dd/t_dd_tritmp.h" - - static void init_rast_tab( void ) { init(); - init_twoside(); init_unfilled(); - init_twoside_unfilled(); } /**********************************************************************/ @@ -523,7 +534,6 @@ static void r300ChooseRenderState( GLcontext *ctx ) GLuint index = 0; GLuint flags = ctx->_TriangleCaps; - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R300_TWOSIDE_BIT; if (flags & DD_TRI_UNFILLED) index |= R300_UNFILLED_BIT; if (index != rmesa->radeon.swtcl.RenderIndex) { diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index ebc99c9e8a..75c419380d 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -51,6 +51,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SWTCL_OVM_POS 0 #define SWTCL_OVM_COLOR0 2 #define SWTCL_OVM_COLOR1 3 +#define SWTCL_OVM_COLOR2 4 +#define SWTCL_OVM_COLOR3 5 #define SWTCL_OVM_TEX(n) ((n) + 6) #define SWTCL_OVM_POINT_SIZE 15 -- cgit v1.2.3 From 3c6bffa7618494a465ecb6ab6103143c12abb0c4 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 27 Apr 2009 15:31:01 +0200 Subject: r300: fallback only if stencil test is enabled --- src/mesa/drivers/dri/r300/r300_render.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 41b5e30be4..f87fee4af6 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -439,14 +439,9 @@ static int r300Fallback(GLcontext * ctx) FALLBACK_IF(ctx->RenderMode != GL_RENDER); - /* If GL_EXT_stencil_two_side is disabled, this fallback check can - * be removed. - */ - FALLBACK_IF(ctx->Stencil.Ref[0] != ctx->Stencil.Ref[back] - || ctx->Stencil.ValueMask[0] != - ctx->Stencil.ValueMask[back] - || ctx->Stencil.WriteMask[0] != - ctx->Stencil.WriteMask[back]); + FALLBACK_IF(ctx->Stencil.Enabled && (ctx->Stencil.Ref[0] != ctx->Stencil.Ref[back] + || ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[back] + || ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[back])); if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) FALLBACK_IF(ctx->Point.PointSprite); -- cgit v1.2.3 From ce0d10dd6cd688d16e004c33ea4418cd7254a7f7 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 27 Apr 2009 16:25:34 +0200 Subject: r300: fix fragment program limits --- src/mesa/drivers/dri/r300/r300_context.c | 29 +++++++++++++++++--------- src/mesa/drivers/dri/r300/r300_context.h | 24 ++++++++++++--------- src/mesa/drivers/dri/r300/r300_fragprog_emit.c | 8 +++---- src/mesa/drivers/dri/r300/r500_fragprog_emit.c | 2 +- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index c80dcd8420..4d1f10ba4d 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -308,16 +308,25 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; } - ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; - ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ - ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; - ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeInstructions = - PFS_MAX_ALU_INST + PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = - PFS_MAX_TEX_INDIRECT; - ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; + if (screen->chip_family >= CHIP_FAMILY_RV515) { + ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS; + ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ + ctx->Const.FragmentProgram.MaxNativeParameters = R500_PFS_NUM_CONST_REGS; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = R500_PFS_MAX_INST; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = R500_PFS_MAX_INST; + ctx->Const.FragmentProgram.MaxNativeInstructions = R500_PFS_MAX_INST; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = R500_PFS_MAX_INST; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; + } else { + ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS; + ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ + ctx->Const.FragmentProgram.MaxNativeParameters = R300_PFS_NUM_CONST_REGS; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = R300_PFS_MAX_ALU_INST; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = R300_PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeInstructions = R300_PFS_MAX_ALU_INST + R300_PFS_MAX_TEX_INST; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = R300_PFS_MAX_TEX_INDIRECT; + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; + } } /* Create the device specific rendering context. diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index f8d914e7ac..379977b2c7 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -450,11 +450,15 @@ struct r300_vertex_program_cont { struct r300_vertex_program *progs; }; -#define PFS_MAX_ALU_INST 64 -#define PFS_MAX_TEX_INST 64 -#define PFS_MAX_TEX_INDIRECT 4 -#define PFS_NUM_TEMP_REGS 32 -#define PFS_NUM_CONST_REGS 16 +#define R300_PFS_MAX_ALU_INST 64 +#define R300_PFS_MAX_TEX_INST 32 +#define R300_PFS_MAX_TEX_INDIRECT 4 +#define R300_PFS_NUM_TEMP_REGS 32 +#define R300_PFS_NUM_CONST_REGS 32 + +#define R500_PFS_MAX_INST 512 +#define R500_PFS_NUM_TEMP_REGS 128 +#define R500_PFS_NUM_CONST_REGS 256 struct r300_pfs_compile_state; struct r500_pfs_compile_state; @@ -500,7 +504,7 @@ struct r300_fragment_program_node { struct r300_fragment_program_code { struct { int length; /**< total # of texture instructions used */ - GLuint inst[PFS_MAX_TEX_INST]; + GLuint inst[R300_PFS_MAX_TEX_INST]; } tex; struct { @@ -510,7 +514,7 @@ struct r300_fragment_program_code { GLuint inst1; GLuint inst2; GLuint inst3; - } inst[PFS_MAX_ALU_INST]; + } inst[R300_PFS_MAX_ALU_INST]; } alu; struct r300_fragment_program_node node[4]; @@ -521,7 +525,7 @@ struct r300_fragment_program_code { * Remember which program register a given hardware constant * belongs to. */ - struct prog_src_register constant[PFS_NUM_CONST_REGS]; + struct prog_src_register constant[R300_PFS_NUM_CONST_REGS]; int const_nr; int max_temp_idx; @@ -536,7 +540,7 @@ struct r500_fragment_program_code { GLuint inst3; GLuint inst4; GLuint inst5; - } inst[512]; + } inst[R500_PFS_MAX_INST]; int inst_offset; int inst_end; @@ -545,7 +549,7 @@ struct r500_fragment_program_code { * Remember which program register a given hardware constant * belongs to. */ - struct prog_src_register constant[PFS_NUM_CONST_REGS]; + struct prog_src_register constant[R500_PFS_NUM_CONST_REGS]; int const_nr; int max_temp_idx; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c index 693d485de9..af8bb3887b 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c @@ -66,7 +66,7 @@ static GLboolean emit_const(void* data, GLuint file, GLuint index, GLuint *hwind } if (*hwindex >= code->const_nr) { - if (*hwindex >= PFS_NUM_CONST_REGS) { + if (*hwindex >= R300_PFS_NUM_CONST_REGS) { error("Out of hw constants!\n"); return GL_FALSE; } @@ -138,7 +138,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) { PROG_CODE; - if (code->alu.length >= PFS_MAX_ALU_INST) { + if (code->alu.length >= R300_PFS_MAX_ALU_INST) { error("Too many ALU instructions"); return GL_FALSE; } @@ -275,7 +275,7 @@ static GLboolean emit_tex(void* data, struct prog_instruction* inst) { PROG_CODE; - if (code->tex.length >= PFS_MAX_TEX_INST) { + if (code->tex.length >= R300_PFS_MAX_TEX_INST) { error("Too many TEX instructions"); return GL_FALSE; } @@ -318,7 +318,7 @@ static const struct radeon_pair_handler pair_handler = { .EmitPaired = &emit_alu, .EmitTex = &emit_tex, .BeginTexBlock = &begin_tex, - .MaxHwTemps = PFS_NUM_TEMP_REGS + .MaxHwTemps = R300_PFS_NUM_TEMP_REGS }; /** diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c index d9f81004e8..277f801c38 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c @@ -72,7 +72,7 @@ static GLboolean emit_const(void *data, GLuint file, GLuint idx, GLuint *hwindex } if (*hwindex >= code->const_nr) { - if (*hwindex >= PFS_NUM_CONST_REGS) { + if (*hwindex >= R500_PFS_NUM_CONST_REGS) { error("Out of hw constants!\n"); return GL_FALSE; } -- cgit v1.2.3 From 638261b3530106b70819c2fe0c3cd613c0d85777 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:23:11 +0200 Subject: gallium: Update the drm_api. Make it possible to pass state-tracker-specific data to the init_screen function, and even open the door for device-specific state-tracker screen initialization. Signed-off-by: Thomas Hellstrom --- src/gallium/include/state_tracker/drm_api.h | 19 +++++++++++- src/gallium/state_trackers/dri2/dri_screen.c | 35 +--------------------- src/gallium/state_trackers/dri2/dri_screen.h | 2 -- src/gallium/state_trackers/egl/egl_tracker.c | 2 +- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- src/gallium/winsys/drm/intel/gem/intel_be_api.h | 3 +- src/gallium/winsys/drm/intel/gem/intel_be_device.c | 35 +++++++++++++++++++++- .../winsys/drm/nouveau/dri/nouveau_screen.c | 2 +- .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 2 +- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 3 +- src/gallium/winsys/drm/radeon/core/radeon_drm.h | 3 +- 11 files changed, 63 insertions(+), 45 deletions(-) diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index 435435da29..5790b2f6c7 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -10,13 +10,30 @@ struct pipe_buffer; struct pipe_context; struct pipe_texture; +enum drm_create_screen_mode { + DRM_CREATE_NORMAL = 0, + DRM_CREATE_DRI1, + DRM_CREATE_DRIVER = 1024, + DRM_CREATE_MAX +}; + +/** + * Modes other than DRM_CREATE_NORMAL derive from this struct. + */ +/*@{*/ +struct drm_create_screen_arg { + enum drm_create_screen_mode mode; +}; +/*@}*/ + struct drm_api { /** * Special buffer functions */ /*@{*/ - struct pipe_screen* (*create_screen)(int drmFB, int pciID); + struct pipe_screen* (*create_screen)(int drm_fd, + struct drm_create_screen_arg *arg); struct pipe_context* (*create_context)(struct pipe_screen *screen); /*@}*/ diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c index ab5878a4bc..ab33003f51 100644 --- a/src/gallium/state_trackers/dri2/dri_screen.c +++ b/src/gallium/state_trackers/dri2/dri_screen.c @@ -67,37 +67,6 @@ static const __DRIextension *dri_screen_extensions[] = { NULL }; - -static void -dri_get_drm_minor(struct dri_screen *screen) -{ - /* TODO get the real minor */ - screen->minor = 0; -} - - -static void -dri_get_device_id(struct dri_screen *screen) -{ - char path[512]; - FILE *file; - - /* - * There must be a better way to get the deviceID. - * XXX this only works on Linux. - */ - snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", screen->minor); - file = fopen(path, "r"); - if (!file) { - return; - } - - fgets(path, sizeof(path), file); - sscanf(path, "%x", &screen->deviceID); - fclose(file); -} - - static const __DRIconfig ** dri_fill_in_modes(__DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, @@ -212,13 +181,11 @@ dri_init_screen2(__DRIscreenPrivate *sPriv) screen->sPriv = sPriv; screen->fd = sPriv->fd; - dri_get_drm_minor(screen); - dri_get_device_id(screen); sPriv->private = (void *) screen; sPriv->extensions = dri_screen_extensions; - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, screen->deviceID); + screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL); if (!screen->pipe_screen) { debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); goto fail; diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h index fe2676d0be..3751ec6121 100644 --- a/src/gallium/state_trackers/dri2/dri_screen.h +++ b/src/gallium/state_trackers/dri2/dri_screen.h @@ -54,9 +54,7 @@ struct dri_screen struct dri_context *dummyContext; /* drm */ - int deviceID; int fd; - int minor; /* gallium */ struct pipe_winsys *pipe_winsys; diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index abdf84544f..8e62008461 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -146,7 +146,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor) dev->drmFD = fd; drm_get_device_id(dev); - dev->screen = drm_api_hooks.create_screen(dev->drmFD, dev->deviceID); + dev->screen = drm_api_hooks.create_screen(dev->drmFD, NULL); if (!dev->screen) goto err_screen; dev->winsys = dev->screen->winsys; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 8a2711e70c..45e831f0c2 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -476,7 +476,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (!ms->screen) { - ms->screen = drm_api_hooks.create_screen(ms->fd, ms->PciInfo->device_id); + ms->screen = drm_api_hooks.create_screen(ms->fd, NULL); if (!ms->screen) { FatalError("Could not init pipe_screen\n"); diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.h b/src/gallium/winsys/drm/intel/gem/intel_be_api.h index 73e458d4ba..1c622f3b97 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.h @@ -8,7 +8,8 @@ #include "intel_be_device.h" -struct pipe_screen *intel_be_create_screen(int drmFD, int pciID); +struct pipe_screen *intel_be_create_screen(int drmFD, + struct drm_create_screen_arg *arg); struct pipe_context *intel_be_create_context(struct pipe_screen *screen); #endif diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c index c866c2a2f1..907ac86637 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -14,6 +14,7 @@ #include "softpipe/sp_winsys.h" #include "intel_be_api.h" +#include /* * Buffer @@ -290,11 +291,42 @@ intel_be_init_device(struct intel_be_device *dev, int fd, unsigned id) return true; } +static void +intel_be_get_device_id(unsigned int *device_id) +{ + char path[512]; + FILE *file; + + /* + * FIXME: Fix this up to use a drm ioctl or whatever. + */ + + snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); + file = fopen(path, "r"); + if (!file) { + return; + } + + fgets(path, sizeof(path), file); + sscanf(path, "%x", device_id); + fclose(file); +} + struct pipe_screen * -intel_be_create_screen(int drmFD, int deviceID) +intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg) { struct intel_be_device *dev; struct pipe_screen *screen; + unsigned int deviceID; + + if (arg != NULL) { + switch(arg->mode) { + case DRM_CREATE_NORMAL: + break; + default: + return NULL; + } + } /* Allocate the private area */ dev = malloc(sizeof(*dev)); @@ -302,6 +334,7 @@ intel_be_create_screen(int drmFD, int deviceID) return NULL; memset(dev, 0, sizeof(*dev)); + intel_be_get_device_id(&deviceID); intel_be_init_device(dev, drmFD, deviceID); if (dev->softpipe) { diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c index 0b45b1ff1f..4e9b76a909 100644 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c +++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c @@ -267,7 +267,7 @@ nouveau_screen_create(__DRIscreenPrivate *psp) nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0); - nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, 0); + nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, NULL); if (!nv_screen->pscreen) { FREE(nv_screen); return NULL; diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index c0127e803f..a558fda140 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -8,7 +8,7 @@ #include "nouveau_bo.h" static struct pipe_screen * -nouveau_drm_create_screen(int fd, int pciid) +nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) { struct pipe_winsys *ws; struct nouveau_winsys *nvws; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 3446654e28..1f89d1b1d1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -31,7 +31,8 @@ #include "radeon_drm.h" /* Create a pipe_screen. */ -struct pipe_screen* radeon_create_screen(int drmFB, int pciID) +struct pipe_screen* radeon_create_screen(int drmFB, + struct drm_create_screen_arg *arg ) { struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h index ca2d98ed1a..049f9984db 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h @@ -40,7 +40,8 @@ #include "radeon_r300.h" #include "radeon_winsys_softpipe.h" -struct pipe_screen* radeon_create_screen(int drmFB, int pciID); +struct pipe_screen* radeon_create_screen(int drmFB, + struct drm_create_screen_arg *arg); struct pipe_context* radeon_create_context(struct pipe_screen* screen); -- cgit v1.2.3 From 2e5acd24b0421f3824fbe441f4a7062c1f081109 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:32:59 +0200 Subject: gallium: Move the dri2 state tracker since we're about to extend it to dri1. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/Makefile | 28 ++ src/gallium/state_trackers/dri/dri_context.c | 170 ++++++++++++ src/gallium/state_trackers/dri/dri_context.h | 96 +++++++ src/gallium/state_trackers/dri/dri_drawable.c | 325 +++++++++++++++++++++++ src/gallium/state_trackers/dri/dri_drawable.h | 89 +++++++ src/gallium/state_trackers/dri/dri_extensions.c | 119 +++++++++ src/gallium/state_trackers/dri/dri_screen.c | 239 +++++++++++++++++ src/gallium/state_trackers/dri/dri_screen.h | 88 ++++++ src/gallium/state_trackers/dri2/Makefile | 28 -- src/gallium/state_trackers/dri2/dri_context.c | 170 ------------ src/gallium/state_trackers/dri2/dri_context.h | 96 ------- src/gallium/state_trackers/dri2/dri_drawable.c | 325 ----------------------- src/gallium/state_trackers/dri2/dri_drawable.h | 89 ------- src/gallium/state_trackers/dri2/dri_extensions.c | 119 --------- src/gallium/state_trackers/dri2/dri_screen.c | 239 ----------------- src/gallium/state_trackers/dri2/dri_screen.h | 88 ------ src/gallium/winsys/drm/intel/dri2/Makefile | 2 +- src/gallium/winsys/drm/nouveau/dri2/Makefile | 2 +- src/gallium/winsys/drm/radeon/dri2/Makefile | 2 +- 19 files changed, 1157 insertions(+), 1157 deletions(-) create mode 100644 src/gallium/state_trackers/dri/Makefile create mode 100644 src/gallium/state_trackers/dri/dri_context.c create mode 100644 src/gallium/state_trackers/dri/dri_context.h create mode 100644 src/gallium/state_trackers/dri/dri_drawable.c create mode 100644 src/gallium/state_trackers/dri/dri_drawable.h create mode 100644 src/gallium/state_trackers/dri/dri_extensions.c create mode 100644 src/gallium/state_trackers/dri/dri_screen.c create mode 100644 src/gallium/state_trackers/dri/dri_screen.h delete mode 100644 src/gallium/state_trackers/dri2/Makefile delete mode 100644 src/gallium/state_trackers/dri2/dri_context.c delete mode 100644 src/gallium/state_trackers/dri2/dri_context.h delete mode 100644 src/gallium/state_trackers/dri2/dri_drawable.c delete mode 100644 src/gallium/state_trackers/dri2/dri_drawable.h delete mode 100644 src/gallium/state_trackers/dri2/dri_extensions.c delete mode 100644 src/gallium/state_trackers/dri2/dri_screen.c delete mode 100644 src/gallium/state_trackers/dri2/dri_screen.h diff --git a/src/gallium/state_trackers/dri/Makefile b/src/gallium/state_trackers/dri/Makefile new file mode 100644 index 0000000000..47750e997e --- /dev/null +++ b/src/gallium/state_trackers/dri/Makefile @@ -0,0 +1,28 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = dri2drm + +LIBRARY_INCLUDES = \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -I$(TOP)/src/mesa/main \ + $(shell pkg-config --cflags-only-I libdrm) + + +C_SOURCES = \ + dri_context.c \ + dri_screen.c \ + dri_drawable.c \ + dri_extensions.c + +# $(TOP)/src/mesa/drivers/dri/common/utils.c \ + $(TOP)/src/mesa/drivers/dri/common/vblank.c \ + $(TOP)/src/mesa/drivers/dri/common/dri_util.c \ + $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \ + $(TOP)/src/mesa/drivers/common/driverfuncs.c \ + $(TOP)/src/mesa/drivers/dri/common/texmem.c \ + $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c + +include ../../Makefile.template diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c new file mode 100644 index 0000000000..92c26ac70f --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -0,0 +1,170 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#include "dri_screen.h" + +#include "dri_drawable.h" + + +#include "state_tracker/drm_api.h" +#include "state_tracker/st_public.h" +#include "state_tracker/st_context.h" +#include "pipe/p_context.h" + +#include "dri_context.h" + +#include "util/u_memory.h" + + +GLboolean +dri_create_context(const __GLcontextModes *visual, + __DRIcontextPrivate *cPriv, + void *sharedContextPrivate) +{ + __DRIscreenPrivate *sPriv = cPriv->driScreenPriv; + struct dri_screen *screen = dri_screen(sPriv); + struct dri_context *ctx = NULL; + struct st_context *st_share = NULL; + + if (sharedContextPrivate) { + st_share = ((struct dri_context *) sharedContextPrivate)->st; + } + + ctx = CALLOC_STRUCT(dri_context); + if (ctx == NULL) + goto fail; + + cPriv->driverPrivate = ctx; + ctx->cPriv = cPriv; + ctx->sPriv = sPriv; + + driParseConfigFiles(&ctx->optionCache, + &screen->optionCache, + sPriv->myNum, + "dri"); + + ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen); + + if (ctx->pipe == NULL) + goto fail; + + /* used in dri_flush_frontbuffer */ + ctx->pipe->priv = ctx; + + ctx->st = st_create_context(ctx->pipe, visual, st_share); + if (ctx->st == NULL) + goto fail; + + dri_init_extensions(ctx); + + return GL_TRUE; + +fail: + if (ctx && ctx->st) + st_destroy_context(ctx->st); + + if (ctx && ctx->pipe) + ctx->pipe->destroy(ctx->pipe); + + FREE(ctx); + return FALSE; +} + + +void +dri_destroy_context(__DRIcontextPrivate *cPriv) +{ + struct dri_context *ctx = dri_context(cPriv); + struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); + + /* No particular reason to wait for command completion before + * destroying a context, but it is probably worthwhile flushing it + * to avoid having to add code elsewhere to cope with flushing a + * partially destroyed context. + */ + st_flush(ctx->st, 0, NULL); + + if (screen->dummyContext == ctx) + screen->dummyContext = NULL; + + /* Also frees ctx->pipe? + */ + st_destroy_context(ctx->st); + + FREE(ctx); +} + + +GLboolean +dri_unbind_context(__DRIcontextPrivate *cPriv) +{ + struct dri_context *ctx = dri_context(cPriv); + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + /* XXX make_current(NULL)? */ + return GL_TRUE; +} + + +GLboolean +dri_make_current(__DRIcontextPrivate *cPriv, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv) +{ + if (cPriv) { + struct dri_context *ctx = dri_context(cPriv); + struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); + struct dri_drawable *draw = dri_drawable(driDrawPriv); + struct dri_drawable *read = dri_drawable(driReadPriv); + + /* This is for situations in which we need a rendering context but + * there may not be any currently bound. + */ + screen->dummyContext = ctx; + + st_make_current(ctx->st, + draw->stfb, + read->stfb); + + /* used in dri_flush_frontbuffer */ + ctx->dPriv = driDrawPriv; + + if (driDrawPriv) + dri_get_buffers(driDrawPriv); + if (driDrawPriv != driReadPriv && driReadPriv) + dri_get_buffers(driReadPriv); + } else { + st_make_current(NULL, NULL, NULL); + } + + return GL_TRUE; +} + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h new file mode 100644 index 0000000000..e910472700 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_context.h @@ -0,0 +1,96 @@ +/************************************************************************** + * + * Copyright (C) 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#ifndef DRI_CONTEXT_H +#define DRI_CONTEXT_H + +#include "pipe/p_compiler.h" +#include "drm.h" +#include "dri_util.h" + + +struct pipe_context; +struct pipe_fence; +struct st_context; +struct dri_drawable; + + +struct dri_context +{ + /* dri */ + __DRIscreenPrivate *sPriv; + __DRIcontextPrivate *cPriv; + __DRIdrawablePrivate *dPriv; + + driOptionCache optionCache; + + /* gallium */ + struct st_context *st; + struct pipe_context *pipe; +}; + + +static INLINE struct dri_context * +dri_context(__DRIcontextPrivate *driContextPriv) +{ + return (struct dri_context *) driContextPriv->driverPrivate; +} + + +/*********************************************************************** + * dri_context.c + */ +void +dri_destroy_context(__DRIcontextPrivate * driContextPriv); + +boolean +dri_unbind_context(__DRIcontextPrivate * driContextPriv); + +boolean +dri_make_current(__DRIcontextPrivate * driContextPriv, + __DRIdrawablePrivate * driDrawPriv, + __DRIdrawablePrivate * driReadPriv); + +boolean +dri_create_context(const __GLcontextModes * visual, + __DRIcontextPrivate * driContextPriv, + void *sharedContextPrivate); + + +/*********************************************************************** + * dri_extensions.c + */ +void +dri_init_extensions(struct dri_context *ctx); + +#endif + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c new file mode 100644 index 0000000000..2e3f4099e2 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -0,0 +1,325 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#include "dri_screen.h" +#include "dri_context.h" +#include "dri_drawable.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" +#include "state_tracker/drm_api.h" +#include "state_tracker/st_public.h" +#include "state_tracker/st_context.h" +#include "state_tracker/st_cb_fbo.h" + +#include "util/u_memory.h" + + +static void +dri_copy_to_front(__DRIdrawablePrivate *dPriv, + struct pipe_surface *from, + int x, int y, unsigned w, unsigned h) +{ + /* TODO send a message to the Xserver to copy to the real front buffer */ +} + + +static struct pipe_surface * +dri_surface_from_handle(struct pipe_screen *screen, + unsigned handle, + enum pipe_format format, + unsigned width, + unsigned height, + unsigned pitch) +{ + struct pipe_surface *surface = NULL; + struct pipe_texture *texture = NULL; + struct pipe_texture templat; + struct pipe_buffer *buf = NULL; + + buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle); + if (!buf) + return NULL; + + memset(&templat, 0, sizeof(templat)); + templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; + templat.target = PIPE_TEXTURE_2D; + templat.last_level = 0; + templat.depth[0] = 1; + templat.format = format; + templat.width[0] = width; + templat.height[0] = height; + pf_get_block(templat.format, &templat.block); + + texture = screen->texture_blanket(screen, + &templat, + &pitch, + buf); + + /* we don't need the buffer from this point on */ + pipe_buffer_reference(&buf, NULL); + + if (!texture) + return NULL; + + surface = screen->get_tex_surface(screen, texture, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* we don't need the texture from this point on */ + pipe_texture_reference(&texture, NULL); + return surface; +} + + +/** + * This will be called a drawable is known to have been resized. + */ +void +dri_get_buffers(__DRIdrawablePrivate *dPriv) +{ + struct dri_drawable *drawable = dri_drawable(dPriv); + struct pipe_surface *surface = NULL; + struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen; + __DRIbuffer *buffers = NULL; + __DRIscreen *dri_screen = drawable->sPriv; + __DRIdrawable *dri_drawable = drawable->dPriv; + boolean have_depth = FALSE; + int i, count; + + buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable, + &dri_drawable->w, + &dri_drawable->h, + drawable->attachments, + drawable->num_attachments, + &count, + dri_drawable->loaderPrivate); + + if (buffers == NULL) { + return; + } + + /* set one cliprect to cover the whole dri_drawable */ + dri_drawable->x = 0; + dri_drawable->y = 0; + dri_drawable->backX = 0; + dri_drawable->backY = 0; + dri_drawable->numClipRects = 1; + dri_drawable->pClipRects[0].x1 = 0; + dri_drawable->pClipRects[0].y1 = 0; + dri_drawable->pClipRects[0].x2 = dri_drawable->w; + dri_drawable->pClipRects[0].y2 = dri_drawable->h; + dri_drawable->numBackClipRects = 1; + dri_drawable->pBackClipRects[0].x1 = 0; + dri_drawable->pBackClipRects[0].y1 = 0; + dri_drawable->pBackClipRects[0].x2 = dri_drawable->w; + dri_drawable->pBackClipRects[0].y2 = dri_drawable->h; + + for (i = 0; i < count; i++) { + enum pipe_format format = 0; + int index = 0; + + switch (buffers[i].attachment) { + case __DRI_BUFFER_FRONT_LEFT: + index = ST_SURFACE_FRONT_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_FAKE_FRONT_LEFT: + index = ST_SURFACE_FRONT_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_BACK_LEFT: + index = ST_SURFACE_BACK_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_DEPTH: + index = ST_SURFACE_DEPTH; + format = PIPE_FORMAT_Z24S8_UNORM; + break; + case __DRI_BUFFER_STENCIL: + index = ST_SURFACE_DEPTH; + format = PIPE_FORMAT_Z24S8_UNORM; + break; + case __DRI_BUFFER_ACCUM: + default: + assert(0); + } + assert(buffers[i].cpp == 4); + + if (index == ST_SURFACE_DEPTH) { + if (have_depth) + continue; + else + have_depth = TRUE; + } + + surface = dri_surface_from_handle(screen, + buffers[i].name, + format, + dri_drawable->w, + dri_drawable->h, + buffers[i].pitch); + + st_set_framebuffer_surface(drawable->stfb, index, surface); + pipe_surface_reference(&surface, NULL); + } + /* this needed, or else the state tracker fails to pick the new buffers */ + st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h); +} + + +void +dri_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surf, + void *context_private) +{ + struct dri_context *ctx = (struct dri_context *)context_private; + dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height); +} + + +void +dri_swap_buffers(__DRIdrawablePrivate * dPriv) +{ + /* not needed for dri2 */ + assert(0); +} + + +void +dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) +{ + /* not needed for dri2 */ + assert(0); +} + + +/** + * This is called when we need to set up GL rendering to a new X window. + */ +boolean +dri_create_buffer(__DRIscreenPrivate *sPriv, + __DRIdrawablePrivate *dPriv, + const __GLcontextModes *visual, + boolean isPixmap) +{ + enum pipe_format colorFormat, depthFormat, stencilFormat; + struct dri_screen *screen = sPriv->private; + struct dri_drawable *drawable = NULL; + struct pipe_screen *pscreen = screen->pipe_screen; + int i; + + if (isPixmap) + goto fail; /* not implemented */ + + drawable = CALLOC_STRUCT(dri_drawable); + if (drawable == NULL) + goto fail; + + /* XXX: todo: use the pipe_screen queries to figure out which + * render targets are supportable. + */ + assert(visual->redBits == 8); + assert(visual->depthBits == 24 || visual->depthBits == 0); + assert(visual->stencilBits == 8 || visual->stencilBits == 0); + + colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; + + if (visual->depthBits) { + if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + depthFormat = PIPE_FORMAT_Z24S8_UNORM; + else + depthFormat = PIPE_FORMAT_S8Z24_UNORM; + } else + depthFormat = PIPE_FORMAT_NONE; + + if (visual->stencilBits) { + if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + stencilFormat = PIPE_FORMAT_Z24S8_UNORM; + else + stencilFormat = PIPE_FORMAT_S8Z24_UNORM; + } else + stencilFormat = PIPE_FORMAT_NONE; + + drawable->stfb = st_create_framebuffer(visual, + colorFormat, + depthFormat, + stencilFormat, + dPriv->w, + dPriv->h, + (void*) drawable); + if (drawable->stfb == NULL) + goto fail; + + drawable->sPriv = sPriv; + drawable->dPriv = dPriv; + dPriv->driverPrivate = (void *) drawable; + + /* setup dri2 buffers information */ + i = 0; + drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT; +#if 0 + /* TODO incase of double buffer visual, delay fake creation */ + drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT; +#endif + if (visual->doubleBufferMode) + drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT; + if (visual->depthBits) + drawable->attachments[i++] = __DRI_BUFFER_DEPTH; + if (visual->stencilBits) + drawable->attachments[i++] = __DRI_BUFFER_STENCIL; + drawable->num_attachments = i; + + return GL_TRUE; +fail: + FREE(drawable); + return GL_FALSE; +} + + +void +dri_destroy_buffer(__DRIdrawablePrivate *dPriv) +{ + struct dri_drawable *drawable = dri_drawable(dPriv); + + st_unreference_framebuffer(drawable->stfb); + + FREE(drawable); +} + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h new file mode 100644 index 0000000000..185c657b35 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -0,0 +1,89 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef DRI_DRAWABLE_H +#define DRI_DRAWABLE_H + +#include "pipe/p_compiler.h" + +struct pipe_surface; +struct pipe_fence; +struct st_framebuffer; + + +struct dri_drawable +{ + /* dri */ + __DRIdrawablePrivate *dPriv; + __DRIscreenPrivate *sPriv; + + unsigned attachments[8]; + unsigned num_attachments; + + /* gallium */ + struct st_framebuffer *stfb; +}; + + +static INLINE struct dri_drawable * +dri_drawable(__DRIdrawablePrivate * driDrawPriv) +{ + return (struct dri_drawable *) driDrawPriv->driverPrivate; +} + + +/*********************************************************************** + * dri_drawable.c + */ +boolean +dri_create_buffer(__DRIscreenPrivate *sPriv, + __DRIdrawablePrivate *dPriv, + const __GLcontextModes *visual, + boolean isPixmap); + +void +dri_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surf, + void *context_private); + +void +dri_swap_buffers(__DRIdrawablePrivate * dPriv); + +void +dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, + int x, int y, + int w, int h); + +void +dri_get_buffers(__DRIdrawablePrivate * dPriv); + +void +dri_destroy_buffer(__DRIdrawablePrivate *dPriv); + +#endif + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c new file mode 100644 index 0000000000..732d1e89b0 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -0,0 +1,119 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#include "dri_screen.h" +#include "dri_context.h" +#include "state_tracker/st_context.h" + +#define need_GL_ARB_multisample +#define need_GL_ARB_occlusion_query +#define need_GL_ARB_point_parameters +#define need_GL_ARB_texture_compression +#define need_GL_ARB_vertex_buffer_object +#define need_GL_ARB_vertex_program +#define need_GL_ARB_window_pos +#define need_GL_EXT_blend_color +#define need_GL_EXT_blend_equation_separate +#define need_GL_EXT_blend_func_separate +#define need_GL_EXT_blend_minmax +#define need_GL_EXT_cull_vertex +#define need_GL_EXT_fog_coord +#define need_GL_EXT_framebuffer_object +#define need_GL_EXT_multi_draw_arrays +#define need_GL_EXT_secondary_color +#define need_GL_NV_vertex_program +#include "extension_helper.h" + + +/** + * Extension strings exported by the driver. + */ +const struct dri_extension card_extensions[] = { + {"GL_ARB_multisample", GL_ARB_multisample_functions}, + {"GL_ARB_multitexture", NULL}, + {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, + {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, + {"GL_ARB_texture_border_clamp", NULL}, + {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions}, + {"GL_ARB_texture_cube_map", NULL}, + {"GL_ARB_texture_env_add", NULL}, + {"GL_ARB_texture_env_combine", NULL}, + {"GL_ARB_texture_env_dot3", NULL}, + {"GL_ARB_texture_mirrored_repeat", NULL}, + {"GL_ARB_texture_rectangle", NULL}, + {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, + {"GL_ARB_pixel_buffer_object", NULL}, + {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, + {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, + {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, + {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, + {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, + {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, + {"GL_EXT_blend_subtract", NULL}, + {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions}, + {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions}, + {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions}, + {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions}, + {"GL_EXT_packed_depth_stencil", NULL}, + {"GL_EXT_pixel_buffer_object", NULL}, + {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, + {"GL_EXT_stencil_wrap", NULL}, + {"GL_EXT_texture_edge_clamp", NULL}, + {"GL_EXT_texture_env_combine", NULL}, + {"GL_EXT_texture_env_dot3", NULL}, + {"GL_EXT_texture_filter_anisotropic", NULL}, + {"GL_EXT_texture_lod_bias", NULL}, + {"GL_3DFX_texture_compression_FXT1", NULL}, + {"GL_APPLE_client_storage", NULL}, + {"GL_MESA_pack_invert", NULL}, + {"GL_MESA_ycbcr_texture", NULL}, + {"GL_NV_blend_square", NULL}, + {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, + {"GL_NV_vertex_program1_1", NULL}, + {"GL_SGIS_generate_mipmap", NULL }, + {NULL, NULL} +}; + + +void +dri_init_extensions(struct dri_context *ctx) +{ + /* The card_extensions list should be pruned according to the + * capabilities of the pipe_screen. This is actually something + * that can/should be done inside st_create_context(). + */ + if (ctx) + driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE); + else + driInitExtensions(NULL, card_extensions, GL_FALSE); +} + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c new file mode 100644 index 0000000000..ab33003f51 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -0,0 +1,239 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#include "utils.h" +#include "vblank.h" +#include "xmlpool.h" + +#include "dri_screen.h" +#include "dri_context.h" +#include "dri_drawable.h" + +#include "pipe/p_context.h" +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" +#include "state_tracker/drm_api.h" +#include "state_tracker/st_public.h" +#include "state_tracker/st_cb_fbo.h" + + +PUBLIC const char __driConfigOptions[] = + DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY + /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/ + DRI_CONF_ALLOW_LARGE_TEXTURES(1) + DRI_CONF_SECTION_END DRI_CONF_END; + + +const uint __driNConfigOptions = 3; + + +static const __DRIextension *dri_screen_extensions[] = { + &driReadDrawableExtension, + &driCopySubBufferExtension.base, + &driSwapControlExtension.base, + &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, + NULL +}; + +static const __DRIconfig ** +dri_fill_in_modes(__DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer) +{ + __DRIconfig **configs; + __GLcontextModes *m; + unsigned num_modes; + uint8_t depth_bits_array[3]; + uint8_t stencil_bits_array[3]; + uint8_t msaa_samples_array[1]; + unsigned depth_buffer_factor; + unsigned back_buffer_factor; + unsigned msaa_samples_factor; + GLenum fb_format; + GLenum fb_type; + int i; + + static const GLenum back_buffer_modes[] = { + GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML + }; + + /* TODO probe the hardware of what is supports */ + depth_bits_array[0] = 0; + depth_bits_array[1] = 24; + depth_bits_array[2] = 24; + + stencil_bits_array[0] = 0; /* no depth or stencil */ + stencil_bits_array[1] = 0; /* z24x8 */ + stencil_bits_array[2] = 8; /* z24s8 */ + + msaa_samples_array[0] = 0; + + depth_buffer_factor = 3; + back_buffer_factor = 3; + msaa_samples_factor = 1; + + num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4; + + if (pixel_bits == 16) { + fb_format = GL_RGB; + fb_type = GL_UNSIGNED_SHORT_5_6_5; + } + else { + fb_format = GL_BGRA; + fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; + } + + configs = driCreateConfigs(fb_format, fb_type, + depth_bits_array, + stencil_bits_array, depth_buffer_factor, + back_buffer_modes, back_buffer_factor, + msaa_samples_array, msaa_samples_factor); + if (configs == NULL) { + debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__); + return NULL; + } + + for (i = 0; configs[i]; i++) { + m = &configs[i]->modes; + if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { + m->visualRating = GLX_SLOW_CONFIG; + } + } + + return (const const __DRIconfig **) configs; +} + + +/** + * Get information about previous buffer swaps. + */ +int +dri_get_swap_info(__DRIdrawablePrivate * dPriv, + __DRIswapInfo * sInfo) +{ + if (dPriv == NULL || + dPriv->driverPrivate == NULL || + sInfo == NULL) + return -1; + else + return 0; +} + + +/** + * NULL stub for old dri loaders + */ +const __DRIconfig ** +dri_init_screen(__DRIscreenPrivate *sPriv) +{ + return NULL; +} + + +/** + * This is the driver specific part of the createNewScreen entry point. + * + * Returns the __GLcontextModes supported by this driver. + */ +const __DRIconfig ** +dri_init_screen2(__DRIscreenPrivate *sPriv) +{ + struct dri_screen *screen; + + /* Set up dispatch table to cope with all known extensions */ + dri_init_extensions(NULL); + + screen = CALLOC_STRUCT(dri_screen); + if (!screen) + goto fail; + + screen->sPriv = sPriv; + screen->fd = sPriv->fd; + sPriv->private = (void *) screen; + sPriv->extensions = dri_screen_extensions; + + + screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL); + if (!screen->pipe_screen) { + debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); + goto fail; + } + + /* We need to hook in here */ + screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer; + + driParseOptionInfo(&screen->optionCache, + __driConfigOptions, + __driNConfigOptions); + + return dri_fill_in_modes(sPriv, + 4 * 8, + 24, + 8, + 1); +fail: + return NULL; +} + + +void +dri_destroy_screen(__DRIscreenPrivate * sPriv) +{ + struct dri_screen *screen = dri_screen(sPriv); + + screen->pipe_screen->destroy(screen->pipe_screen); + FREE(screen); + sPriv->private = NULL; +} + + +PUBLIC const struct __DriverAPIRec driDriverAPI = { + .InitScreen = dri_init_screen, /* not supported but exported */ + .DestroyScreen = dri_destroy_screen, + .CreateContext = dri_create_context, + .DestroyContext = dri_destroy_context, + .CreateBuffer = dri_create_buffer, + .DestroyBuffer = dri_destroy_buffer, + .SwapBuffers = dri_swap_buffers, /* not supported but exported */ + .MakeCurrent = dri_make_current, + .UnbindContext = dri_unbind_context, + .GetSwapInfo = dri_get_swap_info, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */ + .InitScreen2 = dri_init_screen2, +}; + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h new file mode 100644 index 0000000000..3751ec6121 --- /dev/null +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -0,0 +1,88 @@ +/************************************************************************** + * + * Copyright 2009, VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Author: Keith Whitwell + * Author: Jakob Bornecrantz + */ + +#ifndef DRI_SCREEN_H +#define DRI_SCREEN_H + +#include "dri_util.h" +#include "xmlconfig.h" + +#include "pipe/p_compiler.h" + +struct dri_screen +{ + /* dri */ + __DRIscreenPrivate *sPriv; + + /** + * Configuration cache with default values for all contexts + */ + driOptionCache optionCache; + + /** + * Temporary(?) context to use for SwapBuffers or other situations in + * which we need a rendering context, but none is currently bound. + */ + struct dri_context *dummyContext; + + /* drm */ + int fd; + + /* gallium */ + struct pipe_winsys *pipe_winsys; + struct pipe_screen *pipe_screen; +}; + + +/** cast wrapper */ +static INLINE struct dri_screen * +dri_screen(__DRIscreenPrivate *sPriv) +{ + return (struct dri_screen *) sPriv->private; +} + + +/*********************************************************************** + * dri_screen.c + */ +const __DRIconfig ** +dri_init_screen2(__DRIscreenPrivate *sPriv); + +void +dri_destroy_screen(__DRIscreenPrivate * sPriv); + +int +dri_get_swap_info(__DRIdrawablePrivate * dPriv, + __DRIswapInfo * sInfo); + +#endif + +/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/Makefile b/src/gallium/state_trackers/dri2/Makefile deleted file mode 100644 index 47750e997e..0000000000 --- a/src/gallium/state_trackers/dri2/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../../.. -include $(TOP)/configs/current - -LIBNAME = dri2drm - -LIBRARY_INCLUDES = \ - -I$(TOP)/include \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/drivers/dri/common \ - -I$(TOP)/src/mesa/main \ - $(shell pkg-config --cflags-only-I libdrm) - - -C_SOURCES = \ - dri_context.c \ - dri_screen.c \ - dri_drawable.c \ - dri_extensions.c - -# $(TOP)/src/mesa/drivers/dri/common/utils.c \ - $(TOP)/src/mesa/drivers/dri/common/vblank.c \ - $(TOP)/src/mesa/drivers/dri/common/dri_util.c \ - $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \ - $(TOP)/src/mesa/drivers/common/driverfuncs.c \ - $(TOP)/src/mesa/drivers/dri/common/texmem.c \ - $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c - -include ../../Makefile.template diff --git a/src/gallium/state_trackers/dri2/dri_context.c b/src/gallium/state_trackers/dri2/dri_context.c deleted file mode 100644 index 92c26ac70f..0000000000 --- a/src/gallium/state_trackers/dri2/dri_context.c +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#include "dri_screen.h" - -#include "dri_drawable.h" - - -#include "state_tracker/drm_api.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "pipe/p_context.h" - -#include "dri_context.h" - -#include "util/u_memory.h" - - -GLboolean -dri_create_context(const __GLcontextModes *visual, - __DRIcontextPrivate *cPriv, - void *sharedContextPrivate) -{ - __DRIscreenPrivate *sPriv = cPriv->driScreenPriv; - struct dri_screen *screen = dri_screen(sPriv); - struct dri_context *ctx = NULL; - struct st_context *st_share = NULL; - - if (sharedContextPrivate) { - st_share = ((struct dri_context *) sharedContextPrivate)->st; - } - - ctx = CALLOC_STRUCT(dri_context); - if (ctx == NULL) - goto fail; - - cPriv->driverPrivate = ctx; - ctx->cPriv = cPriv; - ctx->sPriv = sPriv; - - driParseConfigFiles(&ctx->optionCache, - &screen->optionCache, - sPriv->myNum, - "dri"); - - ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen); - - if (ctx->pipe == NULL) - goto fail; - - /* used in dri_flush_frontbuffer */ - ctx->pipe->priv = ctx; - - ctx->st = st_create_context(ctx->pipe, visual, st_share); - if (ctx->st == NULL) - goto fail; - - dri_init_extensions(ctx); - - return GL_TRUE; - -fail: - if (ctx && ctx->st) - st_destroy_context(ctx->st); - - if (ctx && ctx->pipe) - ctx->pipe->destroy(ctx->pipe); - - FREE(ctx); - return FALSE; -} - - -void -dri_destroy_context(__DRIcontextPrivate *cPriv) -{ - struct dri_context *ctx = dri_context(cPriv); - struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); - - /* No particular reason to wait for command completion before - * destroying a context, but it is probably worthwhile flushing it - * to avoid having to add code elsewhere to cope with flushing a - * partially destroyed context. - */ - st_flush(ctx->st, 0, NULL); - - if (screen->dummyContext == ctx) - screen->dummyContext = NULL; - - /* Also frees ctx->pipe? - */ - st_destroy_context(ctx->st); - - FREE(ctx); -} - - -GLboolean -dri_unbind_context(__DRIcontextPrivate *cPriv) -{ - struct dri_context *ctx = dri_context(cPriv); - st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); - /* XXX make_current(NULL)? */ - return GL_TRUE; -} - - -GLboolean -dri_make_current(__DRIcontextPrivate *cPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - if (cPriv) { - struct dri_context *ctx = dri_context(cPriv); - struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); - struct dri_drawable *draw = dri_drawable(driDrawPriv); - struct dri_drawable *read = dri_drawable(driReadPriv); - - /* This is for situations in which we need a rendering context but - * there may not be any currently bound. - */ - screen->dummyContext = ctx; - - st_make_current(ctx->st, - draw->stfb, - read->stfb); - - /* used in dri_flush_frontbuffer */ - ctx->dPriv = driDrawPriv; - - if (driDrawPriv) - dri_get_buffers(driDrawPriv); - if (driDrawPriv != driReadPriv && driReadPriv) - dri_get_buffers(driReadPriv); - } else { - st_make_current(NULL, NULL, NULL); - } - - return GL_TRUE; -} - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_context.h b/src/gallium/state_trackers/dri2/dri_context.h deleted file mode 100644 index e910472700..0000000000 --- a/src/gallium/state_trackers/dri2/dri_context.h +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - * - * Copyright (C) 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#ifndef DRI_CONTEXT_H -#define DRI_CONTEXT_H - -#include "pipe/p_compiler.h" -#include "drm.h" -#include "dri_util.h" - - -struct pipe_context; -struct pipe_fence; -struct st_context; -struct dri_drawable; - - -struct dri_context -{ - /* dri */ - __DRIscreenPrivate *sPriv; - __DRIcontextPrivate *cPriv; - __DRIdrawablePrivate *dPriv; - - driOptionCache optionCache; - - /* gallium */ - struct st_context *st; - struct pipe_context *pipe; -}; - - -static INLINE struct dri_context * -dri_context(__DRIcontextPrivate *driContextPriv) -{ - return (struct dri_context *) driContextPriv->driverPrivate; -} - - -/*********************************************************************** - * dri_context.c - */ -void -dri_destroy_context(__DRIcontextPrivate * driContextPriv); - -boolean -dri_unbind_context(__DRIcontextPrivate * driContextPriv); - -boolean -dri_make_current(__DRIcontextPrivate * driContextPriv, - __DRIdrawablePrivate * driDrawPriv, - __DRIdrawablePrivate * driReadPriv); - -boolean -dri_create_context(const __GLcontextModes * visual, - __DRIcontextPrivate * driContextPriv, - void *sharedContextPrivate); - - -/*********************************************************************** - * dri_extensions.c - */ -void -dri_init_extensions(struct dri_context *ctx); - -#endif - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_drawable.c b/src/gallium/state_trackers/dri2/dri_drawable.c deleted file mode 100644 index 2e3f4099e2..0000000000 --- a/src/gallium/state_trackers/dri2/dri_drawable.c +++ /dev/null @@ -1,325 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#include "dri_screen.h" -#include "dri_context.h" -#include "dri_drawable.h" - -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "pipe/p_inlines.h" -#include "state_tracker/drm_api.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_cb_fbo.h" - -#include "util/u_memory.h" - - -static void -dri_copy_to_front(__DRIdrawablePrivate *dPriv, - struct pipe_surface *from, - int x, int y, unsigned w, unsigned h) -{ - /* TODO send a message to the Xserver to copy to the real front buffer */ -} - - -static struct pipe_surface * -dri_surface_from_handle(struct pipe_screen *screen, - unsigned handle, - enum pipe_format format, - unsigned width, - unsigned height, - unsigned pitch) -{ - struct pipe_surface *surface = NULL; - struct pipe_texture *texture = NULL; - struct pipe_texture templat; - struct pipe_buffer *buf = NULL; - - buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle); - if (!buf) - return NULL; - - memset(&templat, 0, sizeof(templat)); - templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; - templat.target = PIPE_TEXTURE_2D; - templat.last_level = 0; - templat.depth[0] = 1; - templat.format = format; - templat.width[0] = width; - templat.height[0] = height; - pf_get_block(templat.format, &templat.block); - - texture = screen->texture_blanket(screen, - &templat, - &pitch, - buf); - - /* we don't need the buffer from this point on */ - pipe_buffer_reference(&buf, NULL); - - if (!texture) - return NULL; - - surface = screen->get_tex_surface(screen, texture, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); - - /* we don't need the texture from this point on */ - pipe_texture_reference(&texture, NULL); - return surface; -} - - -/** - * This will be called a drawable is known to have been resized. - */ -void -dri_get_buffers(__DRIdrawablePrivate *dPriv) -{ - struct dri_drawable *drawable = dri_drawable(dPriv); - struct pipe_surface *surface = NULL; - struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen; - __DRIbuffer *buffers = NULL; - __DRIscreen *dri_screen = drawable->sPriv; - __DRIdrawable *dri_drawable = drawable->dPriv; - boolean have_depth = FALSE; - int i, count; - - buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable, - &dri_drawable->w, - &dri_drawable->h, - drawable->attachments, - drawable->num_attachments, - &count, - dri_drawable->loaderPrivate); - - if (buffers == NULL) { - return; - } - - /* set one cliprect to cover the whole dri_drawable */ - dri_drawable->x = 0; - dri_drawable->y = 0; - dri_drawable->backX = 0; - dri_drawable->backY = 0; - dri_drawable->numClipRects = 1; - dri_drawable->pClipRects[0].x1 = 0; - dri_drawable->pClipRects[0].y1 = 0; - dri_drawable->pClipRects[0].x2 = dri_drawable->w; - dri_drawable->pClipRects[0].y2 = dri_drawable->h; - dri_drawable->numBackClipRects = 1; - dri_drawable->pBackClipRects[0].x1 = 0; - dri_drawable->pBackClipRects[0].y1 = 0; - dri_drawable->pBackClipRects[0].x2 = dri_drawable->w; - dri_drawable->pBackClipRects[0].y2 = dri_drawable->h; - - for (i = 0; i < count; i++) { - enum pipe_format format = 0; - int index = 0; - - switch (buffers[i].attachment) { - case __DRI_BUFFER_FRONT_LEFT: - index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_FAKE_FRONT_LEFT: - index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_BACK_LEFT: - index = ST_SURFACE_BACK_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_DEPTH: - index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; - break; - case __DRI_BUFFER_STENCIL: - index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; - break; - case __DRI_BUFFER_ACCUM: - default: - assert(0); - } - assert(buffers[i].cpp == 4); - - if (index == ST_SURFACE_DEPTH) { - if (have_depth) - continue; - else - have_depth = TRUE; - } - - surface = dri_surface_from_handle(screen, - buffers[i].name, - format, - dri_drawable->w, - dri_drawable->h, - buffers[i].pitch); - - st_set_framebuffer_surface(drawable->stfb, index, surface); - pipe_surface_reference(&surface, NULL); - } - /* this needed, or else the state tracker fails to pick the new buffers */ - st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h); -} - - -void -dri_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private) -{ - struct dri_context *ctx = (struct dri_context *)context_private; - dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height); -} - - -void -dri_swap_buffers(__DRIdrawablePrivate * dPriv) -{ - /* not needed for dri2 */ - assert(0); -} - - -void -dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) -{ - /* not needed for dri2 */ - assert(0); -} - - -/** - * This is called when we need to set up GL rendering to a new X window. - */ -boolean -dri_create_buffer(__DRIscreenPrivate *sPriv, - __DRIdrawablePrivate *dPriv, - const __GLcontextModes *visual, - boolean isPixmap) -{ - enum pipe_format colorFormat, depthFormat, stencilFormat; - struct dri_screen *screen = sPriv->private; - struct dri_drawable *drawable = NULL; - struct pipe_screen *pscreen = screen->pipe_screen; - int i; - - if (isPixmap) - goto fail; /* not implemented */ - - drawable = CALLOC_STRUCT(dri_drawable); - if (drawable == NULL) - goto fail; - - /* XXX: todo: use the pipe_screen queries to figure out which - * render targets are supportable. - */ - assert(visual->redBits == 8); - assert(visual->depthBits == 24 || visual->depthBits == 0); - assert(visual->stencilBits == 8 || visual->stencilBits == 0); - - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; - - if (visual->depthBits) { - if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - depthFormat = PIPE_FORMAT_Z24S8_UNORM; - else - depthFormat = PIPE_FORMAT_S8Z24_UNORM; - } else - depthFormat = PIPE_FORMAT_NONE; - - if (visual->stencilBits) { - if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - stencilFormat = PIPE_FORMAT_Z24S8_UNORM; - else - stencilFormat = PIPE_FORMAT_S8Z24_UNORM; - } else - stencilFormat = PIPE_FORMAT_NONE; - - drawable->stfb = st_create_framebuffer(visual, - colorFormat, - depthFormat, - stencilFormat, - dPriv->w, - dPriv->h, - (void*) drawable); - if (drawable->stfb == NULL) - goto fail; - - drawable->sPriv = sPriv; - drawable->dPriv = dPriv; - dPriv->driverPrivate = (void *) drawable; - - /* setup dri2 buffers information */ - i = 0; - drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT; -#if 0 - /* TODO incase of double buffer visual, delay fake creation */ - drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT; -#endif - if (visual->doubleBufferMode) - drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT; - if (visual->depthBits) - drawable->attachments[i++] = __DRI_BUFFER_DEPTH; - if (visual->stencilBits) - drawable->attachments[i++] = __DRI_BUFFER_STENCIL; - drawable->num_attachments = i; - - return GL_TRUE; -fail: - FREE(drawable); - return GL_FALSE; -} - - -void -dri_destroy_buffer(__DRIdrawablePrivate *dPriv) -{ - struct dri_drawable *drawable = dri_drawable(dPriv); - - st_unreference_framebuffer(drawable->stfb); - - FREE(drawable); -} - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_drawable.h b/src/gallium/state_trackers/dri2/dri_drawable.h deleted file mode 100644 index 185c657b35..0000000000 --- a/src/gallium/state_trackers/dri2/dri_drawable.h +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef DRI_DRAWABLE_H -#define DRI_DRAWABLE_H - -#include "pipe/p_compiler.h" - -struct pipe_surface; -struct pipe_fence; -struct st_framebuffer; - - -struct dri_drawable -{ - /* dri */ - __DRIdrawablePrivate *dPriv; - __DRIscreenPrivate *sPriv; - - unsigned attachments[8]; - unsigned num_attachments; - - /* gallium */ - struct st_framebuffer *stfb; -}; - - -static INLINE struct dri_drawable * -dri_drawable(__DRIdrawablePrivate * driDrawPriv) -{ - return (struct dri_drawable *) driDrawPriv->driverPrivate; -} - - -/*********************************************************************** - * dri_drawable.c - */ -boolean -dri_create_buffer(__DRIscreenPrivate *sPriv, - __DRIdrawablePrivate *dPriv, - const __GLcontextModes *visual, - boolean isPixmap); - -void -dri_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private); - -void -dri_swap_buffers(__DRIdrawablePrivate * dPriv); - -void -dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, - int x, int y, - int w, int h); - -void -dri_get_buffers(__DRIdrawablePrivate * dPriv); - -void -dri_destroy_buffer(__DRIdrawablePrivate *dPriv); - -#endif - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_extensions.c b/src/gallium/state_trackers/dri2/dri_extensions.c deleted file mode 100644 index 732d1e89b0..0000000000 --- a/src/gallium/state_trackers/dri2/dri_extensions.c +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#include "dri_screen.h" -#include "dri_context.h" -#include "state_tracker/st_context.h" - -#define need_GL_ARB_multisample -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_point_parameters -#define need_GL_ARB_texture_compression -#define need_GL_ARB_vertex_buffer_object -#define need_GL_ARB_vertex_program -#define need_GL_ARB_window_pos -#define need_GL_EXT_blend_color -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_cull_vertex -#define need_GL_EXT_fog_coord -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_multi_draw_arrays -#define need_GL_EXT_secondary_color -#define need_GL_NV_vertex_program -#include "extension_helper.h" - - -/** - * Extension strings exported by the driver. - */ -const struct dri_extension card_extensions[] = { - {"GL_ARB_multisample", GL_ARB_multisample_functions}, - {"GL_ARB_multitexture", NULL}, - {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, - {"GL_ARB_texture_border_clamp", NULL}, - {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions}, - {"GL_ARB_texture_cube_map", NULL}, - {"GL_ARB_texture_env_add", NULL}, - {"GL_ARB_texture_env_combine", NULL}, - {"GL_ARB_texture_env_dot3", NULL}, - {"GL_ARB_texture_mirrored_repeat", NULL}, - {"GL_ARB_texture_rectangle", NULL}, - {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, - {"GL_ARB_pixel_buffer_object", NULL}, - {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, - {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, - {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, - {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, - {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, - {"GL_EXT_blend_subtract", NULL}, - {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions}, - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions}, - {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions}, - {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions}, - {"GL_EXT_packed_depth_stencil", NULL}, - {"GL_EXT_pixel_buffer_object", NULL}, - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, - {"GL_EXT_stencil_wrap", NULL}, - {"GL_EXT_texture_edge_clamp", NULL}, - {"GL_EXT_texture_env_combine", NULL}, - {"GL_EXT_texture_env_dot3", NULL}, - {"GL_EXT_texture_filter_anisotropic", NULL}, - {"GL_EXT_texture_lod_bias", NULL}, - {"GL_3DFX_texture_compression_FXT1", NULL}, - {"GL_APPLE_client_storage", NULL}, - {"GL_MESA_pack_invert", NULL}, - {"GL_MESA_ycbcr_texture", NULL}, - {"GL_NV_blend_square", NULL}, - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_NV_vertex_program1_1", NULL}, - {"GL_SGIS_generate_mipmap", NULL }, - {NULL, NULL} -}; - - -void -dri_init_extensions(struct dri_context *ctx) -{ - /* The card_extensions list should be pruned according to the - * capabilities of the pipe_screen. This is actually something - * that can/should be done inside st_create_context(). - */ - if (ctx) - driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE); - else - driInitExtensions(NULL, card_extensions, GL_FALSE); -} - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_screen.c b/src/gallium/state_trackers/dri2/dri_screen.c deleted file mode 100644 index ab33003f51..0000000000 --- a/src/gallium/state_trackers/dri2/dri_screen.c +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#include "utils.h" -#include "vblank.h" -#include "xmlpool.h" - -#include "dri_screen.h" -#include "dri_context.h" -#include "dri_drawable.h" - -#include "pipe/p_context.h" -#include "pipe/p_screen.h" -#include "pipe/p_inlines.h" -#include "state_tracker/drm_api.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_cb_fbo.h" - - -PUBLIC const char __driConfigOptions[] = - DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY - /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/ - DRI_CONF_ALLOW_LARGE_TEXTURES(1) - DRI_CONF_SECTION_END DRI_CONF_END; - - -const uint __driNConfigOptions = 3; - - -static const __DRIextension *dri_screen_extensions[] = { - &driReadDrawableExtension, - &driCopySubBufferExtension.base, - &driSwapControlExtension.base, - &driFrameTrackingExtension.base, - &driMediaStreamCounterExtension.base, - NULL -}; - -static const __DRIconfig ** -dri_fill_in_modes(__DRIscreenPrivate *psp, - unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer) -{ - __DRIconfig **configs; - __GLcontextModes *m; - unsigned num_modes; - uint8_t depth_bits_array[3]; - uint8_t stencil_bits_array[3]; - uint8_t msaa_samples_array[1]; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - unsigned msaa_samples_factor; - GLenum fb_format; - GLenum fb_type; - int i; - - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML - }; - - /* TODO probe the hardware of what is supports */ - depth_bits_array[0] = 0; - depth_bits_array[1] = 24; - depth_bits_array[2] = 24; - - stencil_bits_array[0] = 0; /* no depth or stencil */ - stencil_bits_array[1] = 0; /* z24x8 */ - stencil_bits_array[2] = 8; /* z24s8 */ - - msaa_samples_array[0] = 0; - - depth_buffer_factor = 3; - back_buffer_factor = 3; - msaa_samples_factor = 1; - - num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4; - - if (pixel_bits == 16) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, - stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - msaa_samples_array, msaa_samples_factor); - if (configs == NULL) { - debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__); - return NULL; - } - - for (i = 0; configs[i]; i++) { - m = &configs[i]->modes; - if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { - m->visualRating = GLX_SLOW_CONFIG; - } - } - - return (const const __DRIconfig **) configs; -} - - -/** - * Get information about previous buffer swaps. - */ -int -dri_get_swap_info(__DRIdrawablePrivate * dPriv, - __DRIswapInfo * sInfo) -{ - if (dPriv == NULL || - dPriv->driverPrivate == NULL || - sInfo == NULL) - return -1; - else - return 0; -} - - -/** - * NULL stub for old dri loaders - */ -const __DRIconfig ** -dri_init_screen(__DRIscreenPrivate *sPriv) -{ - return NULL; -} - - -/** - * This is the driver specific part of the createNewScreen entry point. - * - * Returns the __GLcontextModes supported by this driver. - */ -const __DRIconfig ** -dri_init_screen2(__DRIscreenPrivate *sPriv) -{ - struct dri_screen *screen; - - /* Set up dispatch table to cope with all known extensions */ - dri_init_extensions(NULL); - - screen = CALLOC_STRUCT(dri_screen); - if (!screen) - goto fail; - - screen->sPriv = sPriv; - screen->fd = sPriv->fd; - sPriv->private = (void *) screen; - sPriv->extensions = dri_screen_extensions; - - - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL); - if (!screen->pipe_screen) { - debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); - goto fail; - } - - /* We need to hook in here */ - screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer; - - driParseOptionInfo(&screen->optionCache, - __driConfigOptions, - __driNConfigOptions); - - return dri_fill_in_modes(sPriv, - 4 * 8, - 24, - 8, - 1); -fail: - return NULL; -} - - -void -dri_destroy_screen(__DRIscreenPrivate * sPriv) -{ - struct dri_screen *screen = dri_screen(sPriv); - - screen->pipe_screen->destroy(screen->pipe_screen); - FREE(screen); - sPriv->private = NULL; -} - - -PUBLIC const struct __DriverAPIRec driDriverAPI = { - .InitScreen = dri_init_screen, /* not supported but exported */ - .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, - .DestroyContext = dri_destroy_context, - .CreateBuffer = dri_create_buffer, - .DestroyBuffer = dri_destroy_buffer, - .SwapBuffers = dri_swap_buffers, /* not supported but exported */ - .MakeCurrent = dri_make_current, - .UnbindContext = dri_unbind_context, - .GetSwapInfo = dri_get_swap_info, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */ - .InitScreen2 = dri_init_screen2, -}; - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri2/dri_screen.h b/src/gallium/state_trackers/dri2/dri_screen.h deleted file mode 100644 index 3751ec6121..0000000000 --- a/src/gallium/state_trackers/dri2/dri_screen.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** - * - * Copyright 2009, VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ -/* - * Author: Keith Whitwell - * Author: Jakob Bornecrantz - */ - -#ifndef DRI_SCREEN_H -#define DRI_SCREEN_H - -#include "dri_util.h" -#include "xmlconfig.h" - -#include "pipe/p_compiler.h" - -struct dri_screen -{ - /* dri */ - __DRIscreenPrivate *sPriv; - - /** - * Configuration cache with default values for all contexts - */ - driOptionCache optionCache; - - /** - * Temporary(?) context to use for SwapBuffers or other situations in - * which we need a rendering context, but none is currently bound. - */ - struct dri_context *dummyContext; - - /* drm */ - int fd; - - /* gallium */ - struct pipe_winsys *pipe_winsys; - struct pipe_screen *pipe_screen; -}; - - -/** cast wrapper */ -static INLINE struct dri_screen * -dri_screen(__DRIscreenPrivate *sPriv) -{ - return (struct dri_screen *) sPriv->private; -} - - -/*********************************************************************** - * dri_screen.c - */ -const __DRIconfig ** -dri_init_screen2(__DRIscreenPrivate *sPriv); - -void -dri_destroy_screen(__DRIscreenPrivate * sPriv); - -int -dri_get_swap_info(__DRIdrawablePrivate * dPriv, - __DRIswapInfo * sInfo); - -#endif - -/* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile index e7c57afc34..286ef08d5b 100644 --- a/src/gallium/winsys/drm/intel/dri2/Makefile +++ b/src/gallium/winsys/drm/intel/dri2/Makefile @@ -4,7 +4,7 @@ include $(TOP)/configs/current LIBNAME = i915_dri.so PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile index 728870d2e1..5e5efbcb11 100644 --- a/src/gallium/winsys/drm/nouveau/dri2/Makefile +++ b/src/gallium/winsys/drm/nouveau/dri2/Makefile @@ -4,7 +4,7 @@ include $(TOP)/configs/current LIBNAME = nouveau_dri2.so PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \ $(TOP)/src/gallium/drivers/nv04/libnv04.a \ $(TOP)/src/gallium/drivers/nv10/libnv10.a \ diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile index f471c44349..58a87dae18 100644 --- a/src/gallium/winsys/drm/radeon/dri2/Makefile +++ b/src/gallium/winsys/drm/radeon/dri2/Makefile @@ -7,7 +7,7 @@ LIBNAME = radeon_dri.so MINIGLX_SOURCES = PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri2/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/r300/libr300.a -- cgit v1.2.3 From a70c4f352e8e7aea0b130fd1285352bbf89503b5 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:43:06 +0200 Subject: gallium: Add a dri1 api that a driver needs to implement on top of the drm api to support dri1. Signed-off-by: Thomas Hellstrom --- src/gallium/include/state_tracker/dri1_api.h | 82 ++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/gallium/include/state_tracker/dri1_api.h diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h new file mode 100644 index 0000000000..b173ba3683 --- /dev/null +++ b/src/gallium/include/state_tracker/dri1_api.h @@ -0,0 +1,82 @@ +#ifndef _DRI1_API_H_ +#define _DRI1_API_H_ + +#include "pipe/p_compiler.h" +#include "pipe/p_screen.h" +#include "pipe/p_format.h" + +#include "state_tracker/drm_api.h" + +#include + +struct pipe_screen; +struct pipe_winsys; +struct pipe_buffer; +struct pipe_context; +struct pipe_texture; + +struct dri1_api_version +{ + int major; + int minor; + int patch_level; +}; + +/** + * This callback struct is intended for drivers that need to take + * the hardware lock on command submission. + */ + +struct dri1_api_lock_funcs +{ + void (*lock) (struct pipe_context * pipe); + void (*unlock) (struct pipe_context * locked_pipe); + boolean(*is_locked) (struct pipe_context * locked_pipe); + boolean(*is_lock_lost) (struct pipe_context * locked_pipe); + void (*clear_lost_lock) (struct pipe_context * locked_pipe); +}; + +struct dri1_api +{ + /** + * For flushing to the front buffer. A driver should implement one and only + * one of the functions below. The present_locked functions allows a dri1 + * driver to pageflip. + */ + + /*@{ */ + + struct pipe_surface *(*front_srf_locked) (struct pipe_context * + locked_pipe); + + void (*present_locked) (struct pipe_context * locked_pipe, + struct pipe_surface * surf, + const struct drm_clip_rect * rect, + unsigned int num_clip, + int x_draw, int y_draw, + const struct drm_clip_rect * src_bbox, + struct pipe_fence_handle ** fence); + /*@} */ +}; + +struct dri1_create_screen_arg +{ + struct drm_create_screen_arg base; + + struct dri1_api_lock_funcs *lf; + void *ddx_info; + int ddx_info_size; + void *sarea; + + struct dri1_api_version ddx_version; + struct dri1_api_version dri_version; + struct dri1_api_version drm_version; + + /* + * out parameters; + */ + + struct dri1_api *api; +}; + +#endif -- cgit v1.2.3 From ca1f5f7e6c05e34cfe8ef10f29aa19f5547311e6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:49:39 +0200 Subject: gallium: Update the dri2 state tracker to support dri1. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/dri_context.c | 91 ++++++-- src/gallium/state_trackers/dri/dri_context.h | 36 ++- src/gallium/state_trackers/dri/dri_drawable.c | 318 ++++++++++++++++++++++++-- src/gallium/state_trackers/dri/dri_drawable.h | 18 +- src/gallium/state_trackers/dri/dri_screen.c | 87 +++++-- src/gallium/state_trackers/dri/dri_screen.h | 12 +- 6 files changed, 507 insertions(+), 55 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 92c26ac70f..a45fb541fd 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -32,9 +32,8 @@ #include "dri_screen.h" #include "dri_drawable.h" - - #include "state_tracker/drm_api.h" +#include "state_tracker/dri1_api.h" #include "state_tracker/st_public.h" #include "state_tracker/st_context.h" #include "pipe/p_context.h" @@ -44,6 +43,7 @@ #include "util/u_memory.h" + GLboolean dri_create_context(const __GLcontextModes *visual, __DRIcontextPrivate *cPriv, @@ -65,6 +65,9 @@ dri_create_context(const __GLcontextModes *visual, cPriv->driverPrivate = ctx; ctx->cPriv = cPriv; ctx->sPriv = sPriv; + ctx->lock = screen->drmLock; + ctx->d_stamp = -1; + ctx->r_stamp = -1; driParseConfigFiles(&ctx->optionCache, &screen->optionCache, @@ -126,13 +129,22 @@ dri_destroy_context(__DRIcontextPrivate *cPriv) GLboolean dri_unbind_context(__DRIcontextPrivate *cPriv) { - struct dri_context *ctx = dri_context(cPriv); - st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); - /* XXX make_current(NULL)? */ + if (cPriv) { + struct dri_context *ctx = dri_context(cPriv); + + if (--ctx->bind_count == 0) { + GET_CURRENT_CONTEXT(curGLCtx); + + if (ctx->st == curGLCtx->st) { + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + st_make_current(NULL, NULL, NULL); + } + } + } + return GL_TRUE; } - GLboolean dri_make_current(__DRIcontextPrivate *cPriv, __DRIdrawablePrivate *driDrawPriv, @@ -143,23 +155,32 @@ dri_make_current(__DRIcontextPrivate *cPriv, struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); struct dri_drawable *draw = dri_drawable(driDrawPriv); struct dri_drawable *read = dri_drawable(driReadPriv); + GET_CURRENT_CONTEXT(oldGLCtx); + + if (oldGLCtx && oldGLCtx->st != ctx->st) + st_flush(oldGLCtx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + + ++ctx->bind_count; /* This is for situations in which we need a rendering context but * there may not be any currently bound. */ screen->dummyContext = ctx; - st_make_current(ctx->st, - draw->stfb, - read->stfb); - /* used in dri_flush_frontbuffer */ ctx->dPriv = driDrawPriv; - - if (driDrawPriv) - dri_get_buffers(driDrawPriv); - if (driDrawPriv != driReadPriv && driReadPriv) - dri_get_buffers(driReadPriv); + ctx->rPriv = driReadPriv; + + st_make_current(ctx->st, draw->stfb, read->stfb); + + if (__dri1_api_hooks) { + dri1_update_drawables(ctx, draw, read); + } else { + if (driDrawPriv) + dri_get_buffers(driDrawPriv); + if (driDrawPriv != driReadPriv && driReadPriv) + dri_get_buffers(driReadPriv); + } } else { st_make_current(NULL, NULL, NULL); } @@ -167,4 +188,44 @@ dri_make_current(__DRIcontextPrivate *cPriv, return GL_TRUE; } +static void +st_dri_lock(struct pipe_context *pipe) +{ + dri_lock((struct dri_context *) pipe->priv); +} + +static void +st_dri_unlock(struct pipe_context *pipe) +{ + dri_unlock((struct dri_context *) pipe->priv); +} + +static boolean +st_dri_is_locked(struct pipe_context *pipe) +{ + return ((struct dri_context *) pipe->priv)->isLocked; +} + +static boolean +st_dri_lost_lock(struct pipe_context *pipe) +{ + return ((struct dri_context *) pipe->priv)->wsLostLock; +} + +static void +st_dri_clear_lost_lock(struct pipe_context *pipe) +{ + ((struct dri_context *) pipe->priv)->wsLostLock = FALSE; +} + +struct dri1_api_lock_funcs dri1_lf = +{ + .lock = st_dri_lock, + .unlock = st_dri_unlock, + .is_locked = st_dri_is_locked, + .is_lock_lost = st_dri_lost_lock, + .clear_lost_lock = st_dri_clear_lost_lock +}; + + /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h index e910472700..82a5916827 100644 --- a/src/gallium/state_trackers/dri/dri_context.h +++ b/src/gallium/state_trackers/dri/dri_context.h @@ -42,32 +42,64 @@ struct pipe_fence; struct st_context; struct dri_drawable; - struct dri_context { /* dri */ __DRIscreenPrivate *sPriv; __DRIcontextPrivate *cPriv; __DRIdrawablePrivate *dPriv; + __DRIdrawablePrivate *rPriv; driOptionCache optionCache; + unsigned int d_stamp; + unsigned int r_stamp; + + drmLock *lock; + boolean isLocked; + boolean stLostLock; + boolean wsLostLock; + + unsigned int bind_count; + /* gallium */ struct st_context *st; struct pipe_context *pipe; }; - static INLINE struct dri_context * dri_context(__DRIcontextPrivate *driContextPriv) { return (struct dri_context *) driContextPriv->driverPrivate; } +static INLINE void +dri_lock(struct dri_context *ctx) +{ + drm_context_t hw_context = ctx->cPriv->hHWContext; + char ret = 0; + + DRM_CAS(ctx->lock, hw_context, DRM_LOCK_HELD | hw_context, ret); + if (ret) { + drmGetLock(ctx->sPriv->fd, hw_context, 0); + ctx->stLostLock = TRUE; + ctx->wsLostLock = TRUE; + } + ctx->isLocked = TRUE; +} + +static INLINE void +dri_unlock(struct dri_context *ctx) +{ + ctx->isLocked = FALSE; + DRM_UNLOCK(ctx->sPriv->fd, ctx->lock, ctx->cPriv->hHWContext); +} /*********************************************************************** * dri_context.c */ +extern struct dri1_api_lock_funcs dri1_lf; + void dri_destroy_context(__DRIcontextPrivate * driContextPriv); diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 2e3f4099e2..287617e9a9 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -37,6 +37,7 @@ #include "pipe/p_screen.h" #include "pipe/p_inlines.h" #include "state_tracker/drm_api.h" +#include "state_tracker/dri1_api.h" #include "state_tracker/st_public.h" #include "state_tracker/st_context.h" #include "state_tracker/st_cb_fbo.h" @@ -207,22 +208,6 @@ dri_flush_frontbuffer(struct pipe_screen *screen, } -void -dri_swap_buffers(__DRIdrawablePrivate * dPriv) -{ - /* not needed for dri2 */ - assert(0); -} - - -void -dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) -{ - /* not needed for dri2 */ - assert(0); -} - - /** * This is called when we need to set up GL rendering to a new X window. */ @@ -305,21 +290,322 @@ dri_create_buffer(__DRIscreenPrivate *sPriv, drawable->attachments[i++] = __DRI_BUFFER_STENCIL; drawable->num_attachments = i; + drawable->desired_fences = 2; + return GL_TRUE; fail: FREE(drawable); return GL_FALSE; } +static struct pipe_fence_handle * +dri_swap_fences_pop_front(struct dri_drawable *draw) +{ + struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen; + struct pipe_fence_handle *fence = NULL; + + if (draw->cur_fences >= draw->desired_fences) { + screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]); + screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL); + --draw->cur_fences; + draw->tail &= DRI_SWAP_FENCES_MASK; + } + return fence; +} + +static void +dri_swap_fences_push_back(struct dri_drawable *draw, + struct pipe_fence_handle *fence) +{ + struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen; + + if (!fence) + return; + + if (draw->cur_fences < DRI_SWAP_FENCES_MAX) { + draw->cur_fences++; + screen->fence_reference(screen, &draw->swap_fences[draw->head++], fence); + draw->head &= DRI_SWAP_FENCES_MASK; + } +} void dri_destroy_buffer(__DRIdrawablePrivate *dPriv) { struct dri_drawable *drawable = dri_drawable(dPriv); + struct pipe_fence_handle *fence; + struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen; st_unreference_framebuffer(drawable->stfb); + drawable->desired_fences = 0; + while(drawable->cur_fences) { + fence = dri_swap_fences_pop_front(drawable); + screen->fence_reference(screen, &fence, NULL); + } FREE(drawable); } +static void +dri1_update_drawables_locked(struct dri_context *ctx, + __DRIdrawablePrivate *driDrawPriv, + __DRIdrawablePrivate *driReadPriv) +{ + if (ctx->stLostLock) { + ctx->stLostLock = FALSE; + if (driDrawPriv == driReadPriv) + DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv); + else + DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, driReadPriv); + } +} + +/** + * This ensures all contexts which binds to a drawable picks up the + * drawable change and signals new buffer state. + * Calling st_resize_framebuffer for each context may seem like overkill, + * but no new buffers will actually be allocated if the dimensions doesn't + * change. + */ + +static void +dri1_propagate_drawable_change(struct dri_context *ctx) +{ + __DRIdrawablePrivate *dPriv = ctx->dPriv; + __DRIdrawablePrivate *rPriv = ctx->rPriv; + boolean flushed = FALSE; + + if (dPriv && ctx->d_stamp != dPriv->lastStamp) { + + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + flushed = TRUE; + ctx->d_stamp = dPriv->lastStamp; + st_resize_framebuffer(dri_drawable(dPriv)->stfb, dPriv->w, dPriv->h); + + } + + if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) { + + if (!flushed) + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + ctx->r_stamp = rPriv->lastStamp; + st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h); + + } else if (rPriv && dPriv == rPriv) { + + ctx->r_stamp = ctx->d_stamp; + + } +} + +void +dri1_update_drawables(struct dri_context *ctx, + struct dri_drawable *draw, + struct dri_drawable *read) +{ + dri_lock(ctx); + dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv); + dri_unlock(ctx); + + dri1_propagate_drawable_change(ctx); +} + +static INLINE boolean +dri1_intersect_src_bbox(struct drm_clip_rect *dst, + int dst_x, + int dst_y, + const struct drm_clip_rect *src, + const struct drm_clip_rect *bbox) +{ + int xy1; + int xy2; + + xy1 = ((int) src->x1 > (int) bbox->x1 + dst_x) ? src->x1 : + (int) bbox->x1 + dst_x; + xy2 = ((int) src->x2 < (int) bbox->x2 + dst_x) ? src->x2 : + (int) bbox->x2 + dst_x; + if (xy1 >= xy2 || xy1 < 0) + return FALSE; + + dst->x1 = xy1; + dst->x2 = xy2; + + xy1 = ((int) src->y1 > (int) bbox->y1 + dst_x) ? src->y1 : + (int) bbox->y1 + dst_x; + xy2 = ((int) src->y2 < (int) bbox->y2 + dst_x) ? src->y2 : + (int) bbox->y2 + dst_x; + if (xy1 >= xy2 || xy1 < 0) + return FALSE; + + dst->y1 = xy1; + dst->y2 = xy2; + return TRUE; +} + + +static void +dri1_swap_copy(struct dri_context *ctx, + struct pipe_surface *dst, + struct pipe_surface *src, + __DRIdrawablePrivate *dPriv, + const struct drm_clip_rect *bbox) +{ + struct pipe_context *pipe = ctx->pipe; + struct drm_clip_rect clip; + struct drm_clip_rect *cur; + int i; + + cur = dPriv->pClipRects; + + for (i=0; inumClipRects; ++i) { + if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) + pipe->surface_copy(pipe, dst, clip.x1, clip.y1, + src, + (int) clip.x1 - dPriv->x, + (int) clip.y1 - dPriv->y, + clip.x2 - clip.x1, + clip.y2 - clip.y1); + } +} + +static void +dri1_copy_to_front(struct dri_context *ctx, + struct pipe_surface *surf, + __DRIdrawablePrivate *dPriv, + const struct drm_clip_rect *sub_box, + struct pipe_fence_handle **fence) +{ + struct pipe_context *pipe = ctx->pipe; + boolean save_lost_lock; + uint cur_w; + uint cur_h; + struct drm_clip_rect bbox; + boolean visible = TRUE; + + *fence = NULL; + + dri_lock(ctx); + save_lost_lock = ctx->stLostLock; + dri1_update_drawables_locked(ctx, dPriv, dPriv); + st_get_framebuffer_dimensions(dri_drawable(dPriv)->stfb, &cur_w, &cur_h); + + bbox.x1 = 0; + bbox.x2 = cur_w; + bbox.y1 = 0; + bbox.y2 = cur_h; + + if (sub_box) + visible = dri1_intersect_src_bbox(&bbox, 0, 0, &bbox, sub_box); + + if (visible && __dri1_api_hooks->present_locked) { + + __dri1_api_hooks->present_locked(pipe, + surf, + dPriv->pClipRects, + dPriv->numClipRects, + dPriv->x, + dPriv->y, + &bbox, + fence); + + } else if (visible && __dri1_api_hooks->front_srf_locked) { + + struct pipe_surface *front = + __dri1_api_hooks->front_srf_locked(pipe); + + if (front) + dri1_swap_copy(ctx, front, surf, dPriv, &bbox); + + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, fence); + } + + ctx->stLostLock = save_lost_lock; + + /** + * FIXME: Revisit this: Update drawables on copy_sub_buffer ? + */ + + if (!sub_box) + dri1_update_drawables_locked(ctx, ctx->dPriv, ctx->rPriv); + + dri_unlock(ctx); + dri1_propagate_drawable_change(ctx); +} + +void +dri1_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surf, + void *context_private) +{ + struct dri_context *ctx = (struct dri_context *)context_private; + struct pipe_fence_handle *dummy_fence; + + dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence); + + /** + * FIXME: Do we need swap throttling here? + */ +} + +void +dri_swap_buffers(__DRIdrawablePrivate * dPriv) +{ + struct dri_context *ctx; + struct pipe_surface *back_surf; + struct dri_drawable *draw = dri_drawable(dPriv); + struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen; + struct pipe_fence_handle *fence; + GET_CURRENT_CONTEXT(glCtx); + + assert(__dri1_api_hooks != NULL); + + if (!glCtx) + return; /* For now */ + + ctx = (struct dri_context *) glCtx->st->pipe->priv; + + st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf); + if (back_surf) { + st_notify_swapbuffers(draw->stfb); + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + fence = dri_swap_fences_pop_front(draw); + if (fence) { + (void) screen->fence_finish(screen, fence, 0); + screen->fence_reference(screen, &fence, NULL); + } + dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence); + dri_swap_fences_push_back(draw, fence); + screen->fence_reference(screen, &fence, NULL); + } +} + +void +dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) +{ + struct drm_clip_rect sub_bbox; + struct dri_context *ctx; + struct pipe_surface *back_surf; + struct dri_drawable *draw = dri_drawable(dPriv); + struct pipe_fence_handle *dummy_fence; + GET_CURRENT_CONTEXT(glCtx); + + assert(__dri1_api_hooks != NULL); + + if (!glCtx) + return; + + ctx = (struct dri_context *) glCtx->st->pipe->priv; + + sub_bbox.x1 = x; + sub_bbox.x2 = x + w; + sub_bbox.y1 = y; + sub_bbox.y2 = y + h; + + st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf); + if (back_surf) { + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence); + } +} + /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index 185c657b35..c1341deb52 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -31,9 +31,11 @@ #include "pipe/p_compiler.h" struct pipe_surface; -struct pipe_fence; +struct pipe_fence_handle; struct st_framebuffer; +#define DRI_SWAP_FENCES_MAX 8 +#define DRI_SWAP_FENCES_MASK 7 struct dri_drawable { @@ -46,6 +48,11 @@ struct dri_drawable /* gallium */ struct st_framebuffer *stfb; + struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; + unsigned int head; + unsigned int tail; + unsigned int desired_fences; + unsigned int cur_fences; }; @@ -84,6 +91,15 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv); void dri_destroy_buffer(__DRIdrawablePrivate *dPriv); +void +dri1_update_drawables(struct dri_context *ctx, + struct dri_drawable *draw, + struct dri_drawable *read); + +void +dri1_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surf, + void *context_private); #endif /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index ab33003f51..418bb90115 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -40,7 +40,9 @@ #include "pipe/p_context.h" #include "pipe/p_screen.h" #include "pipe/p_inlines.h" +#include "pipe/p_format.h" #include "state_tracker/drm_api.h" +#include "state_tracker/dri1_api.h" #include "state_tracker/st_public.h" #include "state_tracker/st_cb_fbo.h" @@ -57,7 +59,6 @@ PUBLIC const char __driConfigOptions[] = const uint __driNConfigOptions = 3; - static const __DRIextension *dri_screen_extensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, @@ -67,6 +68,8 @@ static const __DRIextension *dri_screen_extensions[] = { NULL }; +struct dri1_api *__dri1_api_hooks = NULL; + static const __DRIconfig ** dri_fill_in_modes(__DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, @@ -139,7 +142,7 @@ dri_fill_in_modes(__DRIscreenPrivate *psp, /** * Get information about previous buffer swaps. */ -int +static int dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo) { @@ -151,13 +154,69 @@ dri_get_swap_info(__DRIdrawablePrivate * dPriv, return 0; } +static INLINE void +dri_copy_version(struct dri1_api_version *dst, + const struct __DRIversionRec *src) +{ + dst->major = src->major; + dst->minor = src->minor; + dst->patch_level = src->patch; +} -/** - * NULL stub for old dri loaders - */ -const __DRIconfig ** +static const __DRIconfig ** dri_init_screen(__DRIscreenPrivate *sPriv) { + struct dri_screen *screen; + const __DRIconfig **configs; + struct dri1_create_screen_arg arg; + + dri_init_extensions(NULL); + + screen = CALLOC_STRUCT(dri_screen); + if (!screen) + return NULL; + + screen->sPriv = sPriv; + screen->fd = sPriv->fd; + screen->drmLock = (drmLock *) &sPriv->pSAREA->lock; + + sPriv->private = (void *) screen; + sPriv->extensions = dri_screen_extensions; + + arg.base.mode = DRM_CREATE_DRI1; + arg.lf = &dri1_lf; + arg.ddx_info = sPriv->pDevPriv; + arg.ddx_info_size = sPriv->devPrivSize; + arg.sarea = sPriv->pSAREA; + dri_copy_version(&arg.ddx_version, &sPriv->ddx_version); + dri_copy_version(&arg.dri_version, &sPriv->dri_version); + dri_copy_version(&arg.drm_version, &sPriv->drm_version); + arg.api = NULL; + + screen->pipe_screen = drm_api_hooks.create_screen + (screen->fd, &arg.base); + + if (!screen->pipe_screen || !arg.api) { + debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__); + goto out_no_screen; + } + + __dri1_api_hooks = arg.api; + + screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer; + driParseOptionInfo(&screen->optionCache, + __driConfigOptions, + __driNConfigOptions); + + configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1); + if (!configs) + goto out_no_configs; + + return configs; + out_no_configs: + screen->pipe_screen->destroy(screen->pipe_screen); + out_no_screen: + FREE(screen); return NULL; } @@ -167,10 +226,11 @@ dri_init_screen(__DRIscreenPrivate *sPriv) * * Returns the __GLcontextModes supported by this driver. */ -const __DRIconfig ** +static const __DRIconfig ** dri_init_screen2(__DRIscreenPrivate *sPriv) { struct dri_screen *screen; + struct drm_create_screen_arg arg; /* Set up dispatch table to cope with all known extensions */ dri_init_extensions(NULL); @@ -183,9 +243,9 @@ dri_init_screen2(__DRIscreenPrivate *sPriv) screen->fd = sPriv->fd; sPriv->private = (void *) screen; sPriv->extensions = dri_screen_extensions; + arg.mode = DRM_CREATE_NORMAL; - - screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, NULL); + screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg); if (!screen->pipe_screen) { debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__); goto fail; @@ -208,7 +268,7 @@ fail: } -void +static void dri_destroy_screen(__DRIscreenPrivate * sPriv) { struct dri_screen *screen = dri_screen(sPriv); @@ -220,19 +280,20 @@ dri_destroy_screen(__DRIscreenPrivate * sPriv) PUBLIC const struct __DriverAPIRec driDriverAPI = { - .InitScreen = dri_init_screen, /* not supported but exported */ + .InitScreen = dri_init_screen, .DestroyScreen = dri_destroy_screen, .CreateContext = dri_create_context, .DestroyContext = dri_destroy_context, .CreateBuffer = dri_create_buffer, .DestroyBuffer = dri_destroy_buffer, - .SwapBuffers = dri_swap_buffers, /* not supported but exported */ + .SwapBuffers = dri_swap_buffers, .MakeCurrent = dri_make_current, .UnbindContext = dri_unbind_context, .GetSwapInfo = dri_get_swap_info, .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, - .CopySubBuffer = dri_copy_sub_buffer, /* not supported but exported */ + .CopySubBuffer = dri_copy_sub_buffer, + .InitScreen = dri_init_screen, .InitScreen2 = dri_init_screen2, }; diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index 3751ec6121..c358c35168 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -37,6 +37,8 @@ #include "pipe/p_compiler.h" +#include "state_tracker/dri1_api.h" + struct dri_screen { /* dri */ @@ -55,6 +57,7 @@ struct dri_screen /* drm */ int fd; + drmLock *drmLock; /* gallium */ struct pipe_winsys *pipe_winsys; @@ -73,15 +76,8 @@ dri_screen(__DRIscreenPrivate *sPriv) /*********************************************************************** * dri_screen.c */ -const __DRIconfig ** -dri_init_screen2(__DRIscreenPrivate *sPriv); - -void -dri_destroy_screen(__DRIscreenPrivate * sPriv); -int -dri_get_swap_info(__DRIdrawablePrivate * dPriv, - __DRIswapInfo * sInfo); +extern struct dri1_api *__dri1_api_hooks; #endif -- cgit v1.2.3 From 0929b2bf3cdb54d94da8dee5797878e2ee582b41 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:54:25 +0200 Subject: gallium: indent and cleanfile the dri state-tracker. --- src/gallium/state_trackers/dri/dri_context.c | 42 ++--- src/gallium/state_trackers/dri/dri_context.h | 23 +-- src/gallium/state_trackers/dri/dri_drawable.c | 227 +++++++++++------------- src/gallium/state_trackers/dri/dri_drawable.h | 33 ++-- src/gallium/state_trackers/dri/dri_extensions.c | 7 +- src/gallium/state_trackers/dri/dri_screen.c | 164 ++++++++--------- src/gallium/state_trackers/dri/dri_screen.h | 6 +- 7 files changed, 221 insertions(+), 281 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index a45fb541fd..7f38671126 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -42,12 +42,9 @@ #include "util/u_memory.h" - - GLboolean -dri_create_context(const __GLcontextModes *visual, - __DRIcontextPrivate *cPriv, - void *sharedContextPrivate) +dri_create_context(const __GLcontextModes * visual, + __DRIcontextPrivate * cPriv, void *sharedContextPrivate) { __DRIscreenPrivate *sPriv = cPriv->driScreenPriv; struct dri_screen *screen = dri_screen(sPriv); @@ -55,7 +52,7 @@ dri_create_context(const __GLcontextModes *visual, struct st_context *st_share = NULL; if (sharedContextPrivate) { - st_share = ((struct dri_context *) sharedContextPrivate)->st; + st_share = ((struct dri_context *)sharedContextPrivate)->st; } ctx = CALLOC_STRUCT(dri_context); @@ -70,9 +67,7 @@ dri_create_context(const __GLcontextModes *visual, ctx->r_stamp = -1; driParseConfigFiles(&ctx->optionCache, - &screen->optionCache, - sPriv->myNum, - "dri"); + &screen->optionCache, sPriv->myNum, "dri"); ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen); @@ -90,7 +85,7 @@ dri_create_context(const __GLcontextModes *visual, return GL_TRUE; -fail: + fail: if (ctx && ctx->st) st_destroy_context(ctx->st); @@ -101,9 +96,8 @@ fail: return FALSE; } - void -dri_destroy_context(__DRIcontextPrivate *cPriv) +dri_destroy_context(__DRIcontextPrivate * cPriv) { struct dri_context *ctx = dri_context(cPriv); struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); @@ -125,9 +119,8 @@ dri_destroy_context(__DRIcontextPrivate *cPriv) FREE(ctx); } - GLboolean -dri_unbind_context(__DRIcontextPrivate *cPriv) +dri_unbind_context(__DRIcontextPrivate * cPriv) { if (cPriv) { struct dri_context *ctx = dri_context(cPriv); @@ -146,15 +139,16 @@ dri_unbind_context(__DRIcontextPrivate *cPriv) } GLboolean -dri_make_current(__DRIcontextPrivate *cPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) +dri_make_current(__DRIcontextPrivate * cPriv, + __DRIdrawablePrivate * driDrawPriv, + __DRIdrawablePrivate * driReadPriv) { if (cPriv) { struct dri_context *ctx = dri_context(cPriv); struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); struct dri_drawable *draw = dri_drawable(driDrawPriv); struct dri_drawable *read = dri_drawable(driReadPriv); + GET_CURRENT_CONTEXT(oldGLCtx); if (oldGLCtx && oldGLCtx->st != ctx->st) @@ -191,35 +185,34 @@ dri_make_current(__DRIcontextPrivate *cPriv, static void st_dri_lock(struct pipe_context *pipe) { - dri_lock((struct dri_context *) pipe->priv); + dri_lock((struct dri_context *)pipe->priv); } static void st_dri_unlock(struct pipe_context *pipe) { - dri_unlock((struct dri_context *) pipe->priv); + dri_unlock((struct dri_context *)pipe->priv); } static boolean st_dri_is_locked(struct pipe_context *pipe) { - return ((struct dri_context *) pipe->priv)->isLocked; + return ((struct dri_context *)pipe->priv)->isLocked; } static boolean st_dri_lost_lock(struct pipe_context *pipe) { - return ((struct dri_context *) pipe->priv)->wsLostLock; + return ((struct dri_context *)pipe->priv)->wsLostLock; } static void st_dri_clear_lost_lock(struct pipe_context *pipe) { - ((struct dri_context *) pipe->priv)->wsLostLock = FALSE; + ((struct dri_context *)pipe->priv)->wsLostLock = FALSE; } -struct dri1_api_lock_funcs dri1_lf = -{ +struct dri1_api_lock_funcs dri1_lf = { .lock = st_dri_lock, .unlock = st_dri_unlock, .is_locked = st_dri_is_locked, @@ -227,5 +220,4 @@ struct dri1_api_lock_funcs dri1_lf = .clear_lost_lock = st_dri_clear_lost_lock }; - /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h index 82a5916827..4650178734 100644 --- a/src/gallium/state_trackers/dri/dri_context.h +++ b/src/gallium/state_trackers/dri/dri_context.h @@ -36,7 +36,6 @@ #include "drm.h" #include "dri_util.h" - struct pipe_context; struct pipe_fence; struct st_context; @@ -68,9 +67,9 @@ struct dri_context }; static INLINE struct dri_context * -dri_context(__DRIcontextPrivate *driContextPriv) +dri_context(__DRIcontextPrivate * driContextPriv) { - return (struct dri_context *) driContextPriv->driverPrivate; + return (struct dri_context *)driContextPriv->driverPrivate; } static INLINE void @@ -100,28 +99,24 @@ dri_unlock(struct dri_context *ctx) */ extern struct dri1_api_lock_funcs dri1_lf; -void -dri_destroy_context(__DRIcontextPrivate * driContextPriv); +void dri_destroy_context(__DRIcontextPrivate * driContextPriv); -boolean -dri_unbind_context(__DRIcontextPrivate * driContextPriv); +boolean dri_unbind_context(__DRIcontextPrivate * driContextPriv); boolean dri_make_current(__DRIcontextPrivate * driContextPriv, - __DRIdrawablePrivate * driDrawPriv, - __DRIdrawablePrivate * driReadPriv); + __DRIdrawablePrivate * driDrawPriv, + __DRIdrawablePrivate * driReadPriv); boolean dri_create_context(const __GLcontextModes * visual, - __DRIcontextPrivate * driContextPriv, - void *sharedContextPrivate); - + __DRIcontextPrivate * driContextPriv, + void *sharedContextPrivate); /*********************************************************************** * dri_extensions.c */ -void -dri_init_extensions(struct dri_context *ctx); +void dri_init_extensions(struct dri_context *ctx); #endif diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 287617e9a9..abda4ff17e 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -44,23 +44,19 @@ #include "util/u_memory.h" - static void -dri_copy_to_front(__DRIdrawablePrivate *dPriv, - struct pipe_surface *from, - int x, int y, unsigned w, unsigned h) +dri_copy_to_front(__DRIdrawablePrivate * dPriv, + struct pipe_surface *from, + int x, int y, unsigned w, unsigned h) { /* TODO send a message to the Xserver to copy to the real front buffer */ } - static struct pipe_surface * dri_surface_from_handle(struct pipe_screen *screen, - unsigned handle, - enum pipe_format format, - unsigned width, - unsigned height, - unsigned pitch) + unsigned handle, + enum pipe_format format, + unsigned width, unsigned height, unsigned pitch) { struct pipe_surface *surface = NULL; struct pipe_texture *texture = NULL; @@ -81,10 +77,7 @@ dri_surface_from_handle(struct pipe_screen *screen, templat.height[0] = height; pf_get_block(templat.format, &templat.block); - texture = screen->texture_blanket(screen, - &templat, - &pitch, - buf); + texture = screen->texture_blanket(screen, &templat, &pitch, buf); /* we don't need the buffer from this point on */ pipe_buffer_reference(&buf, NULL); @@ -93,20 +86,19 @@ dri_surface_from_handle(struct pipe_screen *screen, return NULL; surface = screen->get_tex_surface(screen, texture, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); /* we don't need the texture from this point on */ pipe_texture_reference(&texture, NULL); return surface; } - /** * This will be called a drawable is known to have been resized. */ void -dri_get_buffers(__DRIdrawablePrivate *dPriv) +dri_get_buffers(__DRIdrawablePrivate * dPriv) { struct dri_drawable *drawable = dri_drawable(dPriv); struct pipe_surface *surface = NULL; @@ -117,13 +109,14 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv) boolean have_depth = FALSE; int i, count; - buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable, - &dri_drawable->w, - &dri_drawable->h, - drawable->attachments, - drawable->num_attachments, - &count, - dri_drawable->loaderPrivate); + buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable, + &dri_drawable->w, + &dri_drawable->h, + drawable->attachments, + drawable-> + num_attachments, &count, + dri_drawable-> + loaderPrivate); if (buffers == NULL) { return; @@ -150,45 +143,44 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv) int index = 0; switch (buffers[i].attachment) { - case __DRI_BUFFER_FRONT_LEFT: - index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_FAKE_FRONT_LEFT: - index = ST_SURFACE_FRONT_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_BACK_LEFT: - index = ST_SURFACE_BACK_LEFT; - format = PIPE_FORMAT_A8R8G8B8_UNORM; - break; - case __DRI_BUFFER_DEPTH: - index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; - break; - case __DRI_BUFFER_STENCIL: - index = ST_SURFACE_DEPTH; - format = PIPE_FORMAT_Z24S8_UNORM; - break; - case __DRI_BUFFER_ACCUM: - default: - assert(0); + case __DRI_BUFFER_FRONT_LEFT: + index = ST_SURFACE_FRONT_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_FAKE_FRONT_LEFT: + index = ST_SURFACE_FRONT_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_BACK_LEFT: + index = ST_SURFACE_BACK_LEFT; + format = PIPE_FORMAT_A8R8G8B8_UNORM; + break; + case __DRI_BUFFER_DEPTH: + index = ST_SURFACE_DEPTH; + format = PIPE_FORMAT_Z24S8_UNORM; + break; + case __DRI_BUFFER_STENCIL: + index = ST_SURFACE_DEPTH; + format = PIPE_FORMAT_Z24S8_UNORM; + break; + case __DRI_BUFFER_ACCUM: + default: + assert(0); } assert(buffers[i].cpp == 4); if (index == ST_SURFACE_DEPTH) { - if (have_depth) - continue; - else - have_depth = TRUE; + if (have_depth) + continue; + else + have_depth = TRUE; } surface = dri_surface_from_handle(screen, - buffers[i].name, - format, - dri_drawable->w, - dri_drawable->h, - buffers[i].pitch); + buffers[i].name, + format, + dri_drawable->w, + dri_drawable->h, buffers[i].pitch); st_set_framebuffer_surface(drawable->stfb, index, surface); pipe_surface_reference(&surface, NULL); @@ -197,25 +189,22 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv) st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h); } - void dri_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private) + struct pipe_surface *surf, void *context_private) { struct dri_context *ctx = (struct dri_context *)context_private; + dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height); } - /** * This is called when we need to set up GL rendering to a new X window. */ boolean -dri_create_buffer(__DRIscreenPrivate *sPriv, - __DRIdrawablePrivate *dPriv, - const __GLcontextModes *visual, - boolean isPixmap) +dri_create_buffer(__DRIscreenPrivate * sPriv, + __DRIdrawablePrivate * dPriv, + const __GLcontextModes * visual, boolean isPixmap) { enum pipe_format colorFormat, depthFormat, stencilFormat; struct dri_screen *screen = sPriv->private; @@ -224,7 +213,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv, int i; if (isPixmap) - goto fail; /* not implemented */ + goto fail; /* not implemented */ drawable = CALLOC_STRUCT(dri_drawable); if (drawable == NULL) @@ -241,39 +230,38 @@ dri_create_buffer(__DRIscreenPrivate *sPriv, if (visual->depthBits) { if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - depthFormat = PIPE_FORMAT_Z24S8_UNORM; + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + depthFormat = PIPE_FORMAT_Z24S8_UNORM; else - depthFormat = PIPE_FORMAT_S8Z24_UNORM; + depthFormat = PIPE_FORMAT_S8Z24_UNORM; } else depthFormat = PIPE_FORMAT_NONE; if (visual->stencilBits) { if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - stencilFormat = PIPE_FORMAT_Z24S8_UNORM; + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET | + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + stencilFormat = PIPE_FORMAT_Z24S8_UNORM; else - stencilFormat = PIPE_FORMAT_S8Z24_UNORM; + stencilFormat = PIPE_FORMAT_S8Z24_UNORM; } else stencilFormat = PIPE_FORMAT_NONE; drawable->stfb = st_create_framebuffer(visual, - colorFormat, - depthFormat, - stencilFormat, - dPriv->w, - dPriv->h, - (void*) drawable); + colorFormat, + depthFormat, + stencilFormat, + dPriv->w, + dPriv->h, (void *)drawable); if (drawable->stfb == NULL) goto fail; drawable->sPriv = sPriv; drawable->dPriv = dPriv; - dPriv->driverPrivate = (void *) drawable; + dPriv->driverPrivate = (void *)drawable; /* setup dri2 buffers information */ i = 0; @@ -293,7 +281,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv, drawable->desired_fences = 2; return GL_TRUE; -fail: + fail: FREE(drawable); return GL_FALSE; } @@ -324,13 +312,14 @@ dri_swap_fences_push_back(struct dri_drawable *draw, if (draw->cur_fences < DRI_SWAP_FENCES_MAX) { draw->cur_fences++; - screen->fence_reference(screen, &draw->swap_fences[draw->head++], fence); + screen->fence_reference(screen, &draw->swap_fences[draw->head++], + fence); draw->head &= DRI_SWAP_FENCES_MASK; } } void -dri_destroy_buffer(__DRIdrawablePrivate *dPriv) +dri_destroy_buffer(__DRIdrawablePrivate * dPriv) { struct dri_drawable *drawable = dri_drawable(dPriv); struct pipe_fence_handle *fence; @@ -338,7 +327,7 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv) st_unreference_framebuffer(drawable->stfb); drawable->desired_fences = 0; - while(drawable->cur_fences) { + while (drawable->cur_fences) { fence = dri_swap_fences_pop_front(drawable); screen->fence_reference(screen, &fence, NULL); } @@ -348,15 +337,16 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv) static void dri1_update_drawables_locked(struct dri_context *ctx, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) + __DRIdrawablePrivate * driDrawPriv, + __DRIdrawablePrivate * driReadPriv) { if (ctx->stLostLock) { ctx->stLostLock = FALSE; if (driDrawPriv == driReadPriv) DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv); else - DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, driReadPriv); + DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, + driReadPriv); } } @@ -387,7 +377,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx) if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) { if (!flushed) - st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); ctx->r_stamp = rPriv->lastStamp; st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h); @@ -400,8 +390,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx) void dri1_update_drawables(struct dri_context *ctx, - struct dri_drawable *draw, - struct dri_drawable *read) + struct dri_drawable *draw, struct dri_drawable *read) { dri_lock(ctx); dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv); @@ -420,20 +409,20 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst, int xy1; int xy2; - xy1 = ((int) src->x1 > (int) bbox->x1 + dst_x) ? src->x1 : - (int) bbox->x1 + dst_x; - xy2 = ((int) src->x2 < (int) bbox->x2 + dst_x) ? src->x2 : - (int) bbox->x2 + dst_x; + xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 : + (int)bbox->x1 + dst_x; + xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 : + (int)bbox->x2 + dst_x; if (xy1 >= xy2 || xy1 < 0) return FALSE; dst->x1 = xy1; dst->x2 = xy2; - xy1 = ((int) src->y1 > (int) bbox->y1 + dst_x) ? src->y1 : - (int) bbox->y1 + dst_x; - xy2 = ((int) src->y2 < (int) bbox->y2 + dst_x) ? src->y2 : - (int) bbox->y2 + dst_x; + xy1 = ((int)src->y1 > (int)bbox->y1 + dst_x) ? src->y1 : + (int)bbox->y1 + dst_x; + xy2 = ((int)src->y2 < (int)bbox->y2 + dst_x) ? src->y2 : + (int)bbox->y2 + dst_x; if (xy1 >= xy2 || xy1 < 0) return FALSE; @@ -442,13 +431,11 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst, return TRUE; } - static void dri1_swap_copy(struct dri_context *ctx, struct pipe_surface *dst, struct pipe_surface *src, - __DRIdrawablePrivate *dPriv, - const struct drm_clip_rect *bbox) + __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox) { struct pipe_context *pipe = ctx->pipe; struct drm_clip_rect clip; @@ -457,21 +444,20 @@ dri1_swap_copy(struct dri_context *ctx, cur = dPriv->pClipRects; - for (i=0; inumClipRects; ++i) { + for (i = 0; i < dPriv->numClipRects; ++i) { if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) pipe->surface_copy(pipe, dst, clip.x1, clip.y1, src, - (int) clip.x1 - dPriv->x, - (int) clip.y1 - dPriv->y, - clip.x2 - clip.x1, - clip.y2 - clip.y1); + (int)clip.x1 - dPriv->x, + (int)clip.y1 - dPriv->y, + clip.x2 - clip.x1, clip.y2 - clip.y1); } } static void dri1_copy_to_front(struct dri_context *ctx, struct pipe_surface *surf, - __DRIdrawablePrivate *dPriv, + __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *sub_box, struct pipe_fence_handle **fence) { @@ -503,15 +489,11 @@ dri1_copy_to_front(struct dri_context *ctx, surf, dPriv->pClipRects, dPriv->numClipRects, - dPriv->x, - dPriv->y, - &bbox, - fence); + dPriv->x, dPriv->y, &bbox, fence); } else if (visible && __dri1_api_hooks->front_srf_locked) { - struct pipe_surface *front = - __dri1_api_hooks->front_srf_locked(pipe); + struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe); if (front) dri1_swap_copy(ctx, front, surf, dPriv, &bbox); @@ -534,8 +516,7 @@ dri1_copy_to_front(struct dri_context *ctx, void dri1_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private) + struct pipe_surface *surf, void *context_private) { struct dri_context *ctx = (struct dri_context *)context_private; struct pipe_fence_handle *dummy_fence; @@ -555,14 +536,15 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv) struct dri_drawable *draw = dri_drawable(dPriv); struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen; struct pipe_fence_handle *fence; + GET_CURRENT_CONTEXT(glCtx); assert(__dri1_api_hooks != NULL); if (!glCtx) - return; /* For now */ + return; /* For now */ - ctx = (struct dri_context *) glCtx->st->pipe->priv; + ctx = (struct dri_context *)glCtx->st->pipe->priv; st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf); if (back_surf) { @@ -570,7 +552,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv) st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); fence = dri_swap_fences_pop_front(draw); if (fence) { - (void) screen->fence_finish(screen, fence, 0); + (void)screen->fence_finish(screen, fence, 0); screen->fence_reference(screen, &fence, NULL); } dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence); @@ -587,6 +569,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) struct pipe_surface *back_surf; struct dri_drawable *draw = dri_drawable(dPriv); struct pipe_fence_handle *dummy_fence; + GET_CURRENT_CONTEXT(glCtx); assert(__dri1_api_hooks != NULL); @@ -594,7 +577,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) if (!glCtx) return; - ctx = (struct dri_context *) glCtx->st->pipe->priv; + ctx = (struct dri_context *)glCtx->st->pipe->priv; sub_bbox.x1 = x; sub_bbox.x2 = x + w; diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index c1341deb52..78a66624aa 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -55,51 +55,40 @@ struct dri_drawable unsigned int cur_fences; }; - static INLINE struct dri_drawable * dri_drawable(__DRIdrawablePrivate * driDrawPriv) { - return (struct dri_drawable *) driDrawPriv->driverPrivate; + return (struct dri_drawable *)driDrawPriv->driverPrivate; } - /*********************************************************************** * dri_drawable.c */ boolean -dri_create_buffer(__DRIscreenPrivate *sPriv, - __DRIdrawablePrivate *dPriv, - const __GLcontextModes *visual, - boolean isPixmap); +dri_create_buffer(__DRIscreenPrivate * sPriv, + __DRIdrawablePrivate * dPriv, + const __GLcontextModes * visual, boolean isPixmap); void dri_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private); + struct pipe_surface *surf, void *context_private); -void -dri_swap_buffers(__DRIdrawablePrivate * dPriv); +void dri_swap_buffers(__DRIdrawablePrivate * dPriv); void -dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, - int x, int y, - int w, int h); +dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h); -void -dri_get_buffers(__DRIdrawablePrivate * dPriv); +void dri_get_buffers(__DRIdrawablePrivate * dPriv); -void -dri_destroy_buffer(__DRIdrawablePrivate *dPriv); +void dri_destroy_buffer(__DRIdrawablePrivate * dPriv); void dri1_update_drawables(struct dri_context *ctx, - struct dri_drawable *draw, - struct dri_drawable *read); + struct dri_drawable *draw, struct dri_drawable *read); void dri1_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surf, - void *context_private); + struct pipe_surface *surf, void *context_private); #endif /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 732d1e89b0..0c59d42d5c 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -52,7 +52,6 @@ #define need_GL_NV_vertex_program #include "extension_helper.h" - /** * Extension strings exported by the driver. */ @@ -74,7 +73,8 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, - {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, + {"GL_EXT_blend_equation_separate", + GL_EXT_blend_equation_separate_functions}, {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, {"GL_EXT_blend_subtract", NULL}, @@ -98,11 +98,10 @@ const struct dri_extension card_extensions[] = { {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, {"GL_NV_vertex_program1_1", NULL}, - {"GL_SGIS_generate_mipmap", NULL }, + {"GL_SGIS_generate_mipmap", NULL}, {NULL, NULL} }; - void dri_init_extensions(struct dri_context *ctx) { diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 418bb90115..d3392ee690 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -46,34 +46,32 @@ #include "state_tracker/st_public.h" #include "state_tracker/st_cb_fbo.h" - PUBLIC const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY - /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/ - DRI_CONF_ALLOW_LARGE_TEXTURES(1) + /*DRI_CONF_FORCE_S3TC_ENABLE(false) */ + DRI_CONF_ALLOW_LARGE_TEXTURES(1) DRI_CONF_SECTION_END DRI_CONF_END; + const uint __driNConfigOptions = 3; -const uint __driNConfigOptions = 3; - -static const __DRIextension *dri_screen_extensions[] = { - &driReadDrawableExtension, - &driCopySubBufferExtension.base, - &driSwapControlExtension.base, - &driFrameTrackingExtension.base, - &driMediaStreamCounterExtension.base, - NULL -}; + static const __DRIextension *dri_screen_extensions[] = { + &driReadDrawableExtension, + &driCopySubBufferExtension.base, + &driSwapControlExtension.base, + &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, + NULL + }; struct dri1_api *__dri1_api_hooks = NULL; static const __DRIconfig ** -dri_fill_in_modes(__DRIscreenPrivate *psp, - unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer) +dri_fill_in_modes(__DRIscreenPrivate * psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer) { __DRIconfig **configs; __GLcontextModes *m; @@ -97,9 +95,9 @@ dri_fill_in_modes(__DRIscreenPrivate *psp, depth_bits_array[1] = 24; depth_bits_array[2] = 24; - stencil_bits_array[0] = 0; /* no depth or stencil */ - stencil_bits_array[1] = 0; /* z24x8 */ - stencil_bits_array[2] = 8; /* z24s8 */ + stencil_bits_array[0] = 0; /* no depth or stencil */ + stencil_bits_array[1] = 0; /* z24x8 */ + stencil_bits_array[2] = 8; /* z24s8 */ msaa_samples_array[0] = 0; @@ -107,22 +105,22 @@ dri_fill_in_modes(__DRIscreenPrivate *psp, back_buffer_factor = 3; msaa_samples_factor = 1; - num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4; + num_modes = + depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4; if (pixel_bits == 16) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { + } else { fb_format = GL_BGRA; fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, - stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - msaa_samples_array, msaa_samples_factor); + stencil_bits_array, depth_buffer_factor, + back_buffer_modes, back_buffer_factor, + msaa_samples_array, msaa_samples_factor); if (configs == NULL) { debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__); return NULL; @@ -131,24 +129,20 @@ dri_fill_in_modes(__DRIscreenPrivate *psp, for (i = 0; configs[i]; i++) { m = &configs[i]->modes; if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) { - m->visualRating = GLX_SLOW_CONFIG; + m->visualRating = GLX_SLOW_CONFIG; } } - return (const const __DRIconfig **) configs; + return (const const __DRIconfig **)configs; } - /** * Get information about previous buffer swaps. */ static int -dri_get_swap_info(__DRIdrawablePrivate * dPriv, - __DRIswapInfo * sInfo) +dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo) { - if (dPriv == NULL || - dPriv->driverPrivate == NULL || - sInfo == NULL) + if (dPriv == NULL || dPriv->driverPrivate == NULL || sInfo == NULL) return -1; else return 0; @@ -164,37 +158,36 @@ dri_copy_version(struct dri1_api_version *dst, } static const __DRIconfig ** -dri_init_screen(__DRIscreenPrivate *sPriv) +dri_init_screen(__DRIscreenPrivate * sPriv) { - struct dri_screen *screen; - const __DRIconfig **configs; - struct dri1_create_screen_arg arg; + struct dri_screen *screen; + const __DRIconfig **configs; + struct dri1_create_screen_arg arg; - dri_init_extensions(NULL); + dri_init_extensions(NULL); - screen = CALLOC_STRUCT(dri_screen); - if (!screen) - return NULL; + screen = CALLOC_STRUCT(dri_screen); + if (!screen) + return NULL; - screen->sPriv = sPriv; - screen->fd = sPriv->fd; - screen->drmLock = (drmLock *) &sPriv->pSAREA->lock; + screen->sPriv = sPriv; + screen->fd = sPriv->fd; + screen->drmLock = (drmLock *) & sPriv->pSAREA->lock; - sPriv->private = (void *) screen; - sPriv->extensions = dri_screen_extensions; + sPriv->private = (void *)screen; + sPriv->extensions = dri_screen_extensions; - arg.base.mode = DRM_CREATE_DRI1; - arg.lf = &dri1_lf; - arg.ddx_info = sPriv->pDevPriv; - arg.ddx_info_size = sPriv->devPrivSize; - arg.sarea = sPriv->pSAREA; - dri_copy_version(&arg.ddx_version, &sPriv->ddx_version); - dri_copy_version(&arg.dri_version, &sPriv->dri_version); - dri_copy_version(&arg.drm_version, &sPriv->drm_version); - arg.api = NULL; + arg.base.mode = DRM_CREATE_DRI1; + arg.lf = &dri1_lf; + arg.ddx_info = sPriv->pDevPriv; + arg.ddx_info_size = sPriv->devPrivSize; + arg.sarea = sPriv->pSAREA; + dri_copy_version(&arg.ddx_version, &sPriv->ddx_version); + dri_copy_version(&arg.dri_version, &sPriv->dri_version); + dri_copy_version(&arg.drm_version, &sPriv->drm_version); + arg.api = NULL; - screen->pipe_screen = drm_api_hooks.create_screen - (screen->fd, &arg.base); + screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg.base); if (!screen->pipe_screen || !arg.api) { debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__); @@ -205,8 +198,7 @@ dri_init_screen(__DRIscreenPrivate *sPriv) screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer; driParseOptionInfo(&screen->optionCache, - __driConfigOptions, - __driNConfigOptions); + __driConfigOptions, __driNConfigOptions); configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1); if (!configs) @@ -220,14 +212,13 @@ dri_init_screen(__DRIscreenPrivate *sPriv) return NULL; } - /** * This is the driver specific part of the createNewScreen entry point. * * Returns the __GLcontextModes supported by this driver. */ static const __DRIconfig ** -dri_init_screen2(__DRIscreenPrivate *sPriv) +dri_init_screen2(__DRIscreenPrivate * sPriv) { struct dri_screen *screen; struct drm_create_screen_arg arg; @@ -241,7 +232,7 @@ dri_init_screen2(__DRIscreenPrivate *sPriv) screen->sPriv = sPriv; screen->fd = sPriv->fd; - sPriv->private = (void *) screen; + sPriv->private = (void *)screen; sPriv->extensions = dri_screen_extensions; arg.mode = DRM_CREATE_NORMAL; @@ -255,19 +246,13 @@ dri_init_screen2(__DRIscreenPrivate *sPriv) screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer; driParseOptionInfo(&screen->optionCache, - __driConfigOptions, - __driNConfigOptions); - - return dri_fill_in_modes(sPriv, - 4 * 8, - 24, - 8, - 1); -fail: + __driConfigOptions, __driNConfigOptions); + + return dri_fill_in_modes(sPriv, 4 * 8, 24, 8, 1); + fail: return NULL; } - static void dri_destroy_screen(__DRIscreenPrivate * sPriv) { @@ -278,23 +263,22 @@ dri_destroy_screen(__DRIscreenPrivate * sPriv) sPriv->private = NULL; } - PUBLIC const struct __DriverAPIRec driDriverAPI = { - .InitScreen = dri_init_screen, - .DestroyScreen = dri_destroy_screen, - .CreateContext = dri_create_context, - .DestroyContext = dri_destroy_context, - .CreateBuffer = dri_create_buffer, - .DestroyBuffer = dri_destroy_buffer, - .SwapBuffers = dri_swap_buffers, - .MakeCurrent = dri_make_current, - .UnbindContext = dri_unbind_context, - .GetSwapInfo = dri_get_swap_info, - .GetDrawableMSC = driDrawableGetMSC32, - .WaitForMSC = driWaitForMSC32, - .CopySubBuffer = dri_copy_sub_buffer, - .InitScreen = dri_init_screen, - .InitScreen2 = dri_init_screen2, + .InitScreen = dri_init_screen, + .DestroyScreen = dri_destroy_screen, + .CreateContext = dri_create_context, + .DestroyContext = dri_destroy_context, + .CreateBuffer = dri_create_buffer, + .DestroyBuffer = dri_destroy_buffer, + .SwapBuffers = dri_swap_buffers, + .MakeCurrent = dri_make_current, + .UnbindContext = dri_unbind_context, + .GetSwapInfo = dri_get_swap_info, + .GetDrawableMSC = driDrawableGetMSC32, + .WaitForMSC = driWaitForMSC32, + .CopySubBuffer = dri_copy_sub_buffer, + .InitScreen = dri_init_screen, + .InitScreen2 = dri_init_screen2, }; /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index c358c35168..100d9e50e0 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -64,15 +64,13 @@ struct dri_screen struct pipe_screen *pipe_screen; }; - /** cast wrapper */ static INLINE struct dri_screen * -dri_screen(__DRIscreenPrivate *sPriv) +dri_screen(__DRIscreenPrivate * sPriv) { - return (struct dri_screen *) sPriv->private; + return (struct dri_screen *)sPriv->private; } - /*********************************************************************** * dri_screen.c */ -- cgit v1.2.3 From 05af5a7f593ac6451cff9e6923d4a969d5358bcb Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 11:58:27 +0200 Subject: gallium: Rename the dri state tracker lib to libdridrm.a --- src/gallium/state_trackers/dri/Makefile | 2 +- src/gallium/winsys/drm/intel/dri2/Makefile | 2 +- src/gallium/winsys/drm/nouveau/dri2/Makefile | 2 +- src/gallium/winsys/drm/radeon/dri2/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/state_trackers/dri/Makefile b/src/gallium/state_trackers/dri/Makefile index 47750e997e..ef8f19709a 100644 --- a/src/gallium/state_trackers/dri/Makefile +++ b/src/gallium/state_trackers/dri/Makefile @@ -1,7 +1,7 @@ TOP = ../../../.. include $(TOP)/configs/current -LIBNAME = dri2drm +LIBNAME = dridrm LIBRARY_INCLUDES = \ -I$(TOP)/include \ diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile index 286ef08d5b..125e79e0ed 100644 --- a/src/gallium/winsys/drm/intel/dri2/Makefile +++ b/src/gallium/winsys/drm/intel/dri2/Makefile @@ -4,7 +4,7 @@ include $(TOP)/configs/current LIBNAME = i915_dri.so PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile index 5e5efbcb11..377a80d518 100644 --- a/src/gallium/winsys/drm/nouveau/dri2/Makefile +++ b/src/gallium/winsys/drm/nouveau/dri2/Makefile @@ -4,7 +4,7 @@ include $(TOP)/configs/current LIBNAME = nouveau_dri2.so PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \ $(TOP)/src/gallium/drivers/nv04/libnv04.a \ $(TOP)/src/gallium/drivers/nv10/libnv10.a \ diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile index 58a87dae18..c218ee9d01 100644 --- a/src/gallium/winsys/drm/radeon/dri2/Makefile +++ b/src/gallium/winsys/drm/radeon/dri2/Makefile @@ -7,7 +7,7 @@ LIBNAME = radeon_dri.so MINIGLX_SOURCES = PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdri2drm.a \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/r300/libr300.a -- cgit v1.2.3 From 1ae877d95adbc19cb0a8d4fe07f46ac4d46c8147 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 28 Apr 2009 03:28:37 -0700 Subject: radeon: Use PCI_MATCH_ANY for xorg driver. Might as well. --- src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c b/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c index 6f77fbe5de..36824251f0 100644 --- a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c +++ b/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c @@ -38,20 +38,17 @@ static Bool radeon_xorg_pci_probe(DriverPtr driver, intptr_t match_data); static const struct pci_id_match radeon_xorg_device_match[] = { - {0x1002, 0x5E4D, 0xffff, 0xffff, 0, 0, 0}, - {0x1002, 0x7249, 0xffff, 0xffff, 0, 0, 0}, + {0x1002, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0}, {0, 0, 0}, }; static SymTabRec radeon_xorg_chipsets[] = { - {0x5E4D, "Radeon RV410 PCIE (X700)"}, - {0x7249, "Radeon R580 PCIE (X1900 XT)"}, + {PCI_MATCH_ANY, "ATI/AMD Radeon Graphics Chipset"}, {-1, NULL} }; static PciChipsets radeon_xorg_pci_devices[] = { - {0x5E4D, 0x5E4D, RES_SHARED_VGA}, - {0x7249, 0x7249, RES_SHARED_VGA}, + {PCI_MATCH_ANY, PCI_MATCH_ANY, RES_SHARED_VGA}, {-1, -1, RES_UNDEFINED} }; -- cgit v1.2.3 From 81ded8092a4068ec289e6c7207078f076bfee5fd Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 28 Apr 2009 03:28:57 -0700 Subject: radeon-r300: Fix a bit of breakage. Not really sure why reordering the ioctls makes them work again. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 19 +++++++++--------- src/gallium/winsys/drm/radeon/dri/Makefile | 25 ++++++++++++++++++++++++ src/gallium/winsys/drm/radeon/dri/SConscript | 14 +++++++++++++ src/gallium/winsys/drm/radeon/dri2/Makefile | 25 ------------------------ src/gallium/winsys/drm/radeon/dri2/SConscript | 14 ------------- 5 files changed, 48 insertions(+), 49 deletions(-) create mode 100644 src/gallium/winsys/drm/radeon/dri/Makefile create mode 100644 src/gallium/winsys/drm/radeon/dri/SConscript delete mode 100644 src/gallium/winsys/drm/radeon/dri2/Makefile delete mode 100644 src/gallium/winsys/drm/radeon/dri2/SConscript diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 293b6c2d38..3302d623bf 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -53,32 +53,31 @@ static void radeon_r300_flush_cs(struct radeon_cs* cs) static void do_ioctls(struct r300_winsys* winsys, int fd) { drm_radeon_getparam_t gp; - uint32_t target; + int target; int retval; /* XXX is this cast safe? */ gp.value = (int*)⌖ - /* First, get PCI ID */ - gp.param = RADEON_PARAM_DEVICE_ID; + /* First, get the number of pixel pipes */ + gp.param = RADEON_PARAM_NUM_GB_PIPES; retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (retval) { - fprintf(stderr, "%s: Failed to get PCI ID, error number %d", + fprintf(stderr, "%s: Failed to get GB pipe count, error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->pci_id = target; + winsys->gb_pipes = target; - /* Then, get the number of pixel pipes */ - gp.param = RADEON_PARAM_NUM_GB_PIPES; + /* Then, get PCI ID */ + gp.param = RADEON_PARAM_DEVICE_ID; retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, error number %d", + fprintf(stderr, "%s: Failed to get PCI ID, error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->gb_pipes = target; - + winsys->pci_id = target; } struct r300_winsys* diff --git a/src/gallium/winsys/drm/radeon/dri/Makefile b/src/gallium/winsys/drm/radeon/dri/Makefile new file mode 100644 index 0000000000..c218ee9d01 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/dri/Makefile @@ -0,0 +1,25 @@ + +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBNAME = radeon_dri.so + +MINIGLX_SOURCES = + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ + $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/r300/libr300.a + +C_SOURCES = \ + $(COMMON_GALLIUM_SOURCES) \ + $(DRIVER_SOURCES) + +ASM_SOURCES = + +include ../../Makefile.template + +DRI_LIB_DEPS += -ldrm_radeon + +symlinks: diff --git a/src/gallium/winsys/drm/radeon/dri/SConscript b/src/gallium/winsys/drm/radeon/dri/SConscript new file mode 100644 index 0000000000..f2cdee97d9 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/dri/SConscript @@ -0,0 +1,14 @@ +Import('*') + +env = drienv.Clone() + +drivers = [ + softpipe, + r300 +] + +env.SharedLibrary( + target ='radeon_dri.so', + source = COMMON_GALLIUM_SOURCES, + LIBS = drivers + mesa + auxiliaries + env['LIBS'], +) diff --git a/src/gallium/winsys/drm/radeon/dri2/Makefile b/src/gallium/winsys/drm/radeon/dri2/Makefile deleted file mode 100644 index c218ee9d01..0000000000 --- a/src/gallium/winsys/drm/radeon/dri2/Makefile +++ /dev/null @@ -1,25 +0,0 @@ - -TOP = ../../../../../.. -include $(TOP)/configs/current - -LIBNAME = radeon_dri.so - -MINIGLX_SOURCES = - -PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ - $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \ - $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ - $(TOP)/src/gallium/drivers/r300/libr300.a - -C_SOURCES = \ - $(COMMON_GALLIUM_SOURCES) \ - $(DRIVER_SOURCES) - -ASM_SOURCES = - -include ../../Makefile.template - -DRI_LIB_DEPS += -ldrm_radeon - -symlinks: diff --git a/src/gallium/winsys/drm/radeon/dri2/SConscript b/src/gallium/winsys/drm/radeon/dri2/SConscript deleted file mode 100644 index f2cdee97d9..0000000000 --- a/src/gallium/winsys/drm/radeon/dri2/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -Import('*') - -env = drienv.Clone() - -drivers = [ - softpipe, - r300 -] - -env.SharedLibrary( - target ='radeon_dri.so', - source = COMMON_GALLIUM_SOURCES, - LIBS = drivers + mesa + auxiliaries + env['LIBS'], -) -- cgit v1.2.3 From 171c7f91cd3dcb41bf7abb333d725b3b3a3e9b1a Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 13:03:22 +0200 Subject: gallium dri st: Fix up some comments and minor bugs. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/dri_context.c | 2 +- src/gallium/state_trackers/dri/dri_drawable.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 7f38671126..8e6299c540 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -128,7 +128,7 @@ dri_unbind_context(__DRIcontextPrivate * cPriv) if (--ctx->bind_count == 0) { GET_CURRENT_CONTEXT(curGLCtx); - if (ctx->st == curGLCtx->st) { + if (curGLCtx && ctx->st == curGLCtx->st) { st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); st_make_current(NULL, NULL, NULL); } diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index abda4ff17e..fd4bae5aea 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -351,10 +351,10 @@ dri1_update_drawables_locked(struct dri_context *ctx, } /** - * This ensures all contexts which binds to a drawable picks up the - * drawable change and signals new buffer state. + * This ensures all contexts which bind to a drawable pick up the + * drawable change and signal new buffer state. * Calling st_resize_framebuffer for each context may seem like overkill, - * but no new buffers will actually be allocated if the dimensions doesn't + * but no new buffers will actually be allocated if the dimensions don't * change. */ @@ -419,10 +419,10 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst, dst->x1 = xy1; dst->x2 = xy2; - xy1 = ((int)src->y1 > (int)bbox->y1 + dst_x) ? src->y1 : - (int)bbox->y1 + dst_x; - xy2 = ((int)src->y2 < (int)bbox->y2 + dst_x) ? src->y2 : - (int)bbox->y2 + dst_x; + xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 : + (int)bbox->y1 + dst_y; + xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 : + (int)bbox->y2 + dst_y; if (xy1 >= xy2 || xy1 < 0) return FALSE; @@ -522,6 +522,7 @@ dri1_flush_frontbuffer(struct pipe_screen *screen, struct pipe_fence_handle *dummy_fence; dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence); + screen->fence_reference(screen, &dummy_fence, NULL); /** * FIXME: Do we need swap throttling here? @@ -564,6 +565,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv) void dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) { + struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen; struct drm_clip_rect sub_bbox; struct dri_context *ctx; struct pipe_surface *back_surf; @@ -588,6 +590,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) if (back_surf) { st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence); + screen->fence_reference(screen, &dummy_fence, NULL); } } -- cgit v1.2.3 From c9b336bc936a733b1273170fc5e2ecc4980116b2 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 28 Apr 2009 01:00:51 +0200 Subject: gallium-intel: Fix build of dri driver --- src/gallium/winsys/drm/intel/dri/Makefile | 23 +++++++++++++++++++++++ src/gallium/winsys/drm/intel/dri2/Makefile | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 src/gallium/winsys/drm/intel/dri/Makefile delete mode 100644 src/gallium/winsys/drm/intel/dri2/Makefile diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile new file mode 100644 index 0000000000..125e79e0ed --- /dev/null +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -0,0 +1,23 @@ +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBNAME = i915_dri.so + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ + $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/i915simple/libi915simple.a + + +DRIVER_SOURCES = + +C_SOURCES = \ + $(COMMON_GALLIUM_SOURCES) \ + $(DRIVER_SOURCES) + +include ../../Makefile.template + +DRI_LIB_DEPS += -ldrm_intel + +symlinks: diff --git a/src/gallium/winsys/drm/intel/dri2/Makefile b/src/gallium/winsys/drm/intel/dri2/Makefile deleted file mode 100644 index 125e79e0ed..0000000000 --- a/src/gallium/winsys/drm/intel/dri2/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TOP = ../../../../../.. -include $(TOP)/configs/current - -LIBNAME = i915_dri.so - -PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ - $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ - $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ - $(TOP)/src/gallium/drivers/i915simple/libi915simple.a - - -DRIVER_SOURCES = - -C_SOURCES = \ - $(COMMON_GALLIUM_SOURCES) \ - $(DRIVER_SOURCES) - -include ../../Makefile.template - -DRI_LIB_DEPS += -ldrm_intel - -symlinks: -- cgit v1.2.3 From 4e7d603fae8cff2a80096936ad210cb26a3f5f0e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Apr 2009 15:26:24 +1000 Subject: radeon: remove kernel mm, dri2 path takes care of it --- src/mesa/drivers/dri/radeon/radeon_screen.c | 104 ++++++++++++---------------- 1 file changed, 44 insertions(+), 60 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 1541412028..ed542d71fc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -787,19 +787,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) { int ret; -#ifdef RADEON_PARAM_KERNEL_MM - ret = radeonGetParam(sPriv, RADEON_PARAM_KERNEL_MM, &screen->kernel_mm); - - if (ret && ret != -EINVAL) { - FREE( screen ); - fprintf(stderr, "drm_radeon_getparam_t (RADEON_OFFSET): %d\n", ret); - return NULL; - } - - if (ret == -EINVAL) - screen->kernel_mm = 0; -#endif - ret = radeonGetParam(sPriv, RADEON_PARAM_GART_BUFFER_OFFSET, &screen->gart_buffer_offset); @@ -833,63 +820,60 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->drmSupportsVertexProgram = (sPriv->drm_version.minor >= 25); } - if (!screen->kernel_mm) { - screen->mmio.handle = dri_priv->registerHandle; - screen->mmio.size = dri_priv->registerSize; - if ( drmMap( sPriv->fd, - screen->mmio.handle, - screen->mmio.size, - &screen->mmio.map ) ) { - FREE( screen ); - __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ ); - return NULL; - } + screen->mmio.handle = dri_priv->registerHandle; + screen->mmio.size = dri_priv->registerSize; + if ( drmMap( sPriv->fd, + screen->mmio.handle, + screen->mmio.size, + &screen->mmio.map ) ) { + FREE( screen ); + __driUtilMessage("%s: drmMap failed\n", __FUNCTION__ ); + return NULL; + } - RADEONMMIO = screen->mmio.map; + RADEONMMIO = screen->mmio.map; - screen->status.handle = dri_priv->statusHandle; - screen->status.size = dri_priv->statusSize; - if ( drmMap( sPriv->fd, - screen->status.handle, - screen->status.size, - &screen->status.map ) ) { - drmUnmap( screen->mmio.map, screen->mmio.size ); - FREE( screen ); - __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ ); - return NULL; - } - screen->scratch = (__volatile__ uint32_t *) - ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET); + screen->status.handle = dri_priv->statusHandle; + screen->status.size = dri_priv->statusSize; + if ( drmMap( sPriv->fd, + screen->status.handle, + screen->status.size, + &screen->status.map ) ) { + drmUnmap( screen->mmio.map, screen->mmio.size ); + FREE( screen ); + __driUtilMessage("%s: drmMap (2) failed\n", __FUNCTION__ ); + return NULL; + } + screen->scratch = (__volatile__ uint32_t *) + ((GLubyte *)screen->status.map + RADEON_SCRATCH_REG_OFFSET); + + screen->buffers = drmMapBufs( sPriv->fd ); + if ( !screen->buffers ) { + drmUnmap( screen->status.map, screen->status.size ); + drmUnmap( screen->mmio.map, screen->mmio.size ); + FREE( screen ); + __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ ); + return NULL; + } - screen->buffers = drmMapBufs( sPriv->fd ); - if ( !screen->buffers ) { + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { + screen->gartTextures.handle = dri_priv->gartTexHandle; + screen->gartTextures.size = dri_priv->gartTexMapSize; + if ( drmMap( sPriv->fd, + screen->gartTextures.handle, + screen->gartTextures.size, + (drmAddressPtr)&screen->gartTextures.map ) ) { + drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); FREE( screen ); - __driUtilMessage("%s: drmMapBufs failed\n", __FUNCTION__ ); + __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__); return NULL; - } - - if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { - screen->gartTextures.handle = dri_priv->gartTexHandle; - screen->gartTextures.size = dri_priv->gartTexMapSize; - if ( drmMap( sPriv->fd, - screen->gartTextures.handle, - screen->gartTextures.size, - (drmAddressPtr)&screen->gartTextures.map ) ) { - drmUnmapBufs( screen->buffers ); - drmUnmap( screen->status.map, screen->status.size ); - drmUnmap( screen->mmio.map, screen->mmio.size ); - FREE( screen ); - __driUtilMessage("%s: drmMap failed for GART texture area\n", __FUNCTION__); - return NULL; - } + } - screen->gart_texture_offset = dri_priv->gartTexOffset + screen->gart_base; - } + screen->gart_texture_offset = dri_priv->gartTexOffset + screen->gart_base; } - ret = radeon_set_screen_flags(screen, dri_priv->deviceID); if (ret == -1) return NULL; -- cgit v1.2.3 From 7731d931650d721550bc558ad84b6e3060fa94b9 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Apr 2009 15:27:31 +1000 Subject: r300: remove unused debugging in set tex buffer paths --- src/mesa/drivers/dri/r200/r200_texstate.c | 1 - src/mesa/drivers/dri/r300/r300_texstate.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 15758d767c..eee54cd73b 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -833,7 +833,6 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_miptree_unreference(rImage->mt); rImage->mt = NULL; } - fprintf(stderr,"settexbuf %d %dx%d@%d\n", rb->pitch, rb->width, rb->height, rb->cpp); _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->width, rb->height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index cf4cad73d2..2d7ad55521 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -431,7 +431,6 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_miptree_unreference(rImage->mt); rImage->mt = NULL; } - fprintf(stderr,"settexbuf %dx%d@%d %d targ %x format %x\n", rb->width, rb->height, rb->cpp, rb->pitch, target, format); _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->width, rb->height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; -- cgit v1.2.3 From a9d64873d771a0ac8a319f036d97d827fea934df Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Apr 2009 15:35:52 +1000 Subject: radeon: further cleanup dri1 screen init --- src/mesa/drivers/dri/radeon/radeon_screen.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index ed542d71fc..544ab74997 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -904,7 +904,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) ret = radeonGetParam(sPriv, RADEON_PARAM_FB_LOCATION, &temp); if (ret) { - if (screen->chip_family < CHIP_FAMILY_RS600 && !screen->kernel_mm) + if (screen->chip_family < CHIP_FAMILY_RS600) screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff) << 16; else { FREE( screen ); @@ -1005,9 +1005,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->extensions[i++] = &driMediaStreamCounterExtension.base; } - if (!screen->kernel_mm) { #if !RADEON_COMMON - screen->extensions[i++] = &radeonTexOffsetExtension.base; + screen->extensions[i++] = &radeonTexOffsetExtension.base; #endif #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) @@ -1030,10 +1029,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + screen->sarea_priv_offset); - if (screen->kernel_mm) - screen->bom = radeon_bo_manager_gem_ctor(sPriv->fd); - else - screen->bom = radeon_bo_manager_legacy_ctor(screen); + screen->bom = radeon_bo_manager_legacy_ctor(screen); if (screen->bom == NULL) { free(screen); return NULL; -- cgit v1.2.3 From 5ca4f3c5dad94f8e07aa7d93c076d4bc0acee1f6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 28 Apr 2009 15:44:10 +1000 Subject: radeno: cleanup the startup path further --- src/mesa/drivers/dri/radeon/radeon_screen.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 544ab74997..9ce950af17 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1010,16 +1010,15 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) #endif #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - if (IS_R200_CLASS(screen)) - screen->extensions[i++] = &r200AllocateExtension.base; + if (IS_R200_CLASS(screen)) + screen->extensions[i++] = &r200AllocateExtension.base; - screen->extensions[i++] = &r200texOffsetExtension.base; + screen->extensions[i++] = &r200texOffsetExtension.base; #endif #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) - screen->extensions[i++] = &r300texOffsetExtension.base; + screen->extensions[i++] = &r300texOffsetExtension.base; #endif - } screen->extensions[i++] = NULL; sPriv->extensions = screen->extensions; -- cgit v1.2.3 From aef3bccbdaf20f7e0e1fdab0084f60556a12d55d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 28 Apr 2009 12:56:21 +0100 Subject: gallium-intel: Create a i965_dri.so symlink This is only used for debuging the gem backend on i965 chipset using the softpipe pipe driver. Usage: "export INTEL_SOFTPIPE=y" and point LIBGL_DRIVERS_PATH to "$MESA/lib/gallium" where $MESA is the mesa root. --- src/gallium/winsys/drm/intel/dri/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile index 125e79e0ed..a4704bc050 100644 --- a/src/gallium/winsys/drm/intel/dri/Makefile +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -20,4 +20,6 @@ include ../../Makefile.template DRI_LIB_DEPS += -ldrm_intel -symlinks: +symlinks: $(TOP)/$(LIB_DIR)/gallium + @rm -f $(TOP)/lib/gallium/i965_dri.so + ln -s i915_dri.so $(TOP)/lib/gallium/i965_dri.so -- cgit v1.2.3 From 3d2bba0d10d59a9c2d6d09c5dc3fabe148d5e0d7 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 14:12:39 +0200 Subject: st: Add an st_get_current() function. Signed-off-by: Thomas Hellstrom --- src/mesa/state_tracker/st_context.c | 6 ++++++ src/mesa/state_tracker/st_public.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index b27274725f..92a630eff9 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -279,6 +279,12 @@ void st_make_current(struct st_context *st, } } +struct st_context *st_get_current(void) +{ + GET_CURRENT_CONTEXT(ctx); + + return (ctx == NULL) ? NULL : ctx->st; +} void st_copy_context_state(struct st_context *dst, struct st_context *src, diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 030314372f..290b8a974e 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -95,6 +95,8 @@ void st_make_current(struct st_context *st, struct st_framebuffer *draw, struct st_framebuffer *read); +struct st_context *st_get_current(void); + void st_flush( struct st_context *st, uint pipeFlushFlags, struct pipe_fence_handle **fence ); void st_finish( struct st_context *st ); -- cgit v1.2.3 From 8cfa6546c9aa25edad3e7bc3cf6f1a9399052b79 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 14:20:45 +0200 Subject: gallium dri st: Use st_get_current() instead of GET_CURRENT_CONTEXT() Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/dri_context.c | 11 ++++------- src/gallium/state_trackers/dri/dri_drawable.c | 14 ++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 8e6299c540..54d2a56356 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -126,9 +126,7 @@ dri_unbind_context(__DRIcontextPrivate * cPriv) struct dri_context *ctx = dri_context(cPriv); if (--ctx->bind_count == 0) { - GET_CURRENT_CONTEXT(curGLCtx); - - if (curGLCtx && ctx->st == curGLCtx->st) { + if (ctx->st && ctx->st == st_get_current()) { st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); st_make_current(NULL, NULL, NULL); } @@ -148,11 +146,10 @@ dri_make_current(__DRIcontextPrivate * cPriv, struct dri_screen *screen = dri_screen(cPriv->driScreenPriv); struct dri_drawable *draw = dri_drawable(driDrawPriv); struct dri_drawable *read = dri_drawable(driReadPriv); + struct st_context *old_st = st_get_current(); - GET_CURRENT_CONTEXT(oldGLCtx); - - if (oldGLCtx && oldGLCtx->st != ctx->st) - st_flush(oldGLCtx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + if (old_st && old_st != ctx->st) + st_flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL); ++ctx->bind_count; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index fd4bae5aea..15a2088df5 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -537,15 +537,14 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv) struct dri_drawable *draw = dri_drawable(dPriv); struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen; struct pipe_fence_handle *fence; - - GET_CURRENT_CONTEXT(glCtx); + struct st_context *st = st_get_current(); assert(__dri1_api_hooks != NULL); - if (!glCtx) + if (!st) return; /* For now */ - ctx = (struct dri_context *)glCtx->st->pipe->priv; + ctx = (struct dri_context *)st->pipe->priv; st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf); if (back_surf) { @@ -571,15 +570,14 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h) struct pipe_surface *back_surf; struct dri_drawable *draw = dri_drawable(dPriv); struct pipe_fence_handle *dummy_fence; - - GET_CURRENT_CONTEXT(glCtx); + struct st_context *st = st_get_current(); assert(__dri1_api_hooks != NULL); - if (!glCtx) + if (!st) return; - ctx = (struct dri_context *)glCtx->st->pipe->priv; + ctx = (struct dri_context *)st->pipe->priv; sub_bbox.x1 = x; sub_bbox.x2 = x + w; -- cgit v1.2.3 From 2c994ad3cb91288966bdc028b0afa9935a51a971 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 28 Apr 2009 14:43:41 +0200 Subject: gallium dri st: Propagate the drawable info when we bind to new drawables. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/dri_context.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 54d2a56356..45eaec4ed3 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -158,9 +158,14 @@ dri_make_current(__DRIcontextPrivate * cPriv, */ screen->dummyContext = ctx; - /* used in dri_flush_frontbuffer */ - ctx->dPriv = driDrawPriv; - ctx->rPriv = driReadPriv; + if (ctx->dPriv != driDrawPriv) { + ctx->dPriv = driDrawPriv; + ctx->d_stamp = driDrawPriv->lastStamp - 1; + } + if (ctx->rPriv != driReadPriv) { + ctx->rPriv = driReadPriv; + ctx->r_stamp = driReadPriv->lastStamp - 1; + } st_make_current(ctx->st, draw->stfb, read->stfb); -- cgit v1.2.3 From e0d5ff1a8a2237808d88f087f029224beee015af Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 27 Apr 2009 17:01:59 -0600 Subject: demos: asst. updates, clean-ups --- progs/tests/floattex.c | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/progs/tests/floattex.c b/progs/tests/floattex.c index dd99d836c6..ad14cacdcb 100644 --- a/progs/tests/floattex.c +++ b/progs/tests/floattex.c @@ -1,6 +1,5 @@ /* * Test floating point textures. - * No actual rendering, yet. */ @@ -103,7 +102,6 @@ Key(unsigned char key, int x, int y) } - static void InitTexture(void) { @@ -141,6 +139,8 @@ InitTexture(void) GL_RGB, GL_FLOAT, ftex); + CheckError(__LINE__); + /* sanity checks */ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t); assert(t == GL_FLOAT); @@ -152,32 +152,26 @@ InitTexture(void) assert(t == GL_FLOAT); free(image); - free(ftex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); -#if 0 - /* read back the texture and make sure values are correct */ - glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2); - CheckError(__LINE__); - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (tex[i][j][0] != tex2[i][j][0] || - tex[i][j][1] != tex2[i][j][1] || - tex[i][j][2] != tex2[i][j][2] || - tex[i][j][3] != tex2[i][j][3]) { - printf("tex[%d][%d] %g %g %g %g != tex2[%d][%d] %g %g %g %g\n", - i, j, - tex[i][j][0], tex[i][j][1], tex[i][j][2], tex[i][j][3], - i, j, - tex2[i][j][0], tex2[i][j][1], tex2[i][j][2], tex2[i][j][3]); + if (1) { + /* read back the texture and make sure values are correct */ + GLfloat *tex2 = (GLfloat *) + malloc(imgWidth * imgHeight * 4 * sizeof(GLfloat)); + glGetTexImage(GL_TEXTURE_2D, 0, imgFormat, GL_FLOAT, tex2); + CheckError(__LINE__); + for (i = 0; i < imgWidth * imgHeight * 4; i++) { + if (ftex[i] != tex2[i]) { + printf("tex[%d] %g != tex2[%d] %g\n", + i, ftex[i], i, tex2[i]); } } } -#endif + + free(ftex); } @@ -193,7 +187,9 @@ CreateProgram(void) assert(program); - // InitUniforms(program, Uniforms); + glUseProgram_func(program); + + InitUniforms(program, Uniforms); return program; } @@ -211,8 +207,9 @@ Init(void) exit(1); } - if (!glutExtensionSupported("GL_MESAX_texture_float")) { - printf("Sorry, this test requires GL_MESAX_texture_float\n"); + if (!glutExtensionSupported("GL_MESAX_texture_float") && + !glutExtensionSupported("GL_ARB_texture_float")) { + printf("Sorry, this test requires GL_MESAX/ARB_texture_float\n"); exit(1); } -- cgit v1.2.3 From dcf571aff9de1a4298c4d2c4148d84cdc4daf02e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 28 Apr 2009 09:05:19 -0600 Subject: swrast: add missing break in clamp_rect_coord_linear() See bug 21461. --- src/mesa/swrast/s_texfilter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index a483023a50..31bfb5c952 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -462,6 +462,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max, fcol -= 0.5F; i0 = IFLOOR(fcol); i1 = i0 + 1; + break; default: _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear"); i0 = i1 = 0; -- cgit v1.2.3 From 43d9020ff1e975e7f4f9480d9ef24f0b9fb2141f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 28 Apr 2009 09:58:44 -0600 Subject: i965: avoid segfault in intel_update_renderbuffers() if using DRI1 --- src/mesa/drivers/dri/intel/intel_context.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index eb224a8a41..a6d8729d8f 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -198,7 +198,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) struct intel_renderbuffer *rb; struct intel_region *region, *depth_region; struct intel_context *intel = context->driverPrivate; - __DRIbuffer *buffers; + __DRIbuffer *buffers = NULL; __DRIscreen *screen; int i, count; unsigned int attachments[10]; @@ -210,7 +210,8 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) screen = intel->intelScreen->driScrnPriv; - if ((screen->dri2.loader->base.version > 2) + if (screen->dri2.loader + && (screen->dri2.loader->base.version > 2) && (screen->dri2.loader->getBuffersWithFormat != NULL)) { struct intel_renderbuffer *depth_rb; struct intel_renderbuffer *stencil_rb; @@ -248,7 +249,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) attachments, i / 2, &count, drawable->loaderPrivate); - } else { + } else if (screen->dri2.loader) { i = 0; if (intel_fb->color_rb[0]) attachments[i++] = __DRI_BUFFER_FRONT_LEFT; -- cgit v1.2.3 From 09c91a1565fc99f20379a0f552651303ae8067c2 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 28 Apr 2009 12:37:29 -0400 Subject: R300: add quadpipe overrides RV410 SE chips only have 1 quadpipe. Also, handle other R300 chip with quadpipe override --- src/mesa/drivers/dri/radeon/radeon_screen.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 882853344b..791f59826b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -561,11 +561,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->chip_family = CHIP_FAMILY_RS300; break; - /* 9500 with 1 pipe verified by: Reid Linnemann */ + case PCI_CHIP_R300_AD: - screen->chip_family = CHIP_FAMILY_RV350; - screen->chip_flags = RADEON_CHIPSET_TCL; - break; case PCI_CHIP_R300_AE: case PCI_CHIP_R300_AF: case PCI_CHIP_R300_AG: @@ -893,6 +890,18 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } else { screen->num_gb_pipes = temp; } + + /* pipe overrides */ + switch (dri_priv->deviceID) { + case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann */ + case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */ + case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */ + screen->num_gb_pipes = 1; + break; + default: + break; + } + } if ( sPriv->drm_version.minor >= 10 ) { -- cgit v1.2.3 From 55db6ce537f1fd9acf205400202abfcc3908d6c3 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 28 Apr 2009 12:50:38 -0400 Subject: R300: add quadpipe overrides RV410 SE chips only have 1 quadpipe. Also, handle other R300 chip with quadpipe override. --- src/mesa/drivers/dri/radeon/radeon_screen.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 9ce950af17..70ae5d26e2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -476,11 +476,7 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id) screen->chip_family = CHIP_FAMILY_RS300; break; - /* 9500 with 1 pipe verified by: Reid Linnemann */ case PCI_CHIP_R300_AD: - screen->chip_family = CHIP_FAMILY_RV350; - screen->chip_flags = RADEON_CHIPSET_TCL; - break; case PCI_CHIP_R300_AE: case PCI_CHIP_R300_AF: case PCI_CHIP_R300_AG: @@ -942,6 +938,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } else { screen->num_gb_pipes = temp; } + + /* pipe overrides */ + switch (dri_priv->deviceID) { + case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann */ + case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */ + case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */ + screen->num_gb_pipes = 1; + break; + default: + break; + } } if ( sPriv->drm_version.minor >= 10 ) { @@ -1106,6 +1113,18 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv) } else { screen->num_gb_pipes = temp; } + + /* pipe overrides */ + switch (device_id) { + case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann */ + case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */ + case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */ + screen->num_gb_pipes = 1; + break; + default: + break; + } + } if (screen->chip_family <= CHIP_FAMILY_RS200) -- cgit v1.2.3 From 43e24a5928aaf6a00f7d9e55e92abfb1b3e20166 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 27 Apr 2009 20:24:55 +0100 Subject: wgl: Store current HDC/HGLRC in stw_context. Less TLS lookups. --- .../state_trackers/wgl/shared/stw_context.c | 66 ++++++++++++++-------- .../state_trackers/wgl/shared/stw_context.h | 1 + src/gallium/state_trackers/wgl/shared/stw_tls.h | 2 - 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index f3c7af93f5..0b5dd78ec6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -101,7 +101,7 @@ stw_create_layer_context( ctx = CALLOC_STRUCT( stw_context ); if (ctx == NULL) - return 0; + goto no_ctx; ctx->hdc = hdc; ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL ); @@ -125,7 +125,7 @@ stw_create_layer_context( pf->pfd.cAccumAlphaBits, pf->numSamples ); if (visual == NULL) - goto fail; + goto no_visual; screen = stw_dev->screen; @@ -137,7 +137,7 @@ stw_create_layer_context( pipe = stw_dev->stw_winsys->create_context( screen ); if (pipe == NULL) - goto fail; + goto no_pipe; #ifdef DEBUG /* Wrap context */ @@ -150,28 +150,29 @@ stw_create_layer_context( ctx->st = st_create_context( pipe, visual, NULL ); if (ctx->st == NULL) - goto fail; + goto no_st_ctx; ctx->st->ctx->DriverCtx = ctx; ctx->pfi = pf; pipe_mutex_lock( stw_dev->mutex ); - hglrc = handle_table_add(stw_dev->ctx_table, ctx); + ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); pipe_mutex_unlock( stw_dev->mutex ); - - /* Success? - */ - if (hglrc != 0) - return hglrc; - -fail: - if (visual) - _mesa_destroy_visual( visual ); - - if (pipe) - pipe->destroy( pipe ); - + if (!ctx->hglrc) + goto no_hglrc; + + return ctx->hglrc; + +no_hglrc: + st_destroy_context(ctx->st); + goto no_pipe; /* st_context_destroy already destroys pipe */ +no_st_ctx: + pipe->destroy( pipe ); +no_pipe: + _mesa_destroy_visual( visual ); +no_visual: FREE( ctx ); +no_ctx: return 0; } @@ -271,13 +272,35 @@ stw_get_window_size( HDC hdc, GLuint *width, GLuint *height ) UINT_PTR stw_get_current_context( void ) { - return stw_tls_get_data()->currentGLRC; + GET_CURRENT_CONTEXT( glcurctx ); + struct stw_context *ctx; + + if(!glcurctx) + return NULL; + + ctx = (struct stw_context *)glcurctx->DriverCtx; + assert(ctx); + if(!ctx) + return NULL; + + return ctx->hglrc; } HDC stw_get_current_dc( void ) { - return stw_tls_get_data()->currentDC; + GET_CURRENT_CONTEXT( glcurctx ); + struct stw_context *ctx; + + if(!glcurctx) + return NULL; + + ctx = (struct stw_context *)glcurctx->DriverCtx; + assert(ctx); + if(!ctx) + return NULL; + + return ctx->hdc; } BOOL @@ -299,9 +322,6 @@ stw_make_current( ctx = stw_lookup_context_locked( hglrc ); pipe_mutex_unlock( stw_dev->mutex ); - stw_tls_get_data()->currentDC = hdc; - stw_tls_get_data()->currentGLRC = hglrc; - if (glcurctx != NULL) { curctx = (struct stw_context *) glcurctx->DriverCtx; diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h index bc3b1dc880..e276737e85 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.h +++ b/src/gallium/state_trackers/wgl/shared/stw_context.h @@ -36,6 +36,7 @@ struct stw_pixelformat_info; struct stw_context { struct st_context *st; + UINT_PTR hglrc; HDC hdc; DWORD color_bits; const struct stw_pixelformat_info *pfi; diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h index f5a6bdf4b1..6cfb0899f2 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.h +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.h @@ -33,8 +33,6 @@ struct stw_tls_data { uint currentPixelFormat; - HDC currentDC; - UINT_PTR currentGLRC; HHOOK hCallWndProcHook; }; -- cgit v1.2.3 From afd16512bc354cf1a7220cb9bf3ce445503c7af4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Apr 2009 18:56:26 +0100 Subject: mesa/st: workaround for crashes in st_copy_texsubimage Proper fix for this hasn't been identified, but avoid crashing. --- src/mesa/state_tracker/st_cb_texture.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index aeb75117ec..b7b791d9a4 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -51,6 +51,7 @@ #include "state_tracker/st_texture.h" #include "state_tracker/st_gen_mipmap.h" #include "state_tracker/st_inlines.h" +#include "state_tracker/st_atom.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -1317,6 +1318,10 @@ st_copy_texsubimage(GLcontext *ctx, /* any rendering in progress must complete before we grab the fb image */ st_finish(ctx->st); + /* make sure finalize_textures has been called? + */ + if (0) st_validate_state(ctx->st); + /* determine if copying depth or color data */ if (texBaseFormat == GL_DEPTH_COMPONENT || texBaseFormat == GL_DEPTH24_STENCIL8) { @@ -1330,6 +1335,11 @@ st_copy_texsubimage(GLcontext *ctx, strb = st_renderbuffer(fb->_ColorReadBuffer); } + if (!strb || !strb->surface || !stImage->pt) { + debug_printf("%s: null strb or stImage\n", __FUNCTION__); + return; + } + assert(strb); assert(strb->surface); assert(stImage->pt); -- cgit v1.2.3 From b91e5f8e197793feac016242140bf489bd16071c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Apr 2009 19:36:42 +0100 Subject: util/indices: remove debug prints --- src/gallium/auxiliary/indices/u_unfilled_gen.c | 160 ------------------------ src/gallium/auxiliary/indices/u_unfilled_gen.py | 1 - 2 files changed, 161 deletions(-) diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.c b/src/gallium/auxiliary/indices/u_unfilled_gen.c index fd082ebbb3..93897c98de 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_gen.c +++ b/src/gallium/auxiliary/indices/u_unfilled_gen.c @@ -71,13 +71,10 @@ static void generate_tris_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (ushort)(i); (out+j)[1] = (ushort)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)(i+1); (out+j+2)[1] = (ushort)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (ushort)(i+2); (out+j+4)[1] = (ushort)(i); } @@ -90,13 +87,10 @@ static void generate_tristrip_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (ushort)(i); (out+j)[1] = (ushort)(i+1/*+(i&1)*/); - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (ushort)(i+1/*+(i&1)*/); (out+j+2)[1] = (ushort)(i+2/*-(i&1)*/); - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (ushort)(i+2/*-(i&1)*/); (out+j+4)[1] = (ushort)(i); } @@ -109,13 +103,10 @@ static void generate_trifan_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)(0); (out+j)[1] = (ushort)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)(i+1); (out+j+2)[1] = (ushort)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)(i+2); (out+j+4)[1] = (ushort)(0); } @@ -128,16 +119,12 @@ static void generate_quads_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (ushort)(i+0); (out+j)[1] = (ushort)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)(i+1); (out+j+2)[1] = (ushort)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (ushort)(i+2); (out+j+4)[1] = (ushort)(i+3); - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (ushort)(i+3); (out+j+6)[1] = (ushort)(i+0); } @@ -150,16 +137,12 @@ static void generate_quadstrip_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (ushort)(i+2); (out+j)[1] = (ushort)(i+0); - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (ushort)(i+0); (out+j+2)[1] = (ushort)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (ushort)(i+1); (out+j+4)[1] = (ushort)(i+3); - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (ushort)(i+3); (out+j+6)[1] = (ushort)(i+2); } @@ -172,13 +155,10 @@ static void generate_polygon_ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)(0); (out+j)[1] = (ushort)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)(i+1); (out+j+2)[1] = (ushort)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)(i+2); (out+j+4)[1] = (ushort)(0); } @@ -191,13 +171,10 @@ static void generate_tris_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (uint)(i); (out+j)[1] = (uint)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)(i+1); (out+j+2)[1] = (uint)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (uint)(i+2); (out+j+4)[1] = (uint)(i); } @@ -210,13 +187,10 @@ static void generate_tristrip_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (uint)(i); (out+j)[1] = (uint)(i+1/*+(i&1)*/); - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (uint)(i+1/*+(i&1)*/); (out+j+2)[1] = (uint)(i+2/*-(i&1)*/); - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (uint)(i+2/*-(i&1)*/); (out+j+4)[1] = (uint)(i); } @@ -229,13 +203,10 @@ static void generate_trifan_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)(0); (out+j)[1] = (uint)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)(i+1); (out+j+2)[1] = (uint)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)(i+2); (out+j+4)[1] = (uint)(0); } @@ -248,16 +219,12 @@ static void generate_quads_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (uint)(i+0); (out+j)[1] = (uint)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)(i+1); (out+j+2)[1] = (uint)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (uint)(i+2); (out+j+4)[1] = (uint)(i+3); - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (uint)(i+3); (out+j+6)[1] = (uint)(i+0); } @@ -270,16 +237,12 @@ static void generate_quadstrip_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (uint)(i+2); (out+j)[1] = (uint)(i+0); - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (uint)(i+0); (out+j+2)[1] = (uint)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (uint)(i+1); (out+j+4)[1] = (uint)(i+3); - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (uint)(i+3); (out+j+6)[1] = (uint)(i+2); } @@ -292,13 +255,10 @@ static void generate_polygon_uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)(0); (out+j)[1] = (uint)(i+1); - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)(i+1); (out+j+2)[1] = (uint)(i+2); - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)(i+2); (out+j+4)[1] = (uint)(0); } @@ -313,13 +273,10 @@ static void translate_tris_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i]; } @@ -334,13 +291,10 @@ static void translate_tristrip_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (ushort)in[i]; } @@ -355,13 +309,10 @@ static void translate_trifan_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -376,16 +327,12 @@ static void translate_quads_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (ushort)in[i+0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+0]; } @@ -400,16 +347,12 @@ static void translate_quadstrip_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (ushort)in[i+2]; (out+j)[1] = (ushort)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (ushort)in[i+0]; (out+j+2)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (ushort)in[i+1]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+2]; } @@ -424,13 +367,10 @@ static void translate_polygon_ubyte2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -445,13 +385,10 @@ static void translate_tris_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i]; } @@ -466,13 +403,10 @@ static void translate_tristrip_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (uint)in[i]; } @@ -487,13 +421,10 @@ static void translate_trifan_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } @@ -508,16 +439,12 @@ static void translate_quads_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (uint)in[i+0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+0]; } @@ -532,16 +459,12 @@ static void translate_quadstrip_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (uint)in[i+2]; (out+j)[1] = (uint)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (uint)in[i+0]; (out+j+2)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (uint)in[i+1]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+2]; } @@ -556,13 +479,10 @@ static void translate_polygon_ubyte2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } @@ -577,13 +497,10 @@ static void translate_tris_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i]; } @@ -598,13 +515,10 @@ static void translate_tristrip_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (ushort)in[i]; } @@ -619,13 +533,10 @@ static void translate_trifan_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -640,16 +551,12 @@ static void translate_quads_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (ushort)in[i+0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+0]; } @@ -664,16 +571,12 @@ static void translate_quadstrip_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (ushort)in[i+2]; (out+j)[1] = (ushort)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (ushort)in[i+0]; (out+j+2)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (ushort)in[i+1]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+2]; } @@ -688,13 +591,10 @@ static void translate_polygon_ushort2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -709,13 +609,10 @@ static void translate_tris_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i]; } @@ -730,13 +627,10 @@ static void translate_tristrip_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (uint)in[i]; } @@ -751,13 +645,10 @@ static void translate_trifan_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } @@ -772,16 +663,12 @@ static void translate_quads_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (uint)in[i+0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+0]; } @@ -796,16 +683,12 @@ static void translate_quadstrip_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (uint)in[i+2]; (out+j)[1] = (uint)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (uint)in[i+0]; (out+j+2)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (uint)in[i+1]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+2]; } @@ -820,13 +703,10 @@ static void translate_polygon_ushort2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } @@ -841,13 +721,10 @@ static void translate_tris_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i]; } @@ -862,13 +739,10 @@ static void translate_tristrip_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (ushort)in[i]; (out+j)[1] = (ushort)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (ushort)in[i]; } @@ -883,13 +757,10 @@ static void translate_trifan_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -904,16 +775,12 @@ static void translate_quads_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (ushort)in[i+0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+0]; } @@ -928,16 +795,12 @@ static void translate_quadstrip_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (ushort)in[i+2]; (out+j)[1] = (ushort)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (ushort)in[i+0]; (out+j+2)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (ushort)in[i+1]; (out+j+4)[1] = (ushort)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (ushort)in[i+3]; (out+j+6)[1] = (ushort)in[i+2]; } @@ -952,13 +815,10 @@ static void translate_polygon_uint2ushort( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (ushort)in[0]; (out+j)[1] = (ushort)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (ushort)in[i+1]; (out+j+2)[1] = (ushort)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (ushort)in[i+2]; (out+j+4)[1] = (ushort)in[0]; } @@ -973,13 +833,10 @@ static void translate_tris_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i+=3) { - debug_printf(" line %d %d\n", (int)i, (int)i+1); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i]; } @@ -994,13 +851,10 @@ static void translate_tristrip_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/); (out+j)[0] = (uint)in[i]; (out+j)[1] = (uint)in[i+1/*+(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/); (out+j+2)[0] = (uint)in[i+1/*+(i&1)*/]; (out+j+2)[1] = (uint)in[i+2/*-(i&1)*/]; - debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i); (out+j+4)[0] = (uint)in[i+2/*-(i&1)*/]; (out+j+4)[1] = (uint)in[i]; } @@ -1015,13 +869,10 @@ static void translate_trifan_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } @@ -1036,16 +887,12 @@ static void translate_quads_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=4) { - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j)[0] = (uint)in[i+0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)i+3); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+0); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+0]; } @@ -1060,16 +907,12 @@ static void translate_quadstrip_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=8, i+=2) { - debug_printf(" line %d %d\n", (int)i+2, (int)i+0); (out+j)[0] = (uint)in[i+2]; (out+j)[1] = (uint)in[i+0]; - debug_printf(" line %d %d\n", (int)i+0, (int)i+1); (out+j+2)[0] = (uint)in[i+0]; (out+j+2)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+3); (out+j+4)[0] = (uint)in[i+1]; (out+j+4)[1] = (uint)in[i+3]; - debug_printf(" line %d %d\n", (int)i+3, (int)i+2); (out+j+6)[0] = (uint)in[i+3]; (out+j+6)[1] = (uint)in[i+2]; } @@ -1084,13 +927,10 @@ static void translate_polygon_uint2uint( unsigned i, j; (void)j; for (j = i = 0; j < nr; j+=6, i++) { - debug_printf(" line %d %d\n", (int)0, (int)i+1); (out+j)[0] = (uint)in[0]; (out+j)[1] = (uint)in[i+1]; - debug_printf(" line %d %d\n", (int)i+1, (int)i+2); (out+j+2)[0] = (uint)in[i+1]; (out+j+2)[1] = (uint)in[i+2]; - debug_printf(" line %d %d\n", (int)i+2, (int)0); (out+j+4)[0] = (uint)in[i+2]; (out+j+4)[1] = (uint)in[0]; } diff --git a/src/gallium/auxiliary/indices/u_unfilled_gen.py b/src/gallium/auxiliary/indices/u_unfilled_gen.py index d0344fe313..36896ce605 100644 --- a/src/gallium/auxiliary/indices/u_unfilled_gen.py +++ b/src/gallium/auxiliary/indices/u_unfilled_gen.py @@ -99,7 +99,6 @@ def vert( intype, outtype, v0 ): return '(' + outtype + ')in[' + v0 + ']' def line( intype, outtype, ptr, v0, v1 ): - print ' debug_printf(" line %d %d\\n", (int)' + v0 + ', (int)' + v1 + ');' print ' (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';' print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';' -- cgit v1.2.3 From fd402791f909371d8f1c1381f0e16a0f08bd78e6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Apr 2009 11:49:55 +0100 Subject: progs: add fflushes for cygwin --- progs/demos/dinoshade.c | 2 ++ progs/redbook/polyoff.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/progs/demos/dinoshade.c b/progs/demos/dinoshade.c index 451da2ec89..41b19d5a92 100644 --- a/progs/demos/dinoshade.c +++ b/progs/demos/dinoshade.c @@ -624,6 +624,7 @@ redraw(void) glFinish(); end = glutGet(GLUT_ELAPSED_TIME); printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start); + fflush(stdout); } glutSwapBuffers(); @@ -878,6 +879,7 @@ main(int argc, char **argv) polygonOffsetVersion = MISSING; printf("\ndinoshine: Missing polygon offset.\n"); printf(" Expect shadow depth aliasing artifacts.\n\n"); + fflush(stdout); } } diff --git a/progs/redbook/polyoff.c b/progs/redbook/polyoff.c index 2017b4d8ee..de34b2e767 100644 --- a/progs/redbook/polyoff.c +++ b/progs/redbook/polyoff.c @@ -153,6 +153,7 @@ static void Benchmark( float xdiff, float ydiff ) double seconds, fps; printf("Benchmarking...\n"); + fflush(stdout); draws = 0; startTime = glutGet(GLUT_ELAPSED_TIME); @@ -169,6 +170,7 @@ static void Benchmark( float xdiff, float ydiff ) seconds = (double) (endTime - startTime) / 1000.0; fps = draws / seconds; printf("Result: fps: %g\n", fps); + fflush(stdout); } @@ -263,6 +265,7 @@ void keyboard (unsigned char key, int x, int y) default: break; } + fflush(stdout); } static void -- cgit v1.2.3 From afc0c59dbd7f89d914763fd78701461f22c00450 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Apr 2009 15:33:44 +0100 Subject: mesa/st: translate VERT_ATTRIB_GENERIC8..15 in st_translate_vertex_program It seems quake4 can hit these attributes sometimes. --- src/mesa/state_tracker/st_program.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 2795570cf1..6ec633c0b4 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -169,6 +169,14 @@ st_translate_vertex_program(struct st_context *st, case VERT_ATTRIB_GENERIC5: case VERT_ATTRIB_GENERIC6: case VERT_ATTRIB_GENERIC7: + case VERT_ATTRIB_GENERIC8: + case VERT_ATTRIB_GENERIC9: + case VERT_ATTRIB_GENERIC10: + case VERT_ATTRIB_GENERIC11: + case VERT_ATTRIB_GENERIC12: + case VERT_ATTRIB_GENERIC13: + case VERT_ATTRIB_GENERIC14: + case VERT_ATTRIB_GENERIC15: assert(attr < VERT_ATTRIB_MAX); vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; vs_input_semantic_index[slot] = num_generic++; -- cgit v1.2.3 From eb979cef8535914f428d2462e78f713da558fc18 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Apr 2009 14:50:05 +0100 Subject: gallium/draw: add ability to print out active pipeline stages --- src/gallium/auxiliary/draw/draw_pipe.h | 1 + src/gallium/auxiliary/draw/draw_pipe_aaline.c | 1 + src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 1 + src/gallium/auxiliary/draw/draw_pipe_clip.c | 1 + src/gallium/auxiliary/draw/draw_pipe_cull.c | 1 + src/gallium/auxiliary/draw/draw_pipe_flatshade.c | 1 + src/gallium/auxiliary/draw/draw_pipe_offset.c | 1 + src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 1 + src/gallium/auxiliary/draw/draw_pipe_stipple.c | 1 + src/gallium/auxiliary/draw/draw_pipe_twoside.c | 1 + src/gallium/auxiliary/draw/draw_pipe_unfilled.c | 1 + src/gallium/auxiliary/draw/draw_pipe_validate.c | 11 ++++++++++- src/gallium/auxiliary/draw/draw_pipe_vbuf.c | 1 + src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 1 + src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 1 + 15 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe.h b/src/gallium/auxiliary/draw/draw_pipe.h index dbad8f98ac..479250729f 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.h +++ b/src/gallium/auxiliary/draw/draw_pipe.h @@ -57,6 +57,7 @@ struct draw_stage struct draw_context *draw; /**< parent context */ struct draw_stage *next; /**< next stage in pipeline */ + const char *name; /**< for debugging */ struct vertex_header **tmp; /**< temp vert storage, such as for clipping */ unsigned nr_tmps; diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index ca69f0b95e..9fedeef2d3 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -746,6 +746,7 @@ draw_aaline_stage(struct draw_context *draw) goto fail; aaline->stage.draw = draw; + aaline->stage.name = "aaline"; aaline->stage.next = NULL; aaline->stage.point = draw_pipe_passthrough_point; aaline->stage.line = aaline_first_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 3133abe5dc..66839f7873 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -757,6 +757,7 @@ draw_aapoint_stage(struct draw_context *draw) goto fail; aapoint->stage.draw = draw; + aapoint->stage.name = "aapoint"; aapoint->stage.next = NULL; aapoint->stage.point = aapoint_first_point; aapoint->stage.line = draw_pipe_passthrough_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 3265dcd154..0670268a19 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -496,6 +496,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw ) goto fail; clipper->stage.draw = draw; + clipper->stage.name = "clipper"; clipper->stage.point = clip_point; clipper->stage.line = clip_first_line; clipper->stage.tri = clip_first_tri; diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c index 053be5f050..0a70483858 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_cull.c +++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c @@ -129,6 +129,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw ) goto fail; cull->stage.draw = draw; + cull->stage.name = "cull"; cull->stage.next = NULL; cull->stage.point = draw_pipe_passthrough_point; cull->stage.line = draw_pipe_passthrough_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c index 43d1fecc4d..34afb1a0b6 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_flatshade.c +++ b/src/gallium/auxiliary/draw/draw_pipe_flatshade.c @@ -261,6 +261,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw ) goto fail; flatshade->stage.draw = draw; + flatshade->stage.name = "flatshade"; flatshade->stage.next = NULL; flatshade->stage.point = draw_pipe_passthrough_point; flatshade->stage.line = flatshade_first_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c index 62c31532d0..40798a5d6e 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_offset.c +++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c @@ -166,6 +166,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw ) draw_alloc_temp_verts( &offset->stage, 3 ); offset->stage.draw = draw; + offset->stage.name = "offset"; offset->stage.next = NULL; offset->stage.point = draw_pipe_passthrough_point; offset->stage.line = draw_pipe_passthrough_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 04e59152c5..9287fc130e 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -586,6 +586,7 @@ draw_pstip_stage(struct draw_context *draw) draw_alloc_temp_verts( &pstip->stage, 8 ); pstip->stage.draw = draw; + pstip->stage.name = "pstip"; pstip->stage.next = NULL; pstip->stage.point = draw_pipe_passthrough_point; pstip->stage.line = draw_pipe_passthrough_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_stipple.c b/src/gallium/auxiliary/draw/draw_pipe_stipple.c index b65e2aa102..6e921bac27 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_stipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_stipple.c @@ -238,6 +238,7 @@ struct draw_stage *draw_stipple_stage( struct draw_context *draw ) draw_alloc_temp_verts( &stipple->stage, 2 ); stipple->stage.draw = draw; + stipple->stage.name = "stipple"; stipple->stage.next = NULL; stipple->stage.point = stipple_reset_point; stipple->stage.line = stipple_first_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_twoside.c b/src/gallium/auxiliary/draw/draw_pipe_twoside.c index c329d92339..eef0238b15 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_twoside.c +++ b/src/gallium/auxiliary/draw/draw_pipe_twoside.c @@ -181,6 +181,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw ) goto fail; twoside->stage.draw = draw; + twoside->stage.name = "twoside"; twoside->stage.next = NULL; twoside->stage.point = draw_pipe_passthrough_point; twoside->stage.line = draw_pipe_passthrough_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c index 68835fd1a5..03bb842e20 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_unfilled.c +++ b/src/gallium/auxiliary/draw/draw_pipe_unfilled.c @@ -184,6 +184,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw ) goto fail; unfilled->stage.draw = draw; + unfilled->stage.name = "unfilled"; unfilled->stage.next = NULL; unfilled->stage.tmp = NULL; unfilled->stage.point = draw_pipe_passthrough_point; diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 03e842ce08..bea90e50d3 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -262,7 +262,15 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) draw->pipeline.first = next; - return next; + + if (0) { + debug_printf("draw pipeline:\n"); + for (next = draw->pipeline.first; next ; next = next->next ) + debug_printf(" %s\n", next->name); + debug_printf("\n"); + } + + return draw->pipeline.first; } static void validate_tri( struct draw_stage *stage, @@ -318,6 +326,7 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw ) return NULL; stage->draw = draw; + stage->name = "validate"; stage->next = NULL; stage->point = validate_point; stage->line = validate_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index 12325d30d6..a5d840b96e 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c +++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c @@ -446,6 +446,7 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw, goto fail; vbuf->stage.draw = draw; + vbuf->stage.name = "vbuf"; vbuf->stage.point = vbuf_first_point; vbuf->stage.line = vbuf_first_line; vbuf->stage.tri = vbuf_first_tri; diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c index 184e363594..f32cbef983 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_line.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_line.c @@ -168,6 +168,7 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw ) draw_alloc_temp_verts( &wide->stage, 4 ); wide->stage.draw = draw; + wide->stage.name = "wide-line"; wide->stage.next = NULL; wide->stage.point = draw_pipe_passthrough_point; wide->stage.line = wideline_line; diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index e1af9e56a2..49034ae86a 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -279,6 +279,7 @@ struct draw_stage *draw_wide_point_stage( struct draw_context *draw ) goto fail; wide->stage.draw = draw; + wide->stage.name = "wide-point"; wide->stage.next = NULL; wide->stage.point = widepoint_first_point; wide->stage.line = draw_pipe_passthrough_line; -- cgit v1.2.3 From 106f2b031cbb83a54fa2949cb07357ecea68b92a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Apr 2009 14:51:11 +0100 Subject: mesa/st: remove duplicate offset calculation --- src/mesa/state_tracker/st_atom_rasterizer.c | 17 +---------------- src/mesa/state_tracker/st_context.h | 2 -- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 61687fbc3e..4e70510c0c 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -180,22 +180,7 @@ static void update_raster_state( struct st_context *st ) if (ctx->Polygon.StippleFlag) raster->poly_stipple_enable = 1; - - - /* _NEW_BUFFERS, _NEW_POLYGON - */ - if (raster->fill_cw != PIPE_POLYGON_MODE_FILL || - raster->fill_ccw != PIPE_POLYGON_MODE_FILL) - { - GLfloat mrd = (ctx->DrawBuffer ? - ctx->DrawBuffer->_MRD : - 1.0f); - - raster->offset_units = ctx->Polygon.OffsetFactor * mrd; - raster->offset_scale = (ctx->Polygon.OffsetUnits * mrd * - st->polygon_offset_scale); - } - + /* _NEW_POINT */ raster->point_size = ctx->Point.Size; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index f840579a40..6ffed56d9a 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -120,8 +120,6 @@ struct st_context GLboolean missing_textures; - GLfloat polygon_offset_scale; /* ?? */ - /** Mapping from VERT_RESULT_x to post-transformed vertex slot */ const GLuint *vertex_result_to_slot; -- cgit v1.2.3 From c0bff53334194f9d1aada23510123f1591d5512e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Apr 2009 17:49:50 +0100 Subject: mesa/main: protect driver.finish with FLUSH_CURRENT Already doing this for driver.flush() --- src/mesa/main/context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4469c8e1fa..016284de9a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1497,6 +1497,7 @@ _mesa_Finish(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Finish) { ctx->Driver.Finish(ctx); } -- cgit v1.2.3 From 801a33ae44355b89cebed47e9e48e39545522f6e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Apr 2009 17:50:19 +0100 Subject: mesa/st: protect internal flushes with FLUSH_CURRENT Already doing this for driver.flush() --- src/mesa/state_tracker/st_cb_flush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 7d7d3823c9..fbaffd154f 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -82,7 +82,7 @@ display_front_buffer(struct st_context *st) void st_flush( struct st_context *st, uint pipeFlushFlags, struct pipe_fence_handle **fence ) { - FLUSH_VERTICES(st->ctx, 0); + FLUSH_CURRENT(st->ctx, 0); /* Release any vertex buffers that might potentially be accessed in * successive frames: -- cgit v1.2.3 From 46ddcbc1a9e70d5dba257e6421eb69ed942dd1da Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 28 Apr 2009 14:29:27 -0600 Subject: softpipe: return PIPE_UNREFERENCED in softpipe_is_buffer/texture_referenced() This allows the engine demo to run again (avoid crash in VBO code). This stuff still needs to be revisited someday though... --- src/gallium/drivers/softpipe/sp_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 11aff81479..62e8d99cfd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return PIPE_UNREFERENCED; } static unsigned int softpipe_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return PIPE_UNREFERENCED; } struct pipe_context * -- cgit v1.2.3 From 0e85dcb66b990a63d60032816798ff693f9248e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 29 Apr 2009 11:52:06 -0600 Subject: mesa: added _mesa_check_soa_dependencies() function This function will check an instruction to see if there's data dependencies between the dst and src registers if executed in an SOA manner. --- src/mesa/shader/prog_instruction.c | 50 ++++++++++++++++++++++++++++++++++++++ src/mesa/shader/prog_instruction.h | 3 +++ 2 files changed, 53 insertions(+) diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index ca7565c091..ae3a003fee 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -285,6 +285,56 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode) } +/** + * Check if there's a potential src/dst register data dependency when + * using SOA execution. + * Example: + * MOV T, T.yxwz; + * This would expand into: + * MOV t0, t1; + * MOV t1, t0; + * MOV t2, t3; + * MOV t3, t2; + * The second instruction will have the wrong value for t0 if executed as-is. + */ +GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst) +{ + GLuint i, chan; + + if (inst->DstReg.WriteMask == WRITEMASK_X || + inst->DstReg.WriteMask == WRITEMASK_Y || + inst->DstReg.WriteMask == WRITEMASK_Z || + inst->DstReg.WriteMask == WRITEMASK_W || + inst->DstReg.WriteMask == 0x0) { + /* no chance of data dependency */ + return GL_FALSE; + } + + /* loop over src regs */ + for (i = 0; i < 3; i++) { + if (inst->SrcReg[i].File == inst->DstReg.File && + inst->SrcReg[i].Index == inst->DstReg.Index) { + /* loop over dest channels */ + GLuint channelsWritten = 0x0; + for (chan = 0; chan < 4; chan++) { + if (inst->DstReg.WriteMask & (1 << chan)) { + /* check if we're reading a channel that's been written */ + GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan); + if (swizzle <= SWIZZLE_W && + (channelsWritten & (1 << swizzle))) { + return GL_TRUE; + } + + channelsWritten |= (1 << chan); + } + } + } + } + return GL_FALSE; +} + + /** * Return string name for given program opcode. */ diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 3109f6cbae..40ad998f79 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -428,6 +428,9 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode); extern GLboolean _mesa_is_tex_instruction(gl_inst_opcode opcode); +extern GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst); + extern const char * _mesa_opcode_string(gl_inst_opcode opcode); -- cgit v1.2.3 From 8fa6c1ac9299402c1faf75b264cf70b1b83d1eff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 29 Apr 2009 11:56:57 -0600 Subject: tgsi: added tgsi_check_soa_dependencies() and related debug code (disabled) The TGSI interpeter operates in SOA style. We need to check for data dependencies in instructions which read from and write to the same register. For now just adding some debug code to detect that condition. Actual fixes to follow. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index e8bd7cda3b..aba7a3f937 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -53,6 +53,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_state.h" #include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" #include "tgsi_exec.h" @@ -169,6 +170,56 @@ print_temp(const struct tgsi_exec_machine *mach, uint index) #endif +/** + * Check if there's a potential src/dst register data dependency when + * using SOA execution. + * Example: + * MOV T, T.yxwz; + * This would expand into: + * MOV t0, t1; + * MOV t1, t0; + * MOV t2, t3; + * MOV t3, t2; + * The second instruction will have the wrong value for t0 if executed as-is. + */ +static boolean +tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) +{ + uint i, chan; + + uint writemask = inst->FullDstRegisters[0].DstRegister.WriteMask; + if (writemask == TGSI_WRITEMASK_X || + writemask == TGSI_WRITEMASK_Y || + writemask == TGSI_WRITEMASK_Z || + writemask == TGSI_WRITEMASK_W || + writemask == TGSI_WRITEMASK_NONE) { + /* no chance of data dependency */ + return FALSE; + } + + /* loop over src regs */ + for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { + if ((inst->FullSrcRegisters[i].SrcRegister.File == + inst->FullDstRegisters[0].DstRegister.File) && + (inst->FullSrcRegisters[i].SrcRegister.Index == + inst->FullDstRegisters[0].DstRegister.Index)) { + /* loop over dest channels */ + uint channelsWritten = 0x0; + FOR_EACH_ENABLED_CHANNEL(*inst, chan) { + /* check if we're reading a channel that's been written */ + uint swizzle = tgsi_util_get_full_src_register_extswizzle(&inst->FullSrcRegisters[i], chan); + if (swizzle <= TGSI_SWIZZLE_W && + (channelsWritten & (1 << swizzle))) { + return TRUE; + } + + channelsWritten |= (1 << chan); + } + } + } + return FALSE; +} + /** * Initialize machine state by expanding tokens to full instructions, @@ -280,6 +331,17 @@ tgsi_exec_machine_bind_shader( memcpy(instructions + numInstructions, &parse.FullToken.FullInstruction, sizeof(instructions[0])); + +#if 0 + if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) { + debug_printf("SOA dependency in instruction:\n"); + tgsi_dump_instruction(&parse.FullToken.FullInstruction, + numInstructions); + } +#else + (void) tgsi_check_soa_dependencies; +#endif + numInstructions++; break; -- cgit v1.2.3 From dca190e9432d4ed122bdd534922d0c3d85791c6a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 29 Apr 2009 11:52:06 -0600 Subject: mesa: added _mesa_check_soa_dependencies() function This function will check an instruction to see if there's data dependencies between the dst and src registers if executed in an SOA manner. --- src/mesa/shader/prog_instruction.c | 50 ++++++++++++++++++++++++++++++++++++++ src/mesa/shader/prog_instruction.h | 3 +++ 2 files changed, 53 insertions(+) diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index ca7565c091..ae3a003fee 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -285,6 +285,56 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode) } +/** + * Check if there's a potential src/dst register data dependency when + * using SOA execution. + * Example: + * MOV T, T.yxwz; + * This would expand into: + * MOV t0, t1; + * MOV t1, t0; + * MOV t2, t3; + * MOV t3, t2; + * The second instruction will have the wrong value for t0 if executed as-is. + */ +GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst) +{ + GLuint i, chan; + + if (inst->DstReg.WriteMask == WRITEMASK_X || + inst->DstReg.WriteMask == WRITEMASK_Y || + inst->DstReg.WriteMask == WRITEMASK_Z || + inst->DstReg.WriteMask == WRITEMASK_W || + inst->DstReg.WriteMask == 0x0) { + /* no chance of data dependency */ + return GL_FALSE; + } + + /* loop over src regs */ + for (i = 0; i < 3; i++) { + if (inst->SrcReg[i].File == inst->DstReg.File && + inst->SrcReg[i].Index == inst->DstReg.Index) { + /* loop over dest channels */ + GLuint channelsWritten = 0x0; + for (chan = 0; chan < 4; chan++) { + if (inst->DstReg.WriteMask & (1 << chan)) { + /* check if we're reading a channel that's been written */ + GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan); + if (swizzle <= SWIZZLE_W && + (channelsWritten & (1 << swizzle))) { + return GL_TRUE; + } + + channelsWritten |= (1 << chan); + } + } + } + } + return GL_FALSE; +} + + /** * Return string name for given program opcode. */ diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 3109f6cbae..40ad998f79 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -428,6 +428,9 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode); extern GLboolean _mesa_is_tex_instruction(gl_inst_opcode opcode); +extern GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst); + extern const char * _mesa_opcode_string(gl_inst_opcode opcode); -- cgit v1.2.3 From 356f311c4a3ee91a4afe33d210dd4c5fdc897ea3 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 29 Apr 2009 06:49:27 -0700 Subject: autoconf: Clean up some m4 usage m4_fatal is equivalent to m4_errprint + m4_exit. --- configure.ac | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 7b07f0fa7c..154f6e6352 100644 --- a/configure.ac +++ b/configure.ac @@ -5,12 +5,8 @@ AC_PREREQ([2.59]) dnl Versioning - scrape the version from configs/default m4_define([mesa_version], [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])]) -m4_ifval(mesa_version,[],[ - m4_errprint([Error: Failed to get the Mesa version from the output of - running `make -f bin/version.mk version' -]) - m4_exit([1]) -]) +m4_ifval(mesa_version,, + [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])]) dnl Tell the user about autoconf.html in the --help output m4_divert_once([HELP_END], [ @@ -58,15 +54,11 @@ fi AC_SUBST([MKDEP_OPTIONS]) dnl Make sure the pkg-config macros are defined -m4_ifdef([PKG_PROG_PKG_CONFIG],[],[ - m4_errprint([Error: Could not locate the pkg-config autoconf macros. - These are usually located in /usr/share/aclocal/pkg.m4. If your - macros are in a different location, try setting the environment - variable ACLOCAL="aclocal -I/other/macro/dir" before running - autoreconf. -]) - m4_exit([1]) -]) +m4_ifndef([PKG_PROG_PKG_CONFIG], + [m4_fatal([Could not locate the pkg-config autoconf macros. + These are usually located in /usr/share/aclocal/pkg.m4. If your macros + are in a different location, try setting the environment variable + ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) PKG_PROG_PKG_CONFIG() dnl LIB_DIR - library basename -- cgit v1.2.3 From 66f978625685d83b04c32b19b62c3cb8c0d25f74 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 29 Apr 2009 12:11:43 -0700 Subject: autoconf: Add switch for optional EGL EGL doesn't build on all platforms, so allow people to opt out. --- configure.ac | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 154f6e6352..8110e0f869 100644 --- a/configure.ac +++ b/configure.ac @@ -403,7 +403,7 @@ esac dnl dnl Driver specific build directories dnl -SRC_DIRS="mesa egl glew" +SRC_DIRS="mesa glew" GLU_DIRS="sgi" WINDOW_SYSTEM="" GALLIUM_DIRS="auxiliary drivers state_trackers" @@ -857,14 +857,23 @@ AC_SUBST([OSMESA_PC_LIB_PRIV]) dnl dnl EGL configuration dnl -if test "$x11_pkgconfig" = yes; then - PKG_CHECK_MODULES([EGL],[x11]) - EGL_LIB_DEPS="$EGL_LIBS" -else - # should check these... - EGL_LIB_DEPS="$X_LIBS -lX11" +AC_ARG_ENABLE([egl], + [AS_HELP_STRING([--disable-egl], + [disable EGL library @<:@default=enabled@:>@])], + [enable_egl="$enableval"], + [enable_egl=yes]) +if test "x$enable_egl" = xyes; then + SRC_DIRS="$SRC_DIRS egl" + + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([EGL], [x11]) + EGL_LIB_DEPS="$EGL_LIBS" + else + # should check these... + EGL_LIB_DEPS="$X_LIBS -lX11" + fi + EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" fi -EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" AC_SUBST([EGL_LIB_DEPS]) dnl @@ -1108,7 +1117,7 @@ yes) GALLIUM_STATE_TRACKERS_DIRS=glx ;; dri) - GALLIUM_STATE_TRACKERS_DIRS=egl + test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl ;; esac ;; @@ -1118,6 +1127,10 @@ yes) for tracker in $state_trackers; do test -d "$srcdir/src/gallium/state_trackers/$tracker" || \ AC_MSG_ERROR([state tracker '$tracker' doesn't exist]) + + if test "$tracker" = egl && test "x$enable_egl" != xyes; then + AC_MSG_ERROR([cannot build egl state tracker without EGL library]) + fi done GALLIUM_STATE_TRACKERS_DIRS="$state_trackers" ;; @@ -1233,6 +1246,7 @@ dnl Libraries echo "" echo " Shared libs: $enable_shared" echo " Static libs: $enable_static" +echo " EGL: $enable_egl" echo " GLU: $enable_glu" echo " GLw: $enable_glw (Motif: $enable_motif)" echo " glut: $enable_glut" -- cgit v1.2.3 From a9c97c5f2a9b880d01336a23134600e4b34429d0 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Wed, 29 Apr 2009 10:32:46 -0600 Subject: Use variable library name in pkg-config output. Previously the pkg-config output files would contain e.g. `-lGL' and `-lGLU', even if the user modified their configuration to build libraries with different names. This modifies the pkg-config inputs, and corresponding makery, so that modifying the output library name will cause the appropriate updated name to appear in the pkg-config `-l' option. Signed-off-by: Dan Nicholson --- src/glu/Makefile | 3 ++- src/glu/glu.pc.in | 2 +- src/glut/glx/Makefile | 3 ++- src/glut/glx/glut.pc.in | 2 +- src/glut/mini/Makefile | 3 ++- src/glut/mini/glut.pc.in | 2 +- src/glw/Makefile | 3 ++- src/glw/glw.pc.in | 2 +- src/mesa/Makefile | 3 ++- src/mesa/gl.pc.in | 2 +- 10 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/glu/Makefile b/src/glu/Makefile index e519dfeec4..5c26ead1bb 100644 --- a/src/glu/Makefile +++ b/src/glu/Makefile @@ -22,7 +22,8 @@ pcedit = sed \ -e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \ -e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \ -e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \ - -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' + -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' \ + -e 's,@GLU_LIB@,$(GLU_LIB),' glu.pc: glu.pc.in $(pcedit) $< > $@ diff --git a/src/glu/glu.pc.in b/src/glu/glu.pc.in index bc2517e90e..f7d9109823 100644 --- a/src/glu/glu.pc.in +++ b/src/glu/glu.pc.in @@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility library Requires: @GLU_PC_REQ@ Requires.private: @GLU_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lGLU +Libs: -L${libdir} -l@GLU_LIB@ Libs.private: @GLU_PC_LIB_PRIV@ Cflags: -I${includedir} @GLU_PC_CFLAGS@ diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 9a975bbc60..1b072906c7 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -107,7 +107,8 @@ pcedit = sed \ -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ - -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' \ + -e 's,@GLUT_LIB@,$(GLUT_LIB),' glut.pc: glut.pc.in $(pcedit) $< > $@ diff --git a/src/glut/glx/glut.pc.in b/src/glut/glx/glut.pc.in index ae0689d7e8..151dd0b802 100644 --- a/src/glut/glx/glut.pc.in +++ b/src/glut/glx/glut.pc.in @@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility Toolkit library Requires: gl glu Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lglut +Libs: -L${libdir} -l@GLUT_LIB@ Libs.private: @GLUT_PC_LIB_PRIV@ Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index 841a473f89..0e42436133 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -81,7 +81,8 @@ pcedit = sed \ -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ - -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' + -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' \ + -e 's,@GLUT_LIB@,$(GLUT_LIB),' glut.pc: glut.pc.in $(pcedit) $< > $@ diff --git a/src/glut/mini/glut.pc.in b/src/glut/mini/glut.pc.in index ae0689d7e8..151dd0b802 100644 --- a/src/glut/mini/glut.pc.in +++ b/src/glut/mini/glut.pc.in @@ -8,6 +8,6 @@ Description: Mesa OpenGL Utility Toolkit library Requires: gl glu Requires.private: @GLUT_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lglut +Libs: -L${libdir} -l@GLUT_LIB@ Libs.private: @GLUT_PC_LIB_PRIV@ Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glw/Makefile b/src/glw/Makefile index b153a6df75..d88d773313 100644 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@ -33,7 +33,8 @@ pcedit = sed \ -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' \ -e 's,@GLW_PC_REQ_PRIV@,$(GLW_PC_REQ_PRIV),' \ -e 's,@GLW_PC_LIB_PRIV@,$(GLW_PC_LIB_PRIV),' \ - -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),' + -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),' \ + -e 's,@GLW_LIB@,$(GLW_LIB),' glw.pc: glw.pc.in $(pcedit) $< > $@ diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in index 5493093be1..19a7c307c0 100644 --- a/src/glw/glw.pc.in +++ b/src/glw/glw.pc.in @@ -8,6 +8,6 @@ Description: Mesa OpenGL widget library Requires: gl Requires.private: @GLW_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lGLw +Libs: -L${libdir} -l@GLW_LIB@ Libs.private: @GLW_PC_LIB_PRIV@ Cflags: -I${includedir} @GLW_PC_CFLAGS@ diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 4ff28dae9b..bb18bee8ea 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -103,7 +103,8 @@ gl_pcedit = sed \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \ -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \ - -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' + -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \ + -e 's,@GL_LIB@,$(GL_LIB),' gl.pc: gl.pc.in $(gl_pcedit) $< > $@ diff --git a/src/mesa/gl.pc.in b/src/mesa/gl.pc.in index 0462b9fca2..97b86596fc 100644 --- a/src/mesa/gl.pc.in +++ b/src/mesa/gl.pc.in @@ -7,6 +7,6 @@ Name: gl Description: Mesa OpenGL library Requires.private: @GL_PC_REQ_PRIV@ Version: @VERSION@ -Libs: -L${libdir} -lGL +Libs: -L${libdir} -l@GL_LIB@ Libs.private: @GL_PC_LIB_PRIV@ Cflags: -I${includedir} @GL_PC_CFLAGS@ -- cgit v1.2.3 From 1793d5adac121a2142b662d87e24990ebf209ca3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 29 Apr 2009 20:17:21 +0100 Subject: progs/tests: Add mipmap_comp for mipmap testing with compressed textures --- progs/tests/.gitignore | 1 + progs/tests/Makefile | 1 + progs/tests/SConscript | 1 + progs/tests/mipmap_comp.c | 295 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 298 insertions(+) create mode 100644 progs/tests/mipmap_comp.c diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index e6369de3ab..8d05668c07 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -49,6 +49,7 @@ mapbufrange mapvbo minmag mipgen +mipmap_comp mipmap_limits mipmap_view multipal diff --git a/progs/tests/Makefile b/progs/tests/Makefile index f5fbf374f7..628ca41535 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -58,6 +58,7 @@ SOURCES = \ mapvbo.c \ minmag.c \ mipgen.c \ + mipmap_comp.c \ mipmap_limits.c \ mipmap_view.c \ multipal.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 4f22ca735c..453fcecd9c 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -81,6 +81,7 @@ progs = [ 'mapvbo', 'minmag', 'mipgen', + 'mipmap_comp', 'mipmap_limits', 'mipmap_view', 'multipal', diff --git a/progs/tests/mipmap_comp.c b/progs/tests/mipmap_comp.c new file mode 100644 index 0000000000..5842e2b880 --- /dev/null +++ b/progs/tests/mipmap_comp.c @@ -0,0 +1,295 @@ +/* Copyright (c) Mark J. Kilgard, 1994. */ +/* + * (c) Copyright 1993, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ + +/* mipmap_comp + * Test compressed texture mipmaps + * + * Based on mipmap_limits + */ + +#include +#include +#include +#include +#include + +#include "readtex.h" + +#define SIZE 16 /* not larger then 16 */ + +static GLint BaseLevel = 0, MaxLevel = 9; +static GLfloat MinLod = -1, MaxLod = 9; +static GLfloat LodBias = 0.0; +static GLboolean NearestFilter = GL_TRUE; +static GLuint texImage; + + +static void +initValues(void) +{ + BaseLevel = 0; + MaxLevel = 9; + MinLod = -1; + MaxLod = 2; + LodBias = 5.0; + NearestFilter = GL_TRUE; +} + + +static void +makeImage(int level, int width, int height) +{ +#if 0 + GLubyte img[SIZE*SIZE*3]; + int i, j; + + (void)size; + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + int k = (i * width + j) * 3; + img[k + 0] = 255 * ((level + 1) % 2); + img[k + 1] = 255 * ((level + 1) % 2); + img[k + 2] = 255 * ((level + 1) % 2); + } + } + + glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0, + GL_RGB, GL_UNSIGNED_BYTE, img); +#else + GLubyte img[128]; + GLint size[] = { + 128, /* 16x16 */ + 32, /* 8x8 */ + 8, /* 4x4 */ + 8, /* 2x2 */ + 8, /* 1x1 */ + }; + int i; + int value = ((level + 1) % 2) * 0xffffffff; + memset(img, 0, 128); + + /* generate black and white mipmap levels */ + if (value) + for (i = 0; i < size[level] / 4; i += 2) + ((int*)img)[i] = value; + + glCompressedTexImage2D(GL_TEXTURE_2D, level, + GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + width, height, 0, + size[level], img); +#endif +} + + +static void +makeImages(void) +{ + int i, sz; + + for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) { + makeImage(i, sz, sz); + printf("Level %d size: %d x %d\n", i, sz, sz); + } +} + + +static void +myInit(void) +{ + + initValues(); + + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + glShadeModel(GL_FLAT); + + glTranslatef(0.0, 0.0, -3.6); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glGenTextures(1, &texImage); + glBindTexture(GL_TEXTURE_2D, texImage); + makeImages(); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glEnable(GL_TEXTURE_2D); +} + + +static void +display(void) +{ + GLfloat tcm = 1.0; + glBindTexture(GL_TEXTURE_2D, texImage); + + printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n", + BaseLevel, MaxLevel, MinLod, MaxLod, LodBias, + NearestFilter ? "NEAREST" : "LINEAR"); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod); + + if (NearestFilter) { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_NEAREST_MIPMAP_NEAREST); + } + else { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + } + + glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); + glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0); + glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0); + glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0); + glEnd(); + glFlush(); +} + + +static void +myReshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +static void +key(unsigned char k, int x, int y) +{ + (void) x; + (void) y; + switch (k) { + case 'b': + BaseLevel--; + if (BaseLevel < 0) + BaseLevel = 0; + break; + case 'B': + BaseLevel++; + if (BaseLevel > 10) + BaseLevel = 10; + break; + case 'm': + MaxLevel--; + if (MaxLevel < 0) + MaxLevel = 0; + break; + case 'M': + MaxLevel++; + if (MaxLevel > 10) + MaxLevel = 10; + break; + case 'l': + LodBias -= 0.25; + break; + case 'L': + LodBias += 0.25; + break; + case 'n': + MinLod -= 0.25; + break; + case 'N': + MinLod += 0.25; + break; + case 'x': + MaxLod -= 0.25; + break; + case 'X': + MaxLod += 0.25; + break; + case 'f': + NearestFilter = !NearestFilter; + break; + case ' ': + initValues(); + break; + case 27: /* Escape */ + exit(0); + break; + default: + return; + } + glutPostRedisplay(); +} + + +static void +usage(void) +{ + printf("usage:\n"); + printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n"); + printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n"); + printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n"); + printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n"); + printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n"); + printf(" f toggle nearest/linear filtering\n"); + printf(" SPACE reset values\n"); +} + + +int +main(int argc, char** argv) +{ + glutInit(&argc, argv); + glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowSize (600, 600); + glutCreateWindow (argv[0]); + glewInit(); + myInit(); + glutReshapeFunc (myReshape); + glutDisplayFunc(display); + glutKeyboardFunc(key); + usage(); + glutMainLoop(); + return 0; /* ANSI C requires main to return int. */ +} -- cgit v1.2.3 From 289dc69418d834e44bd2f63f69382c1f1d3d7c00 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 29 Apr 2009 20:44:03 +0100 Subject: progs/tests: Update ignores --- progs/tests/.gitignore | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 8d05668c07..959ddcc51f 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -16,22 +16,20 @@ blendminmax blendsquare blendxor bufferobj -bumpmap bug_3050 bug_3101 bug_3195 bug_texstore_i8 +bumpmap calibrate_rast copypixrate crossbar cva -dinoshade drawbuffers extfuncs.h exactrast fbotest1 fbotest2 -fbotexture fillrate floattex fog @@ -40,6 +38,7 @@ fptest1 fptexture getprocaddress getproclist.h +glutfx interleave invert jkrahntest @@ -57,7 +56,6 @@ no_s3tc packedpixels pbo prog_parameter -projtex quads random readrate @@ -65,22 +63,22 @@ readtex.c readtex.h rubberband seccolor -sharedtex shader_api shaderutil.c shaderutil.h +sharedtex stencil_twoside -stencil_wrap stencilwrap stencil_wrap +streaming_rect subtex subtexrate tex1d -texcmp texcompress2 +texdown texfilt -texgenmix texline +texobj texobjshare texrect texwrap -- cgit v1.2.3 From cc68cd20d9fbb87486eb69a50fa14a3d6b9c6798 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 29 Apr 2009 20:33:50 -0700 Subject: egl: Don't install demodriver I don't think anyone besides a developer would ever want to use the demo egl driver. Furthermore, egl would only ever load demodriver if it was set via EGL_DRIVER in the environment. In that case, I think you can point it to your mesa source directory. --- src/egl/drivers/demo/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile index d908cdb4b2..26694c92fa 100644 --- a/src/egl/drivers/demo/Makefile +++ b/src/egl/drivers/demo/Makefile @@ -26,8 +26,6 @@ $(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS) $(OBJECTS) install: - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) $(TOP)/$(LIB_DIR)/demodriver.so $(DESTDIR)$(INSTALL_LIB_DIR) clean: -rm -f *.o -- cgit v1.2.3 From ba27fe3710af4933a16278a3e97162bef1737b56 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 30 Apr 2009 09:39:29 +0200 Subject: gallium: Add SCons build support for the DRI state tracker. --- src/gallium/SConscript | 1 + src/gallium/state_trackers/dri/SConscript | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/gallium/state_trackers/dri/SConscript diff --git a/src/gallium/SConscript b/src/gallium/SConscript index 0c632ac2b8..b6ceaf3edf 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -29,6 +29,7 @@ for driver in env['drivers']: SConscript('state_trackers/python/SConscript') SConscript('state_trackers/glx/xlib/SConscript') +SConscript('state_trackers/dri/SConscript') if platform == 'windows': SConscript('state_trackers/wgl/SConscript') diff --git a/src/gallium/state_trackers/dri/SConscript b/src/gallium/state_trackers/dri/SConscript new file mode 100644 index 0000000000..ce2c273597 --- /dev/null +++ b/src/gallium/state_trackers/dri/SConscript @@ -0,0 +1,23 @@ +####################################################################### +# SConscript for dri state_tracker + +Import('*') + +if env['dri']: + + env = env.Clone() + + env.Append(CPPPATH = [ + '#/src/mesa', + '#/src/mesa/drivers/dri/common', + ]) + + st_dri = env.ConvenienceLibrary( + target = 'st_dri', + source = [ 'dri_context.c', + 'dri_drawable.c', + 'dri_extensions.c', + 'dri_screen.c', + ] + ) + Export('st_dri') -- cgit v1.2.3 From c28707b50701b1cf8727be29d61e2d939c6ee58f Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 30 Apr 2009 13:21:08 +0200 Subject: r300: Increase reference count of texture objects referenced by current state. Fixes a use-after-free reported in http://bugs.freedesktop.org/show_bug.cgi?id=20539, so this possibly fixes that bug. It has been confirmed to fix http://bugs.freedesktop.org/show_bug.cgi?id=17895 . --- src/mesa/drivers/dri/r300/r300_context.h | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/r300/r300_texmem.c | 5 +++-- src/mesa/drivers/dri/r300/r300_texstate.c | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 9c49586998..96a3205f1a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -215,7 +215,7 @@ struct r300_tex_obj { }; struct r300_texture_env_state { - r300TexObjPtr texobj; + struct gl_texture_object *texobj; GLenum format; GLenum envMode; }; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 6b79aa4313..79f0b3625c 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1362,7 +1362,7 @@ static void r300SetupTextures(GLcontext * ctx) #endif tmu_mappings[i] = hw_tmu; - t = r300->state.texture.unit[i].texobj; + t = (r300TexObjPtr) r300->state.texture.unit[i].texobj->DriverData; /* XXX questionable fix for bug 9170: */ if (!t) continue; diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c index 0fe51b0c68..a89ab83d94 100644 --- a/src/mesa/drivers/dri/r300/r300_texmem.c +++ b/src/mesa/drivers/dri/r300/r300_texmem.c @@ -44,6 +44,7 @@ SOFTWARE. #include "main/colormac.h" #include "main/macros.h" #include "main/simple_list.h" +#include "main/texobj.h" #include "radeon_reg.h" /* gets definition for usleep */ #include "r300_context.h" #include "r300_state.h" @@ -71,8 +72,8 @@ void r300DestroyTexObj(r300ContextPtr rmesa, r300TexObjPtr t) } for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) { - if (rmesa->state.texture.unit[i].texobj == t) { - rmesa->state.texture.unit[i].texobj = NULL; + if (rmesa->state.texture.unit[i].texobj == t->base.tObj) { + _mesa_reference_texobj(&rmesa->state.texture.unit[i].texobj, NULL); } } } diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index cadec7f3ec..abe613e27b 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -567,19 +567,20 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit) /* Update state if this is a different texture object to last * time. */ - if (rmesa->state.texture.unit[unit].texobj != t) { + if (rmesa->state.texture.unit[unit].texobj != tObj) { if (rmesa->state.texture.unit[unit].texobj != NULL) { + r300TexObjPtr t_old = (r300TexObjPtr) rmesa->state.texture.unit[unit].texobj->DriverData; + /* The old texture is no longer bound to this texture unit. * Mark it as such. */ - rmesa->state.texture.unit[unit].texobj->base.bound &= - ~(1 << unit); + t_old->base.bound &= ~(1 << unit); } - rmesa->state.texture.unit[unit].texobj = t; + _mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj); t->base.bound |= (1 << unit); - driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */ + driUpdateTextureLRU(&t->base); /* XXX: should be locked! */ } return !t->border_fallback; -- cgit v1.2.3 From 60927f97f7b0df9ce352d0c8b4b973e97d53f20a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 16:52:02 -0600 Subject: i915simple: remove duplicated i915_context.c in C_SOURCES --- src/gallium/drivers/i915simple/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile index 12821c5a76..8870b39866 100644 --- a/src/gallium/drivers/i915simple/Makefile +++ b/src/gallium/drivers/i915simple/Makefile @@ -8,7 +8,6 @@ C_SOURCES = \ i915_clear.c \ i915_flush.c \ i915_context.c \ - i915_context.c \ i915_debug.c \ i915_debug_fp.c \ i915_state.c \ -- cgit v1.2.3 From 9cb3cdec76b679f15c591955084bd48e91a32142 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Thu, 30 Apr 2009 16:52:56 -0600 Subject: mesa: Prepend "-Wl," to linking options Let mklib ignore -Wl options inside the object list when building static libraries --- bin/mklib | 17 +++++++++++++++++ src/gallium/winsys/egl_xlib/Makefile | 2 +- src/gallium/winsys/xlib/Makefile | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/bin/mklib b/bin/mklib index a3e826abac..db3bc8325f 100755 --- a/bin/mklib +++ b/bin/mklib @@ -176,6 +176,23 @@ if [ ${ARCH} = "auto" ] ; then fi +if [ $STATIC = 1 ]; then + # filter out linker options inside object list + NEWOBJECTS="" + for OBJ in $OBJECTS ; do + case $OBJ in + -Wl,*) + echo "mklib: warning: ignoring $OBJ for static library" + ;; + *) + NEWOBJECTS="$NEWOBJECTS $OBJ" + ;; + esac + done + OBJECTS=$NEWOBJECTS +fi + + # # Error checking # diff --git a/src/gallium/winsys/egl_xlib/Makefile b/src/gallium/winsys/egl_xlib/Makefile index 02ac47caa4..8646ee3b52 100644 --- a/src/gallium/winsys/egl_xlib/Makefile +++ b/src/gallium/winsys/egl_xlib/Makefile @@ -60,7 +60,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(WINSYS_OBJECTS) $(LIBS) -noprefix \ -install $(TOP)/$(LIB_DIR) \ $(MKLIB_OPTIONS) $(WINSYS_OBJECTS) \ - --whole-archive $(LIBS) --no-whole-archive + -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive depend: $(ALL_SOURCES) diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile index bb187cc14a..04309e67ee 100644 --- a/src/gallium/winsys/xlib/Makefile +++ b/src/gallium/winsys/xlib/Makefile @@ -74,7 +74,7 @@ $(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_WINSYS_OBJECTS) $(LIBS) Makefil -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ -install $(TOP)/$(LIB_DIR)/gallium \ $(MKLIB_OPTIONS) $(XLIB_WINSYS_OBJECTS) \ - --start-group $(LIBS) --end-group $(GL_LIB_DEPS) + -Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS) depend: $(XLIB_WINSYS_SOURCES) -- cgit v1.2.3 From eef79d50bf160a0278266cac56a915027538ac1e Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Thu, 30 Apr 2009 16:55:54 -0600 Subject: mklib: replace if/expr with case Saves forking an expr for every object. --- bin/mklib | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/bin/mklib b/bin/mklib index db3bc8325f..2fd95ba775 100755 --- a/bin/mklib +++ b/bin/mklib @@ -281,18 +281,21 @@ case $ARCH in # expand any .a objects into constituent .o files. NEWOBJECTS="" DELETIA="" - for OBJ in ${OBJECTS} ; do - if [ `expr match $OBJ '.*\.a'` -gt 0 ] ; then - # extract the .o files from this .a archive - FILES=`ar t $OBJ` - ar x $OBJ - NEWOBJECTS="$NEWOBJECTS $FILES" - # keep track of temporary .o files and delete them below - DELETIA="$DELETIA $FILES" - else - # ordinary .o file - NEWOBJECTS="$NEWOBJECTS $OBJ" - fi + for OBJ in $OBJECTS ; do + case $OBJ in + *.a) + # extract the .o files from this .a archive + FILES=`ar t $OBJ` + ar x $OBJ + NEWOBJECTS="$NEWOBJECTS $FILES" + # keep track of temporary .o files and delete them below + DELETIA="$DELETIA $FILES" + ;; + *) + # ordinary .o file + NEWOBJECTS="$NEWOBJECTS $OBJ" + ;; + esac done # make lib -- cgit v1.2.3 From 3dfe672c851756e5ee09443dfafb1295c912da31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:03:54 -0600 Subject: demos: silence warning --- progs/demos/dinoshade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/demos/dinoshade.c b/progs/demos/dinoshade.c index 41b19d5a92..cbf8751e25 100644 --- a/progs/demos/dinoshade.c +++ b/progs/demos/dinoshade.c @@ -382,7 +382,7 @@ static GLfloat floorShadow[4][4]; static void redraw(void) { - int start, end; + int start = 0, end = 0; if (reportSpeed) { start = glutGet(GLUT_ELAPSED_TIME); -- cgit v1.2.3 From aef475c8893b7f524b2314f9f8d1083655db7fe2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:04:01 -0600 Subject: mesa: update linux-static, linux-x86-static configs --- configs/linux-static | 6 ++---- configs/linux-x86-static | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/configs/linux-static b/configs/linux-static index 2fc39ff83e..907904bda4 100644 --- a/configs/linux-static +++ b/configs/linux-static @@ -22,7 +22,5 @@ GLUT_LIB_DEPS = GLW_LIB_DEPS = # Need to specify all libraries we may need -APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ - -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group -lm \ - -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread - +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \ + -l$(GL_LIB) -lm -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread diff --git a/configs/linux-x86-static b/configs/linux-x86-static index 65c92cf352..16c8731c1d 100644 --- a/configs/linux-x86-static +++ b/configs/linux-x86-static @@ -22,6 +22,5 @@ GLUT_LIB_DEPS = GLW_LIB_DEPS = # Need to specify all libraries we may need -APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ - -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \ - $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \ + -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm -- cgit v1.2.3 From 675b1cacf7e41310771791b15f3d44bd3eb9b70e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:11:20 -0600 Subject: docs: notes about new version number meaning in release notes --- docs/relnotes-7.5.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index bfeea3f433..27c64b42b6 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -27,7 +27,14 @@ Some drivers don't support all the features required in OpenGL 2.1.

    See the Compiling/Installing page for prerequisites -for DRI ardware acceleration. +for DRI hardware acceleration. +

    +

    +Note that the Mesa project is no longer using odd/even version numbers +to indicate development/stable releases. +The so-called development releases have been fairly stable. +If you're especially concerned with stability you should probably look for +"point" releases such as 7.5.1 which will be a bug-fix release.

    -- cgit v1.2.3 From a405cc7b7226ac365f7e9f11bd803bf45dceb49a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:13:22 -0600 Subject: docs: bring in 7.4 doc updates from mesa_7_4_branch --- docs/news.html | 14 +++++++++ docs/relnotes-7.4.1.html | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/relnotes-7.4.html | 26 ++++++++++++++-- docs/relnotes.html | 1 + 4 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 docs/relnotes-7.4.1.html diff --git a/docs/news.html b/docs/news.html index b177f3bca2..e032a6a494 100644 --- a/docs/news.html +++ b/docs/news.html @@ -11,6 +11,20 @@

    News

    +

    April 18, 2009

    +

    +Mesa 7.4.1 is released. +This is a stable release fixing bugs since the 7.4 release. +

    + + +

    March 27, 2009

    +

    +Mesa 7.4 is released. +This is a stable release fixing bugs since the 7.3 release. +

    + +

    January 22, 2009

    Mesa 7.3 is released. diff --git a/docs/relnotes-7.4.1.html b/docs/relnotes-7.4.1.html new file mode 100644 index 0000000000..40f4fb1722 --- /dev/null +++ b/docs/relnotes-7.4.1.html @@ -0,0 +1,79 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4.1 Release Notes / 18 April 2009

    + +

    +Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release. +

    +

    +Mesa 7.4.1 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +0c3a72f3295a53a134c04bd7d209ea62  MesaLib-7.4.1.tar.gz
    +423260578b653818ba66c2fcbde6d7ad  MesaLib-7.4.1.tar.bz2
    +84f78b154d4bd5c3ecc42eeff2e56676  MesaLib-7.4.1.zip
    +aa0ad323e59d6d10ff33ac0dde462a60  MesaDemos-7.4.1.tar.gz
    +1e169fb6abc2b45613f1c98a82dfe690  MesaDemos-7.4.1.tar.bz2
    +294e42be2d74176596c994ec23322fcf  MesaDemos-7.4.1.zip
    +92373bfa48e7b68dddf356e86b0e5699  MesaGLUT-7.4.1.tar.gz
    +336f3824b578b072211e0beecf4f04f4  MesaGLUT-7.4.1.tar.bz2
    +20751388d8ef16b42d25d9e3d705d101  MesaGLUT-7.4.1.zip
    +
    + + +

    Bug fixes

    +
      +
    • Fixed a two-sided lighting bug in fixed-function-to-GPU code generation +
    • Fixed some Darwin issues (Jeremy Huddleston) +
    • Indexing the GLSL gl_EyePlane[] or gl_ObjectPlane[] arrays with a variable + was broken, bug 20986 +
    • Fixed incorrect texture unit bias in TXB instruction +
    • glTexParameter settings weren't always propogated to drivers +
    • Assorted vertex/fragment program bug fixes +
    • Fixed point rendering in software rasterizer +
    • Fixed potential deadlock in object hash functions +
    • Fix a couple bugs surrounding front-buffer rendering with DRI2, but this + is not quite complete. +
    • Fixed glPopAttrib() bug when restoring user clip planes +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/docs/relnotes-7.4.html b/docs/relnotes-7.4.html index 60ada854c1..55ba019b22 100644 --- a/docs/relnotes-7.4.html +++ b/docs/relnotes-7.4.html @@ -8,7 +8,7 @@ -

    Mesa 7.4 Release Notes / date TBD

    +

    Mesa 7.4 Release Notes / 27 March 2009

    Mesa 7.4 is a stable development release fixing bugs since the 7.3 release. @@ -20,28 +20,48 @@ Some drivers don't support all the features required in OpenGL 2.1.

    See the Compiling/Installing page for prerequisites -for DRI ardware acceleration. +for DRI hardware acceleration.

    MD5 checksums

    -tbd
    +ed6bd7437177307e51e16d0c7c381dfa  MesaLib-7.4.tar.gz
    +7ecddb341a2691e0dfdb02f697109834  MesaLib-7.4.tar.bz2
    +433e823f8245f9fd5f397e7b719a8e47  MesaLib-7.4.zip
    +656eee6128016fb237e01aa8dabbc703  MesaDemos-7.4.tar.gz
    +02816f10f30b1dc5e069e0f68c177c98  MesaDemos-7.4.tar.bz2
    +44a70d6db4aa4c64ecc47871b6aceee8  MesaDemos-7.4.zip
    +25f80db4f8645cd3e58e2c9af53ec341  MesaGLUT-7.4.tar.gz
    +04ec01caebde44f5b0d619f00716b368  MesaGLUT-7.4.tar.bz2
    +019dc213baecaa3cb1278847d41b8591  MesaGLUT-7.4.zip
     

    New features

      +
    • Added MESA_GLX_FORCE_DIRECT env var for Xlib/software driver +
    • GLSL version 1.20 is returnd by the GL_SHADING_LANGUAGE_VERSION query

    Bug fixes

      +
    • glGetActiveUniform() returned wrong size for some array types +
    • Fixed some error checking in glUniform() +
    • Fixed a potential glTexImage('proxy target') segfault +
    • Fixed bad reference counting for 1D/2D texture arrays +
    • Fixed VBO + glPush/PopClientAttrib() bug #19835
    • Assorted i965 driver bug fixes +
    • Fixed a Windows compilation failure in s_triangle.c +
    • Fixed a GLSL array indexing bug +
    • Fixes for building on Haiku

    Changes

      +
    • Updated GL/glxext.h to version 48 +
    • Assorted updates for building on Solaris
    diff --git a/docs/relnotes.html b/docs/relnotes.html index c5ed109390..298352038c 100644 --- a/docs/relnotes.html +++ b/docs/relnotes.html @@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.
    • 7.5 release notes +
    • 7.4.1 release notes
    • 7.4 release notes
    • 7.3 release notes
    • 7.2 release notes -- cgit v1.2.3 From e4e7ecc221fc1ed5714ac4c13e5cea204d37c6ad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:17:31 -0600 Subject: docs: asst. updates for 7.5 release --- docs/download.html | 6 ------ docs/news.html | 6 ++++++ docs/relnotes-7.5.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/download.html b/docs/download.html index 37b0b3da47..cf1cc21d37 100644 --- a/docs/download.html +++ b/docs/download.html @@ -8,12 +8,6 @@

      Downloading

      -

      -Current development release: 7.3 -
      -Last stable release: 7.2 -

      -

      Primary download site: News +

      May tbd, 2009

      +

      +Mesa 7.5 is released. +

      + +

      April 18, 2009

      Mesa 7.4.1 is released. diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index 27c64b42b6..c10ccd7a5c 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -13,7 +13,7 @@

      Mesa 7.5 is a new development release. People who are concerned with stability and reliability should stick -with the 7.4.x branch or wait for Mesa 7.6. +with the 7.4.x branch or wait for Mesa 7.5.1.

      The main new feature of Mesa 7.5 is the -- cgit v1.2.3 From 1f43cc1d841d3be04433224842f89ff03ba28a02 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 28 Apr 2009 04:37:56 -0700 Subject: radeon: Fix cast and comment. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 3302d623bf..adbf23ab51 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -56,8 +56,7 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) int target; int retval; - /* XXX is this cast safe? */ - gp.value = (int*)⌖ + gp.value = ⌖ /* First, get the number of pixel pipes */ gp.param = RADEON_PARAM_NUM_GB_PIPES; -- cgit v1.2.3 From a609f78cf688c97eda8cde3d876397e042fdb60d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 1 May 2009 04:47:50 -0700 Subject: r300-gallium: Don't bother with conditional double define. We'll just forever leave it in r300_winsys.h since it's needed for whichever winsys is hosting the pipe. --- src/gallium/drivers/r300/r300_context.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 4c695c1195..6f62998b35 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -314,11 +314,4 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_state_functions(struct r300_context* r300); void r300_init_surface_functions(struct r300_context* r300); -/* Fun with includes: r300_winsys also declares this prototype. - * We'll just step out in that case... */ -#ifndef R300_WINSYS_H -struct pipe_context* r300_create_context(struct pipe_screen* screen, - struct r300_winsys* r300_winsys); -#endif - #endif /* R300_CONTEXT_H */ -- cgit v1.2.3 From d7f4ac9f34a72efe53a1a140557f1822afbadf16 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 1 May 2009 05:03:56 -0700 Subject: r300-gallium, radeon-winsys: Reorganize r300_winsys header, break ABI. Make things more consistent, prepare for more function hooks. --- src/gallium/drivers/r300/r300_cs.h | 18 ++++---- src/gallium/drivers/r300/r300_winsys.h | 46 ++++++++++---------- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 53 +++++++++++++++++------- 3 files changed, 70 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 5d9799dd72..82a3942248 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -49,27 +49,27 @@ #define CS_LOCALS(context) \ struct r300_winsys* cs_winsys = context->winsys; \ - struct radeon_cs* cs = cs_winsys->cs; \ int cs_count = 0; #define CHECK_CS(size) \ - cs_winsys->check_cs(cs, (size)) + cs_winsys->check_cs(cs_winsys, (size)) #define BEGIN_CS(size) do { \ CHECK_CS(size); \ debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \ size, __FUNCTION__, __FILE__, __LINE__); \ - cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \ + cs_winsys->begin_cs(cs_winsys, (size), \ + __FILE__, __FUNCTION__, __LINE__); \ cs_count = size; \ } while (0) #define OUT_CS(value) do { \ - cs_winsys->write_cs_dword(cs, (value)); \ + cs_winsys->write_cs_dword(cs_winsys, (value)); \ cs_count--; \ } while (0) #define OUT_CS_32F(value) do { \ - cs_winsys->write_cs_dword(cs, fui(value)); \ + cs_winsys->write_cs_dword(cs_winsys, fui(value)); \ cs_count--; \ } while (0) @@ -97,7 +97,7 @@ bo, offset); \ assert(bo); \ OUT_CS(offset); \ - cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \ + cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ cs_count -= 2; \ } while (0) @@ -106,13 +106,13 @@ __LINE__); \ if (cs_count != 0) \ debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \ - cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__); \ + cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \ } while (0) #define FLUSH_CS do { \ debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \ __LINE__); \ - cs_winsys->flush_cs(cs); \ + cs_winsys->flush_cs(cs_winsys); \ } while (0) #define RADEON_ONE_REG_WR (1 << 15) @@ -138,7 +138,7 @@ assert(bo); \ OUT_CS(offset); \ OUT_CS(count); \ - cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \ + cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ cs_count -= 2; \ } while (0) diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index baa95282c3..393ba07012 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -35,8 +35,6 @@ extern "C" { #include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" -struct radeon_cs; - struct r300_winsys { /* Parent class */ struct pipe_winsys base; @@ -44,45 +42,45 @@ struct r300_winsys { /* Opaque Radeon-specific winsys object. */ void* radeon_winsys; + /* CS object. This is very much like Intel's batchbuffer. + * Fill it full of dwords and relocs and then submit. + * Repeat as needed. */ + struct radeon_cs* cs; + /* PCI ID */ uint32_t pci_id; /* GB pipe count */ uint32_t gb_pipes; - /* CS object. This is very much like Intel's batchbuffer. - * Fill it full of dwords and relocs and then submit. - * Repeat as needed. */ - struct radeon_cs* cs; - /* Check to see if there's room for commands. */ - boolean (*check_cs)(struct radeon_cs* cs, int size); + boolean (*check_cs)(struct r300_winsys* winsys, int size); /* Start a command emit. */ - void (*begin_cs)(struct radeon_cs* cs, - int size, - const char* file, - const char* function, - int line); + void (*begin_cs)(struct r300_winsys* winsys, + int size, + const char* file, + const char* function, + int line); /* Write a dword to the command buffer. */ - void (*write_cs_dword)(struct radeon_cs* cs, uint32_t dword); + void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword); /* Write a relocated dword to the command buffer. */ - void (*write_cs_reloc)(struct radeon_cs* cs, - struct pipe_buffer* bo, - uint32_t rd, - uint32_t wd, - uint32_t flags); + void (*write_cs_reloc)(struct r300_winsys* winsys, + struct pipe_buffer* bo, + uint32_t rd, + uint32_t wd, + uint32_t flags); /* Finish a command emit. */ - void (*end_cs)(struct radeon_cs* cs, - const char* file, - const char* function, - int line); + void (*end_cs)(struct r300_winsys* winsys, + const char* file, + const char* function, + int line); /* Flush the CS. */ - void (*flush_cs)(struct radeon_cs* cs); + void (*flush_cs)(struct r300_winsys* winsys); }; struct pipe_context* r300_create_context(struct pipe_screen* screen, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index adbf23ab51..929e4842cc 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,31 +22,56 @@ #include "radeon_r300.h" -static boolean radeon_r300_check_cs(struct radeon_cs* cs, int size) +static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) { /* XXX check size here, lazy ass! */ + /* XXX also validate buffers */ return TRUE; } -static void radeon_r300_write_cs_reloc(struct radeon_cs* cs, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd, - uint32_t flags) +static void radeon_r300_begin_cs(struct r300_winsys* winsys, + int size, + const char* file, + const char* function, + int line) { - radeon_cs_write_reloc(cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); + radeon_cs_begin(winsys->cs, size, file, function, line); } -static void radeon_r300_flush_cs(struct radeon_cs* cs) +static void radeon_r300_write_cs_dword(struct r300_winsys* winsys, + uint32_t dword) +{ + radeon_cs_write_dword(winsys->cs, dword); +} + +static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd, + uint32_t flags) +{ + radeon_cs_write_reloc(winsys->cs, + ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); +} + +static void radeon_r300_end_cs(struct r300_winsys* winsys, + const char* file, + const char* function, + int line) +{ + radeon_cs_end(winsys->cs, file, function, line); +} + +static void radeon_r300_flush_cs(struct r300_winsys* winsys) { int retval = 0; - retval = radeon_cs_emit(cs); + retval = radeon_cs_emit(winsys->cs); if (retval) { debug_printf("radeon: Bad CS, dumping...\n"); - radeon_cs_print(cs, stderr); + radeon_cs_print(winsys->cs, stderr); } - radeon_cs_erase(cs); + radeon_cs_erase(winsys->cs); } /* Helper function to do the ioctls needed for setup and init. */ @@ -96,10 +121,10 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4); winsys->check_cs = radeon_r300_check_cs; - winsys->begin_cs = radeon_cs_begin; - winsys->write_cs_dword = radeon_cs_write_dword; + winsys->begin_cs = radeon_r300_begin_cs; + winsys->write_cs_dword = radeon_r300_write_cs_dword; winsys->write_cs_reloc = radeon_r300_write_cs_reloc; - winsys->end_cs = radeon_cs_end; + winsys->end_cs = radeon_r300_end_cs; winsys->flush_cs = radeon_r300_flush_cs; memcpy(winsys, old_winsys, sizeof(struct radeon_winsys)); -- cgit v1.2.3 From c11ad489e7432f3ed2fcaf5b15b8fe3538ae6d30 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 1 May 2009 05:54:53 -0700 Subject: r300-gallium, radeon-winsys: Space accounting. It is no longer optional in current libdrm, so it was time to actually start counting our BOs. --- src/gallium/drivers/r300/r300_emit.c | 10 +++- src/gallium/drivers/r300/r300_surface.c | 7 +++ src/gallium/drivers/r300/r300_winsys.h | 16 +++++ src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 12 +++- src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 18 +++++- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 4 +- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 68 ++++++++++++++++++++++ 7 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 74d63ffe41..01bac5f759 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -424,13 +424,21 @@ void r300_emit_dirty_state(struct r300_context* r300) int i; int dirty_tex = 0; - if (!(r300->dirty_state) && !(r300->dirty_hw)) { + if (!(r300->dirty_hw)) { return; } r300_update_derived_state(r300); /* XXX check size */ + struct r300_texture* fb_tex = + (struct r300_texture*)r300->framebuffer_state.cbufs[0]; + r300->winsys->add_buffer(r300->winsys, fb_tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + if (r300->winsys->validate(r300->winsys)) { + /* XXX */ + r300->context.flush(&r300->context, 0, NULL); + } if (r300->dirty_state & R300_NEW_BLEND) { r300_emit_blend_state(r300, r300->blend_state); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 79bed03253..4dd5b8af99 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -34,6 +34,13 @@ static void r300_surface_setup(struct pipe_context* pipe, unsigned pixpitch = tex->stride / tex->tex.block.size; CS_LOCALS(r300); + /* Make sure our target BO is okay. */ + r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + if (r300->winsys->validate(r300->winsys)) { + r300->context.flush(&r300->context, 0, NULL); + } + r300_emit_blend_state(r300, &blend_clear_state); r300_emit_blend_color_state(r300, &blend_color_clear_state); r300_emit_dsa_state(r300, &dsa_clear_state); diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 393ba07012..761aedebfc 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -53,6 +53,22 @@ struct r300_winsys { /* GB pipe count */ uint32_t gb_pipes; + /* GART size. */ + uint32_t gart_size; + + /* VRAM size. */ + uint32_t vram_size; + + /* Add a pipe_buffer to the list of buffer objects to validate. */ + void (*add_buffer)(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd); + + /* Revalidate all currently setup pipe_buffers. + * Returns TRUE if a flush is required. */ + boolean (*validate)(struct r300_winsys* winsys); + /* Check to see if there's room for commands. */ boolean (*check_cs)(struct r300_winsys* winsys, int size); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 611ee68da6..6313eb219e 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -68,8 +68,8 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws, domain |= RADEON_GEM_DOMAIN_GTT; } - radeon_buffer->bo = radeon_bo_open(radeon_ws->bom, 0, size, alignment, - domain, 0); + radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size, + alignment, domain, 0); if (radeon_buffer->bo == NULL) { FREE(radeon_buffer); } @@ -169,8 +169,14 @@ struct radeon_winsys* radeon_pipe_winsys(int fd) return NULL; } + radeon_ws->priv = CALLOC_STRUCT(radeon_winsys_priv); + if (radeon_ws->priv == NULL) { + FREE(radeon_ws); + return NULL; + } + bom = radeon_bo_manager_gem_ctor(fd); - radeon_ws->bom = bom; + radeon_ws->priv->bom = bom; radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index 163422f296..73fa362aca 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -41,6 +41,7 @@ #include "util/u_memory.h" #include "radeon_bo.h" +#include "radeon_cs.h" #include "radeon_drm.h" @@ -49,13 +50,24 @@ struct radeon_pipe_buffer { struct radeon_bo *bo; }; +#define RADEON_MAX_BOS 24 + +struct radeon_winsys_priv { + /* Radeon BO manager. */ + struct radeon_bo_manager* bom; + + /* Radeon BO space checker. */ + struct radeon_cs_space_check sc[RADEON_MAX_BOS]; + /* Current BO count. */ + unsigned bo_count; +}; + struct radeon_winsys { /* Parent class. */ struct pipe_winsys base; - /* Radeon BO manager. - * This corresponds to void* radeon_winsys in r300_winsys. */ - struct radeon_bo_manager* bom; + /* This corresponds to void* radeon_winsys in r300_winsys. */ + struct radeon_winsys_priv* priv; }; struct radeon_winsys* radeon_pipe_winsys(int fb); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 1f89d1b1d1..428d3f65a1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -32,7 +32,7 @@ /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(int drmFB, - struct drm_create_screen_arg *arg ) + struct drm_create_screen_arg *arg) { struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); @@ -69,7 +69,7 @@ struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, unsigned handle) { struct radeon_bo_manager* bom = - ((struct radeon_winsys*)screen->winsys)->bom; + ((struct radeon_winsys*)screen->winsys)->priv->bom; struct radeon_pipe_buffer* radeon_buffer; struct radeon_bo* bo = NULL; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 929e4842cc..b172107432 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,6 +22,54 @@ #include "radeon_r300.h" +static void radeon_r300_add_buffer(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd) +{ + int i; + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + struct radeon_cs_space_check* sc = priv->sc; + struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo; + + /* Check to see if this BO is already in line for validation; + * find a slot for it otherwise. */ + for (i = 0; i < RADEON_MAX_BOS; i++) { + if (sc[i].bo == bo) { + return; + } else if (sc[i].bo == NULL) { + sc[i].bo = bo; + sc[i].read_domains = rd; + sc[i].write_domain = wd; + priv->bo_count = i + 1; + return; + } + } + + assert(FALSE && "Oh God too many BOs!"); +} + +static boolean radeon_r300_validate(struct r300_winsys* winsys) +{ + int retval; + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + struct radeon_cs_space_check* sc = priv->sc; + + retval = radeon_cs_space_check(winsys->cs, sc, priv->bo_count); + + if (retval == RADEON_CS_SPACE_OP_TO_BIG) { + /* XXX we need to failover here */ + } else if (retval == RADEON_CS_SPACE_FLUSH) { + /* We must flush before more rendering can commence. */ + return TRUE; + } + + /* Things are fine, we can proceed as normal. */ + return FALSE; +} + static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) { /* XXX check size here, lazy ass! */ @@ -77,6 +125,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) /* Helper function to do the ioctls needed for setup and init. */ static void do_ioctls(struct r300_winsys* winsys, int fd) { + struct drm_radeon_gem_info info; drm_radeon_getparam_t gp; int target; int retval; @@ -102,6 +151,18 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) exit(1); } winsys->pci_id = target; + + /* Finally, retrieve MM info */ + retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, + &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: Failed to get MM info, error number %d\n", + __FUNCTION__, retval); + exit(1); + } + winsys->gart_size = info.gart_size; + /* XXX */ + winsys->vram_size = info.vram_visible; } struct r300_winsys* @@ -119,6 +180,13 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) csm = radeon_cs_manager_gem_ctor(fd); winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4); + radeon_cs_set_limit(winsys->cs, + RADEON_GEM_DOMAIN_GTT, winsys->gart_size); + radeon_cs_set_limit(winsys->cs, + RADEON_GEM_DOMAIN_VRAM, winsys->vram_size); + + winsys->add_buffer = radeon_r300_add_buffer; + winsys->validate = radeon_r300_validate; winsys->check_cs = radeon_r300_check_cs; winsys->begin_cs = radeon_r300_begin_cs; -- cgit v1.2.3 From 5b15cc312f16c6147e1f8f3d25c6ed34076aa3a1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 1 May 2009 06:01:52 -0700 Subject: r300-gallium, radeon-winsys: Hide radeon_cs from r300 pipe. --- src/gallium/drivers/r300/r300_winsys.h | 5 --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 3 +- src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 6 ++++ src/gallium/winsys/drm/radeon/core/radeon_r300.c | 42 +++++++++++++++------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 761aedebfc..a833bb0399 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -42,11 +42,6 @@ struct r300_winsys { /* Opaque Radeon-specific winsys object. */ void* radeon_winsys; - /* CS object. This is very much like Intel's batchbuffer. - * Fill it full of dwords and relocs and then submit. - * Repeat as needed. */ - struct radeon_cs* cs; - /* PCI ID */ uint32_t pci_id; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 6313eb219e..a15487352b 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -175,8 +175,7 @@ struct radeon_winsys* radeon_pipe_winsys(int fd) return NULL; } - bom = radeon_bo_manager_gem_ctor(fd); - radeon_ws->priv->bom = bom; + radeon_ws->priv->bom = radeon_bo_manager_gem_ctor(fd); radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index 73fa362aca..ca8bbb3c11 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -60,6 +60,12 @@ struct radeon_winsys_priv { struct radeon_cs_space_check sc[RADEON_MAX_BOS]; /* Current BO count. */ unsigned bo_count; + + /* Radeon CS manager. */ + struct radeon_cs_manager* csm; + + /* Current CS. */ + struct radeon_cs* cs; }; struct radeon_winsys { diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index b172107432..ac6cca36bf 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -57,7 +57,7 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) (struct radeon_winsys_priv*)winsys->radeon_winsys; struct radeon_cs_space_check* sc = priv->sc; - retval = radeon_cs_space_check(winsys->cs, sc, priv->bo_count); + retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); if (retval == RADEON_CS_SPACE_OP_TO_BIG) { /* XXX we need to failover here */ @@ -83,13 +83,19 @@ static void radeon_r300_begin_cs(struct r300_winsys* winsys, const char* function, int line) { - radeon_cs_begin(winsys->cs, size, file, function, line); + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + + radeon_cs_begin(priv->cs, size, file, function, line); } static void radeon_r300_write_cs_dword(struct r300_winsys* winsys, uint32_t dword) { - radeon_cs_write_dword(winsys->cs, dword); + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + + radeon_cs_write_dword(priv->cs, dword); } static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, @@ -98,7 +104,10 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, uint32_t wd, uint32_t flags) { - radeon_cs_write_reloc(winsys->cs, + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + + radeon_cs_write_reloc(priv->cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); } @@ -107,19 +116,24 @@ static void radeon_r300_end_cs(struct r300_winsys* winsys, const char* function, int line) { - radeon_cs_end(winsys->cs, file, function, line); + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + + radeon_cs_end(priv->cs, file, function, line); } static void radeon_r300_flush_cs(struct r300_winsys* winsys) { + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; int retval = 0; - retval = radeon_cs_emit(winsys->cs); + retval = radeon_cs_emit(priv->cs); if (retval) { debug_printf("radeon: Bad CS, dumping...\n"); - radeon_cs_print(winsys->cs, stderr); + radeon_cs_print(priv->cs, stderr); } - radeon_cs_erase(winsys->cs); + radeon_cs_erase(priv->cs); } /* Helper function to do the ioctls needed for setup and init. */ @@ -169,20 +183,22 @@ struct r300_winsys* radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) { struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys); - struct radeon_cs_manager* csm; + struct radeon_winsys_priv* priv; if (winsys == NULL) { return NULL; } + priv = old_winsys->priv; + do_ioctls(winsys, fd); - csm = radeon_cs_manager_gem_ctor(fd); + priv->csm = radeon_cs_manager_gem_ctor(fd); - winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4); - radeon_cs_set_limit(winsys->cs, + priv->cs = radeon_cs_create(priv->csm, 1024 * 64 / 4); + radeon_cs_set_limit(priv->cs, RADEON_GEM_DOMAIN_GTT, winsys->gart_size); - radeon_cs_set_limit(winsys->cs, + radeon_cs_set_limit(priv->cs, RADEON_GEM_DOMAIN_VRAM, winsys->vram_size); winsys->add_buffer = radeon_r300_add_buffer; -- cgit v1.2.3 From 2953b180044df602fbbf5882715774a779ff2123 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 1 May 2009 07:29:14 -0700 Subject: radeon: Don't even bother with things too big to fit into our card. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index ac6cca36bf..da233203d7 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -60,7 +60,9 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); if (retval == RADEON_CS_SPACE_OP_TO_BIG) { - /* XXX we need to failover here */ + /* We might as well HCF, since this is not going to fit in the card, + * period. */ + exit(1); } else if (retval == RADEON_CS_SPACE_FLUSH) { /* We must flush before more rendering can commence. */ return TRUE; -- cgit v1.2.3 From edd2bbe4a70fcb9f8e8365f19c1aba6deb4a272d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 30 Apr 2009 17:27:51 -0600 Subject: docs: fix typo --- docs/relnotes-7.5.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index c10ccd7a5c..3de243d1b2 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -79,7 +79,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0

      • Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture extensions. Superseded by the ARB versions. -
      • Omittd some old Mesa demos from the release tarballs, added some others. +
      • Omitted some old Mesa demos from the release tarballs, added some others.
      -- cgit v1.2.3 From 3eafd25aa3b8d7680d3a0ac4869681e951484371 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:15:14 -0600 Subject: configs: bump MESA_MINOR to 5 --- configs/default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/default b/configs/default index eab36a3677..b5ef80afb3 100644 --- a/configs/default +++ b/configs/default @@ -9,7 +9,7 @@ CONFIG_NAME = default # Version info MESA_MAJOR=7 -MESA_MINOR=3 +MESA_MINOR=5 MESA_TINY=0 MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) -- cgit v1.2.3 From 8a488b1be720247339f5c86fea5d2bff3d0fe084 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:19:59 -0600 Subject: mesa: remove -devel suffix from version --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index f5bf6e2c85..ba027465d4 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 5 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5-devel" +#define MESA_VERSION_STRING "7.5" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 666e5bf4a6728484b4bc0c7e2583f141f1f2b2b7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:22:20 -0600 Subject: mesa: bump version to 7.6 (devel) --- Makefile | 2 +- configs/default | 2 +- src/mesa/main/version.h | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a77825e8f9..ab41116795 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ ultrix-gcc: # Rules for making release tarballs -VERSION=7.5-devel +VERSION=7.6-devel DIRECTORY = Mesa-$(VERSION) LIB_NAME = MesaLib-$(VERSION) DEMO_NAME = MesaDemos-$(VERSION) diff --git a/configs/default b/configs/default index b5ef80afb3..9c479fccdf 100644 --- a/configs/default +++ b/configs/default @@ -9,7 +9,7 @@ CONFIG_NAME = default # Version info MESA_MAJOR=7 -MESA_MINOR=5 +MESA_MINOR=6 MESA_TINY=0 MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index f5bf6e2c85..d4d3dd1a94 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.5 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -29,9 +30,9 @@ /* Mesa version */ #define MESA_MAJOR 7 -#define MESA_MINOR 5 +#define MESA_MINOR 6 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5-devel" +#define MESA_VERSION_STRING "7.6-devel" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 7ca04273387fb1af1b67d1359f2b0da4874a0e4c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:24:19 -0600 Subject: docs: initial 7.6 release notes page --- docs/relnotes-7.6.html | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/relnotes.html | 1 + 2 files changed, 62 insertions(+) create mode 100644 docs/relnotes-7.6.html diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html new file mode 100644 index 0000000000..77ce013d43 --- /dev/null +++ b/docs/relnotes-7.6.html @@ -0,0 +1,61 @@ + + +Mesa Release Notes + + + + + + + +

      Mesa 7.6 Release Notes / date TBD

      + +

      +Mesa 7.6 is a new development release. +People who are concerned with stability and reliability should stick +with a previous release or wait for Mesa 7.6.1. +

      +

      +Mesa 7.6 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

      +

      +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

      +

      +Note that the Mesa project is no longer using odd/even version numbers +to indicate development/stable releases. +The so-called development releases have been fairly stable. +If you're especially concerned with stability you should probably look for +"point" releases such as 7.5.1 which will be a bug-fix release. +

      + + +

      MD5 checksums

      +
      +tbd
      +
      + + +

      New features

      +
        +
      • OpenVG front-end (state tracker for Gallium). +This was written by Zack Rusin at Tungsten Graphics. +
      + + +

      Bug fixes

      +
        +
      • i965 DRI driver fixes, including support for "unlimited" size constant + buffers (GLSL uniforms) +
      + + +

      Changes

      +
        +
      + + + diff --git a/docs/relnotes.html b/docs/relnotes.html index 298352038c..936f565236 100644 --- a/docs/relnotes.html +++ b/docs/relnotes.html @@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.

        +
      • 7.6 release notes
      • 7.5 release notes
      • 7.4.1 release notes
      • 7.4 release notes -- cgit v1.2.3 From 3f25219c7bf0f090502489928f0f018e62c4f6cf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:30:32 -0600 Subject: mesa: create/use a fallback texture when bound texture is incomplete When a GLSL sampler reads from an incomplete texture it should return (0,0,0,1). Instead of jumping through hoops in all the drivers to make this happen, just create/install a fallback texture with those texel values. Fixes piglit/fp-incomplete-tex on i965 and more importantly, fixes some GPU lockups when trying to sample from missing surfaces. If a binding table entry is NULL, it seems that sampling sometimes works, but not always (lockup). Todo: create a fallback texture for each type of texture target? --- src/mesa/main/mtypes.h | 3 +++ src/mesa/main/texobj.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texobj.h | 3 +++ src/mesa/main/texstate.c | 9 ++++++-- 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 30c7cca3b5..38c3b1bb40 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2050,6 +2050,9 @@ struct gl_shared_state /** Default texture objects (shared by all texture units) */ struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS]; + /** Fallback texture used when a bound texture is incomplete */ + struct gl_texture_object *FallbackTex; + /** * \name Thread safety and statechange notification for texture * objects. diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b63f747fe8..0024efc0e6 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -662,6 +662,59 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } + +/** + * Return pointer to a default/fallback texture. + * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1). + * That's the value a sampler should get when sampling from an + * incomplete texture. + */ +struct gl_texture_object * +_mesa_get_fallback_texture(GLcontext *ctx) +{ + if (!ctx->Shared->FallbackTex) { + /* create fallback texture now */ + static GLubyte texels[8 * 8][4]; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLuint i; + + for (i = 0; i < 8 * 8; i++) { + texels[i][0] = + texels[i][1] = + texels[i][2] = 0x0; + texels[i][3] = 0xff; + } + + /* create texture object */ + texObj = ctx->Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D); + assert(texObj->RefCount == 1); + texObj->MinFilter = GL_NEAREST; + texObj->MagFilter = GL_NEAREST; + + /* create level[0] texture image */ + texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0); + + /* init the image fields */ + _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage, + 8, 8, 1, 0, GL_RGBA); + + /* set image data */ + ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA, + 8, 8, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texels, + &ctx->DefaultPacking, texObj, texImage); + + _mesa_test_texobj_completeness(ctx, texObj); + assert(texObj->_Complete); + + ctx->Shared->FallbackTex = texObj; + } + return ctx->Shared->FallbackTex; +} + + + /*@}*/ diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index d5374c5d6c..2599c0816a 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -65,6 +65,9 @@ extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); +extern struct gl_texture_object * +_mesa_get_fallback_texture(GLcontext *ctx); + extern void _mesa_unlock_context_textures( GLcontext *ctx ); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 73f8a5339e..32d55ba8d5 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -561,8 +561,13 @@ update_texture_state( GLcontext *ctx ) } if (!texUnit->_ReallyEnabled) { - _mesa_reference_texobj(&texUnit->_Current, NULL); - continue; + /* If we get here it means the shader (or fixed-function state) + * is expecting a texture object, but there isn't one (or it's + * incomplete). Use the fallback texture. + */ + struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); + texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + _mesa_reference_texobj(&texUnit->_Current, texObj); } /* if we get here, we know this texture unit is enabled */ -- cgit v1.2.3 From cd6734288ddc15a778def9578e128184b3f6bdea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 10:15:21 -0600 Subject: st: when double buffered, only create front color buffer on demand Before we always created the front color buffer, even if was never used. This can save some memory. --- src/mesa/state_tracker/st_cb_fbo.c | 101 ++++++++++++++++++++++++++++++++ src/mesa/state_tracker/st_framebuffer.c | 16 ++--- 2 files changed, 109 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 1590f275e2..0b88d9bf7e 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -452,6 +452,104 @@ st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) } +/** + * Check if we're drawing into, or read from, a front color buffer. If the + * front buffer is missing, create it now. + * + * The back color buffer must exist since we'll use its format/samples info + * for creating the front buffer. + * + * \param frontIndex either BUFFER_FRONT_LEFT or BUFFER_FRONT_RIGHT + * \param backIndex either BUFFER_BACK_LEFT or BUFFER_BACK_RIGHT + */ +static void +check_create_front_buffer(GLcontext *ctx, struct gl_framebuffer *fb, + gl_buffer_index frontIndex, + gl_buffer_index backIndex) +{ + if (fb->Attachment[frontIndex].Renderbuffer == NULL) { + GLboolean create = GL_FALSE; + + /* check if drawing to or reading from front buffer */ + if (fb->_ColorReadBufferIndex == frontIndex) { + create = GL_TRUE; + } + else { + GLuint b; + for (b = 0; b < fb->_NumColorDrawBuffers; b++) { + if (fb->_ColorDrawBufferIndexes[b] == frontIndex) { + create = GL_TRUE; + break; + } + } + } + + if (create) { + struct st_renderbuffer *back; + struct gl_renderbuffer *front; + enum pipe_format colorFormat; + uint samples; + + if (0) + _mesa_debug(ctx, "Allocate new front buffer"); + + /* get back renderbuffer info */ + back = st_renderbuffer(fb->Attachment[backIndex].Renderbuffer); + colorFormat = back->format; + samples = back->Base.NumSamples; + + /* create front renderbuffer */ + front = st_new_renderbuffer_fb(colorFormat, samples); + _mesa_add_renderbuffer(fb, frontIndex, front); + + /* alloc texture/surface for new front buffer */ + front->AllocStorage(ctx, front, front->InternalFormat, + fb->Width, fb->Height); + } + } +} + + +/** + * If front left/right color buffers are missing, create them now. + */ +static void +check_create_front_buffers(GLcontext *ctx, struct gl_framebuffer *fb) +{ + /* check if we need to create the front left buffer now */ + check_create_front_buffer(ctx, fb, BUFFER_FRONT_LEFT, BUFFER_BACK_LEFT); + + if (fb->Visual.stereoMode) { + check_create_front_buffer(ctx, fb, BUFFER_FRONT_RIGHT, BUFFER_BACK_RIGHT); + } + + st_invalidate_state(ctx, _NEW_BUFFERS); +} + + +/** + * Called via glDrawBuffer. + */ +static void +st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers) +{ + (void) count; + (void) buffers; + check_create_front_buffers(ctx, ctx->DrawBuffer); +} + + +/** + * Called via glReadBuffer. + */ +static void +st_ReadBuffer(GLcontext *ctx, GLenum buffer) +{ + (void) buffer; + check_create_front_buffers(ctx, ctx->ReadBuffer); +} + + void st_init_fbo_functions(struct dd_function_table *functions) { functions->NewFramebuffer = st_new_framebuffer; @@ -464,4 +562,7 @@ void st_init_fbo_functions(struct dd_function_table *functions) /* no longer needed by core Mesa, drivers handle resizes... functions->ResizeBuffers = st_resize_buffers; */ + + functions->DrawBuffers = st_DrawBuffers; + functions->ReadBuffer = st_ReadBuffer; } diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index daaad65cca..6ad64739bd 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -58,19 +58,19 @@ st_create_framebuffer( const __GLcontextModes *visual, _mesa_initialize_framebuffer(&stfb->Base, visual); - { - /* fake frontbuffer */ - /* XXX allocation should only happen in the unusual case - it's actually needed */ + if (visual->doubleBufferMode) { struct gl_renderbuffer *rb = st_new_renderbuffer_fb(colorFormat, samples); - _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb); } - - if (visual->doubleBufferMode) { + else { + /* Only allocate front buffer right now if we're single buffered. + * If double-buffered, allocate front buffer on demand later. + * See check_create_front_buffers(). + */ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(colorFormat, samples); - _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); } if (depthFormat == stencilFormat && depthFormat != PIPE_FORMAT_NONE) { -- cgit v1.2.3 From 2085cf24628be7cd297ab0f9ef5ce02bd5a006e2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Apr 2009 10:08:57 -0700 Subject: Test either GL_FRONT_LEFT or GL_FRONT for front-buffer rendering For non-stereo visuals, which is all we support, we treat GL_FRONT_LEFT as GL_FRONT. However, they are technically different, and they have different enum values. Test for either one to determine if we're in front-buffer rendering mode. This fix was suggested by Pierre Willenbrock. Signed-off-by: Ian Romanick --- src/mesa/drivers/dri/intel/intel_buffers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index ecac5bf020..b86cafea24 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -326,7 +326,8 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) const GLboolean was_front_buffer_rendering = intel->is_front_buffer_rendering; - intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT); + intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) + || (mode == GL_FRONT); /* If we weren't front-buffer rendering before but we are now, make sure * that the front-buffer has actually been allocated. -- cgit v1.2.3 From 293f576db7cf3f411c2eeb0a72232d25b631dcd1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Mar 2009 19:18:06 +0000 Subject: egl_xlib: Pass RTLD_LAZY to dlopen. dlopen manpage mandates that either RTLD_LAZY or RTLD_NOW flags must be passed. Not doing so was causing a NULL return on debian unstable x86-64. --- src/gallium/winsys/egl_xlib/egl_xlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index b52f427e4a..c10e3c00ff 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -588,7 +588,9 @@ find_supported_apis(void) EGLint mask = 0; void *handle; - handle = dlopen(NULL, 0); + handle = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL); + if(!handle) + return mask; if (dlsym(handle, "st_api_OpenGL_ES1")) mask |= EGL_OPENGL_ES_BIT; -- cgit v1.2.3 From fbceedd2dee967b426ee187205941c6506769ea5 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 1 May 2009 12:50:38 -0400 Subject: actually add debug to the debug config --- configs/linux-x86-64-debug | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/linux-x86-64-debug b/configs/linux-x86-64-debug index 46e72c990a..6f631c0e87 100644 --- a/configs/linux-x86-64-debug +++ b/configs/linux-x86-64-debug @@ -4,4 +4,5 @@ include $(TOP)/configs/linux-x86-64 CONFIG_NAME = linux-x86-64-debug +OPT_FLAGS = -g DEFINES += -DDEBUG -DDEBUG_MATH -- cgit v1.2.3 From 3534539557350f4a63c6e8b3a48fbc8cacffe199 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 10:50:04 -0600 Subject: set: new st_swapbuffers() which does a true front/back buffer swap The pointers to the front/back renderbuffers are exchanged. This new function isn't actually used yet... --- src/mesa/state_tracker/st_framebuffer.c | 79 +++++++++++++++++++++++++++++++++ src/mesa/state_tracker/st_public.h | 4 ++ 2 files changed, 83 insertions(+) diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 6ad64739bd..07ccaa6aab 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -293,6 +293,85 @@ st_notify_swapbuffers(struct st_framebuffer *stfb) } +/** + * Swap the front/back color buffers. Exchange the front/back pointers + * and update some derived state. + * No need to call st_notify_swapbuffers() first. + * This is effectively a no-op for single-buffered framebuffers. + * \param front_left returns pointer to front-left renderbuffer after swap + * \param front_right returns pointer to front-right renderbuffer after swap + */ +void +st_swapbuffers(struct st_framebuffer *stfb, + struct pipe_surface **front_left, + struct pipe_surface **front_right) +{ + struct gl_framebuffer *fb = &stfb->Base; + + GET_CURRENT_CONTEXT(ctx); + + if (ctx && ctx->DrawBuffer == &stfb->Base) { + st_flush( ctx->st, + PIPE_FLUSH_RENDER_CACHE | + PIPE_FLUSH_SWAPBUFFERS | + PIPE_FLUSH_FRAME, + NULL ); + } + + /* swap left buffers */ + if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer && + fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer) { + struct gl_renderbuffer *rbTemp; + rbTemp = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; + fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer = + fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer; + fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer = rbTemp; + if (front_left) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + *front_left = strb->surface; + } + } + else { + /* no front buffer, display the back buffer */ + if (front_left) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); + *front_left = strb->surface; + } + } + + /* swap right buffers (for stereo) */ + if (fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer && + fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer) { + struct gl_renderbuffer *rbTemp; + rbTemp = fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer; + fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer = + fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer; + fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer = rbTemp; + if (front_right) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer); + *front_right = strb->surface; + } + } + else { + /* no front right buffer, display back right buffer (if exists) */ + if (front_right) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer); + *front_right = strb ? strb->surface : NULL; + } + } + + /* Update the _ColorDrawBuffers[] array and _ColorReadBuffer pointer */ + _mesa_update_framebuffer(ctx); + + /* Make sure we draw into the new back surface */ + st_invalidate_state(ctx, _NEW_BUFFERS); +} + + void *st_framebuffer_private( struct st_framebuffer *stfb ) { return stfb->Private; diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 290b8a974e..174fbc6394 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -103,6 +103,10 @@ void st_finish( struct st_context *st ); void st_notify_swapbuffers(struct st_framebuffer *stfb); +void st_swapbuffers(struct st_framebuffer *stfb, + struct pipe_surface **front_left, + struct pipe_surface **front_right); + int st_set_teximage(struct pipe_texture *pt, int target); /** Redirect rendering into stfb's surface to a texture image */ -- cgit v1.2.3 From 36edcebb9012f530a9288956a7fd3b21f9bb8aed Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Tue, 28 Apr 2009 21:03:12 -0700 Subject: Fix symbol list for mangled Mesa on Darwin. When building mangled Mesa on Darwin, the exported symbols are named `_mgluWhatever' instead of simply `_gluWhatever'. When using a list of exported symbols via the system ld's `-exported_symbols_list' command line option (as done by mklib), this resulted in error messages about exporting symbols which do not exist. Fortunately the file format accepts simple wildcards. This throws a wildcard so that the symbol list will match both the mangled and non-mangled names, preventing the warning and actually exporting the correct symbols in one shot. --- src/glu/sgi/glu.exports.darwin | 118 ++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/glu/sgi/glu.exports.darwin b/src/glu/sgi/glu.exports.darwin index 62d20ae1fb..4f56e36f3b 100644 --- a/src/glu/sgi/glu.exports.darwin +++ b/src/glu/sgi/glu.exports.darwin @@ -1,59 +1,59 @@ -_gluBeginCurve -_gluBeginPolygon -_gluBeginSurface -_gluBeginTrim -_gluBuild1DMipmapLevels -_gluBuild1DMipmaps -_gluBuild2DMipmapLevels -_gluBuild2DMipmaps -_gluBuild3DMipmapLevels -_gluBuild3DMipmaps -_gluCheckExtension -_gluCylinder -_gluDeleteNurbsRenderer -_gluDeleteQuadric -_gluDeleteTess -_gluDisk -_gluEndCurve -_gluEndPolygon -_gluEndSurface -_gluEndTrim -_gluErrorString -_gluGetNurbsProperty -_gluGetString -_gluGetTessProperty -_gluLoadSamplingMatrices -_gluLookAt -_gluNewNurbsRenderer -_gluNewQuadric -_gluNewTess -_gluNextContour -_gluNurbsCallback -_gluNurbsCallbackData -_gluNurbsCallbackDataEXT -_gluNurbsCurve -_gluNurbsProperty -_gluNurbsSurface -_gluOrtho2D -_gluPartialDisk -_gluPerspective -_gluPickMatrix -_gluProject -_gluPwlCurve -_gluQuadricCallback -_gluQuadricDrawStyle -_gluQuadricNormals -_gluQuadricOrientation -_gluQuadricTexture -_gluScaleImage -_gluSphere -_gluTessBeginContour -_gluTessBeginPolygon -_gluTessCallback -_gluTessEndContour -_gluTessEndPolygon -_gluTessNormal -_gluTessProperty -_gluTessVertex -_gluUnProject -_gluUnProject4 +_*gluBeginCurve +_*gluBeginPolygon +_*gluBeginSurface +_*gluBeginTrim +_*gluBuild1DMipmapLevels +_*gluBuild1DMipmaps +_*gluBuild2DMipmapLevels +_*gluBuild2DMipmaps +_*gluBuild3DMipmapLevels +_*gluBuild3DMipmaps +_*gluCheckExtension +_*gluCylinder +_*gluDeleteNurbsRenderer +_*gluDeleteQuadric +_*gluDeleteTess +_*gluDisk +_*gluEndCurve +_*gluEndPolygon +_*gluEndSurface +_*gluEndTrim +_*gluErrorString +_*gluGetNurbsProperty +_*gluGetString +_*gluGetTessProperty +_*gluLoadSamplingMatrices +_*gluLookAt +_*gluNewNurbsRenderer +_*gluNewQuadric +_*gluNewTess +_*gluNextContour +_*gluNurbsCallback +_*gluNurbsCallbackData +_*gluNurbsCallbackDataEXT +_*gluNurbsCurve +_*gluNurbsProperty +_*gluNurbsSurface +_*gluOrtho2D +_*gluPartialDisk +_*gluPerspective +_*gluPickMatrix +_*gluProject +_*gluPwlCurve +_*gluQuadricCallback +_*gluQuadricDrawStyle +_*gluQuadricNormals +_*gluQuadricOrientation +_*gluQuadricTexture +_*gluScaleImage +_*gluSphere +_*gluTessBeginContour +_*gluTessBeginPolygon +_*gluTessCallback +_*gluTessEndContour +_*gluTessEndPolygon +_*gluTessNormal +_*gluTessProperty +_*gluTessVertex +_*gluUnProject +_*gluUnProject4 -- cgit v1.2.3 From 30b3d800917cc5b41ec508fd38a0ae1da8624a36 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 12:12:43 -0600 Subject: mesa: fix comment --- src/mesa/main/mtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 38c3b1bb40..cf71077728 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1028,7 +1028,7 @@ struct gl_stencil_attrib /** * An index for each type of texture object. These correspond to the GL - * target target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. + * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. * Note: the order is from highest priority to lowest priority. */ typedef enum -- cgit v1.2.3 From b85b315ebbe25efbd118887bdc87a562d4334fcc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 12:25:42 -0600 Subject: st: added st_renderbuffer::defined flag Indicates whether there's defined image contents, or garbage/don't care. This is set when we draw into a renderbuffer and cleared when we resize/ reallocate a renderbuffer or do a buffer swap (back buffer becomes undefined). We use this to determine whether the front color buffer has been drawn to, and whether to display its contents upon glFlush/Finish(), when the new st_swapbuffers() function is used. --- src/mesa/state_tracker/st_atom_framebuffer.c | 1 + src/mesa/state_tracker/st_cb_fbo.c | 2 ++ src/mesa/state_tracker/st_cb_fbo.h | 1 + src/mesa/state_tracker/st_cb_flush.c | 11 ++++++++++- src/mesa/state_tracker/st_context.h | 3 ++- src/mesa/state_tracker/st_framebuffer.c | 12 ++++++++++++ 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index df0f0931ea..f23186c73d 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -123,6 +123,7 @@ update_framebuffer_state( struct st_context *st ) framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface; framebuffer->nr_cbufs++; } + strb->defined = GL_TRUE; /* we'll be drawing something */ } } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 0b88d9bf7e..fe9befaa2c 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -125,6 +125,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, strb->Base.Height = height; init_renderbuffer_bits(strb, template.format); + strb->defined = GL_FALSE; /* undefined contents now */ + /* Probably need dedicated flags for surface usage too: */ surface_usage = (PIPE_BUFFER_USAGE_GPU_READ | diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 44fa9fe9a4..fd77d0a95b 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -44,6 +44,7 @@ struct st_renderbuffer struct pipe_texture *texture; struct pipe_surface *surface; /* temporary view into texture */ enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */ + GLboolean defined; /**< defined contents? */ struct st_texture_object *rtt; /**< GL render to texture's texture */ int rtt_level, rtt_face, rtt_slice; diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index fbaffd154f..8ceeeabcd3 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -47,10 +47,19 @@ #include "util/u_blit.h" +/** Check if we have a front color buffer and if it's been drawn to. */ static INLINE GLboolean is_front_buffer_dirty(struct st_context *st) { - return st->frontbuffer_status == FRONT_STATUS_DIRTY; + if (st->frontbuffer_status == FRONT_STATUS_DIRTY) { + return GL_TRUE; + } + else { + GLframebuffer *fb = st->ctx->DrawBuffer; + struct st_renderbuffer *strb + = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + return strb && strb->defined; + } } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 6ffed56d9a..18adb35e87 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -45,6 +45,7 @@ struct blit_state; struct bitmap_cache; +/** XXX we'd like to get rid of these */ #define FRONT_STATUS_UNDEFINED 0 #define FRONT_STATUS_DIRTY 1 #define FRONT_STATUS_COPY_OF_BACK 2 @@ -111,7 +112,7 @@ struct st_context struct gl_fragment_program *fragment_program; } cb; - GLuint frontbuffer_status; /**< one of FRONT_STATUS_ */ + GLuint frontbuffer_status; /**< one of FRONT_STATUS_ (XXX to be removed) */ char vendor[100]; char renderer[100]; diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 07ccaa6aab..639373fff7 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -331,6 +331,12 @@ st_swapbuffers(struct st_framebuffer *stfb, st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); *front_left = strb->surface; } + /* mark back buffer contents as undefined */ + { + struct st_renderbuffer *back = + st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); + back->defined = GL_FALSE; + } } else { /* no front buffer, display the back buffer */ @@ -354,6 +360,12 @@ st_swapbuffers(struct st_framebuffer *stfb, st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer); *front_right = strb->surface; } + /* mark back buffer contents as undefined */ + { + struct st_renderbuffer *back = + st_renderbuffer(fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer); + back->defined = GL_FALSE; + } } else { /* no front right buffer, display back right buffer (if exists) */ -- cgit v1.2.3 From 3f52a853f795d7432b181de81da6f0c4cf1cc202 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 12:48:46 -0600 Subject: st: when creating an on-demand front color buffer, init to back buffer image When we create a new front color buffer (user called glDrawBuffer(GL_FRONT)) initialize it to the contents of the back buffer. Any previous call to SwapBuffers() would have done that in effect, so make it reality. --- src/mesa/state_tracker/st_cb_fbo.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fe9befaa2c..9ae4208a18 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -454,6 +454,31 @@ st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) } +/** + * Copy back color buffer to front color buffer. + */ +static void +copy_back_to_front(struct st_context *st, + struct gl_framebuffer *fb, + gl_buffer_index frontIndex, + gl_buffer_index backIndex) + +{ + struct st_framebuffer *stfb = (struct st_framebuffer *) fb; + struct pipe_surface *surf_front, *surf_back; + + (void) st_get_framebuffer_surface(stfb, frontIndex, &surf_front); + (void) st_get_framebuffer_surface(stfb, backIndex, &surf_back); + + if (surf_front && surf_back) { + st->pipe->surface_copy(st->pipe, + surf_front, 0, 0, /* dest */ + surf_back, 0, 0, /* src */ + fb->Width, fb->Height); + } +} + + /** * Check if we're drawing into, or read from, a front color buffer. If the * front buffer is missing, create it now. @@ -493,7 +518,7 @@ check_create_front_buffer(GLcontext *ctx, struct gl_framebuffer *fb, uint samples; if (0) - _mesa_debug(ctx, "Allocate new front buffer"); + _mesa_debug(ctx, "Allocate new front buffer\n"); /* get back renderbuffer info */ back = st_renderbuffer(fb->Attachment[backIndex].Renderbuffer); @@ -507,6 +532,11 @@ check_create_front_buffer(GLcontext *ctx, struct gl_framebuffer *fb, /* alloc texture/surface for new front buffer */ front->AllocStorage(ctx, front, front->InternalFormat, fb->Width, fb->Height); + + /* initialize the front color buffer contents by copying + * the back buffer. + */ + copy_back_to_front(ctx->st, fb, frontIndex, backIndex); } } } -- cgit v1.2.3 From b57b6c2d2c83aee96f945ce3385a1ab8337335cb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 12:28:57 -0600 Subject: xlib winsys: use new st_swapbuffers() function The front/back buffer pointers are truly swapped (when there is an actual front buffer). This fixes some issues seen with apps/tests that draw to both the front and back color buffers. The true swap allows us to avoid the (potentially) slow surface_copy() call in update_framebuffer_state() and is cleaner overall. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index a3d1651653..79c2230588 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -1100,26 +1100,19 @@ XMesaContext XMesaGetCurrentContext( void ) - - - -/* - * Copy the back buffer to the front buffer. If there's no back buffer - * this is a no-op. +/** + * Swap front and back color buffers and have winsys display front buffer. + * If there's no front color buffer no swap actually occurs. */ PUBLIC void XMesaSwapBuffers( XMesaBuffer b ) { - struct pipe_surface *surf; + struct pipe_surface *frontLeftSurf; - /* If we're swapping the buffer associated with the current context - * we have to flush any pending rendering commands first. - */ - st_notify_swapbuffers(b->stfb); + st_swapbuffers(b->stfb, &frontLeftSurf, NULL); - st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT, &surf); - if (surf) { - driver.display_surface(b, surf); + if (frontLeftSurf) { + driver.display_surface(b, frontLeftSurf); } xmesa_check_and_update_buffer_size(NULL, b); -- cgit v1.2.3 From 602833b107cdf3d70117dbd0970c7d574fb55f3b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 16:44:04 -0600 Subject: st: if st_swapbuffers() is called for single-buffered visual don't crash Furthermore, return pointer(s) to the front color buffer(s). --- src/mesa/state_tracker/st_framebuffer.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 639373fff7..ef800291cc 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -297,7 +297,10 @@ st_notify_swapbuffers(struct st_framebuffer *stfb) * Swap the front/back color buffers. Exchange the front/back pointers * and update some derived state. * No need to call st_notify_swapbuffers() first. - * This is effectively a no-op for single-buffered framebuffers. + * + * For a single-buffered framebuffer, no swap occurs, but we still return + * the pointer(s) to the front color buffer(s). + * * \param front_left returns pointer to front-left renderbuffer after swap * \param front_right returns pointer to front-right renderbuffer after swap */ @@ -318,6 +321,21 @@ st_swapbuffers(struct st_framebuffer *stfb, NULL ); } + if (!fb->Visual.doubleBufferMode) { + /* single buffer mode - return pointers to front surfaces */ + if (front_left) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + *front_left = strb->surface; + } + if (front_right) { + struct st_renderbuffer *strb = + st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer); + *front_right = strb ? strb->surface : NULL; + } + return; + } + /* swap left buffers */ if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer && fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer) { -- cgit v1.2.3 From 63f01309801c5a900d8d7f5ccd63413e33ff9bff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 18:04:07 -0600 Subject: mesa: fix state validation bug for glCopyTex[Sub]Image() We need to make sure the framebuffer state is up to date to make sure we read pixels from the right buffer when doing a texture image copy. --- src/mesa/main/teximage.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8c03c36c75..76b46d700b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -51,6 +51,17 @@ #include "mtypes.h" +/** + * State changes which we care about for glCopyTex[Sub]Image() calls. + * In particular, we care about pixel transfer state and buffer state + * (such as glReadBuffer to make sure we read from the right renderbuffer). + */ +#define NEW_COPY_TEX_STATE (_MESA_NEW_TRANSFER_STATE | \ + _NEW_BUFFERS | \ + _NEW_PIXEL) + + + /** * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE * elsewhere. @@ -3008,7 +3019,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); #if FEATURE_convolve @@ -3073,7 +3084,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); #if FEATURE_convolve @@ -3141,7 +3152,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); if (copytexsubimage_error_check1(ctx, 1, target, level)) @@ -3196,7 +3207,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); if (copytexsubimage_error_check1(ctx, 2, target, level)) @@ -3251,7 +3262,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); if (copytexsubimage_error_check1(ctx, 3, target, level)) -- cgit v1.2.3 From 0a56a4968786bd93d9117af2a0a3bda13ea71c4d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 18:17:34 -0600 Subject: st: create renderbuffer's pipe_surface in st_render_texture() Previously we created the pipe_surface during framebuffer validation. But if we did a glCopyTex[Sub]Image() before anything else we wouldn't yet have the surface. This fixes that. --- src/mesa/state_tracker/st_cb_fbo.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 1590f275e2..e003b6db5c 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -343,6 +343,7 @@ st_render_texture(GLcontext *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { + struct pipe_screen *screen = ctx->st->pipe->screen; struct st_renderbuffer *strb; struct gl_renderbuffer *rb; struct pipe_texture *pt = st_get_texobj_texture(att->Texture); @@ -365,6 +366,8 @@ st_render_texture(GLcontext *ctx, rb->AllocStorage = NULL; /* should not get called */ strb = st_renderbuffer(rb); + assert(strb->Base.RefCount > 0); + /* get the texture for the texture object */ stObj = st_texture_object(att->Texture); @@ -384,7 +387,14 @@ st_render_texture(GLcontext *ctx, pipe_surface_reference(&strb->surface, NULL); - /* the new surface will be created during framebuffer validation */ + /* new surface for rendering into the texture */ + strb->surface = screen->get_tex_surface(screen, + strb->texture, + strb->rtt_face, + strb->rtt_level, + strb->rtt_slice, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); init_renderbuffer_bits(strb, pt->format); -- cgit v1.2.3 From 62043b27575c378c027251316421e4699f461108 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 18:31:04 -0600 Subject: mesa: in glReadBufer() set _NEW_BUFFERS, not _NEW_PIXEL Since GL_READ_BUFFER is historically part of the gl_pixel_attrib group it made sense to signal changes with _NEW_PIXEL. But now with FBOs it's also part of the framebuffer state. Now _NEW_PIXEL strictly indicates pixels transfer state changes. This change avoids framebuffer state validation when any random bit of pixel-transfer state is set. DRI drivers updated too: don't check _NEW_COLOR when updating framebuffer state. I think that was just copied from the Xlib driver because we care about dither enable/disable state there. --- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- src/mesa/drivers/dri/r200/r200_state.c | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/radeon/radeon_state.c | 2 +- src/mesa/drivers/x11/xm_dd.c | 3 ++- src/mesa/main/buffers.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index b86cafea24..4f4ea45b74 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -157,7 +157,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) /* Do this here, not core Mesa, since this function is called from * many places within the driver. */ - if (ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (ctx->NewState & _NEW_BUFFERS) { /* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */ _mesa_update_framebuffer(ctx); /* this updates the DrawBuffer's Width/Height if it's a FBO */ diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 28ba5f49bc..81ee1ed022 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2480,7 +2480,7 @@ void r200ValidateState( GLcontext *ctx ) r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint new_state = rmesa->NewGLState; - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { r200UpdateDrawBuffer(ctx); } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index b96ba4ed94..07299f3b36 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2589,7 +2589,7 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) _tnl_InvalidateState(ctx, new_state); _ae_invalidate_state(ctx, new_state); - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { r300UpdateDrawBuffer(ctx); } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index b6561001e7..4432f85691 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2255,7 +2255,7 @@ void radeonValidateState( GLcontext *ctx ) radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLuint new_state = rmesa->NewGLState; - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { radeonUpdateDrawBuffer(ctx); } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 305df548fa..9a01465bdf 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -912,8 +912,9 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) /* * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect * renderbuffer span/clear funcs. + * Check _NEW_COLOR to detect dither enable/disable. */ - if (new_state & (_NEW_COLOR | _NEW_PIXEL | _NEW_BUFFERS)) { + if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); struct xmesa_renderbuffer *front_xrb, *back_xrb; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c5f13345f0..d8b5f3b1f4 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -443,7 +443,7 @@ _mesa_readbuffer(GLcontext *ctx, GLenum buffer, GLint bufferIndex) fb->ColorReadBuffer = buffer; fb->_ColorReadBufferIndex = bufferIndex; - ctx->NewState |= _NEW_PIXEL; + ctx->NewState |= _NEW_BUFFERS; } -- cgit v1.2.3 From 08bc3d175069988dd41433fdb7362863bcf67573 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 23 Apr 2009 10:24:19 -0600 Subject: gallium/glx: say we're direct rendering --- src/gallium/state_trackers/glx/xlib/fakeglx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/glx/xlib/fakeglx.c b/src/gallium/state_trackers/glx/xlib/fakeglx.c index 65e7048188..85e7ecfb9e 100644 --- a/src/gallium/state_trackers/glx/xlib/fakeglx.c +++ b/src/gallium/state_trackers/glx/xlib/fakeglx.c @@ -97,6 +97,9 @@ struct fake_glx_context { +#define DEFAULT_DIRECT GL_TRUE + + /**********************************************************************/ /*** GLX Visual Code ***/ /**********************************************************************/ @@ -1059,7 +1062,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo, return NULL; } - glxCtx->glxContext.isDirect = GL_FALSE; + glxCtx->glxContext.isDirect = DEFAULT_DIRECT; glxCtx->glxContext.currentDpy = dpy; glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */ @@ -1296,9 +1299,9 @@ Fake_glXDestroyContext( Display *dpy, GLXContext ctx ) static Bool Fake_glXIsDirect( Display *dpy, GLXContext ctx ) { - (void) dpy; + struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx; (void) ctx; - return False; + return glxCtx->glxContext.isDirect; } @@ -2055,7 +2058,7 @@ Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config, return NULL; } - glxCtx->glxContext.isDirect = GL_FALSE; + glxCtx->glxContext.isDirect = DEFAULT_DIRECT; glxCtx->glxContext.currentDpy = dpy; glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */ @@ -2277,7 +2280,7 @@ Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int re return NULL; } - glxCtx->glxContext.isDirect = GL_FALSE; + glxCtx->glxContext.isDirect = DEFAULT_DIRECT; glxCtx->glxContext.currentDpy = dpy; glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */ -- cgit v1.2.3 From 986d4a9ec60ee52067b2d6f81c05f8ec3b8dc8b1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 17:52:23 -0600 Subject: draw: added some inf/nan debug code (disabled) --- src/gallium/auxiliary/draw/draw_vs_exec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c index dbbc33fffa..f2368dde5c 100644 --- a/src/gallium/auxiliary/draw/draw_vs_exec.c +++ b/src/gallium/auxiliary/draw/draw_vs_exec.c @@ -114,6 +114,12 @@ vs_exec_run_linear( struct draw_vertex_shader *shader, #endif for (slot = 0; slot < shader->info.num_inputs; slot++) { +#if 0 + assert(!util_is_inf_or_nan(input[slot][0])); + assert(!util_is_inf_or_nan(input[slot][1])); + assert(!util_is_inf_or_nan(input[slot][2])); + assert(!util_is_inf_or_nan(input[slot][3])); +#endif machine->Inputs[slot].xyzw[0].f[j] = input[slot][0]; machine->Inputs[slot].xyzw[1].f[j] = input[slot][1]; machine->Inputs[slot].xyzw[2].f[j] = input[slot][2]; -- cgit v1.2.3 From dd4c142e90a0cba5b445990bb522ce9199d7f565 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 4 May 2009 07:52:55 -0600 Subject: glx: replace Xmalloc() calls with Xcalloc() Fixes a bug where psp->WaitX was uninitialized. Reported by Chris Clayton. --- src/glx/x11/dri_glx.c | 2 +- src/glx/x11/drisw_glx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 87d62ad846..3ce410d9be 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -614,7 +614,7 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen, char *driverName; int i; - psp = Xmalloc(sizeof *psp); + psp = Xcalloc(1, sizeof *psp); if (psp == NULL) return NULL; diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index 35bbd9151c..5e3d763cff 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -359,7 +359,7 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, const char *driverName = "swrast"; int i; - psp = Xmalloc(sizeof *psp); + psp = Xcalloc(1, sizeof *psp); if (psp == NULL) return NULL; -- cgit v1.2.3 From 0b22615c2c860968a027c04519e25864ae69f6cd Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 2 May 2009 17:27:03 +0200 Subject: r300: set proper texture row alignment for IGP chips Looks like r400 based IGP chips require 64 byte alignment --- src/mesa/drivers/dri/r300/r300_context.c | 5 +++++ src/mesa/drivers/dri/radeon/radeon_common_context.c | 2 ++ src/mesa/drivers/dri/radeon/radeon_common_context.h | 1 + src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 11 ++++++----- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 4d1f10ba4d..70c7730be9 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -412,6 +412,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, if (r300->radeon.radeonScreen->kernel_mm) driInitExtensions(ctx, mm_extensions, GL_FALSE); + if (screen->chip_family == CHIP_FAMILY_RS600 || screen->chip_family == CHIP_FAMILY_RS690 || + screen->chip_family == CHIP_FAMILY_RS740) { + r300->radeon.texture_row_align = 64; + } + r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, "def_max_anisotropy"); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index ba74c97f2c..3e713628ec 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -177,6 +177,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->texture_depth = ( glVisual->rgbBits > 16 ) ? DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16; + radeon->texture_row_align = 32; + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index d32e5af544..181688cbe4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -421,6 +421,7 @@ struct radeon_context { */ int texture_depth; float initialMaxAnisotropy; + uint32_t texture_row_align; struct radeon_dma dma; struct radeon_hw_state hw; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 34d6261706..51538e37fa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -86,10 +86,11 @@ static int radeon_compressed_num_bytes(GLuint mesaFormat) * \param curOffset points to the offset at which the image is to be stored * and is updated by this function according to the size of the image. */ -static void compute_tex_image_offset(radeon_mipmap_tree *mt, +static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree *mt, GLuint face, GLuint level, GLuint* curOffset) { radeon_mipmap_level *lvl = &mt->levels[level]; + uint32_t row_align = rmesa->texture_row_align - 1; /* Find image size in bytes */ if (mt->compressed) { @@ -107,7 +108,7 @@ static void compute_tex_image_offset(radeon_mipmap_tree *mt, lvl->rowstride = (lvl->width * mt->bpp * 2 + 31) & ~31; lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth; } else { - lvl->rowstride = (lvl->width * mt->bpp + 31) & ~31; + lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align; lvl->size = lvl->rowstride * lvl->height * lvl->depth; } assert(lvl->size > 0); @@ -131,7 +132,7 @@ static GLuint minify(GLuint size, GLuint levels) return size; } -static void calculate_miptree_layout(radeon_mipmap_tree *mt) +static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { GLuint curOffset; GLuint numLevels; @@ -149,7 +150,7 @@ static void calculate_miptree_layout(radeon_mipmap_tree *mt) mt->levels[i].depth = minify(mt->depth0, i); for(face = 0; face < mt->faces; face++) - compute_tex_image_offset(mt, face, i, &curOffset); + compute_tex_image_offset(rmesa, mt, face, i, &curOffset); } /* Note the required size in memory */ @@ -181,7 +182,7 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj * mt->tilebits = tilebits; mt->compressed = compressed; - calculate_miptree_layout(mt); + calculate_miptree_layout(rmesa, mt); mt->bo = radeon_bo_open(rmesa->radeonScreen->bom, 0, mt->totalsize, 1024, -- cgit v1.2.3 From 27dbdb1684af42ce3e7962111fa0726cf7ba28d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 4 May 2009 11:13:35 -0600 Subject: mesa: remove some unfinished/devel code --- src/mesa/shader/prog_optimize.c | 92 ----------------------------------------- 1 file changed, 92 deletions(-) diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index a02f5efa41..be903106a0 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -812,98 +812,6 @@ _mesa_reallocate_registers(struct gl_program *prog) } - - - - - - -#if 0 -static void -_mesa_find_temporary_live_intervals(struct gl_program *prog, - GLint firstInst[MAX_PROGRAM_TEMPS], - GLint lastInst[MAX_PROGRAM_TEMPS]) -{ - GLuint i; - - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { - firstInst[i] = lastInst[i] = -1; - } - - struct loop_info loopStack[MAX_LOOP_NESTING]; - GLuint loopStackDepth = 0; - GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; - GLuint i; - - /* - * Note: we'll return GL_FALSE below if we find relative indexing - * into the TEMP register file. We can't handle that yet. - * We also give up on subroutines for now. - */ - - if (dbg) { - _mesa_printf("Optimize: Begin find intervals\n"); - } - - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ - intBegin[i] = intEnd[i] = -1; - } - - /* Scan instructions looking for temporary registers */ - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_BGNLOOP) { - loopStack[loopStackDepth].Start = i; - loopStack[loopStackDepth].End = inst->BranchTarget; - loopStackDepth++; - } - else if (inst->Opcode == OPCODE_ENDLOOP) { - loopStackDepth--; - } - else if (inst->Opcode == OPCODE_CAL) { - return GL_FALSE; - } - else { - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - GLuint j; - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { - const GLuint index = inst->SrcReg[j].Index; - if (inst->SrcReg[j].RelAddr) - return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } - } - } - if (inst->DstReg.File == PROGRAM_TEMPORARY) { - const GLuint index = inst->DstReg.Index; - if (inst->DstReg.RelAddr) - return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } - } - } - } - - - - -#endif - - - - - - - /** * Apply optimizations to the given program to eliminate unnecessary * instructions, temp regs, etc. -- cgit v1.2.3 From f95c0c06c0970d9a7700c7c8cea6396982b4b0dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 4 May 2009 11:14:35 -0600 Subject: mesa: also print program params/constants when dumping shaders to disk --- src/mesa/shader/prog_print.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 9967f2978d..e6f9a91069 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -941,6 +941,10 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) fprintf(f, "/*\n"); _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE); fprintf(f, "*/\n"); + fprintf(f, "/* Parameters / constants */\n"); + fprintf(f, "/*\n"); + _mesa_fprint_parameter_list(f, shader->Program->Parameters); + fprintf(f, "*/\n"); } fclose(f); -- cgit v1.2.3 From f616995e5ed56745c4470b2ca5aeeb8d89a8c9db Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 5 May 2009 10:51:44 +1000 Subject: radeon/r200: enable all the optional drm support bits --- src/mesa/drivers/dri/radeon/radeon_screen.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 70ae5d26e2..56dbe74688 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1073,6 +1073,15 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv) screen->kernel_mm = 1; screen->chip_flags = 0; + /* if we have kms we can support all of these */ + screen->drmSupportsCubeMapsR200 = 1; + screen->drmSupportsBlendColor = 1; + screen->drmSupportsTriPerf = 1; + screen->drmSupportsFragShader = 1; + screen->drmSupportsPointSprites = 1; + screen->drmSupportsCubeMapsR100 = 1; + screen->drmSupportsVertexProgram = 1; + ret = radeonGetParam(sPriv, RADEON_PARAM_IRQ_NR, &screen->irq); ret = radeonGetParam(sPriv, RADEON_PARAM_DEVICE_ID, &device_id); -- cgit v1.2.3 From 39ebeead56bddfd339b6b6b31dd1b52d96859d65 Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Tue, 5 May 2009 11:29:58 +0200 Subject: Fix an nv04 bug (thanks Mhopf). --- src/gallium/drivers/nv04/nv04_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h index 0d51439e3f..399f750dbe 100644 --- a/src/gallium/drivers/nv04/nv04_state.h +++ b/src/gallium/drivers/nv04/nv04_state.h @@ -37,7 +37,7 @@ struct nv04_miptree { struct { uint pitch; - uint image_offset; + uint *image_offset; } level[PIPE_MAX_TEXTURE_LEVELS]; }; -- cgit v1.2.3 From 8edb50ff1e87f9bb00ceeaa2fe13df212a91eb11 Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Tue, 5 May 2009 12:03:38 +0200 Subject: nv04: small fix again --- src/gallium/drivers/nv04/nv04_miptree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index 4da833c25e..93f752faec 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -31,7 +31,8 @@ nv04_miptree_layout(struct nv04_miptree *nv04mt) for (l = 0; l <= pt->last_level; l++) { - nv04mt->level[l].image_offset = offset; + nv04mt->level[l].image_offset = + CALLOC(nr_faces, sizeof(unsigned)); offset += nv04mt->level[l].pitch * pt->height[l]; } -- cgit v1.2.3 From 4fd6f296f8d3416472ec83374d459ecb12db60f4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 17:07:01 +0100 Subject: pb: Dump the fenced buffer sizes. --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 044e8e1dd3..4698efa69c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -531,16 +531,17 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) pipe_mutex_lock(fenced_list->mutex); - debug_printf("%10s %7s %10s %s\n", - "buffer", "reference.count", "fence", "signalled"); + debug_printf("%10s %7s %7s %10s %s\n", + "buffer", "size", "refcount", "fence", "signalled"); curr = fenced_list->unfenced.next; next = curr->next; while(curr != &fenced_list->unfenced) { fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); assert(!fenced_buf->fence); - debug_printf("%10p %7u\n", + debug_printf("%10p %7u %7u\n", fenced_buf, + fenced_buf->base.base.size, fenced_buf->base.base.reference.count); curr = next; next = curr->next; @@ -552,8 +553,9 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) int signaled; fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); signaled = ops->fence_signalled(ops, fenced_buf->fence, 0); - debug_printf("%10p %7u %10p %s\n", + debug_printf("%10p %7u %7u %10p %s\n", fenced_buf, + fenced_buf->base.base.size, fenced_buf->base.base.reference.count, fenced_buf->fence, signaled == 0 ? "y" : "n"); -- cgit v1.2.3 From a47f15ba1da4c7f8649d7064dfc23cf571df705c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 18:53:52 +0100 Subject: pb: Save the stack backtrace when creating/mapping a debug buffer. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 102 ++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index f1a05be46e..cedf745bda 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -40,6 +40,7 @@ #include "util/u_memory.h" #include "util/u_double_list.h" #include "util/u_time.h" +#include "util/u_debug_stack.h" #include "pb_buffer.h" #include "pb_bufmgr.h" @@ -48,6 +49,10 @@ #ifdef DEBUG +#define PB_DEBUG_CREATE_BACKTRACE 8 +#define PB_DEBUG_MAP_BACKTRACE 8 + + /** * Convenience macro (type safe). */ @@ -69,6 +74,14 @@ struct pb_debug_buffer size_t underflow_size; size_t overflow_size; + + struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE]; + + pipe_mutex mutex; + unsigned map_count; + struct debug_stack_frame map_backtrace[PB_DEBUG_MAP_BACKTRACE]; + + struct list_head head; }; @@ -80,6 +93,9 @@ struct pb_debug_manager size_t underflow_size; size_t overflow_size; + + pipe_mutex mutex; + struct list_head list; }; @@ -189,6 +205,9 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf) max_ofs == buf->overflow_size - 1 ? "+" : ""); } + if(underflow || overflow) + debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE); + debug_assert(!underflow && !overflow); /* re-fill if not aborted */ @@ -207,11 +226,18 @@ static void pb_debug_buffer_destroy(struct pb_buffer *_buf) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + struct pb_debug_manager *mgr = buf->mgr; assert(!pipe_is_referenced(&buf->base.base.reference)); pb_debug_buffer_check(buf); + pipe_mutex_lock(mgr->mutex); + LIST_DEL(&buf->head); + pipe_mutex_unlock(mgr->mutex); + + pipe_mutex_destroy(buf->mutex); + pb_reference(&buf->buffer, NULL); FREE(buf); } @@ -230,6 +256,13 @@ pb_debug_buffer_map(struct pb_buffer *_buf, if(!map) return NULL; + if(map) { + pipe_mutex_lock(buf->mutex); + ++buf->map_count; + debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE); + pipe_mutex_unlock(buf->mutex); + } + return (uint8_t *)map + buf->underflow_size; } @@ -238,6 +271,13 @@ static void pb_debug_buffer_unmap(struct pb_buffer *_buf) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + + pipe_mutex_lock(buf->mutex); + assert(buf->map_count); + if(buf->map_count) + --buf->map_count; + pipe_mutex_unlock(buf->mutex); + pb_unmap(buf->buffer); pb_debug_buffer_check(buf); @@ -262,6 +302,14 @@ pb_debug_buffer_validate(struct pb_buffer *_buf, { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + pipe_mutex_lock(buf->mutex); + if(buf->map_count) { + debug_printf("%s: attempting to validate a mapped buffer\n", __FUNCTION__); + debug_printf("last map backtrace is\n"); + debug_backtrace_dump(buf->map_backtrace, PB_DEBUG_MAP_BACKTRACE); + } + pipe_mutex_unlock(buf->mutex); + pb_debug_buffer_check(buf); return pb_validate(buf->buffer, vl, flags); @@ -288,6 +336,31 @@ pb_debug_buffer_vtbl = { }; +static void +pb_debug_manager_dump(struct pb_debug_manager *mgr) +{ + struct list_head *curr, *next; + struct pb_debug_buffer *buf; + + pipe_mutex_lock(mgr->mutex); + + curr = mgr->list.next; + next = curr->next; + while(curr != &mgr->list) { + buf = LIST_ENTRY(struct pb_debug_buffer, curr, head); + + debug_printf("buffer = %p\n", buf); + debug_printf(" .size = %p\n", buf->base.base.size); + debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE); + + curr = next; + next = curr->next; + } + + pipe_mutex_unlock(mgr->mutex); +} + + static struct pb_buffer * pb_debug_manager_create_buffer(struct pb_manager *_mgr, size_t size, @@ -312,6 +385,13 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, &real_desc); if(!buf->buffer) { FREE(buf); +#if 0 + pipe_mutex_lock(mgr->mutex); + debug_printf("%s: failed to create buffer\n", __FUNCTION__); + if(!LIST_IS_EMPTY(&mgr->list)) + pb_debug_manager_dump(mgr); + pipe_mutex_unlock(mgr->mutex); +#endif return NULL; } @@ -331,8 +411,16 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, buf->underflow_size = mgr->underflow_size; buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size; + debug_backtrace_capture(buf->create_backtrace, 1, PB_DEBUG_CREATE_BACKTRACE); + pb_debug_buffer_fill(buf); + pipe_mutex_init(buf->mutex); + + pipe_mutex_lock(mgr->mutex); + LIST_ADDTAIL(&buf->head, &mgr->list); + pipe_mutex_unlock(mgr->mutex); + return &buf->base; } @@ -351,6 +439,15 @@ static void pb_debug_manager_destroy(struct pb_manager *_mgr) { struct pb_debug_manager *mgr = pb_debug_manager(_mgr); + + pipe_mutex_lock(mgr->mutex); + if(!LIST_IS_EMPTY(&mgr->list)) { + debug_printf("%s: unfreed buffers\n", __FUNCTION__); + pb_debug_manager_dump(mgr); + } + pipe_mutex_unlock(mgr->mutex); + + pipe_mutex_destroy(mgr->mutex); mgr->provider->destroy(mgr->provider); FREE(mgr); } @@ -375,7 +472,10 @@ pb_debug_manager_create(struct pb_manager *provider, mgr->provider = provider; mgr->underflow_size = underflow_size; mgr->overflow_size = overflow_size; - + + pipe_mutex_init(mgr->mutex); + LIST_INITHEAD(&mgr->list); + return &mgr->base; } -- cgit v1.2.3 From ccec9f76d5ed032b627f5893f733ea0576311d51 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 19:46:56 +0100 Subject: wgl: UINT_PTR null value is an integral type, so return 0 instead of NULL. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 0b5dd78ec6..473e3308c6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -276,12 +276,12 @@ stw_get_current_context( void ) struct stw_context *ctx; if(!glcurctx) - return NULL; + return 0; ctx = (struct stw_context *)glcurctx->DriverCtx; assert(ctx); if(!ctx) - return NULL; + return 0; return ctx->hglrc; } -- cgit v1.2.3 From 4d548bd069220677b12630cbab6f8c228e3d3a6b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 29 Apr 2009 14:21:41 +0100 Subject: trivial: add line-flat.c --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/line-flat.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 progs/trivial/line-flat.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 69c71cbaf6..e255cdadc5 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -30,6 +30,7 @@ SOURCES = \ fs-tri.c \ line-clip.c \ line-cull.c \ + line-flat.c \ line-smooth.c \ line-stipple-wide.c \ line-userclip-clip.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 480630e210..0333418ad8 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -26,6 +26,7 @@ progs = [ 'fs-tri', 'line-clip', 'line-cull', + 'line-flat', 'line-smooth', 'line-stipple-wide', 'line-userclip-clip', diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c new file mode 100644 index 0000000000..14f0ac0782 --- /dev/null +++ b/progs/trivial/line-flat.c @@ -0,0 +1,147 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + + +#define CI_OFFSET_1 16 +#define CI_OFFSET_2 32 + + +GLenum doubleBuffer; + +static void Init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + glClearColor(0.0, 0.0, 1.0, 0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glShadeModel(GL_FLAT); + + glBegin(GL_LINES); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -30.0); + + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -30.0); + + + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -30.0); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -30.0); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From c6b3c2f34b5fdc30e679068d4e6130ba30efc1e4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 10:59:19 +0100 Subject: gallium/draw: cope with unused vertex_elements --- src/gallium/auxiliary/draw/draw_pt.h | 1 + src/gallium/auxiliary/draw/draw_pt_fetch.c | 8 +++++++- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 6f3e1e0289..8ef0ea8011 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -187,6 +187,7 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw ); struct pt_fetch; void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vertex_input_count, unsigned vertex_size ); void draw_pt_fetch_run( struct pt_fetch *fetch, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 505d32f2c3..65c3a34c34 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_math.h" #include "draw/draw_context.h" #include "draw/draw_private.h" #include "draw/draw_vbuf.h" @@ -56,9 +57,11 @@ struct pt_fetch { * */ void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vs_input_count, unsigned vertex_size ) { struct draw_context *draw = fetch->draw; + unsigned nr_inputs; unsigned i, nr = 0; unsigned dst_offset = 0; struct translate_key key; @@ -89,8 +92,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, dst_offset += 4 * sizeof(float); } + assert( draw->pt.nr_vertex_elements >= vs_input_count ); - for (i = 0; i < draw->pt.nr_vertex_elements; i++) { + nr_inputs = MIN2( vs_input_count, draw->pt.nr_vertex_elements ); + + for (i = 0; i < nr_inputs; i++) { key.element[nr].input_format = draw->pt.vertex_element[i].src_format; key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index; key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 11ac90fc56..df6c265b7e 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -77,8 +77,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, draw_pt_fetch_prepare( fpme->fetch, + vs->info.num_inputs, fpme->vertex_size ); - /* XXX: it's not really gl rasterization rules we care about here, * but gl vs dx9 clip spaces. */ -- cgit v1.2.3 From 6b89c35c9f6557a160c8fc0c97a110d3afe4c82f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 30 Apr 2009 12:24:08 +0100 Subject: wgl: Include alpha bits in pixel format's cColorBits field. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 9e642cbdd4..8d6955f390 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -158,7 +158,7 @@ stw_pixelformat_add( pfi->pfd.iPixelType = PFD_TYPE_RGBA; - pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue; + pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha; pfi->pfd.cRedBits = color->bits.red; pfi->pfd.cRedShift = color->shift.red; pfi->pfd.cGreenBits = color->bits.green; -- cgit v1.2.3 From 5f2569a1b997cf7577dc2d44e3670d0c55de905c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 12:35:59 +0100 Subject: progs/trivial: add vbo-noninterleaved test --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/vbo-noninterleaved.c | 139 +++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 progs/trivial/vbo-noninterleaved.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index e255cdadc5..69b0408bbd 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -139,6 +139,7 @@ SOURCES = \ tristrip-flat.c \ tristrip.c \ vbo-drawarrays.c \ + vbo-noninterleaved.c \ vbo-drawelements.c \ vbo-drawrange.c \ vp-array.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 0333418ad8..03ccb1436d 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -135,6 +135,7 @@ progs = [ 'tristrip-flat', 'tristrip', 'vbo-drawarrays', + 'vbo-noninterleaved', 'vbo-drawelements', 'vbo-drawrange', 'vp-array', diff --git a/progs/trivial/vbo-noninterleaved.c b/progs/trivial/vbo-noninterleaved.c new file mode 100644 index 0000000000..0672ca50ff --- /dev/null +++ b/progs/trivial/vbo-noninterleaved.c @@ -0,0 +1,139 @@ +/* Basic VBO */ + +#include +#include +#include +#include +#include +#include +#include + + +struct { + GLfloat pos[4][4]; + GLfloat col[4][4]; +} verts = +{ + /* Position: a quad + */ + { + { 0.9, -0.9, 0.0, 1.0 }, + { 0.9, 0.9, 0.0, 1.0 }, + { -0.9, 0.9, 0.0, 1.0 }, + { -0.9, -0.9, 0.0, 1.0 }, + }, + + /* Color: all red + */ + { + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + }, + + +}; + +GLuint arrayObj, elementObj; + +static void Init( void ) +{ + GLint errno; + GLuint prognum; + + static const char *prog1 = + "!!ARBvp1.0\n" + "MOV result.color, vertex.color;\n" + "MOV result.position, vertex.position;\n" + "END\n"; + + glGenProgramsARB(1, &prognum); + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog1), (const GLubyte *) prog1); + + assert(glIsProgramARB(prognum)); + errno = glGetError(); + printf("glGetError = %d\n", errno); + if (errno != GL_NO_ERROR) + { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + + + glEnableClientState( GL_VERTEX_ARRAY ); + glEnableClientState( GL_COLOR_ARRAY ); + + glGenBuffersARB(1, &arrayObj); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB); + + glVertexPointer( 4, GL_FLOAT, sizeof(verts.pos[0]), 0 ); + glColorPointer( 4, GL_FLOAT, sizeof(verts.col[0]), (void *)(4*4*sizeof(float)) ); + +} + + + +static void Display( void ) +{ + glClearColor(0.3, 0.3, 0.3, 1); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glEnable(GL_VERTEX_PROGRAM_ARB); + +// glDrawArrays( GL_TRIANGLES, 0, 3 ); +// glDrawArrays( GL_TRIANGLES, 1, 3 ); + glDrawArrays( GL_QUADS, 0, 4 ); + + glFlush(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + /*glTranslatef( 0.0, 0.0, -15.0 );*/ +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 250, 250 ); + glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From b865501bda8f2f99bfa8ee365aa4a3da64291e6e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 13:09:34 +0100 Subject: gallium/tgsi: hack around linker/archiver breakage Add a dummy function which exists only so that tgsi_text_translate() doesn't get magic-ed out of the libtgsi.a archive by the build system. Don't remove unless you know this has been fixed - check on mingw/scons builds as well. --- src/gallium/auxiliary/tgsi/tgsi_transform.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c index 062c1be938..bc9c18fd4a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c @@ -198,3 +198,30 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, return ctx->ti; } + + +#include "tgsi_text.h" + +extern int tgsi_transform_foo( struct tgsi_token *tokens_out, + uint max_tokens_out ); + +/* This function exists only so that tgsi_text_translate() doesn't get + * magic-ed out of the libtgsi.a archive by the build system. Don't + * remove unless you know this has been fixed - check on mingw/scons + * builds as well. + */ +int +tgsi_transform_foo( struct tgsi_token *tokens_out, + uint max_tokens_out ) +{ + const char *text = + "FRAG1.1\n" + "DCL IN[0], COLOR, CONSTANT\n" + "DCL OUT[0], COLOR\n" + " 0: MOV OUT[0], IN[0]\n" + " 1: END"; + + return tgsi_text_translate( text, + tokens_out, + max_tokens_out ); +} -- cgit v1.2.3 From 3537c3420d0887ed22565b9e4469952b99f1b76f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 30 Apr 2009 13:10:58 +0100 Subject: util: Limit the stack walk to avoid referencing undefined memory. --- src/gallium/auxiliary/util/u_debug_stack.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index e9891fde8a..528a1c394b 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -62,6 +62,8 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, #ifdef PIPE_ARCH_X86 while(nr_frames) { + const void **next_frame_pointer; + if(!frame_pointer) break; @@ -72,7 +74,14 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, --nr_frames; } - frame_pointer = (const void **)frame_pointer[0]; + next_frame_pointer = (const void **)frame_pointer[0]; + + /* Limit the stack walk to avoid referencing undefined memory */ + if((uintptr_t)next_frame_pointer <= (uintptr_t)frame_pointer || + (uintptr_t)next_frame_pointer > (uintptr_t)frame_pointer + 64*1024) + break; + + frame_pointer = next_frame_pointer; } #endif -- cgit v1.2.3 From e9fb90ab8889136f788a3d9dc395b0f4d46cfdcc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 16:12:17 +0100 Subject: scons: Don't use deprecated Options. --- SConstruct | 10 +++++----- common.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index 1e5fd71adc..89144f7579 100644 --- a/SConstruct +++ b/SConstruct @@ -41,16 +41,16 @@ else: default_drivers = 'all' default_winsys = 'all' -opts = Options('config.py') +opts = Variables('config.py') common.AddOptions(opts) -opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetrackers, +opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers, ['mesa', 'python'])) -opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers, +opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers, ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300'])) -opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys, +opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys, ['xlib', 'intel', 'gdi', 'radeon'])) -opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) +opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) env = Environment( options = opts, diff --git a/common.py b/common.py index f1c6372abd..e57429eb75 100644 --- a/common.py +++ b/common.py @@ -46,13 +46,13 @@ else: def AddOptions(opts): try: - from SCons.Options.BoolOption import BoolOption - except ImportError: from SCons.Variables.BoolVariable import BoolVariable as BoolOption - try: - from SCons.Options.EnumOption import EnumOption except ImportError: + from SCons.Options.BoolOption import BoolOption + try: from SCons.Variables.EnumVariable import EnumVariable as EnumOption + except ImportError: + from SCons.Options.EnumOption import EnumOption opts.Add(BoolOption('debug', 'debug build', 'no')) opts.Add(BoolOption('profile', 'profile build', 'no')) #opts.Add(BoolOption('quiet', 'quiet command lines', 'no')) -- cgit v1.2.3 From c6bfb4c55963937f715a5e6a806be23e940b30d3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 16:30:08 +0100 Subject: wgl: Implemente SwapLayerBuffers. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 2 +- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 12 ++++++++++++ src/gallium/state_trackers/wgl/shared/stw_public.h | 3 +++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 5 +---- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index 3711982fd2..b259ea91f5 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -583,7 +583,7 @@ DrvSwapLayerBuffers( if (DBG) debug_printf( "%s\n", __FUNCTION__ ); - return FALSE; + return stw_swap_layer_buffers( hdc, fuPlanes ); } BOOL APIENTRY diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 4348b8f326..f66f429542 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -237,6 +237,18 @@ stw_swap_buffers( } +BOOL +stw_swap_layer_buffers( + HDC hdc, + UINT fuPlanes ) +{ + if(fuPlanes & WGL_SWAP_MAIN_PLANE) + return stw_swap_buffers(hdc); + + return FALSE; +} + + boolean stw_framebuffer_init_thread(void) { diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h index 39d377c16b..59d709a6d4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_public.h +++ b/src/gallium/state_trackers/wgl/shared/stw_public.h @@ -50,6 +50,9 @@ BOOL stw_make_current( HDC hdc, UINT_PTR hglrc ); BOOL stw_swap_buffers( HDC hdc ); +BOOL +stw_swap_layer_buffers( HDC hdc, UINT fuPlanes ); + PROC stw_get_proc_address( LPCSTR lpszProc ); int stw_pixelformat_describe( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index e06d2640b4..30e42e0ec5 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -100,10 +100,7 @@ wglSwapLayerBuffers( HDC hdc, UINT fuPlanes ) { - (void) hdc; - (void) fuPlanes; - - return FALSE; + return stw_swap_layer_buffers( hdc, fuPlanes ); } WINGDIAPI PROC APIENTRY -- cgit v1.2.3 From 22b417b75ce0e6658a5d1e0e80cb6c3fdf631774 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 1 May 2009 18:20:42 +0100 Subject: mesa/main: set PREFER_DP4 to match position_invarient code This is a quick fix for z fighting in quake4 caused by the mismatch between vertex transformation here and in the position_invarient code. Full fix would be to make this driver-tunable and adjust both position_invarient and ffvertex_prog.c code to respect driver preferences. --- src/mesa/main/ffvertex_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 1ce5685af4..82e1c4af66 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -319,7 +319,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) * multiplications with DP4's or with MUL/MAD's? SSE works better * with the latter, drivers may differ. */ -#define PREFER_DP4 0 +#define PREFER_DP4 1 /* Use uregs to represent registers internally, translate to Mesa's -- cgit v1.2.3 From 113403ef51e2ec764db061aabf569d6f1a1a3ef0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 May 2009 12:12:28 +0100 Subject: mesa: more complete fix for transform_invarient glitches Add a new flag mvp_with_dp4 in the context, and use that to switch both ffvertex.c and programopt.c vertex transformation code to either DP4 or MUL/MAD implementations. --- src/mesa/main/context.c | 13 ++++ src/mesa/main/context.h | 4 ++ src/mesa/main/ffvertex_prog.c | 16 +++-- src/mesa/main/mtypes.h | 6 ++ src/mesa/shader/programopt.c | 119 +++++++++++++++++++++++++++++++++++- src/mesa/state_tracker/st_context.c | 6 ++ 6 files changed, 153 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 016284de9a..d780f91f04 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1522,4 +1522,17 @@ _mesa_Flush(void) } +/** + * Set mvp_with_dp4 flag. If a driver has a preference for DP4 over + * MUL/MAD, or vice versa, call this function to register that. + * Otherwise we default to MUL/MAD. + */ +void +_mesa_set_mvp_with_dp4( GLcontext *ctx, + GLboolean flag ) +{ + ctx->mvp_with_dp4 = flag; +} + + /*@}*/ diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index ecc1cec779..5b57d88029 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -151,6 +151,10 @@ extern struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx); +void +_mesa_set_mvp_with_dp4( GLcontext *ctx, + GLboolean flag ); + /** \name Miscellaneous */ /*@{*/ diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 82e1c4af66..43325b1352 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -315,12 +315,6 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) */ #define DISASSEM 0 -/* Should be tunable by the driver - do we want to do matrix - * multiplications with DP4's or with MUL/MAD's? SSE works better - * with the latter, drivers may differ. - */ -#define PREFER_DP4 1 - /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. @@ -348,6 +342,7 @@ struct tnl_program { const struct state_key *state; struct gl_vertex_program *program; GLint max_inst; /** number of instructions allocated for program */ + GLboolean mvp_with_dp4; GLuint temp_in_use; GLuint temp_reserved; @@ -775,7 +770,7 @@ static struct ureg get_eye_position( struct tnl_program *p ) p->eye_position = reserve_temp(p); - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, 0, modelview ); @@ -881,7 +876,7 @@ static void build_hpos( struct tnl_program *p ) struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); struct ureg mvp[4]; - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, 0, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); @@ -1574,7 +1569,7 @@ static void build_texture_transform( struct tnl_program *p ) struct ureg in = (!is_undef(out_texgen) ? out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, 0, texmat ); emit_matrix_transform_vec4( p, out, texmat, in ); @@ -1708,6 +1703,7 @@ static void build_tnl_program( struct tnl_program *p ) static void create_new_program( const struct state_key *key, struct gl_vertex_program *program, + GLboolean mvp_with_dp4, GLuint max_temps) { struct tnl_program p; @@ -1721,6 +1717,7 @@ create_new_program( const struct state_key *key, p.transformed_normal = undef; p.identity = undef; p.temp_in_use = 0; + p.mvp_with_dp4 = mvp_with_dp4; if (max_temps >= sizeof(int) * 8) p.temp_reserved = 0; @@ -1776,6 +1773,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) return NULL; create_new_program( &key, prog, + ctx->mvp_with_dp4, ctx->Const.VertexProgram.MaxTemps ); #if 0 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index cf71077728..587dc80146 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2980,6 +2980,12 @@ struct __GLcontextRec /** software compression/decompression supported or not */ GLboolean Mesa_DXTn; + /** + * Use dp4 (rather than mul/mad) instructions for position + * transformation? + */ + GLboolean mvp_with_dp4; + /** Core tnl module support */ struct gl_tnl_module TnlModule; diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index ecd98dc85c..f70c75cec8 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -45,8 +45,8 @@ * into a vertex program. * May be used to implement the position_invariant option. */ -void -_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) +static void +_mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog) { struct prog_instruction *newInst; const GLuint origLen = vprog->Base.NumInstructions; @@ -113,6 +113,121 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) } +static void +_mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog) +{ + struct prog_instruction *newInst; + const GLuint origLen = vprog->Base.NumInstructions; + const GLuint newLen = origLen + 4; + GLuint hposTemp; + GLuint i; + + /* + * Setup state references for the modelview/projection matrix. + * XXX we should check if these state vars are already declared. + */ + static const gl_state_index mvpState[4][STATE_LENGTH] = { + { STATE_MVP_MATRIX, 0, 0, 0, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 1, 1, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 2, 2, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 3, 3, STATE_MATRIX_TRANSPOSE }, + }; + GLint mvpRef[4]; + + for (i = 0; i < 4; i++) { + mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters, + mvpState[i]); + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glProgramString(inserting position_invariant code)"); + return; + } + + /* TEMP hposTemp; */ + hposTemp = vprog->Base.NumTemporaries++; + + /* + * Generated instructions: + * emit_op2(p, OPCODE_MUL, tmp, 0, swizzle1(src,X), mat[0]); + * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Y), mat[1], tmp); + * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Z), mat[2], tmp); + * emit_op3(p, OPCODE_MAD, dest, 0, swizzle1(src,W), mat[3], tmp); + */ + _mesa_init_instructions(newInst, 4); + + newInst[0].Opcode = OPCODE_MUL; + newInst[0].DstReg.File = PROGRAM_TEMPORARY; + newInst[0].DstReg.Index = hposTemp; + newInst[0].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[0].SrcReg[0].File = PROGRAM_INPUT; + newInst[0].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[0].SrcReg[0].Swizzle = SWIZZLE_XXXX; + newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[0].SrcReg[1].Index = mvpRef[0]; + newInst[0].SrcReg[1].Swizzle = SWIZZLE_NOOP; + + for (i = 1; i <= 2; i++) { + newInst[i].Opcode = OPCODE_MAD; + newInst[i].DstReg.File = PROGRAM_TEMPORARY; + newInst[i].DstReg.Index = hposTemp; + newInst[i].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[i].SrcReg[0].File = PROGRAM_INPUT; + newInst[i].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[i].SrcReg[0].Swizzle = MAKE_SWIZZLE4(i,i,i,i); + newInst[i].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[i].SrcReg[1].Index = mvpRef[i]; + newInst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP; + newInst[i].SrcReg[2].File = PROGRAM_TEMPORARY; + newInst[i].SrcReg[2].Index = hposTemp; + newInst[1].SrcReg[2].Swizzle = SWIZZLE_NOOP; + } + + newInst[3].Opcode = OPCODE_MAD; + newInst[3].DstReg.File = PROGRAM_OUTPUT; + newInst[3].DstReg.Index = VERT_RESULT_HPOS; + newInst[3].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[3].SrcReg[0].File = PROGRAM_INPUT; + newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[3].SrcReg[0].Swizzle = SWIZZLE_WWWW; + newInst[3].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[3].SrcReg[1].Index = mvpRef[3]; + newInst[3].SrcReg[1].Swizzle = SWIZZLE_NOOP; + newInst[3].SrcReg[2].File = PROGRAM_TEMPORARY; + newInst[3].SrcReg[2].Index = hposTemp; + newInst[3].SrcReg[2].Swizzle = SWIZZLE_NOOP; + + + /* Append original instructions after new instructions */ + _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen); + + /* free old instructions */ + _mesa_free_instructions(vprog->Base.Instructions, origLen); + + /* install new instructions */ + vprog->Base.Instructions = newInst; + vprog->Base.NumInstructions = newLen; + vprog->Base.InputsRead |= VERT_BIT_POS; + vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS); +} + + +void +_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) +{ + if (ctx->mvp_with_dp4) + _mesa_insert_mvp_dp4_code( ctx, vprog ); + else + _mesa_insert_mvp_mad_code( ctx, vprog ); +} + + + + + /** * Append extra instructions onto the given fragment program to implement diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 92a630eff9..2a1f21c51c 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -177,6 +177,12 @@ struct st_context *st_create_context(struct pipe_context *pipe, ctx = _mesa_create_context(visual, shareCtx, &funcs, NULL); + /* XXX: need a capability bit in gallium to query if the pipe + * driver prefers DP4 or MUL/MAD for vertex transformation. + */ + if (debug_get_bool_option("MESA_MVP_DP4", FALSE)) + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + return st_create_context_priv(ctx, pipe); } -- cgit v1.2.3 From 077c904b76542dbe01b20386733d3e9e8a49da0b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 May 2009 13:00:44 +0100 Subject: progs/trivial: add test for vertex program invarient transform --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/vp-tri-invariant.c | 147 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 progs/trivial/vp-tri-invariant.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 69b0408bbd..22de83fa79 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -147,6 +147,7 @@ SOURCES = \ vp-clip.c \ vp-line-clip.c \ vp-tri.c \ + vp-tri-invariant.c \ vp-tri-swap.c \ vp-tri-tex.c \ vp-tri-imm.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 03ccb1436d..9a1f3575bd 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -143,6 +143,7 @@ progs = [ 'vp-clip', 'vp-line-clip', 'vp-tri', + 'vp-tri-invariant', 'vp-tri-swap', 'vp-tri-tex', 'vp-tri-imm', diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c new file mode 100644 index 0000000000..ff24139365 --- /dev/null +++ b/progs/trivial/vp-tri-invariant.c @@ -0,0 +1,147 @@ +/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ + +#include +#include +#include +#include +#include +#include + + +#define CI_OFFSET_1 16 +#define CI_OFFSET_2 32 + + +GLenum doubleBuffer; + +static void Init(void) +{ + GLint errno; + GLuint prognum; + + static const char *prog1 = + "!!ARBvp1.0\n" + "OPTION ARB_position_invariant ;" + "MOV result.color, vertex.color;\n" + "END\n"; + + + glGenProgramsARB(1, &prognum); + + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog1), (const GLubyte *) prog1); + + errno = glGetError(); + printf("glGetError = %d\n", errno); + if (errno != GL_NO_ERROR) + { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + glClearColor(0.0, 0.0, 1.0, 0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_VERTEX_PROGRAM_ARB); + + glBegin(GL_TRIANGLES); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -0.0); + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -0.0); + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -0.0); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + + type = GLUT_RGB | GLUT_ALPHA; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + glewInit(); + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From b2577937b61c2f182d905010ace960ef95c1a026 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 5 May 2009 17:45:50 +0200 Subject: r200: fix CS section size mismatch (bug 21565) --- src/mesa/drivers/dri/r200/r200_state_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 75262e46bd..535d34f115 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -505,6 +505,8 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) dwords += 6; if (rrb) dwords += 6; + if (atom->cmd_size == CTX_STATE_SIZE_NEWDRM) + dwords += 4; /* output the first 7 bytes of context */ BEGIN_BATCH_NO_AUTOSTATE(dwords); -- cgit v1.2.3 From 79ada8c6331a801a0475f38a540670b14e168f19 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 10:11:51 -0600 Subject: gallium: fix texcoords for cubemap mipmap generation We need to use (s,t,r) cubemap coords when sampling from the cubemap texture so the rendered quad gets texture samples from the correct cube face. --- src/gallium/auxiliary/util/u_gen_mipmap.c | 96 +++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 690412ae7d..6fa13a8ce1 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1316,7 +1316,6 @@ util_create_gen_mipmap(struct pipe_context *pipe, for (i = 0; i < 4; i++) { ctx->vertices[i][0][2] = 0.0f; /* z */ ctx->vertices[i][0][3] = 1.0f; /* w */ - ctx->vertices[i][1][2] = 0.0f; /* r */ ctx->vertices[i][1][3] = 1.0f; /* q */ } @@ -1350,29 +1349,104 @@ get_next_slot(struct gen_mipmap_state *ctx) static unsigned -set_vertex_data(struct gen_mipmap_state *ctx, float width, float height) +set_vertex_data(struct gen_mipmap_state *ctx, + enum pipe_texture_target tex_target, + uint face, float width, float height) { unsigned offset; + /* vert[0].position */ ctx->vertices[0][0][0] = 0.0f; /*x*/ ctx->vertices[0][0][1] = 0.0f; /*y*/ - ctx->vertices[0][1][0] = 0.0f; /*s*/ - ctx->vertices[0][1][1] = 0.0f; /*t*/ + /* vert[1].position */ ctx->vertices[1][0][0] = width; ctx->vertices[1][0][1] = 0.0f; - ctx->vertices[1][1][0] = 1.0f; - ctx->vertices[1][1][1] = 0.0f; + /* vert[2].position */ ctx->vertices[2][0][0] = width; ctx->vertices[2][0][1] = height; - ctx->vertices[2][1][0] = 1.0f; - ctx->vertices[2][1][1] = 1.0f; + /* vert[3].position */ ctx->vertices[3][0][0] = 0.0f; ctx->vertices[3][0][1] = height; - ctx->vertices[3][1][0] = 0.0f; - ctx->vertices[3][1][1] = 1.0f; + + /* Setup vertex texcoords. This is a little tricky for cube maps. */ + if (tex_target == PIPE_TEXTURE_CUBE) { + static const float st[4][2] = { + {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} + }; + float rx, ry, rz; + uint i; + + /* loop over quad verts */ + for (i = 0; i < 4; i++) { + /* Compute sc = +/-scale and tc = +/-scale. + * Not +/-1 to avoid cube face selection ambiguity near the edges, + * though that can still sometimes happen with this scale factor... + */ + const float scale = 0.9999; + const float sc = (2.0f * st[i][0] - 1.0f) * scale; + const float tc = (2.0f * st[i][1] - 1.0f) * scale; + + switch (face) { + case PIPE_TEX_FACE_POS_X: + rx = 1.0f; + ry = -tc; + rz = -sc; + break; + case PIPE_TEX_FACE_NEG_X: + rx = -1.0f; + ry = -tc; + rz = sc; + break; + case PIPE_TEX_FACE_POS_Y: + rx = sc; + ry = 1.0f; + rz = tc; + break; + case PIPE_TEX_FACE_NEG_Y: + rx = sc; + ry = -1.0f; + rz = -tc; + break; + case PIPE_TEX_FACE_POS_Z: + rx = sc; + ry = -tc; + rz = 1.0f; + break; + case PIPE_TEX_FACE_NEG_Z: + rx = -sc; + ry = -tc; + rz = -1.0f; + break; + default: + assert(0); + } + + ctx->vertices[i][1][0] = rx; /*s*/ + ctx->vertices[i][1][1] = ry; /*t*/ + ctx->vertices[i][1][2] = rz; /*r*/ + } + } + else { + /* 1D/2D */ + ctx->vertices[0][1][0] = 0.0f; /*s*/ + ctx->vertices[0][1][1] = 0.0f; /*t*/ + ctx->vertices[0][1][2] = 0.0f; /*r*/ + + ctx->vertices[1][1][0] = 1.0f; + ctx->vertices[1][1][1] = 0.0f; + ctx->vertices[1][1][2] = 0.0f; + + ctx->vertices[2][1][0] = 1.0f; + ctx->vertices[2][1][1] = 1.0f; + ctx->vertices[2][1][2] = 0.0f; + + ctx->vertices[3][1][0] = 0.0f; + ctx->vertices[3][1][1] = 1.0f; + ctx->vertices[3][1][2] = 0.0f; + } offset = get_next_slot( ctx ); @@ -1503,6 +1577,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, /* quad coords in window coords (bypassing vs, clip and viewport) */ offset = set_vertex_data(ctx, + pt->target, + face, (float) pt->width[dstLevel], (float) pt->height[dstLevel]); -- cgit v1.2.3 From 95b7771ea705b71bbd8185cd8e39b546e18e09a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 09:39:39 -0600 Subject: gallium: remove redundant cube face #defines --- src/gallium/include/pipe/p_defines.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 82e23c413c..47c24f3086 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -132,6 +132,7 @@ enum pipe_texture_target { #define PIPE_TEX_FACE_NEG_Y 3 #define PIPE_TEX_FACE_POS_Z 4 #define PIPE_TEX_FACE_NEG_Z 5 +#define PIPE_TEX_FACE_MAX 6 #define PIPE_TEX_WRAP_REPEAT 0 #define PIPE_TEX_WRAP_CLAMP 1 @@ -158,14 +159,6 @@ enum pipe_texture_target { #define PIPE_TEX_COMPARE_NONE 0 #define PIPE_TEX_COMPARE_R_TO_TEXTURE 1 -#define PIPE_TEX_FACE_POS_X 0 -#define PIPE_TEX_FACE_NEG_X 1 -#define PIPE_TEX_FACE_POS_Y 2 -#define PIPE_TEX_FACE_NEG_Y 3 -#define PIPE_TEX_FACE_POS_Z 4 -#define PIPE_TEX_FACE_NEG_Z 5 -#define PIPE_TEX_FACE_MAX 6 - #define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1 #define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */ #define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */ -- cgit v1.2.3 From 3503af07c4b7624252890e229cb6efd0ede2b7d6 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 5 May 2009 20:17:37 +0200 Subject: r200: fix another section size mismatch --- src/mesa/drivers/dri/r200/r200_state_init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 535d34f115..9eb95d60ab 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -595,7 +595,6 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) hastexture = 0; } - dwords += 2; if (hastexture) dwords += 2; else -- cgit v1.2.3 From 5f8381724e81b594d6f11bb2d59964fbdbf22e90 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 5 May 2009 21:01:36 +0200 Subject: r200: fix some cube map issues remove the r100-ism of swapping cube faces which doesn't apply to r200, and also use precalculated offsets. Note that cube textures will still not work on r100 and r200 since mipmap layout is level-first order (for r300) whereas r100/r200 require face-first (and possibly also 2k alignment for face at least with tiling). --- src/mesa/drivers/dri/r200/r200_state_init.c | 36 ++++++++++------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 9eb95d60ab..4db7fa1210 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -557,17 +557,12 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) if (t && t->mt && !t->image_override) dwords += 2; BEGIN_BATCH_NO_AUTOSTATE(dwords); + /* is this ok even with drm older than 1.18? */ OUT_BATCH_TABLE(atom->cmd, 10); if (t && t->mt && !t->image_override) { - if ((ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) { - lvl = &t->mt->levels[0]; - OUT_BATCH_RELOC(lvl->faces[5].offset, t->mt->bo, lvl->faces[5].offset, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - } else { - OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - } + OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); } else if (!t) { /* workaround for old CS mechanism */ OUT_BATCH(r200->radeon.radeonScreen->texOffset[RADEON_LOCAL_TEX_HEAP]); @@ -607,14 +602,8 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) if (hastexture) { OUT_BATCH(CP_PACKET0(R200_PP_TXOFFSET_0 + (24 * i), 0)); if (t->mt && !t->image_override) { - if ((ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) { - lvl = &t->mt->levels[0]; - OUT_BATCH_RELOC(lvl->faces[5].offset, t->mt->bo, lvl->faces[5].offset, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - } else { - OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - } + OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); } else { if (t->bo) OUT_BATCH_RELOC(t->tile_bits, t->bo, 0, @@ -630,20 +619,19 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); uint32_t dwords = atom->cmd_size; - int i = atom->idx; + int i = atom->idx, j; radeonTexObj *t = r200->state.texture.unit[i].texobj; - GLuint size; + radeon_mipmap_level *lvl; BEGIN_BATCH_NO_AUTOSTATE(dwords + (2 * 5)); OUT_BATCH_TABLE(atom->cmd, 3); if (t && !t->image_override) { - size = t->mt->totalsize / 6; - OUT_BATCH_RELOC(0, t->mt->bo, size, RADEON_GEM_DOMAIN_VRAM, 0, 0); - OUT_BATCH_RELOC(0, t->mt->bo, size * 2, RADEON_GEM_DOMAIN_VRAM, 0, 0); - OUT_BATCH_RELOC(0, t->mt->bo, size * 3, RADEON_GEM_DOMAIN_VRAM, 0, 0); - OUT_BATCH_RELOC(0, t->mt->bo, size * 4, RADEON_GEM_DOMAIN_VRAM, 0, 0); - OUT_BATCH_RELOC(0, t->mt->bo, size * 5, RADEON_GEM_DOMAIN_VRAM, 0, 0); + lvl = &t->mt->levels[0]; + for (j = 1; j <= 5; j++) { + OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, + RADEON_GEM_DOMAIN_VRAM, 0, 0); + } } END_BATCH(); } -- cgit v1.2.3 From c0d3761c167c2d952e92c46cf3a0e26461985ada Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 16:17:55 -0600 Subject: mesa: minor simplification in enable_texture(), updated comments --- src/mesa/main/enable.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index f432be183c..2e7baa48ff 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -222,14 +222,16 @@ get_texcoord_unit(GLcontext *ctx) /** * Helper function to enable or disable a texture target. + * \param bit one of the TEXTURE_x_BIT values + * \return GL_TRUE if state is changing or GL_FALSE if no change */ static GLboolean -enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit) +enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - const GLuint newenabled = (!state) - ? (texUnit->Enabled & ~bit) : (texUnit->Enabled | bit); + const GLbitfield newenabled = state + ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit); if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return GL_FALSE; -- cgit v1.2.3 From 01e16befd4809e3e93ee7855a4a5d7df9fe010d9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 16:21:20 -0600 Subject: mesa: only use fallback texture when using shaders, not fixed-function The semantics are a little different for shaders vs. fixed-function when trying to use an incomplete texture. The fallback texture returning (0,0,0,1) should only be used with shaders. Fixes glean fbo test regression. --- src/mesa/main/texstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 32d55ba8d5..9664bd58bc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -560,10 +560,10 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled) { - /* If we get here it means the shader (or fixed-function state) - * is expecting a texture object, but there isn't one (or it's - * incomplete). Use the fallback texture. + if (fprog && !texUnit->_ReallyEnabled) { + /* If we get here it means the shader is expecting a texture + * object, but there isn't one (or it's incomplete). Use the + * fallback texture. */ struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; -- cgit v1.2.3 From a0edbfb28fb2e670c657d52190a7e8b1ccf4f46e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 16:29:04 -0600 Subject: mesa: only use fallback texture when using shaders, not fixed-function The semantics are a little different for shaders vs. fixed-function when trying to use an incomplete texture. The fallback texture returning (0,0,0,1) should only be used with shaders. Fixes glean fbo test regression. --- src/mesa/main/texstate.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 9664bd58bc..5453331c67 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -560,14 +560,20 @@ update_texture_state( GLcontext *ctx ) } } - if (fprog && !texUnit->_ReallyEnabled) { - /* If we get here it means the shader is expecting a texture - * object, but there isn't one (or it's incomplete). Use the - * fallback texture. - */ - struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); - texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; - _mesa_reference_texobj(&texUnit->_Current, texObj); + if (!texUnit->_ReallyEnabled) { + if (fprog) { + /* If we get here it means the shader is expecting a texture + * object, but there isn't one (or it's incomplete). Use the + * fallback texture. + */ + struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); + texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + _mesa_reference_texobj(&texUnit->_Current, texObj); + } + else { + /* fixed-function: texture unit is really disabled */ + continue; + } } /* if we get here, we know this texture unit is enabled */ -- cgit v1.2.3 From 823815a48556940cc27867717658afda93733ce8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 16:30:30 -0600 Subject: Revert "mesa: only use fallback texture when using shaders, not fixed-function" This reverts commit a0edbfb28fb2e670c657d52190a7e8b1ccf4f46e. This patch didn't completely fix the problem. The next patch will. --- src/mesa/main/texstate.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 5453331c67..9664bd58bc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -560,20 +560,14 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled) { - if (fprog) { - /* If we get here it means the shader is expecting a texture - * object, but there isn't one (or it's incomplete). Use the - * fallback texture. - */ - struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); - texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; - _mesa_reference_texobj(&texUnit->_Current, texObj); - } - else { - /* fixed-function: texture unit is really disabled */ - continue; - } + if (fprog && !texUnit->_ReallyEnabled) { + /* If we get here it means the shader is expecting a texture + * object, but there isn't one (or it's incomplete). Use the + * fallback texture. + */ + struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); + texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + _mesa_reference_texobj(&texUnit->_Current, texObj); } /* if we get here, we know this texture unit is enabled */ -- cgit v1.2.3 From 51325f44d1e7e62b47795a79f8038d10dc5bc30b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 16:29:04 -0600 Subject: mesa: only use fallback texture when using shaders, not fixed-function (take two) The semantics are a little different for shaders vs. fixed-function when trying to use an incomplete texture. The fallback texture returning (0,0,0,1) should only be used with shaders. For fixed function, the texture unit is truly disabled/ignored. Fixes glean fbo test regression. --- src/mesa/main/texstate.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 9664bd58bc..5453331c67 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -560,14 +560,20 @@ update_texture_state( GLcontext *ctx ) } } - if (fprog && !texUnit->_ReallyEnabled) { - /* If we get here it means the shader is expecting a texture - * object, but there isn't one (or it's incomplete). Use the - * fallback texture. - */ - struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); - texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; - _mesa_reference_texobj(&texUnit->_Current, texObj); + if (!texUnit->_ReallyEnabled) { + if (fprog) { + /* If we get here it means the shader is expecting a texture + * object, but there isn't one (or it's incomplete). Use the + * fallback texture. + */ + struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); + texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + _mesa_reference_texobj(&texUnit->_Current, texObj); + } + else { + /* fixed-function: texture unit is really disabled */ + continue; + } } /* if we get here, we know this texture unit is enabled */ -- cgit v1.2.3 From acf086ebfa95b77bb221c15acf6776439063c0b7 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 May 2009 13:34:34 +1000 Subject: r200: fix cubic emission. Still doesn't fix cubemaps, I really missed the whole drmsupports thing when testing this all originally --- src/mesa/drivers/dri/r200/r200_state_init.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 4db7fa1210..be57ac3163 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -618,17 +618,18 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) { r200ContextPtr r200 = R200_CONTEXT(ctx); BATCH_LOCALS(&r200->radeon); - uint32_t dwords = atom->cmd_size; + uint32_t dwords = 2; int i = atom->idx, j; radeonTexObj *t = r200->state.texture.unit[i].texobj; radeon_mipmap_level *lvl; - BEGIN_BATCH_NO_AUTOSTATE(dwords + (2 * 5)); - OUT_BATCH_TABLE(atom->cmd, 3); + BEGIN_BATCH_NO_AUTOSTATE(dwords + (4 * 5)); + OUT_BATCH_TABLE(atom->cmd, 2); if (t && !t->image_override) { lvl = &t->mt->levels[0]; for (j = 1; j <= 5; j++) { + OUT_BATCH(CP_PACKET0(R200_PP_CUBIC_OFFSET_F1_0 + (24*i) + (4 * (j-1)), 0)); OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, RADEON_GEM_DOMAIN_VRAM, 0, 0); } -- cgit v1.2.3 From d7f62e54055c7b8afaf0683944a4ba907b96d6ec Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 May 2009 14:06:13 +1000 Subject: r100/r200: try and allocate miptree correct for hw. This doesn't make things worse but according to sroland it is how the GPU hw expects things on the r100/r200 --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 51538e37fa..8d1ba1cdba 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -132,7 +132,33 @@ static GLuint minify(GLuint size, GLuint levels) return size; } -static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree *mt) + +static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_tree *mt) +{ + GLuint curOffset; + GLuint numLevels; + GLuint i; + GLuint face; + + numLevels = mt->lastLevel - mt->firstLevel + 1; + assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); + + curOffset = 0; + for(face = 0; face < mt->faces; face++) { + + for(i = 0; i < numLevels; i++) { + mt->levels[i].width = minify(mt->width0, i); + mt->levels[i].height = minify(mt->height0, i); + mt->levels[i].depth = minify(mt->depth0, i); + compute_tex_image_offset(rmesa, mt, face, i, &curOffset); + } + } + + /* Note the required size in memory */ + mt->totalsize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK; +} + +static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { GLuint curOffset; GLuint numLevels; @@ -157,7 +183,6 @@ static void calculate_miptree_layout(radeonContextPtr rmesa, radeon_mipmap_tree mt->totalsize = (curOffset + RADEON_OFFSET_MASK) & ~RADEON_OFFSET_MASK; } - /** * Create a new mipmap tree, calculate its layout and allocate memory. */ @@ -182,7 +207,10 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj * mt->tilebits = tilebits; mt->compressed = compressed; - calculate_miptree_layout(rmesa, mt); + if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_R300) + calculate_miptree_layout_r300(rmesa, mt); + else + calculate_miptree_layout_r100(rmesa, mt); mt->bo = radeon_bo_open(rmesa->radeonScreen->bom, 0, mt->totalsize, 1024, -- cgit v1.2.3 From 7f65fea95e56fe0dee91ba726358896c9899780a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 May 2009 14:43:07 +1000 Subject: radeon: hopefully fixup radeon cube state emission for kms --- src/mesa/drivers/dri/radeon/radeon_state_init.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index c00f59f7ad..f5d4189d66 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -465,10 +465,11 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) { r100ContextPtr r100 = R100_CONTEXT(ctx); BATCH_LOCALS(&r100->radeon); - uint32_t dwords = atom->cmd_size; + uint32_t dwords = 2; int i = atom->idx, j; radeonTexObj *t = r100->state.texture.unit[i].texobj; radeon_mipmap_level *lvl; + uint32_t base_reg; if (!(ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) return; @@ -479,10 +480,17 @@ static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom) if (!t->mt) return; - BEGIN_BATCH_NO_AUTOSTATE(dwords + 10); - OUT_BATCH_TABLE(atom->cmd, 3); + switch(i) { + case 1: base_reg = RADEON_PP_CUBIC_OFFSET_T1_0; break; + case 2: base_reg = RADEON_PP_CUBIC_OFFSET_T2_0; break; + default: + case 0: base_reg = RADEON_PP_CUBIC_OFFSET_T0_0; break; + }; + BEGIN_BATCH_NO_AUTOSTATE(dwords + (5 * 4)); + OUT_BATCH_TABLE(atom->cmd, 2); lvl = &t->mt->levels[0]; for (j = 0; j < 5; j++) { + OUT_BATCH(CP_PACKET0(base_reg + (4 * (j-1)), 0)); OUT_BATCH_RELOC(lvl->faces[j].offset, t->mt->bo, lvl->faces[j].offset, RADEON_GEM_DOMAIN_VRAM, 0, 0); } -- cgit v1.2.3 From d277547dc69c9004097afdc2ca56a7aed85c6f54 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 May 2009 13:07:33 -0700 Subject: i965: Don't create constant buffers if they won't be used. Really, the creation and upload of constants should be in the same place, since they should only happen together, and a state flag should be triggered by them so that we don't thrash state around so much for just updating constants. But this still recovers openarena performance by another 19%, leaving us 16% behind Mesa 7.4 branch. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index f646ee7fc3..ad28c78f69 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -396,6 +396,14 @@ brw_update_wm_constant_surface( GLcontext *ctx, struct brw_surface_key key; struct intel_context *intel = &brw->intel; const int size = params->NumParameters * 4 * sizeof(GLfloat); + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + + if (!fp->use_const_buffer) { + dri_bo_unreference(const_buffer); + brw->wm.surf_bo[surf] = NULL; + return NULL; + } /* free old const buffer if too small */ if (const_buffer && const_buffer->size < size) { @@ -455,6 +463,8 @@ brw_update_vs_constant_surface( GLcontext *ctx, struct brw_surface_key key; struct intel_context *intel = &brw->intel; const int size = params->NumParameters * 4 * sizeof(GLfloat); + struct brw_vertex_program *vp = + (struct brw_vertex_program *) brw->vertex_program; assert(surf == 0); @@ -463,6 +473,11 @@ brw_update_vs_constant_surface( GLcontext *ctx, */ dri_bo_unreference(const_buffer); + if (!vp->use_const_buffer) { + brw->vs.surf_bo[surf] = NULL; + return NULL; + } + /* alloc new buffer */ const_buffer = drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64); @@ -703,7 +718,8 @@ static void prepare_wm_surfaces(struct brw_context *brw ) brw_update_wm_constant_surface(ctx, surf, fp->const_buffer, fp->program.Base.Parameters); - brw->wm.nr_surfaces = surf + 1; + if (fp->const_buffer != NULL) + brw->wm.nr_surfaces = surf + 1; } /* Update surfaces for textures */ -- cgit v1.2.3 From 9490d86808300e5819941a40784e272c290e05ee Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 May 2009 14:05:54 -0700 Subject: i965: Disentangle VS constant surface state from WM surface state. Also, only create VS surface state if there's a VS constant buffer to be uploaded, and set the contents of the buffer at the same time as creation. --- src/mesa/drivers/dri/i965/Makefile | 1 + src/mesa/drivers/dri/i965/brw_curbe.c | 15 -- src/mesa/drivers/dri/i965/brw_misc_state.c | 5 +- src/mesa/drivers/dri/i965/brw_state.h | 20 ++ src/mesa/drivers/dri/i965/brw_state_upload.c | 3 +- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 226 +++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 171 +---------------- 7 files changed, 255 insertions(+), 186 deletions(-) create mode 100644 src/mesa/drivers/dri/i965/brw_vs_surface_state.c diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 2934414d99..4913c25f74 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -69,6 +69,7 @@ DRIVER_SOURCES = \ brw_vs_constval.c \ brw_vs_emit.c \ brw_vs_state.c \ + brw_vs_surface_state.c \ brw_vtbl.c \ brw_wm.c \ brw_wm_debug.c \ diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 05a685af3d..7bd5021346 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -363,20 +363,6 @@ update_constant_buffer(struct brw_context *brw, } -/** Copy current vertex program's parameters into the constant buffer */ -static void -update_vertex_constant_buffer(struct brw_context *brw) -{ - struct brw_vertex_program *vp = - (struct brw_vertex_program *) brw->vertex_program; - if (0) { - printf("update VS constants in buffer %p vp = %p\n", vp->const_buffer, vp); - printf("program %u\n", vp->program.Base.Id); - } - if (vp->use_const_buffer) - update_constant_buffer(brw, vp->program.Base.Parameters, vp->const_buffer); -} - /** Copy current fragment program's parameters into the constant buffer */ static void @@ -398,7 +384,6 @@ static void emit_constant_buffer(struct brw_context *brw) struct intel_context *intel = &brw->intel; GLuint sz = brw->curbe.total_size; - update_vertex_constant_buffer(brw); update_fragment_constant_buffer(brw); BEGIN_BATCH(2, IGNORE_CLIPRECTS); diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 9bc5c35139..4784254bc7 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -118,7 +118,10 @@ static void upload_binding_table_pointers(struct brw_context *brw) BEGIN_BATCH(6, IGNORE_CLIPRECTS); OUT_BATCH(CMD_BINDING_TABLE_PTRS << 16 | (6 - 2)); - OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */ + if (brw->vs.bind_bo != NULL) + OUT_RELOC(brw->vs.bind_bo, I915_GEM_DOMAIN_SAMPLER, 0, 0); /* vs */ + else + OUT_BATCH(0); OUT_BATCH(0); /* gs */ OUT_BATCH(0); /* clip */ OUT_BATCH(0); /* sf */ diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 7ea2fc113c..1171e61ad4 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -72,6 +72,7 @@ const struct brw_tracked_state brw_sf_vp; const struct brw_tracked_state brw_state_base_address; const struct brw_tracked_state brw_urb_fence; const struct brw_tracked_state brw_vertex_state; +const struct brw_tracked_state brw_vs_surfaces; const struct brw_tracked_state brw_vs_prog; const struct brw_tracked_state brw_vs_unit; const struct brw_tracked_state brw_wm_input_sizes; @@ -91,6 +92,20 @@ const struct brw_tracked_state brw_drawing_rect; const struct brw_tracked_state brw_indices; const struct brw_tracked_state brw_vertices; +/** + * Use same key for WM and VS surfaces. + */ +struct brw_surface_key { + GLenum target, depthmode; + dri_bo *bo; + GLint format, internal_format; + GLint first_level, last_level; + GLint width, height, depth; + GLint pitch, cpp; + uint32_t tiling; + GLuint offset; +}; + /*********************************************************************** * brw_state.c */ @@ -150,4 +165,9 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw, void brw_destroy_batch_cache( struct brw_context *brw ); void brw_clear_batch_cache_flush( struct brw_context *brw ); +/* brw_wm_surface_state.c */ +dri_bo * +brw_create_constant_surface( struct brw_context *brw, + struct brw_surface_key *key ); + #endif diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 2641bcb2aa..4c1ffe81c9 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -62,7 +62,8 @@ const struct brw_tracked_state *atoms[] = &brw_cc_vp, &brw_cc_unit, - &brw_wm_surfaces, /* must do before samplers */ + &brw_vs_surfaces, /* must do before unit */ + &brw_wm_surfaces, /* must do before samplers and unit */ &brw_wm_samplers, &brw_wm_unit, diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c new file mode 100644 index 0000000000..89f47522a1 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -0,0 +1,226 @@ +/* + Copyright (C) Intel Corp. 2006. All Rights Reserved. + Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to + develop this 3D driver. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + **********************************************************************/ + /* + * Authors: + * Keith Whitwell + */ + +#include "main/mtypes.h" +#include "main/texformat.h" +#include "main/texstore.h" +#include "shader/prog_parameter.h" + +#include "brw_context.h" +#include "brw_state.h" +#include "brw_defines.h" + +/* Creates a new VS constant buffer reflecting the current VS program's + * constants, if needed by the VS program. + * + * Otherwise, constants go through the CURBEs using the brw_constant_buffer + * state atom. + */ +static drm_intel_bo * +brw_vs_update_constant_buffer(struct brw_context *brw) +{ + 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; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + drm_intel_bo *const_buffer; + + /* BRW_NEW_VERTEX_PROGRAM */ + if (!vp->use_const_buffer) + return NULL; + + const_buffer = drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", + size, 64); + + /* _NEW_PROGRAM_CONSTANTS */ + dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); + + return const_buffer; +} + +/** + * Update the surface state for a VS constant buffer. + * + * Sets brw->vs.surf_bo[surf] and brw->vp->const_buffer. + */ +static void +brw_update_vs_constant_surface( GLcontext *ctx, + GLuint surf) +{ + struct brw_context *brw = brw_context(ctx); + struct brw_surface_key key; + struct brw_vertex_program *vp = + (struct brw_vertex_program *) brw->vertex_program; + const struct gl_program_parameter_list *params = vp->program.Base.Parameters; + + assert(surf == 0); + + /* If we're in this state update atom, we need to update VS constants, so + * free the old buffer and create a new one for the new contents. + */ + dri_bo_unreference(vp->const_buffer); + vp->const_buffer = brw_vs_update_constant_buffer(brw); + + /* If there's no constant buffer, then no surface BO is needed to point at + * it. + */ + if (vp->const_buffer == 0) { + drm_intel_bo_unreference(brw->vs.surf_bo[surf]); + brw->vs.surf_bo[surf] = NULL; + return; + } + + memset(&key, 0, sizeof(key)); + + key.format = MESA_FORMAT_RGBA_FLOAT32; + key.internal_format = GL_RGBA; + key.bo = vp->const_buffer; + key.depthmode = GL_NONE; + key.pitch = params->NumParameters; + key.width = params->NumParameters; + key.height = 1; + key.depth = 1; + key.cpp = 16; + + /* + printf("%s:\n", __FUNCTION__); + printf(" width %d height %d depth %d cpp %d pitch %d\n", + key.width, key.height, key.depth, key.cpp, key.pitch); + */ + + drm_intel_bo_unreference(brw->vs.surf_bo[surf]); + brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, + &key, sizeof(key), + &key.bo, key.bo ? 1 : 0, + NULL); + if (brw->vs.surf_bo[surf] == NULL) { + brw->vs.surf_bo[surf] = brw_create_constant_surface(brw, &key); + } +} + + +/** + * Constructs the binding table for the VS surface state. + */ +static dri_bo * +brw_vs_get_binding_table(struct brw_context *brw) +{ + dri_bo *bind_bo; + + bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND, + NULL, 0, + brw->vs.surf_bo, BRW_VS_MAX_SURF, + NULL); + + if (bind_bo == NULL) { + GLuint data_size = BRW_VS_MAX_SURF * sizeof(GLuint); + uint32_t *data = malloc(data_size); + int i; + + for (i = 0; i < BRW_VS_MAX_SURF; i++) + if (brw->vs.surf_bo[i]) + data[i] = brw->vs.surf_bo[i]->offset; + else + data[i] = 0; + + bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND, + NULL, 0, + brw->vs.surf_bo, BRW_VS_MAX_SURF, + data, data_size, + NULL, NULL); + + /* Emit binding table relocations to surface state */ + for (i = 0; i < BRW_VS_MAX_SURF; i++) { + if (brw->vs.surf_bo[i] != NULL) { + /* The presumed offsets were set in the data values for + * brw_upload_cache. + */ + drm_intel_bo_emit_reloc(bind_bo, i * 4, + brw->vs.surf_bo[i], 0, + I915_GEM_DOMAIN_INSTRUCTION, 0); + } + } + + free(data); + } + + return bind_bo; +} + +/** + * Vertex shader surfaces (constant buffer). + * + * This consumes the state updates for the constant buffer needing + * to be updated, and produces BRW_NEW_NR_VS_SURFACES for the VS unit and + * CACHE_NEW_SURF_BIND for the binding table upload. + */ +static void prepare_vs_surfaces(struct brw_context *brw ) +{ + GLcontext *ctx = &brw->intel.ctx; + int i; + int nr_surfaces = 0; + + brw_update_vs_constant_surface(ctx, SURF_INDEX_VERT_CONST_BUFFER); + + for (i = 0; i < BRW_VS_MAX_SURF; i++) { + if (brw->vs.surf_bo[i] != NULL) { + nr_surfaces = i + 1; + } + } + + if (brw->vs.nr_surfaces != nr_surfaces) { + brw->state.dirty.brw |= BRW_NEW_NR_VS_SURFACES; + brw->vs.nr_surfaces = nr_surfaces; + } + + /* Note that we don't end up updating the bind_bo if we don't have a + * surface to be pointing at. This should be relatively harmless, as it + * just slightly increases our working set size. + */ + if (brw->vs.nr_surfaces != 0) { + dri_bo_unreference(brw->vs.bind_bo); + brw->vs.bind_bo = brw_vs_get_binding_table(brw); + } +} + +const struct brw_tracked_state brw_vs_surfaces = { + .dirty = { + .mesa = (_NEW_PROGRAM_CONSTANTS), + .brw = (BRW_NEW_VERTEX_PROGRAM), + .cache = 0 + }, + .prepare = prepare_vs_surfaces, +}; + + + diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index ad28c78f69..052bcf342c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -176,22 +176,6 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, } } - -/** - * Use same key for WM and VS surfaces. - */ -struct brw_surface_key { - GLenum target, depthmode; - dri_bo *bo; - GLint format, internal_format; - GLint first_level, last_level; - GLint width, height, depth; - GLint pitch, cpp; - uint32_t tiling; - GLuint offset; -}; - - static void brw_set_surface_tiling(struct brw_surface_state *surf, uint32_t tiling) { @@ -337,7 +321,7 @@ brw_update_texture_surface( GLcontext *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 dri_bo * +dri_bo * brw_create_constant_surface( struct brw_context *brw, struct brw_surface_key *key ) { @@ -449,71 +433,6 @@ brw_update_wm_constant_surface( GLcontext *ctx, } -/** - * Update the surface state for a VS constant buffer. - * The constant buffer will be (re)allocated here if needed. - */ -static dri_bo * -brw_update_vs_constant_surface( GLcontext *ctx, - GLuint surf, - dri_bo *const_buffer, - const struct gl_program_parameter_list *params) -{ - struct brw_context *brw = brw_context(ctx); - struct brw_surface_key key; - struct intel_context *intel = &brw->intel; - const int size = params->NumParameters * 4 * sizeof(GLfloat); - struct brw_vertex_program *vp = - (struct brw_vertex_program *) brw->vertex_program; - - assert(surf == 0); - - /* We always create a new VS constant buffer so that several can be - * in flight at a time. Free the old one first... - */ - dri_bo_unreference(const_buffer); - - if (!vp->use_const_buffer) { - brw->vs.surf_bo[surf] = NULL; - return NULL; - } - - /* alloc new buffer */ - const_buffer = - drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer", size, 64); - - memset(&key, 0, sizeof(key)); - - key.format = MESA_FORMAT_RGBA_FLOAT32; - key.internal_format = GL_RGBA; - key.bo = const_buffer; - key.depthmode = GL_NONE; - key.pitch = params->NumParameters; - key.width = params->NumParameters; - key.height = 1; - key.depth = 1; - key.cpp = 16; - - /* - printf("%s:\n", __FUNCTION__); - printf(" width %d height %d depth %d cpp %d pitch %d\n", - key.width, key.height, key.depth, key.cpp, key.pitch); - */ - - dri_bo_unreference(brw->vs.surf_bo[surf]); - brw->vs.surf_bo[surf] = brw_search_cache(&brw->surface_cache, - BRW_SS_SURFACE, - &key, sizeof(key), - &key.bo, key.bo ? 1 : 0, - NULL); - if (brw->vs.surf_bo[surf] == NULL) { - brw->vs.surf_bo[surf] = brw_create_constant_surface(brw, &key); - } - - return const_buffer; -} - - /** * Sets up a surface state structure to point at the given region. * While it is only used for the front/back buffer currently, it should be @@ -753,92 +672,6 @@ static void prepare_wm_surfaces(struct brw_context *brw ) brw->state.dirty.brw |= BRW_NEW_NR_WM_SURFACES; } - -/** - * Constructs the binding table for the VS surface state. - */ -static dri_bo * -brw_vs_get_binding_table(struct brw_context *brw) -{ - dri_bo *bind_bo; - - assert(brw->vs.nr_surfaces <= BRW_VS_MAX_SURF); - - bind_bo = brw_search_cache(&brw->surface_cache, BRW_SS_SURF_BIND, - NULL, 0, - brw->vs.surf_bo, brw->vs.nr_surfaces, - NULL); - - if (bind_bo == NULL) { - GLuint data_size = brw->vs.nr_surfaces * sizeof(GLuint); - uint32_t *data = malloc(data_size); - int i; - - for (i = 0; i < brw->vs.nr_surfaces; i++) - if (brw->vs.surf_bo[i]) - data[i] = brw->vs.surf_bo[i]->offset; - else - data[i] = 0; - - bind_bo = brw_upload_cache( &brw->surface_cache, BRW_SS_SURF_BIND, - NULL, 0, - brw->vs.surf_bo, brw->vs.nr_surfaces, - data, data_size, - NULL, NULL); - - /* Emit binding table relocations to surface state */ - for (i = 0; i < BRW_VS_MAX_SURF; i++) { - if (brw->vs.surf_bo[i] != NULL) { - dri_bo_emit_reloc(bind_bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - 0, - i * sizeof(GLuint), - brw->vs.surf_bo[i]); - } - } - - free(data); - } - - return bind_bo; -} - - -/** - * Vertex shader surfaces (constant buffer). - */ -static void prepare_vs_surfaces(struct brw_context *brw ) -{ - GLcontext *ctx = &brw->intel.ctx; - - /* Update surface / buffer for vertex shader constant buffer */ - { - const GLuint surf = SURF_INDEX_VERT_CONST_BUFFER; - struct brw_vertex_program *vp = - (struct brw_vertex_program *) brw->vertex_program; - vp->const_buffer = - brw_update_vs_constant_surface(ctx, surf, vp->const_buffer, - vp->program.Base.Parameters); - - brw->vs.nr_surfaces = 1; - } - - dri_bo_unreference(brw->vs.bind_bo); - brw->vs.bind_bo = brw_vs_get_binding_table(brw); - - if (1) - brw->state.dirty.brw |= BRW_NEW_NR_VS_SURFACES; -} - - -static void -prepare_surfaces(struct brw_context *brw) -{ - prepare_wm_surfaces(brw); - prepare_vs_surfaces(brw); -} - - const struct brw_tracked_state brw_wm_surfaces = { .dirty = { .mesa = (_NEW_COLOR | @@ -849,7 +682,7 @@ const struct brw_tracked_state brw_wm_surfaces = { .brw = (BRW_NEW_CONTEXT), .cache = 0 }, - .prepare = prepare_surfaces, + .prepare = prepare_wm_surfaces, }; -- cgit v1.2.3 From 71fb9d62ece0177183efd5bb955d1f3292cb4376 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 5 May 2009 17:16:15 -0700 Subject: i965: Split WM constant buffer update from other WM surfaces. This can avoid re-uploading constant data when it isn't necessary, and is a step towards not updating other surfaces just because constants change. It also brings the upload of the constant buffer next to the creation. This brings openarena performance up another 4%, to 91% of the Mesa 7.4 branch. --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_curbe.c | 52 --------- src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 1 + src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 130 ++++++++++++++++------- 5 files changed, 95 insertions(+), 90 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 838e718d0d..873fc8ffff 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -131,6 +131,7 @@ struct brw_context; #define BRW_NEW_WM_INPUT_DIMENSIONS 0x100 #define BRW_NEW_INPUT_VARYING 0x200 #define BRW_NEW_PSP 0x800 +#define BRW_NEW_WM_SURFACES 0x1000 #define BRW_NEW_FENCE 0x2000 #define BRW_NEW_INDICES 0x4000 #define BRW_NEW_VERTICES 0x8000 diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 7bd5021346..a1a6c53d0e 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -329,63 +329,11 @@ static void prepare_constant_buffer(struct brw_context *brw) */ } - -/** - * Copy Mesa program parameters into given constant buffer. - */ -static void -update_constant_buffer(struct brw_context *brw, - const struct gl_program_parameter_list *params, - dri_bo *const_buffer) -{ - struct intel_context *intel = &brw->intel; - const int size = params->NumParameters * 4 * sizeof(GLfloat); - - /* copy Mesa program constants into the buffer */ - if (const_buffer && size > 0) { - - assert(const_buffer); - assert(const_buffer->size >= size); - - if (intel->intelScreen->kernel_exec_fencing) { - drm_intel_gem_bo_map_gtt(const_buffer); - memcpy(const_buffer->virtual, params->ParameterValues, size); - drm_intel_gem_bo_unmap_gtt(const_buffer); - } - else { - dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); - } - - if (0) { - _mesa_print_parameter_list(params); - } - } -} - - - -/** Copy current fragment program's parameters into the constant buffer */ -static void -update_fragment_constant_buffer(struct brw_context *brw) -{ - struct brw_fragment_program *fp = - (struct brw_fragment_program *) brw->fragment_program; - if (0) { - printf("update WM constants in buffer %p\n", fp->const_buffer); - printf("program %u\n", fp->program.Base.Id); - } - if (fp->use_const_buffer) - update_constant_buffer(brw, fp->program.Base.Parameters, fp->const_buffer); -} - - static void emit_constant_buffer(struct brw_context *brw) { struct intel_context *intel = &brw->intel; GLuint sz = brw->curbe.total_size; - update_fragment_constant_buffer(brw); - BEGIN_BATCH(2, IGNORE_CLIPRECTS); if (sz == 0) { OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2)); diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 1171e61ad4..bf9f6cae55 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -78,6 +78,7 @@ const struct brw_tracked_state brw_vs_unit; const struct brw_tracked_state brw_wm_input_sizes; const struct brw_tracked_state brw_wm_prog; const struct brw_tracked_state brw_wm_samplers; +const struct brw_tracked_state brw_wm_constant_surface; const struct brw_tracked_state brw_wm_surfaces; const struct brw_tracked_state brw_wm_unit; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 4c1ffe81c9..c6dfea4743 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -63,6 +63,7 @@ const struct brw_tracked_state *atoms[] = &brw_cc_unit, &brw_vs_surfaces, /* must do before unit */ + &brw_wm_constant_surface, /* must do before wm surfaces/bind bo */ &brw_wm_surfaces, /* must do before samplers and unit */ &brw_wm_samplers, diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 052bcf342c..53ce39cfe2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -365,47 +365,70 @@ brw_create_constant_surface( struct brw_context *brw, return bo; } +/* Creates a new WM constant buffer reflecting the current fragment program's + * constants, if needed by the fragment program. + * + * Otherwise, constants go through the CURBEs using the brw_constant_buffer + * state atom. + */ +static drm_intel_bo * +brw_wm_update_constant_buffer(struct brw_context *brw) +{ + struct intel_context *intel = &brw->intel; + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + const struct gl_program_parameter_list *params = fp->program.Base.Parameters; + const int size = params->NumParameters * 4 * sizeof(GLfloat); + drm_intel_bo *const_buffer; + + /* BRW_NEW_FRAGMENT_PROGRAM */ + if (!fp->use_const_buffer) + return NULL; + + const_buffer = drm_intel_bo_alloc(intel->bufmgr, "fp_const_buffer", + size, 64); + + /* _NEW_PROGRAM_CONSTANTS */ + dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); + + return const_buffer; +} /** * Update the surface state for a WM constant buffer. * The constant buffer will be (re)allocated here if needed. */ -static dri_bo * +static void brw_update_wm_constant_surface( GLcontext *ctx, - GLuint surf, - dri_bo *const_buffer, - const struct gl_program_parameter_list *params) + GLuint surf) { struct brw_context *brw = brw_context(ctx); struct brw_surface_key key; - struct intel_context *intel = &brw->intel; - const int size = params->NumParameters * 4 * sizeof(GLfloat); struct brw_fragment_program *fp = (struct brw_fragment_program *) brw->fragment_program; + const struct gl_program_parameter_list *params = + fp->program.Base.Parameters; - if (!fp->use_const_buffer) { - dri_bo_unreference(const_buffer); - brw->wm.surf_bo[surf] = NULL; - return NULL; - } - - /* free old const buffer if too small */ - if (const_buffer && const_buffer->size < size) { - dri_bo_unreference(const_buffer); - const_buffer = NULL; - } + /* If we're in this state update atom, we need to update WM constants, so + * free the old buffer and create a new one for the new contents. + */ + dri_bo_unreference(fp->const_buffer); + fp->const_buffer = brw_wm_update_constant_buffer(brw); - /* alloc new buffer if needed */ - if (!const_buffer) { - const_buffer = - drm_intel_bo_alloc(intel->bufmgr, "fp_const_buffer", size, 64); + /* If there's no constant buffer, then no surface BO is needed to point at + * it. + */ + if (fp->const_buffer == 0) { + drm_intel_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = NULL; + return; } memset(&key, 0, sizeof(key)); key.format = MESA_FORMAT_RGBA_FLOAT32; key.internal_format = GL_RGBA; - key.bo = const_buffer; + key.bo = fp->const_buffer; key.depthmode = GL_NONE; key.pitch = params->NumParameters; key.width = params->NumParameters; @@ -428,10 +451,51 @@ brw_update_wm_constant_surface( GLcontext *ctx, if (brw->wm.surf_bo[surf] == NULL) { brw->wm.surf_bo[surf] = brw_create_constant_surface(brw, &key); } + brw->state.dirty.brw |= BRW_NEW_WM_SURFACES; +} - return const_buffer; +/** + * Updates surface / buffer for fragment shader constant buffer, if + * one is required. + * + * This consumes the state updates for the constant buffer, and produces + * BRW_NEW_WM_SURFACES to get picked up by brw_prepare_wm_surfaces for + * inclusion in the binding table. + */ +static void prepare_wm_constant_surface(struct brw_context *brw ) +{ + GLcontext *ctx = &brw->intel.ctx; + struct brw_fragment_program *fp = + (struct brw_fragment_program *) brw->fragment_program; + GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; + + drm_intel_bo_unreference(fp->const_buffer); + fp->const_buffer = brw_wm_update_constant_buffer(brw); + + /* If there's no constant buffer, then no surface BO is needed to point at + * it. + */ + if (fp->const_buffer == 0) { + if (brw->wm.surf_bo[surf] != NULL) { + drm_intel_bo_unreference(brw->wm.surf_bo[surf]); + brw->wm.surf_bo[surf] = NULL; + brw->state.dirty.brw |= BRW_NEW_WM_SURFACES; + } + return; + } + + brw_update_wm_constant_surface(ctx, surf); } +const struct brw_tracked_state brw_wm_constant_surface = { + .dirty = { + .mesa = (_NEW_PROGRAM_CONSTANTS), + .brw = (BRW_NEW_FRAGMENT_PROGRAM), + .cache = 0 + }, + .prepare = prepare_wm_constant_surface, +}; + /** * Sets up a surface state structure to point at the given region. @@ -628,18 +692,8 @@ static void prepare_wm_surfaces(struct brw_context *brw ) old_nr_surfaces = brw->wm.nr_surfaces; brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; - /* Update surface / buffer for fragment shader constant buffer */ - { - const GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER; - struct brw_fragment_program *fp = - (struct brw_fragment_program *) brw->fragment_program; - fp->const_buffer = - brw_update_wm_constant_surface(ctx, surf, fp->const_buffer, - fp->program.Base.Parameters); - - if (fp->const_buffer != NULL) - brw->wm.nr_surfaces = surf + 1; - } + if (brw->wm.surf_bo[SURF_INDEX_FRAG_CONST_BUFFER] != NULL) + brw->wm.nr_surfaces = SURF_INDEX_FRAG_CONST_BUFFER + 1; /* Update surfaces for textures */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { @@ -677,9 +731,9 @@ const struct brw_tracked_state brw_wm_surfaces = { .mesa = (_NEW_COLOR | _NEW_TEXTURE | _NEW_BUFFERS | - _NEW_PROGRAM | - _NEW_PROGRAM_CONSTANTS), - .brw = (BRW_NEW_CONTEXT), + _NEW_PROGRAM), + .brw = (BRW_NEW_CONTEXT | + BRW_NEW_WM_SURFACES), .cache = 0 }, .prepare = prepare_wm_surfaces, -- cgit v1.2.3 From 9b678af7967bb88044c5fe437e050472fa03eaca Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 08:45:55 -0600 Subject: mesa: be smarter about allocating vert/frag program constants Try to re-use constants/literals more often to make best use of the constant buffer space. See bug 21354. --- src/mesa/shader/arbprogparse.c | 101 +++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index c7a031067e..36267c336f 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -563,6 +563,7 @@ struct var_cache * we take up with our state tokens or constants. Note that * this is _not_ the same as the number of param registers * we eventually use */ + GLuint swizzle; /**< swizzle to access this variable */ struct var_cache *next; }; @@ -581,6 +582,7 @@ var_cache_create (struct var_cache **va) (**va).param_binding_begin = ~0; (**va).param_binding_length = ~0; (**va).alias_binding = NULL; + (**va).swizzle = SWIZZLE_XYZW; (**va).next = NULL; } } @@ -872,15 +874,16 @@ parse_signed_float (const GLubyte ** inst, struct arb_program *Program) * This picks out a constant value from the parsed array. The constant vector is r * returned in the *values array, which should be of length 4. * - * \param values - The 4 component vector with the constant value in it + * \param values - return the vector constant values. + * \param size - returns the number elements in valuesOut [1..4] */ static GLvoid -parse_constant (const GLubyte ** inst, GLfloat *values, struct arb_program *Program, - GLboolean use) +parse_constant(const GLubyte ** inst, GLfloat *values, GLint *size, + struct arb_program *Program, + GLboolean use) { GLuint components, i; - switch (*(*inst)++) { case CONSTANT_SCALAR: if (use == GL_TRUE) { @@ -893,7 +896,7 @@ parse_constant (const GLubyte ** inst, GLfloat *values, struct arb_program *Prog values[1] = values[2] = values[3] = parse_signed_float (inst, Program); } - + *size = 1; break; case CONSTANT_VECTOR: values[0] = values[1] = values[2] = 0; @@ -902,7 +905,12 @@ parse_constant (const GLubyte ** inst, GLfloat *values, struct arb_program *Prog for (i = 0; i < components; i++) { values[i] = parse_signed_float (inst, Program); } + *size = 4; break; + default: + _mesa_problem(NULL, "unexpected case in parse_constant()"); + values[0] = 0.0F; + *size = 0; } } @@ -1816,7 +1824,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, GLint idx; GLuint err = 0; gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0}; - GLfloat const_values[4]; GLubyte token = *(*inst)++; @@ -1908,18 +1915,31 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, case PARAM_CONSTANT: /* parsing something like {1.0, 2.0, 3.0, 4.0} */ - parse_constant (inst, const_values, Program, use); - idx = _mesa_add_named_constant(Program->Base.Parameters, - (char *) param_var->name, - const_values, 4); - if (param_var->param_binding_begin == ~0U) - param_var->param_binding_begin = idx; - param_var->param_binding_type = PROGRAM_STATE_VAR; - /* Note: when we reference this parameter in an instruction later, - * we'll check if it's really a constant/immediate and set the - * instruction register type appropriately. - */ - param_var->param_binding_length++; + { + GLfloat const_values[4]; + GLint size; + parse_constant(inst, const_values, &size, Program, use); + if (param_var->name[0] == ' ') { + /* this is an unnamed constant */ + idx = _mesa_add_unnamed_constant(Program->Base.Parameters, + const_values, size, + ¶m_var->swizzle); + } + else { + /* named parameter/constant */ + idx = _mesa_add_named_constant(Program->Base.Parameters, + (char *) param_var->name, + const_values, size); + } + if (param_var->param_binding_begin == ~0U) + param_var->param_binding_begin = idx; + param_var->param_binding_type = PROGRAM_STATE_VAR; + /* Note: when we reference this parameter in an instruction later, + * we'll check if it's really a constant/immediate and set the + * instruction register type appropriately. + */ + param_var->param_binding_length++; + } break; default: @@ -2428,6 +2448,9 @@ parse_swizzle_mask(const GLubyte ** inst, GLubyte *swizzle, GLint len) return; } } + + if (len == 1) + swizzle[1] = swizzle[2] = swizzle[3] = swizzle[0]; } @@ -2482,7 +2505,7 @@ static GLuint parse_src_reg (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, - gl_register_file * File, GLint * Index, + gl_register_file * File, GLint * Index, GLuint *swizzle, GLboolean *IsRelOffset ) { struct var_cache *src; @@ -2491,6 +2514,8 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, *IsRelOffset = 0; + *swizzle = SWIZZLE_XYZW; /* default */ + /* And the binding for the src */ switch (*(*inst)++) { case REGISTER_ATTRIB: @@ -2546,6 +2571,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, } *Index = src->param_binding_begin + offset; + *swizzle = src->swizzle; break; case ARRAY_INDEX_RELATIVE: @@ -2568,6 +2594,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, /* And store it properly */ *Index = src->param_binding_begin + rel_off; *IsRelOffset = 1; + *swizzle = src->swizzle; } break; } @@ -2579,6 +2606,7 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, *File = (gl_register_file) src->param_binding_type; *Index = src->param_binding_begin; + *swizzle = src->swizzle; break; } break; @@ -2647,6 +2675,21 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, } +static GLuint +swizzle_swizzle(GLuint baseSwizzle, const GLubyte swizzle[4]) +{ + GLuint i, swz, s[4]; + for (i = 0; i < 4; i++) { + GLuint c = swizzle[i]; + if (c <= SWIZZLE_W) + s[i] = GET_SWZ(baseSwizzle, c); + else + s[i] = c; + } + swz = MAKE_SWIZZLE4(s[0], s[1], s[2], s[3]); + return swz; +} + /** * Parse vertex/fragment program vector source register. */ @@ -2661,12 +2704,14 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, GLubyte negateMask; GLubyte swizzle[4]; GLboolean isRelOffset; + GLuint baseSwizzle; /* Grab the sign */ negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ - if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &isRelOffset)) + if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &baseSwizzle, + &isRelOffset)) return 1; /* finally, the swizzle */ @@ -2674,7 +2719,7 @@ parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, reg->File = file; reg->Index = index; - reg->Swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]); + reg->Swizzle = swizzle_swizzle(baseSwizzle, swizzle); reg->Negate = negateMask; reg->RelAddr = isRelOffset; return 0; @@ -2695,12 +2740,14 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, GLubyte negateMask; GLubyte swizzle[4]; GLboolean isRelOffset; + GLuint baseSwizzle; /* Grab the sign */ negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; /* And the src reg */ - if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &isRelOffset)) + if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &baseSwizzle, + &isRelOffset)) return 1; /* finally, the swizzle */ @@ -2708,7 +2755,7 @@ parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, reg->File = file; reg->Index = index; - reg->Swizzle = (swizzle[0] << 0); + reg->Swizzle = swizzle_swizzle(baseSwizzle, swizzle); reg->Negate = negateMask; reg->RelAddr = isRelOffset; return 0; @@ -3019,8 +3066,10 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, GLubyte negateMask; gl_register_file file; GLint index; + GLuint baseSwizzle; - if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &rel)) + if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, + &baseSwizzle, &rel)) return 1; parse_extended_swizzle_mask(inst, swizzle, &negateMask); fp->SrcReg[0].File = file; @@ -3360,11 +3409,13 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, GLboolean relAddr; gl_register_file file; GLint index; + GLuint baseSwizzle; if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; - if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, &relAddr)) + if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, + &baseSwizzle, &relAddr)) return 1; parse_extended_swizzle_mask (inst, swizzle, &negateMask); vp->SrcReg[0].File = file; -- cgit v1.2.3 From 4cb87840ff7c99654a89f45c6a5a2a026a587a2f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 May 2009 07:58:40 -0700 Subject: i965: Remove _NEW_PROGRAM from brw_wm_surfaces setup dependencies. This was a leftover from the brw_wm_constant_buffer change. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 53ce39cfe2..f2d9541e51 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -730,8 +730,7 @@ const struct brw_tracked_state brw_wm_surfaces = { .dirty = { .mesa = (_NEW_COLOR | _NEW_TEXTURE | - _NEW_BUFFERS | - _NEW_PROGRAM), + _NEW_BUFFERS), .brw = (BRW_NEW_CONTEXT | BRW_NEW_WM_SURFACES), .cache = 0 -- cgit v1.2.3 From f831d2d41b5551abcf61f19880bc96779c5efd51 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 May 2009 10:51:58 -0700 Subject: i965: Remove the forced lack of caching for renderbuffer surface state. This snuck in with the multi-draw-buffers commit, and is a major penalty to performance. It doesn't appear to be required, as the only dependency the surface BO has is on the state key (and if there's some other dependency, it should just be in the key). This brings openarena performance up to almost 2% faster than Mesa 7.4. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index f2d9541e51..c49a5f6b4e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -505,7 +505,7 @@ const struct brw_tracked_state brw_wm_constant_surface = { static void brw_update_renderbuffer_surface(struct brw_context *brw, struct gl_renderbuffer *rb, - unsigned int unit, GLboolean cached) + unsigned int unit) { GLcontext *ctx = &brw->intel.ctx; dri_bo *region_bo = NULL; @@ -565,13 +565,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw, ctx->Color.BlendEnabled); dri_bo_unreference(brw->wm.surf_bo[unit]); - brw->wm.surf_bo[unit] = NULL; - if (cached) - brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache, - BRW_SS_SURFACE, - &key, sizeof(key), - ®ion_bo, 1, - NULL); + brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache, + BRW_SS_SURFACE, + &key, sizeof(key), + ®ion_bo, 1, + NULL); if (brw->wm.surf_bo[unit] == NULL) { struct brw_surface_state surf; @@ -682,11 +680,10 @@ static void prepare_wm_surfaces(struct brw_context *brw ) for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { brw_update_renderbuffer_surface(brw, ctx->DrawBuffer->_ColorDrawBuffers[i], - i, - GL_FALSE); + i); } } else { - brw_update_renderbuffer_surface(brw, NULL, 0, GL_TRUE); + brw_update_renderbuffer_surface(brw, NULL, 0); } old_nr_surfaces = brw->wm.nr_surfaces; -- cgit v1.2.3 From a13df193c23f9202ade6f16643e3ef529cff772b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:23:28 -0600 Subject: mesa: use elementBuf local var instead of ctx->Array.ElementArrayBufferObj Makes no real difference, but more consistant. --- src/mesa/main/api_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 42d1e579e0..1986cbecbb 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -72,7 +72,7 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, if (map) { ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, - ctx->Array.ElementArrayBufferObj); + elementBuf); } return max; -- cgit v1.2.3 From 88af3f8783452dcf50a9e2e82076f52b2044f643 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:27:38 -0600 Subject: mesa: new comments, minor reformatting --- src/mesa/main/api_validate.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 1986cbecbb..dfe754dee5 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -44,10 +44,8 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, if (elementBuf->Name) { /* elements are in a user-defined buffer object. need to map it */ - map = ctx->Driver.MapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, - GL_READ_ONLY, - elementBuf); + map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, + GL_READ_ONLY, elementBuf); /* Actual address is the sum of pointers */ indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); } @@ -70,14 +68,16 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, } if (map) { - ctx->Driver.UnmapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, - elementBuf); + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuf); } return max; } + +/** + * Check if OK to render by examining framebuffer status and vertex arrays. + */ static GLboolean check_valid_to_render(GLcontext *ctx, char *function) { @@ -105,6 +105,12 @@ check_valid_to_render(GLcontext *ctx, char *function) return GL_TRUE; } + +/** + * Error checking for glDrawElements(). Includes parameter checking + * and VBO bounds checking. + * \return GL_TRUE if OK to render, GL_FALSE if error found + */ GLboolean _mesa_validate_DrawElements(GLcontext *ctx, GLenum mode, GLsizei count, GLenum type, @@ -184,6 +190,12 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_TRUE; } + +/** + * Error checking for glDrawRangeElements(). Includes parameter checking + * and VBO bounds checking. + * \return GL_TRUE if OK to render, GL_FALSE if error found + */ GLboolean _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, GLuint start, GLuint end, @@ -265,6 +277,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, /** * Called from the tnl module to error check the function parameters and * verify that we really can draw something. + * \return GL_TRUE if OK to render, GL_FALSE if error found */ GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, -- cgit v1.2.3 From bb1fb2a5444c6b7d83ccb47949f60ed9fb4f0f93 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:37:10 -0600 Subject: mesa: code consolidation in glDraw[Range]Elements() validation --- src/mesa/main/api_validate.c | 48 ++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index dfe754dee5..ad150eea80 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -30,6 +30,26 @@ #include "state.h" + +/** + * \return number of bytes in array [count] of type. + */ +static GLsizei +index_bytes(GLenum type, GLsizei count) +{ + if (type == GL_UNSIGNED_INT) { + return count * sizeof(GLuint); + } + else if (type == GL_UNSIGNED_BYTE) { + return count * sizeof(GLubyte); + } + else { + ASSERT(type == GL_UNSIGNED_SHORT); + return count * sizeof(GLushort); + } +} + + /** * Find the max index in the given element/index buffer */ @@ -146,7 +166,6 @@ _mesa_validate_DrawElements(GLcontext *ctx, /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - GLuint indexBytes; if (!ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, @@ -154,19 +173,8 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_FALSE; } - if (type == GL_UNSIGNED_INT) { - indexBytes = count * sizeof(GLuint); - } - else if (type == GL_UNSIGNED_BYTE) { - indexBytes = count * sizeof(GLubyte); - } - else { - ASSERT(type == GL_UNSIGNED_SHORT); - indexBytes = count * sizeof(GLushort); - } - /* make sure count doesn't go outside buffer bounds */ - if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } @@ -236,21 +244,9 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - GLuint indexBytes; - - if (type == GL_UNSIGNED_INT) { - indexBytes = count * sizeof(GLuint); - } - else if (type == GL_UNSIGNED_BYTE) { - indexBytes = count * sizeof(GLubyte); - } - else { - ASSERT(type == GL_UNSIGNED_SHORT); - indexBytes = count * sizeof(GLushort); - } /* make sure count doesn't go outside buffer bounds */ - if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); return GL_FALSE; } -- cgit v1.2.3 From 58544a28ad561d7d9e16deb048443c2d2b5c12d8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:38:11 -0600 Subject: mesa: remove unnecessary buffer size check --- src/mesa/main/api_validate.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index ad150eea80..27049486ee 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -166,13 +166,6 @@ _mesa_validate_DrawElements(GLcontext *ctx, /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - - if (!ctx->Array.ElementArrayBufferObj->Size) { - _mesa_warning(ctx, - "glDrawElements called with empty array elements buffer"); - return GL_FALSE; - } - /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); @@ -244,7 +237,6 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ - /* make sure count doesn't go outside buffer bounds */ if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); -- cgit v1.2.3 From cfc3ac8d6e3024d1284cfc3f50f695b6b8008c5f Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 6 May 2009 14:44:16 -0400 Subject: When clearing the stencil buffer, don't use a two-sided stencil In radeon_clear_tris(), when clearing the stencil buffer, pass GL_FRONT_AND_BACK to _mesa_StencilFuncSeparate(), to avoid triggering a software fallback on r300 and below. https://bugs.freedesktop.org/show_bug.cgi?id=21601 --- src/mesa/drivers/dri/radeon/radeon_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 8b5b892f0d..ee3ee9ca50 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1429,7 +1429,7 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) if (this_mask & BUFFER_BIT_STENCIL) { _mesa_Enable(GL_STENCIL_TEST); _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - _mesa_StencilFuncSeparate(GL_FRONT, GL_ALWAYS, ctx->Stencil.Clear, + _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, ctx->Stencil.Clear, ctx->Stencil.WriteMask[0]); } else { _mesa_Disable(GL_STENCIL_TEST); -- cgit v1.2.3 From 156a79f5bd7b3e79f219adf4619ec449a7c0ed1c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 May 2009 13:58:57 -0700 Subject: intel: Unmap buffers if needed at DeleteBuffer time. This fixes a crash in glean's pbo test, which tripped over the assert when a context was destroyed while a buffer was still mapped (Mesa doesn't call UnmapBuffer in that case). Regression in c6bde8873fbda6d8467600b7491d8543c75b0509 --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index c849e4869e..f6b0d769c6 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -35,6 +35,9 @@ #include "intel_batchbuffer.h" #include "intel_regions.h" +static GLboolean +intel_bufferobj_unmap(GLcontext * ctx, + GLenum target, struct gl_buffer_object *obj); /** Allocates a new dri_bo to store the data for the buffer object. */ static void @@ -100,7 +103,13 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) struct intel_buffer_object *intel_obj = intel_buffer_object(obj); assert(intel_obj); - assert(!obj->Pointer); /* Mesa should have unmapped it */ + + /* Buffer objects are automatically unmapped when deleting according + * to the spec, but Mesa doesn't do UnmapBuffer for us at context destroy + * (though it does if you call glDeleteBuffers) + */ + if (obj->Pointer) + intel_bufferobj_unmap(ctx, 0, obj); if (intel_obj->region) { intel_bufferobj_release_region(intel, intel_obj); -- cgit v1.2.3 From 3d048e57504c63999aeaaf5a65e8e493e6a67ff7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 May 2009 21:44:13 -0700 Subject: i965: Remove bad constant buffer constant-reg-already-loaded optimization. Thanks to branching, the state of c->current_const[i].index at the point of emitting constant loads for this instruction may not match the actual constant currently loaded in the reg at runtime. Fixes a regression in my GLSL program for idr's class since b58b3a786aa38dcc9d72144c2cc691151e46e3d5. --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 39ea95f6fc..cc2c6ab189 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -407,23 +407,21 @@ static void fetch_constants(struct brw_wm_compile *c, if (src->File == PROGRAM_STATE_VAR || src->File == PROGRAM_CONSTANT || src->File == PROGRAM_UNIFORM) { - if (c->current_const[i].index != src->Index) { - c->current_const[i].index = src->Index; + c->current_const[i].index = src->Index; #if 0 - printf(" fetch const[%d] for arg %d into reg %d\n", - src->Index, i, c->current_const[i].reg.nr); + printf(" fetch const[%d] for arg %d into reg %d\n", + src->Index, i, c->current_const[i].reg.nr); #endif - /* need to fetch the constant now */ - brw_dp_READ_4(p, - c->current_const[i].reg, /* writeback dest */ - 1, /* msg_reg */ - src->RelAddr, /* relative indexing? */ - 16 * src->Index, /* byte offset */ - SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */ - ); - } + /* need to fetch the constant now */ + brw_dp_READ_4(p, + c->current_const[i].reg, /* writeback dest */ + 1, /* msg_reg */ + src->RelAddr, /* relative indexing? */ + 16 * src->Index, /* byte offset */ + SURF_INDEX_FRAG_CONST_BUFFER/* binding table index */ + ); } } } -- cgit v1.2.3 From cc7170464493453ec8213decd21df95121b236e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 09:36:21 -0600 Subject: mesa: unmap buffer objects during context tear-down --- src/mesa/main/shared.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 193ac8970c..ae8dd2a836 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -190,6 +190,10 @@ delete_bufferobj_cb(GLuint id, void *data, void *userData) { struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data; GLcontext *ctx = (GLcontext *) userData; + if (bufObj->Pointer) { + ctx->Driver.UnmapBuffer(ctx, 0, bufObj); + bufObj->Pointer = NULL; + } ctx->Driver.DeleteBuffer(ctx, bufObj); } -- cgit v1.2.3 From 6a3004b9ae58dafd1ce995df78b0f3183827a59d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 09:43:15 -0600 Subject: swrast: fix span clipping bug If a horizontal span of pixels was located at x < 0 we could sometimes read/write outside of renderbuffer bounds. --- src/mesa/swrast/s_span.c | 84 ++++++++++++++++++++++++++++++++++++------------ src/mesa/swrast/s_span.h | 9 ++++-- 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index cfff82b051..fa8ca1d0e2 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.5 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -188,10 +189,10 @@ interpolate_active_attribs(GLcontext *ctx, SWspan *span, GLbitfield attrMask) const GLfloat dv1dx = span->attrStepX[attr][1]; const GLfloat dv2dx = span->attrStepX[attr][2]; const GLfloat dv3dx = span->attrStepX[attr][3]; - GLfloat v0 = span->attrStart[attr][0]; - GLfloat v1 = span->attrStart[attr][1]; - GLfloat v2 = span->attrStart[attr][2]; - GLfloat v3 = span->attrStart[attr][3]; + GLfloat v0 = span->attrStart[attr][0] + span->leftClip * dv0dx; + GLfloat v1 = span->attrStart[attr][1] + span->leftClip * dv1dx; + GLfloat v2 = span->attrStart[attr][2] + span->leftClip * dv2dx; + GLfloat v3 = span->attrStart[attr][3] + span->leftClip * dv3dx; GLuint k; for (k = 0; k < span->end; k++) { const GLfloat invW = 1.0f / w; @@ -521,10 +522,10 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span) const GLfloat drdx = span->attrStepX[attr][2]; const GLfloat dqdx = span->attrStepX[attr][3]; const GLfloat dqdy = span->attrStepY[attr][3]; - GLfloat s = span->attrStart[attr][0]; - GLfloat t = span->attrStart[attr][1]; - GLfloat r = span->attrStart[attr][2]; - GLfloat q = span->attrStart[attr][3]; + GLfloat s = span->attrStart[attr][0] + span->leftClip * dsdx; + GLfloat t = span->attrStart[attr][1] + span->leftClip * dtdx; + GLfloat r = span->attrStart[attr][2] + span->leftClip * drdx; + GLfloat q = span->attrStart[attr][3] + span->leftClip * dqdx; if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; @@ -546,7 +547,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -587,7 +588,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span) ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -660,8 +661,8 @@ interpolate_wpos(GLcontext *ctx, SWspan *span) } } - w = span->attrStart[FRAG_ATTRIB_WPOS][3]; dw = span->attrStepX[FRAG_ATTRIB_WPOS][3]; + w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw; for (i = 0; i < span->end; i++) { wpos[i][2] = (GLfloat) span->array->z[i] * zScale; wpos[i][3] = w; @@ -726,6 +727,8 @@ clip_span( GLcontext *ctx, SWspan *span ) const GLint ymin = ctx->DrawBuffer->_Ymin; const GLint ymax = ctx->DrawBuffer->_Ymax; + span->leftClip = 0; + if (span->arrayMask & SPAN_XY) { /* arrays of x/y pixel coords */ const GLint *x = span->array->x; @@ -753,7 +756,7 @@ clip_span( GLcontext *ctx, SWspan *span ) /* horizontal span of pixels */ const GLint x = span->x; const GLint y = span->y; - const GLint n = span->end; + GLint n = span->end; /* Trivial rejection tests */ if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) { @@ -761,18 +764,44 @@ clip_span( GLcontext *ctx, SWspan *span ) return GL_FALSE; /* all pixels clipped */ } + /* Clip to right */ + if (x + n > xmax) { + ASSERT(x < xmax); + n = span->end = xmax - x; + } + /* Clip to the left */ if (x < xmin) { + const GLint leftClip = xmin - x; + GLuint i; + + ASSERT(leftClip > 0); ASSERT(x + n > xmin); + + /* Clip 'leftClip' pixels from the left side. + * The span->leftClip field will be applied when we interpolate + * fragment attributes. + * For arrays of values, shift them left. + */ + for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (span->arrayAttribs & (1 << i)) { + /* shift array elements left by 'leftClip' */ + _mesa_memcpy(span->array->attribs[i], + span->array->attribs[i] + leftClip, + (n - leftClip) * 4 * sizeof(GLfloat)); + } + } + + span->leftClip = leftClip; + span->x = xmin; + span->end -= leftClip; span->writeAll = GL_FALSE; - _mesa_bzero(span->array->mask, (xmin - x) * sizeof(GLubyte)); } - /* Clip to right */ - if (x + n > xmax) { - ASSERT(x < xmax); - span->end = xmax - x; - } + ASSERT(span->x >= xmin); + ASSERT(span->x + span->end <= xmax); + ASSERT(span->y >= ymin); + ASSERT(span->y < ymax); return GL_TRUE; /* some pixels visible */ } @@ -818,6 +847,12 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) } } + if (!(span->arrayMask & SPAN_MASK)) { + /* post-clip sanity check */ + assert(span->x >= 0); + assert(span->y >= 0); + } + /* Depth bounds test */ if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) { if (!_swrast_depth_bounds_test(ctx, span)) { @@ -1284,6 +1319,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) #ifdef DEBUG /* Make sure all fragments are within window bounds */ if (span->arrayMask & SPAN_XY) { + /* array of pixel locations */ GLuint i; for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { @@ -1321,6 +1357,14 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); + if ((span->arrayMask & SPAN_XY) == 0) { + if (span->x < fb->_Xmin || span->x + span->end > fb->_Xmax || + span->y < fb->_Ymin || span->y >= fb->_Ymax) { + printf("Bad span clipping at %d, %d\n", span->x, span->y); + return; + } + } + if (ctx->Stencil._Enabled) { /* Combined Z/stencil tests */ if (!_swrast_stencil_and_ztest_span(ctx, span)) { diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h index c4b47df58f..0eabae20e0 100644 --- a/src/mesa/swrast/s_span.h +++ b/src/mesa/swrast/s_span.h @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.5 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -106,6 +107,9 @@ typedef struct sw_span /** Number of fragments in the span */ GLuint end; + /** for clipping left edge of spans */ + GLuint leftClip; + /** This flag indicates that mask[] array is effectively filled with ones */ GLboolean writeAll; @@ -165,6 +169,7 @@ do { \ (S).arrayMask = 0x0; \ (S).arrayAttribs = 0x0; \ (S).end = 0; \ + (S).leftClip = 0; \ (S).facing = 0; \ (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ } while (0) -- cgit v1.2.3 From f56893ea173454ed5367eafb038fa4905f9ebce3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 08:16:42 -0600 Subject: i965: relAddr local var (to make debug/test a little easier) --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 3fdc48583b..0a3debb101 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -714,10 +714,11 @@ get_constant(struct brw_vs_compile *c, struct brw_compile *p = &c->func; struct brw_reg const_reg; struct brw_reg const2_reg; + const GLboolean relAddr = src->RelAddr; assert(argIndex < 3); - if (c->current_const[argIndex].index != src->Index || src->RelAddr) { + if (c->current_const[argIndex].index != src->Index || relAddr) { struct brw_reg addrReg = c->regs[PROGRAM_ADDRESS][0]; c->current_const[argIndex].index = src->Index; @@ -730,13 +731,13 @@ get_constant(struct brw_vs_compile *c, brw_dp_READ_4_vs(p, c->current_const[argIndex].reg,/* writeback dest */ 0, /* oword */ - src->RelAddr, /* relative indexing? */ + relAddr, /* relative indexing? */ addrReg, /* address register */ 16 * src->Index, /* byte offset */ SURF_INDEX_VERT_CONST_BUFFER /* binding table index */ ); - if (src->RelAddr) { + if (relAddr) { /* second read */ const2_reg = get_tmp(c); @@ -747,7 +748,7 @@ get_constant(struct brw_vs_compile *c, brw_dp_READ_4_vs(p, const2_reg, /* writeback dest */ 1, /* oword */ - src->RelAddr, /* relative indexing? */ + relAddr, /* relative indexing? */ addrReg, /* address register */ 16 * src->Index, /* byte offset */ SURF_INDEX_VERT_CONST_BUFFER @@ -757,7 +758,7 @@ get_constant(struct brw_vs_compile *c, const_reg = c->current_const[argIndex].reg; - if (src->RelAddr) { + if (relAddr) { /* merge the two Owords into the constant register */ /* const_reg[7..4] = const2_reg[7..4] */ brw_MOV(p, -- cgit v1.2.3 From 134ac52decf020e6ffb2da8d641cdb3cda9ac0f2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 4 May 2009 18:22:19 -0600 Subject: tnl: replace 0x3f with CILP_FRUSTUM_BITS --- src/mesa/tnl/t_vb_cliptmp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 788fe329ed..e1643c2735 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -127,7 +127,7 @@ TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask ) GLuint p; const GLuint v0_orig = v0; - if (mask & 0x3f) { + if (mask & CLIP_FRUSTUM_BITS) { LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); @@ -199,7 +199,7 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ - if (mask & 0x3f) { + if (mask & CLIP_FRUSTUM_BITS) { POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); @@ -250,7 +250,7 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, ASSIGN_4V(inlist, v3, v0, v1, v2 ); /* pv rotated to slot zero */ - if (mask & 0x3f) { + if (mask & CLIP_FRUSTUM_BITS) { POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); -- cgit v1.2.3 From 424507953ca9d41e0dbfcc0399f50315b5671776 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 May 2009 11:11:25 -0600 Subject: mesa: reformatting, updated comments, const-correctness --- src/mesa/math/m_vector.c | 84 ++++++++++++++++++++++-------------------------- src/mesa/math/m_vector.h | 25 +++++++------- 2 files changed, 50 insertions(+), 59 deletions(-) diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index c5e2fd1de1..dd631376d0 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -1,4 +1,3 @@ - /* * Mesa 3-D graphics library * Version: 3.5 @@ -37,11 +36,12 @@ -/* +/** * Given a vector [count][4] of floats, set all the [][elt] values * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). */ -void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) +void +_mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) { static const GLubyte elem_bits[4] = { VEC_DIRTY_0, @@ -54,12 +54,13 @@ void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; GLuint i; - for (i = 0 ; i < count ; i++) + for (i = 0; i < count; i++) data[i][elt] = v; vec->flags &= ~elem_bits[elt]; } + static const GLubyte size_bits[5] = { 0, VEC_SIZE_1, @@ -69,40 +70,34 @@ static const GLubyte size_bits[5] = { }; - -/* +/** * Initialize GLvector objects. - * Input: v - the vector object to initialize. - * flags - bitwise-OR of VEC_* flags - * storage - pointer to storage for the vector's data + * \param v the vector object to initialize. + * \param flags bitwise-OR of VEC_* flags + * \param storage pointer to storage for the vector's data */ - - -void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) +void +_mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) { v->stride = 4 * sizeof(GLfloat); v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ v->data = storage; v->start = (GLfloat *) storage; v->count = 0; - v->flags = size_bits[4] | flags ; + v->flags = size_bits[4] | flags; } - - -/* +/** * Initialize GLvector objects and allocate storage. - * Input: v - the vector object - * sz - unused???? - * flags - bitwise-OR of VEC_* flags - * count - number of elements to allocate in vector - * alignment - desired memory alignment for the data (in bytes) + * \param v the vector object + * \param flags bitwise-OR of VEC_* flags + * \param count number of elements to allocate in vector + * \param alignment desired memory alignment for the data (in bytes) */ - - -void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, - GLuint alignment ) +void +_mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, + GLuint alignment ) { v->stride = 4 * sizeof(GLfloat); v->size = 2; @@ -110,20 +105,17 @@ void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; v->count = 0; - v->flags = size_bits[4] | flags | VEC_MALLOC ; + v->flags = size_bits[4] | flags | VEC_MALLOC; } - - -/* +/** * Vector deallocation. Free whatever memory is pointed to by the * vector's storage field if the VEC_MALLOC flag is set. * DO NOT free the GLvector object itself, though. */ - - -void _mesa_vector4f_free( GLvector4f *v ) +void +_mesa_vector4f_free( GLvector4f *v ) { if (v->flags & VEC_MALLOC) { ALIGN_FREE( v->storage ); @@ -135,13 +127,15 @@ void _mesa_vector4f_free( GLvector4f *v ) } -/* +/** * For debugging */ -void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) +void +_mesa_vector4f_print( const GLvector4f *v, const GLubyte *cullmask, + GLboolean culling ) { - GLfloat c[4] = { 0, 0, 0, 1 }; - const char *templates[5] = { + static const GLfloat c[4] = { 0, 0, 0, 1 }; + static const char *templates[5] = { "%d:\t0, 0, 0, 1\n", "%d:\t%f, 0, 0, 1\n", "%d:\t%f, %f, 0, 1\n", @@ -154,30 +148,32 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) GLuint j, i = 0, count; _mesa_printf("data-start\n"); - for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) + for (; d != v->start; STRIDE_F(d, v->stride), i++) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); _mesa_printf("start-count(%u)\n", v->count); count = i + v->count; if (culling) { - for ( ; i < count ; STRIDE_F(d, v->stride), i++) + for (; i < count; STRIDE_F(d, v->stride), i++) if (cullmask[i]) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } else { - for ( ; i < count ; STRIDE_F(d, v->stride), i++) + for (; i < count; STRIDE_F(d, v->stride), i++) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } - for (j = v->size ; j < 4; j++) { + for (j = v->size; j < 4; j++) { if ((v->flags & (1<data ; - i < count && d[j] == c[j] ; - i++, STRIDE_F(d, v->stride)) {}; + for (i = 0, d = (GLfloat *) v->data; + i < count && d[j] == c[j]; + i++, STRIDE_F(d, v->stride)) { + /* no-op */ + } if (i == count) _mesa_printf(" --> ok\n"); @@ -186,5 +182,3 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) } } } - - diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index 647388ac7d..9112a2b5d5 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -31,7 +31,6 @@ #define _M_VECTOR_H_ #include "main/glheader.h" -#include "main/mtypes.h" /* hack for GLchan */ #define VEC_DIRTY_0 0x1 @@ -50,7 +49,8 @@ -/* Wrap all the information about vectors up in a struct. Has +/** + * Wrap all the information about vectors up in a struct. Has * additional fields compared to the other vectors to help us track of * different vertex sizes, and whether we need to clean columns out * because they contain non-(0,0,0,1) values. @@ -60,13 +60,13 @@ * the transformation routines. */ typedef struct { - GLfloat (*data)[4]; /* may be malloc'd or point to client data */ - GLfloat *start; /* points somewhere inside of */ - GLuint count; /* size of the vector (in elements) */ - GLuint stride; /* stride from one element to the next (in bytes) */ - GLuint size; /* 2-4 for vertices and 1-4 for texcoords */ - GLuint flags; /* which columns are dirty */ - void *storage; /* self-allocated storage */ + GLfloat (*data)[4]; /**< may be malloc'd or point to client data */ + GLfloat *start; /**< points somewhere inside of */ + GLuint count; /**< size of the vector (in elements) */ + GLuint stride; /**< stride from one element to the next (in bytes) */ + GLuint size; /**< 2-4 for vertices and 1-4 for texcoords */ + GLuint flags; /**< which columns are dirty */ + void *storage; /**< self-allocated storage */ } GLvector4f; @@ -75,14 +75,11 @@ extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags, extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, GLuint alignment ); extern void _mesa_vector4f_free( GLvector4f *v ); -extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean ); +extern void _mesa_vector4f_print( const GLvector4f *v, const GLubyte *, GLboolean ); extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt ); - - - -/* +/** * Given vector , return a pointer (cast to to the -th element. * * End up doing a lot of slow imuls if not careful. -- cgit v1.2.3 From ad32489987f3f65d37aee76083f466d674ada0c5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 09:45:24 -0600 Subject: tnl: added some clip debug/print code (disabled) --- src/mesa/tnl/t_vb_cliptmp.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index e1643c2735..61b0a89554 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -227,6 +227,25 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) } } + if (0) { + /* print pre/post-clip vertex coords */ + GLuint i, j; + _mesa_printf("pre clip\n"); + for (i = 0; i < 3; i++) { + j = outlist[i]; + _mesa_printf(" %u: %u: %f, %f, %f, %f\n", + i, j, + coord[j][0], coord[j][1], coord[j][2], coord[j][3]); + } + _mesa_printf("post clip\n"); + for (i = 0; i < n; i++) { + j = inlist[i]; + _mesa_printf(" %u: %u: %f, %f, %f, %f\n", + i, j, + coord[j][0], coord[j][1], coord[j][2], coord[j][3]); + } + } + tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); } -- cgit v1.2.3 From 74bec42b45910e2ff6bf1a8cc0eeb2bc5c705767 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 09:01:47 -0600 Subject: mesa: limit number of error raised by invalid GL_TEXTURE_MAX_ANISOTROPY_EXT --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index e60ab6aa12..2195a334d3 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -469,8 +469,10 @@ set_tex_parameterf(GLcontext *ctx, return GL_TRUE; } else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); + static GLuint count = 0; + if (count++ < 10) + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); } return GL_FALSE; -- cgit v1.2.3 From 2369f14245222a9c073846baa1bb03e23aa37c15 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 09:51:56 -0600 Subject: mesa: in vbo split code, map buffers read-only, not write-only And use GL_ELEMENT_ARRAY_BUFFER where appropriate. --- src/mesa/vbo/vbo_split_copy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 5fb66d3318..4fc0e36156 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -389,8 +389,8 @@ static void replay_init( struct copy_context *copy ) if (vbo->Name && !vbo->Pointer) ctx->Driver.MapBuffer(ctx, - GL_ARRAY_BUFFER_ARB, - GL_WRITE_ONLY, /* XXX */ + GL_ARRAY_BUFFER, + GL_READ_ONLY, vbo); copy->varying[j].src_ptr = ADD_POINTERS(vbo->Pointer, @@ -406,8 +406,8 @@ static void replay_init( struct copy_context *copy ) */ if (copy->ib->obj->Name && !copy->ib->obj->Pointer) ctx->Driver.MapBuffer(ctx, - GL_ARRAY_BUFFER_ARB, /* XXX */ - GL_WRITE_ONLY, /* XXX */ + GL_ELEMENT_ARRAY_BUFFER, + GL_READ_ONLY, copy->ib->obj); srcptr = (const GLubyte *)ADD_POINTERS(copy->ib->obj->Pointer, copy->ib->ptr); @@ -509,14 +509,14 @@ static void replay_finish( struct copy_context *copy ) struct gl_buffer_object *vbo = copy->varying[i].array->BufferObj; if (vbo->Name && vbo->Pointer) - ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, vbo); + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, vbo); } /* Unmap index buffer: */ if (copy->ib->obj->Name && copy->ib->obj->Pointer) { ctx->Driver.UnmapBuffer(ctx, - GL_ARRAY_BUFFER_ARB, /* XXX */ + GL_ELEMENT_ARRAY_BUFFER, copy->ib->obj); } } -- cgit v1.2.3 From 87ba2285fe11dfe068798e5f8ea8e089a5d8b28b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 09:56:26 -0600 Subject: mesa: add GL_DOUBLE case in _mesa_sizeof_type() --- src/mesa/main/image.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ddae456fa1..ea76ed04e4 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -181,6 +181,8 @@ _mesa_sizeof_type( GLenum type ) return sizeof(GLint); case GL_FLOAT: return sizeof(GLfloat); + case GL_DOUBLE: + return sizeof(GLdouble); case GL_HALF_FLOAT_ARB: return sizeof(GLhalfARB); default: -- cgit v1.2.3 From 3acdab82cba03ea2a0dfaa3d7d5d940f1e94a374 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 10:36:33 -0600 Subject: mesa: vbo code reformatting, clean-up, comments --- src/mesa/vbo/vbo_split_copy.c | 95 +++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 4fc0e36156..44b748dad7 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -41,7 +41,8 @@ #define ELT_TABLE_SIZE 16 -/* Used for vertex-level splitting of indexed buffers. Note that +/** + * Used for vertex-level splitting of indexed buffers. Note that * non-indexed primitives may be converted to indexed in some cases * (eg loops, fans) in order to use this splitting path. */ @@ -73,23 +74,21 @@ struct copy_context { GLuint *translated_elt_buf; const GLuint *srcelt; - /* A baby hash table to avoid re-emitting (some) duplicate + /** A baby hash table to avoid re-emitting (some) duplicate * vertices when splitting indexed primitives. */ struct { GLuint in; GLuint out; } vert_cache[ELT_TABLE_SIZE]; - GLuint vertex_size; GLubyte *dstbuf; - GLubyte *dstptr; /* dstptr == dstbuf + dstelt_max * vertsize */ - GLuint dstbuf_size; /* in vertices */ - GLuint dstbuf_nr; /* count of emitted vertices, also the - * largest value in dstelt. Our - * MaxIndex. - */ + GLubyte *dstptr; /**< dstptr == dstbuf + dstelt_max * vertsize */ + GLuint dstbuf_size; /**< in vertices */ + GLuint dstbuf_nr; /**< count of emitted vertices, also the largest value + * in dstelt. Our MaxIndex. + */ GLuint *dstelt; GLuint dstelt_nr; @@ -123,11 +122,13 @@ static GLuint attr_size( const struct gl_client_array *array ) } -/* Starts returning true slightly before the buffer fills, to ensure +/** + * Starts returning true slightly before the buffer fills, to ensure * that there is sufficient room for any remaining vertices to finish * off the prim: */ -static GLboolean check_flush( struct copy_context *copy ) +static GLboolean +check_flush( struct copy_context *copy ) { GLenum mode = copy->dstprim[copy->dstprim_nr].mode; @@ -145,7 +146,9 @@ static GLboolean check_flush( struct copy_context *copy ) return GL_FALSE; } -static void flush( struct copy_context *copy ) + +static void +flush( struct copy_context *copy ) { GLuint i; @@ -175,8 +178,11 @@ static void flush( struct copy_context *copy ) } - -static void begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag ) +/** + * Called at begin of each primitive during replay. + */ +static void +begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag ) { struct _mesa_prim *prim = ©->dstprim[copy->dstprim_nr]; @@ -187,10 +193,12 @@ static void begin( struct copy_context *copy, GLenum mode, GLboolean begin_flag } -/* Use a hashtable to attempt to identify recently-emitted vertices +/** + * Use a hashtable to attempt to identify recently-emitted vertices * and avoid re-emitting them. */ -static GLuint elt(struct copy_context *copy, GLuint elt_idx) +static GLuint +elt(struct copy_context *copy, GLuint elt_idx) { GLuint elt = copy->srcelt[elt_idx]; GLuint slot = elt & (ELT_TABLE_SIZE-1); @@ -222,7 +230,6 @@ static GLuint elt(struct copy_context *copy, GLuint elt_idx) _mesa_printf("%x ", f[j]); _mesa_printf("\n"); } - } copy->vert_cache[slot].in = elt; @@ -230,9 +237,8 @@ static GLuint elt(struct copy_context *copy, GLuint elt_idx) copy->dstptr += copy->vertex_size; assert(csr == copy->dstptr); - assert(copy->dstptr == (copy->dstbuf + - copy->dstbuf_nr * - copy->vertex_size)); + assert(copy->dstptr == (copy->dstbuf + + copy->dstbuf_nr * copy->vertex_size)); } /* else */ /* _mesa_printf(" --> reuse vertex\n"); */ @@ -242,7 +248,12 @@ static GLuint elt(struct copy_context *copy, GLuint elt_idx) return check_flush(copy); } -static void end( struct copy_context *copy, GLboolean end_flag ) + +/** + * Called at end of each primitive during replay. + */ +static void +end( struct copy_context *copy, GLboolean end_flag ) { struct _mesa_prim *prim = ©->dstprim[copy->dstprim_nr]; @@ -257,8 +268,8 @@ static void end( struct copy_context *copy, GLboolean end_flag ) } - -static void replay_elts( struct copy_context *copy ) +static void +replay_elts( struct copy_context *copy ) { GLuint i, j, k; GLboolean split; @@ -362,7 +373,8 @@ static void replay_elts( struct copy_context *copy ) } -static void replay_init( struct copy_context *copy ) +static void +replay_init( struct copy_context *copy ) { GLcontext *ctx = copy->ctx; GLuint i; @@ -388,10 +400,7 @@ static void replay_init( struct copy_context *copy ) copy->vertex_size += attr_size(copy->array[i]); if (vbo->Name && !vbo->Pointer) - ctx->Driver.MapBuffer(ctx, - GL_ARRAY_BUFFER, - GL_READ_ONLY, - vbo); + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY, vbo); copy->varying[j].src_ptr = ADD_POINTERS(vbo->Pointer, copy->array[i]->Ptr); @@ -405,12 +414,11 @@ static void replay_init( struct copy_context *copy ) * do it internally. */ if (copy->ib->obj->Name && !copy->ib->obj->Pointer) - ctx->Driver.MapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER, - GL_READ_ONLY, + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY, copy->ib->obj); - srcptr = (const GLubyte *)ADD_POINTERS(copy->ib->obj->Pointer, copy->ib->ptr); + srcptr = (const GLubyte *) ADD_POINTERS(copy->ib->obj->Pointer, + copy->ib->ptr); switch (copy->ib->type) { case GL_UNSIGNED_BYTE: @@ -434,7 +442,6 @@ static void replay_init( struct copy_context *copy ) copy->srcelt = (const GLuint *)srcptr; break; } - /* Figure out the maximum allowed vertex buffer size: */ @@ -449,8 +456,7 @@ static void replay_init( struct copy_context *copy ) * * XXX: This should be a VBO! */ - copy->dstbuf = _mesa_malloc(copy->dstbuf_size * - copy->vertex_size); + copy->dstbuf = _mesa_malloc(copy->dstbuf_size * copy->vertex_size); copy->dstptr = copy->dstbuf; /* Setup new vertex arrays to point into the output buffer: @@ -492,7 +498,11 @@ static void replay_init( struct copy_context *copy ) } -static void replay_finish( struct copy_context *copy ) +/** + * Free up everything allocated during split/replay. + */ +static void +replay_finish( struct copy_context *copy ) { GLcontext *ctx = copy->ctx; GLuint i; @@ -502,12 +512,11 @@ static void replay_finish( struct copy_context *copy ) _mesa_free(copy->translated_elt_buf); _mesa_free(copy->dstbuf); _mesa_free(copy->dstelt); - + /* Unmap VBO's */ for (i = 0; i < copy->nr_varying; i++) { struct gl_buffer_object *vbo = copy->varying[i].array->BufferObj; - if (vbo->Name && vbo->Pointer) ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, vbo); } @@ -515,12 +524,14 @@ static void replay_finish( struct copy_context *copy ) /* Unmap index buffer: */ if (copy->ib->obj->Name && copy->ib->obj->Pointer) { - ctx->Driver.UnmapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER, - copy->ib->obj); + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, copy->ib->obj); } } + +/** + * Split VBO into smaller pieces, draw the pieces. + */ void vbo_split_copy( GLcontext *ctx, const struct gl_client_array *arrays[], const struct _mesa_prim *prim, @@ -546,13 +557,11 @@ void vbo_split_copy( GLcontext *ctx, copy.draw = draw; copy.limits = limits; - /* Clear the vertex cache: */ for (i = 0; i < ELT_TABLE_SIZE; i++) copy.vert_cache[i].in = ~0; - replay_init(©); replay_elts(©); replay_finish(©); -- cgit v1.2.3 From 7e3bd457e8cf106391f4418d910b8267b4b0de2c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 10:54:34 -0600 Subject: mesa: use _mesa_sizeof_type() in vbo split code --- src/mesa/vbo/vbo_split_copy.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 44b748dad7..56a9fafac4 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -31,6 +31,7 @@ #include "main/glheader.h" #include "main/imports.h" +#include "main/image.h" #include "main/macros.h" #include "main/enums.h" #include "main/mtypes.h" @@ -101,24 +102,9 @@ struct copy_context { }; -static GLuint type_size( GLenum type ) -{ - switch(type) { - case GL_BYTE: return sizeof(GLbyte); - case GL_UNSIGNED_BYTE: return sizeof(GLubyte); - case GL_SHORT: return sizeof(GLshort); - case GL_UNSIGNED_SHORT: return sizeof(GLushort); - case GL_INT: return sizeof(GLint); - case GL_UNSIGNED_INT: return sizeof(GLuint); - case GL_FLOAT: return sizeof(GLfloat); - case GL_DOUBLE: return sizeof(GLdouble); - default: return 0; - } -} - static GLuint attr_size( const struct gl_client_array *array ) { - return array->Size * type_size(array->Type); + return array->Size * _mesa_sizeof_type(array->Type); } -- cgit v1.2.3 From b102c1d8f9ea359879e6c1c4fd8c80c00d21cad5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:48:21 -0600 Subject: mesa: fix/add comments --- src/mesa/main/mtypes.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 587dc80146..bdb1081ca8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1542,9 +1542,8 @@ struct gl_client_array GLboolean Enabled; /**< Enabled flag is a boolean */ GLboolean Normalized; /**< GL_ARB_vertex_program */ - /**< GL_ARB_vertex_buffer_object */ - struct gl_buffer_object *BufferObj; - GLuint _MaxElement; + struct gl_buffer_object *BufferObj;/**< GL_ARB_vertex_buffer_object */ + GLuint _MaxElement; /**< max element index into array buffer */ }; -- cgit v1.2.3 From a6c8e900af981e011e51268a2724e5ff4a3ff1eb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 12:56:15 -0600 Subject: mesa: use local var to make code a bit more concise --- src/mesa/main/state.c | 73 ++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index f18fc8f683..47e1aaa728 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -69,17 +69,18 @@ update_separate_specular(GLcontext *ctx) static void update_arrays( GLcontext *ctx ) { + const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i, min; /* find min of _MaxElement values for all enabled arrays */ /* 0 */ if (ctx->VertexProgram._Current - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) { - min = ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS]._MaxElement; + && arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) { + min = arrayObj->VertexAttrib[VERT_ATTRIB_POS]._MaxElement; } - else if (ctx->Array.ArrayObj->Vertex.Enabled) { - min = ctx->Array.ArrayObj->Vertex._MaxElement; + else if (arrayObj->Vertex.Enabled) { + min = arrayObj->Vertex._MaxElement; } else { /* can't draw anything without vertex positions! */ @@ -88,86 +89,86 @@ update_arrays( GLcontext *ctx ) /* 1 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); } /* no conventional vertex weight array */ /* 2 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); } - else if (ctx->Array.ArrayObj->Normal.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->Normal._MaxElement); + else if (arrayObj->Normal.Enabled) { + min = MIN2(min, arrayObj->Normal._MaxElement); } /* 3 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); } - else if (ctx->Array.ArrayObj->Color.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->Color._MaxElement); + else if (arrayObj->Color.Enabled) { + min = MIN2(min, arrayObj->Color._MaxElement); } /* 4 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); } - else if (ctx->Array.ArrayObj->SecondaryColor.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->SecondaryColor._MaxElement); + else if (arrayObj->SecondaryColor.Enabled) { + min = MIN2(min, arrayObj->SecondaryColor._MaxElement); } /* 5 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); } - else if (ctx->Array.ArrayObj->FogCoord.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->FogCoord._MaxElement); + else if (arrayObj->FogCoord.Enabled) { + min = MIN2(min, arrayObj->FogCoord._MaxElement); } /* 6 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement); } - else if (ctx->Array.ArrayObj->Index.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->Index._MaxElement); + else if (arrayObj->Index.Enabled) { + min = MIN2(min, arrayObj->Index._MaxElement); } /* 7 */ if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement); + && arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement); } /* 8..15 */ for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) { if (ctx->VertexProgram._Enabled - && ctx->Array.ArrayObj->VertexAttrib[i].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement); + && arrayObj->VertexAttrib[i].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[i]._MaxElement); } else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits - && ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); + && arrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { + min = MIN2(min, arrayObj->TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); } } /* 16..31 */ if (ctx->VertexProgram._Current) { for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) { - if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement); + if (arrayObj->VertexAttrib[i].Enabled) { + min = MIN2(min, arrayObj->VertexAttrib[i]._MaxElement); } } } - if (ctx->Array.ArrayObj->EdgeFlag.Enabled) { - min = MIN2(min, ctx->Array.ArrayObj->EdgeFlag._MaxElement); + if (arrayObj->EdgeFlag.Enabled) { + min = MIN2(min, arrayObj->EdgeFlag._MaxElement); } /* _MaxElement is one past the last legal array element */ -- cgit v1.2.3 From 0077c879b57f663c038becdde37b2f6671f59150 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 13:00:35 -0600 Subject: mesa: added _ElementSize field to gl_client_array Will be handy for bounds checking later... --- src/mesa/main/mtypes.h | 1 + src/mesa/main/varray.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bdb1081ca8..716e5c655d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1541,6 +1541,7 @@ struct gl_client_array const GLubyte *Ptr; /**< Points to array data */ GLboolean Enabled; /**< Enabled flag is a boolean */ GLboolean Normalized; /**< GL_ARB_vertex_program */ + GLuint _ElementSize; /**< size of each element in bytes */ struct gl_buffer_object *BufferObj;/**< GL_ARB_vertex_buffer_object */ GLuint _MaxElement; /**< max element index into array buffer */ diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 106252e460..629be600d4 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -63,6 +63,8 @@ update_array(GLcontext *ctx, struct gl_client_array *array, array->StrideB = stride ? stride : elementSize; array->Normalized = normalized; array->Ptr = (const GLubyte *) ptr; + array->_ElementSize = elementSize; + #if FEATURE_ARB_vertex_buffer_object _mesa_reference_buffer_object(ctx, &array->BufferObj, ctx->Array.ArrayBufferObj); -- cgit v1.2.3 From 828aa76f360c96adea1725380c397d04690bfd04 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 13:02:38 -0600 Subject: mesa: use array->BufferObj instead of ctx->Array.ArrayBufferObj No difference, but a little more understandable. --- src/mesa/main/varray.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 629be600d4..527555be0e 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -73,8 +73,8 @@ update_array(GLcontext *ctx, struct gl_client_array *array, * Later in glDrawArrays we'll check if start + count > _MaxElement to * be sure we won't go out of bounds. */ - if (ctx->Array.ArrayBufferObj->Name) - array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size + if (array->BufferObj->Name) + array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size - (GLsizeiptrARB) array->Ptr + array->StrideB - elementSize) / array->StrideB; else -- cgit v1.2.3 From 1f75c2daeae71985ec3b9fd8f1431aa33ae35d1e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:09:18 -0600 Subject: mesa: add storage_count field to GLvector4f. Useful for debugging. --- src/mesa/math/m_vector.c | 1 + src/mesa/math/m_vector.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index dd631376d0..0636421727 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -102,6 +102,7 @@ _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, v->stride = 4 * sizeof(GLfloat); v->size = 2; v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment ); + v->storage_count = count; v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; v->count = 0; diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index 9112a2b5d5..fcf618a740 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -67,6 +67,7 @@ typedef struct { GLuint size; /**< 2-4 for vertices and 1-4 for texcoords */ GLuint flags; /**< which columns are dirty */ void *storage; /**< self-allocated storage */ + GLuint storage_count; /**< storage size in elements */ } GLvector4f; -- cgit v1.2.3 From 800b14cd378ed708a29230d92031ac7b6ad6a286 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:12:01 -0600 Subject: mesa: GLvector4f:: flags is a GLbitfield, update comments too. --- src/mesa/math/m_vector.c | 4 ++-- src/mesa/math/m_vector.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 0636421727..4cbab11a35 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -77,7 +77,7 @@ static const GLubyte size_bits[5] = { * \param storage pointer to storage for the vector's data */ void -_mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) +_mesa_vector4f_init( GLvector4f *v, GLbitfield flags, GLfloat (*storage)[4] ) { v->stride = 4 * sizeof(GLfloat); v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ @@ -96,7 +96,7 @@ _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) * \param alignment desired memory alignment for the data (in bytes) */ void -_mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, +_mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count, GLuint alignment ) { v->stride = 4 * sizeof(GLfloat); diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index fcf618a740..71281d5758 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -65,15 +65,15 @@ typedef struct { GLuint count; /**< size of the vector (in elements) */ GLuint stride; /**< stride from one element to the next (in bytes) */ GLuint size; /**< 2-4 for vertices and 1-4 for texcoords */ - GLuint flags; /**< which columns are dirty */ + GLbitfield flags; /**< bitmask of VEC_x flags */ void *storage; /**< self-allocated storage */ GLuint storage_count; /**< storage size in elements */ } GLvector4f; -extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags, +extern void _mesa_vector4f_init( GLvector4f *v, GLbitfield flags, GLfloat (*storage)[4] ); -extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, +extern void _mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count, GLuint alignment ); extern void _mesa_vector4f_free( GLvector4f *v ); extern void _mesa_vector4f_print( const GLvector4f *v, const GLubyte *, GLboolean ); -- cgit v1.2.3 From b9d0f947f2bcc47047b162e3d7c8f91b6153e02c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:17:25 -0600 Subject: mesa: Compute gl_client_array->_MaxElement during array validation Used to be done in the glVertex/Normal/Color/etc/Pointer() calls but if the VBO was reallocated the size could change. New _NEW_BUFFER_OBJECT state flag. --- src/mesa/main/bufferobj.c | 2 ++ src/mesa/main/mtypes.h | 1 + src/mesa/main/state.c | 88 ++++++++++++++++++++++++++++++++--------------- src/mesa/main/varray.c | 13 ------- 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index c8d160baa9..49f690ddd2 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -958,6 +958,8 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, bufObj->Pointer = NULL; } + FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT); + ASSERT(ctx->Driver.BufferData); /* Give the buffer object to the driver! may be null! */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 716e5c655d..368acde7a1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2619,6 +2619,7 @@ struct gl_matrix_stack #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */ #define _NEW_PROGRAM_CONSTANTS 0x20000000 +#define _NEW_BUFFER_OBJECT 0x40000000 #define _NEW_ALL ~0 /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 47e1aaa728..a6411f7b62 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -64,97 +64,131 @@ update_separate_specular(GLcontext *ctx) /** - * Update state dependent on vertex arrays. + * Compute the index of the last array element that can be safely accessed + * in a vertex array. We can really only do this when the array lives in + * a VBO. + * The array->_MaxElement field will be updated. + * Later in glDrawArrays/Elements/etc we can do some bounds checking. + */ +static void +compute_max_element(struct gl_client_array *array) +{ + assert(array->Enabled); + if (array->BufferObj->Name) { + /* Compute the max element we can access in the VBO without going + * out of bounds. + */ + array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size + - (GLsizeiptrARB) array->Ptr + array->StrideB + - array->_ElementSize) / array->StrideB; + } + else { + /* user-space array, no idea how big it is */ + array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ + } +} + + +/** + * Helper for update_arrays(). + * \return min(current min, array->_MaxElement). + */ +static GLuint +update_min(GLuint min, struct gl_client_array *array) +{ + compute_max_element(array); + return MIN2(min, array->_MaxElement); +} + + +/** + * Update ctx->Array._MaxElement (the max legal index into all enabled arrays). + * Need to do this upon new array state or new buffer object state. */ static void update_arrays( GLcontext *ctx ) { - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; - GLuint i, min; + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + GLuint i, min = ~0; /* find min of _MaxElement values for all enabled arrays */ /* 0 */ if (ctx->VertexProgram._Current && arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) { - min = arrayObj->VertexAttrib[VERT_ATTRIB_POS]._MaxElement; + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]); } else if (arrayObj->Vertex.Enabled) { - min = arrayObj->Vertex._MaxElement; - } - else { - /* can't draw anything without vertex positions! */ - min = 0; + min = update_min(min, &arrayObj->Vertex); } /* 1 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]); } /* no conventional vertex weight array */ /* 2 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]); } else if (arrayObj->Normal.Enabled) { - min = MIN2(min, arrayObj->Normal._MaxElement); + min = update_min(min, &arrayObj->Normal); } /* 3 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]); } else if (arrayObj->Color.Enabled) { - min = MIN2(min, arrayObj->Color._MaxElement); + min = update_min(min, &arrayObj->Color); } /* 4 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]); } else if (arrayObj->SecondaryColor.Enabled) { - min = MIN2(min, arrayObj->SecondaryColor._MaxElement); + min = update_min(min, &arrayObj->SecondaryColor); } /* 5 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]); } else if (arrayObj->FogCoord.Enabled) { - min = MIN2(min, arrayObj->FogCoord._MaxElement); + min = update_min(min, &arrayObj->FogCoord); } /* 6 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]); } else if (arrayObj->Index.Enabled) { - min = MIN2(min, arrayObj->Index._MaxElement); + min = update_min(min, &arrayObj->Index); } - /* 7 */ if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]); } /* 8..15 */ for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) { if (ctx->VertexProgram._Enabled && arrayObj->VertexAttrib[i].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[i]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[i]); } else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits && arrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { - min = MIN2(min, arrayObj->TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); + min = update_min(min, &arrayObj->TexCoord[i - VERT_ATTRIB_TEX0]); } } @@ -162,13 +196,13 @@ update_arrays( GLcontext *ctx ) if (ctx->VertexProgram._Current) { for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) { if (arrayObj->VertexAttrib[i].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[i]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[i]); } } } if (arrayObj->EdgeFlag.Enabled) { - min = MIN2(min, arrayObj->EdgeFlag._MaxElement); + min = update_min(min, &arrayObj->EdgeFlag); } /* _MaxElement is one past the last legal array element */ @@ -548,7 +582,7 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & _DD_NEW_SEPARATE_SPECULAR) update_separate_specular( ctx ); - if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) + if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) update_arrays( ctx ); if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 527555be0e..4d153b1c0b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -65,22 +65,9 @@ update_array(GLcontext *ctx, struct gl_client_array *array, array->Ptr = (const GLubyte *) ptr; array->_ElementSize = elementSize; -#if FEATURE_ARB_vertex_buffer_object _mesa_reference_buffer_object(ctx, &array->BufferObj, ctx->Array.ArrayBufferObj); - /* Compute the index of the last array element that's inside the buffer. - * Later in glDrawArrays we'll check if start + count > _MaxElement to - * be sure we won't go out of bounds. - */ - if (array->BufferObj->Name) - array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size - - (GLsizeiptrARB) array->Ptr + array->StrideB - - elementSize) / array->StrideB; - else -#endif - array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ - ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= dirtyBit; } -- cgit v1.2.3 From dcca97a3e3c1d8f5d27e1177257964eddb9effd3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:23:09 -0600 Subject: mesa: added gl_buffer_object::Written flag (for debug purposes) The flag is set when we data has been written into the buffer object. --- src/mesa/main/bufferobj.c | 6 ++++++ src/mesa/main/mtypes.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 49f690ddd2..43a8d2ba66 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -962,6 +962,8 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, ASSERT(ctx->Driver.BufferData); + bufObj->Written = GL_TRUE; + /* Give the buffer object to the driver! may be null! */ ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj ); } @@ -982,6 +984,8 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, return; } + bufObj->Written = GL_TRUE; + ASSERT(ctx->Driver.BufferSubData); ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj ); } @@ -1046,6 +1050,8 @@ _mesa_MapBufferARB(GLenum target, GLenum access) } bufObj->Access = access; + if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB) + bufObj->Written = GL_TRUE; return bufObj->Pointer; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 368acde7a1..276bc42eba 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1506,6 +1506,7 @@ struct gl_buffer_object GLsizeiptrARB Size; /**< Size of storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */ + GLboolean Written; /**< Ever written to? (for debugging) */ }; -- cgit v1.2.3 From 6359ecebec860963886801656ab4e01c4e9ff988 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:39:51 -0600 Subject: mesa: remove unused gl_buffer_object::OnCard field --- src/mesa/main/bufferobj.c | 2 -- src/mesa/main/mtypes.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 43a8d2ba66..641e5d7c3b 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -389,7 +389,6 @@ _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, (void) ctx; (void) target; (void) access; - ASSERT(!bufObj->OnCard); /* Just return a direct pointer to the data */ if (bufObj->Pointer) { /* already mapped! */ @@ -413,7 +412,6 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, { (void) ctx; (void) target; - ASSERT(!bufObj->OnCard); /* XXX we might assert here that bufObj->Pointer is non-null */ bufObj->Pointer = NULL; return GL_TRUE; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 276bc42eba..affb000b8c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1505,7 +1505,6 @@ struct gl_buffer_object GLsizeiptr Length; /**< mapped length */ GLsizeiptrARB Size; /**< Size of storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ - GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */ GLboolean Written; /**< Ever written to? (for debugging) */ }; -- cgit v1.2.3 From f37cccde3c2f4d63ba45be5b50b2358eb8ef98b4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 11:01:02 -0600 Subject: vbo: in glDraw[Range]Element() code, check for out of bounds indexes No-op the bad drawing command rather than go out of bounds and render garbage. Print a warning to alert the developer to the bad drawing call. --- src/mesa/vbo/vbo_exec_array.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0d4cbe9a1e..f4ad394f51 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -352,6 +352,13 @@ vbo_exec_DrawRangeElements(GLenum mode, if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) return; + if (end >= ctx->Array._MaxElement) { + /* the max element is out of bounds of one or more enabled arrays */ + _mesa_warning(ctx, "glDraw[Range]Elements() index=%u is " + "out of bounds (max=%u)", end, ctx->Array._MaxElement); + return; + } + FLUSH_CURRENT( ctx, 0 ); if (ctx->NewState) -- cgit v1.2.3 From 105c8529e78db961fee832b6248c3bcf59668bad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 13:10:48 -0600 Subject: mesa: fix comments, s/texture/buffer/ --- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 641e5d7c3b..a983376251 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -194,7 +194,7 @@ _mesa_reference_buffer_object(GLcontext *ctx, return; if (*ptr) { - /* Unreference the old texture */ + /* Unreference the old buffer */ GLboolean deleteFlag = GL_FALSE; struct gl_buffer_object *oldObj = *ptr; @@ -227,7 +227,7 @@ _mesa_reference_buffer_object(GLcontext *ctx, ASSERT(!*ptr); if (bufObj) { - /* reference new texture */ + /* reference new buffer */ /*_glthread_LOCK_MUTEX(tex->Mutex);*/ if (bufObj->RefCount == 0) { /* this buffer's being deleted (look just above) */ -- cgit v1.2.3 From 4f6b704f9796775d8d9937c3cf75a2901b99b896 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 13:30:39 -0600 Subject: mesa: move the NullBufferObj from GLcontext to gl_shared_state Since shared array objects may point to the null/default buffer object, the null/default buffer object should be part of the shared state. --- src/mesa/main/arrayobj.c | 5 +++-- src/mesa/main/bufferobj.c | 16 ++++------------ src/mesa/main/context.c | 3 --- src/mesa/main/mtypes.h | 3 ++- src/mesa/main/pixel.c | 12 ++++++------ src/mesa/main/pixelstore.c | 9 ++++++--- src/mesa/main/shared.c | 12 ++++++++++++ src/mesa/swrast/s_imaging.c | 10 +++++----- src/mesa/vbo/vbo_context.c | 9 ++++++--- src/mesa/vbo/vbo_exec_api.c | 4 ++-- src/mesa/vbo/vbo_rebase.c | 2 +- src/mesa/vbo/vbo_split_copy.c | 4 ++-- src/mesa/vbo/vbo_split_inplace.c | 2 +- 13 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index b04095fd16..2646c12ccc 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -112,7 +112,8 @@ init_array(GLcontext *ctx, array->Normalized = GL_FALSE; #if FEATURE_ARB_vertex_buffer_object /* Vertex array buffers */ - array->BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &array->BufferObj, + ctx->Shared->NullBufferObj); #endif } @@ -180,7 +181,7 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) static void unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) { - if (bufObj != ctx->Array.NullBufferObj) { + if (bufObj != ctx->Shared->NullBufferObj) { _mesa_reference_buffer_object(ctx, &bufObj, NULL); } } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index a983376251..1f2070ef47 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -424,16 +424,8 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, void _mesa_init_buffer_objects( GLcontext *ctx ) { - /* Allocate the default buffer object and set refcount so high that - * it never gets deleted. - * XXX with recent/improved refcounting this may not longer be needed. - */ - ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); - if (ctx->Array.NullBufferObj) - ctx->Array.NullBufferObj->RefCount = 1000; - - ctx->Array.ArrayBufferObj = ctx->Array.NullBufferObj; - ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj; + ctx->Array.ArrayBufferObj = ctx->Shared->NullBufferObj; + ctx->Array.ElementArrayBufferObj = ctx->Shared->NullBufferObj; } @@ -477,7 +469,7 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) /* The spec says there's not a buffer object named 0, but we use * one internally because it simplifies things. */ - newBufObj = ctx->Array.NullBufferObj; + newBufObj = ctx->Shared->NullBufferObj; } else { /* non-default buffer object */ @@ -744,7 +736,7 @@ unbind(GLcontext *ctx, struct gl_buffer_object *obj) { if (*ptr == obj) { - _mesa_reference_buffer_object(ctx, ptr, ctx->Array.NullBufferObj); + _mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj); } } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index d780f91f04..1a290f251a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1005,9 +1005,6 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_query_data(ctx); #endif -#if FEATURE_ARB_vertex_buffer_object - _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); -#endif _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); /* free dispatch tables */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index affb000b8c..3debbe9f2d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1593,7 +1593,6 @@ struct gl_array_attrib GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */ #if FEATURE_ARB_vertex_buffer_object - struct gl_buffer_object *NullBufferObj; struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; #endif @@ -2064,6 +2063,8 @@ struct gl_shared_state GLuint TextureStateStamp; /**< state notification for shared tex */ /*@}*/ + /** Default buffer object for vertex arrays that aren't in VBOs */ + struct gl_buffer_object *NullBufferObj; /** * \name Vertex/fragment programs diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 57ae9c721a..d9f3e476e8 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -170,7 +170,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); @@ -229,7 +229,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); @@ -303,7 +303,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); @@ -371,7 +371,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); @@ -432,7 +432,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); @@ -494,7 +494,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values ) return; } /* restore */ - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + ctx->DefaultPacking.BufferObj = ctx->Shared->NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c index ff1a6344cc..6a641f83f2 100644 --- a/src/mesa/main/pixelstore.c +++ b/src/mesa/main/pixelstore.c @@ -245,7 +245,8 @@ _mesa_init_pixelstore( GLcontext *ctx ) ctx->Pack.ClientStorage = GL_FALSE; ctx->Pack.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object - ctx->Pack.BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, + ctx->Shared->NullBufferObj); #endif ctx->Unpack.Alignment = 4; ctx->Unpack.RowLength = 0; @@ -258,7 +259,8 @@ _mesa_init_pixelstore( GLcontext *ctx ) ctx->Unpack.ClientStorage = GL_FALSE; ctx->Unpack.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, + ctx->Shared->NullBufferObj); #endif /* @@ -278,6 +280,7 @@ _mesa_init_pixelstore( GLcontext *ctx ) ctx->DefaultPacking.ClientStorage = GL_FALSE; ctx->DefaultPacking.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &ctx->DefaultPacking.BufferObj, + ctx->Shared->NullBufferObj); #endif } diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index ae8dd2a836..759883743d 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -33,6 +33,7 @@ #include "mtypes.h" #include "hash.h" #include "arrayobj.h" +#include "bufferobj.h" #include "shared.h" #include "shader/program.h" #include "shader/shader_api.h" @@ -92,6 +93,13 @@ _mesa_alloc_shared_state(GLcontext *ctx) shared->BufferObjects = _mesa_NewHashTable(); #endif + /* Allocate the default buffer object and set refcount so high that + * it never gets deleted. + * XXX with recent/improved refcounting this may not longer be needed. + */ + shared->NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); + shared->NullBufferObj->RefCount = 1000; + shared->ArrayObjects = _mesa_NewHashTable(); /* Create default texture objects */ @@ -341,6 +349,10 @@ _mesa_free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) _mesa_DeleteHashTable(shared->RenderBuffers); #endif +#if FEATURE_ARB_vertex_buffer_object + _mesa_delete_buffer_object(ctx, shared->NullBufferObj); +#endif + /* * Free texture objects (after FBOs since some textures might have * been bound to FBOs). diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c index d6be3aa022..3578b713f6 100644 --- a/src/mesa/swrast/s_imaging.c +++ b/src/mesa/swrast/s_imaging.c @@ -60,7 +60,7 @@ _swrast_CopyColorTable( GLcontext *ctx, /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; _mesa_ColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); @@ -94,7 +94,7 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; _mesa_ColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); @@ -126,7 +126,7 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; /* store as convolution filter */ _mesa_ConvolutionFilter1D(target, internalFormat, width, @@ -178,12 +178,12 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, ctx->Unpack.SkipImages = 0; ctx->Unpack.SwapBytes = GL_FALSE; ctx->Unpack.LsbFirst = GL_FALSE; - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; ctx->NewState |= _NEW_PACKUNPACK; /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; + ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; _mesa_ConvolutionFilter2D(target, internalFormat, width, height, GL_RGBA, CHAN_TYPE, rgba); diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index ca8190fd05..f193a4bf1e 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -28,6 +28,7 @@ #include "main/imports.h" #include "main/mtypes.h" #include "main/api_arrayelt.h" +#include "main/bufferobj.h" #include "math/m_eval.h" #include "vbo.h" #include "vbo_context.h" @@ -81,7 +82,8 @@ static void init_legacy_currval(GLcontext *ctx) cl->Type = GL_FLOAT; cl->Format = GL_RGBA; cl->Ptr = (const void *)ctx->Current.Attrib[i]; - cl->BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &cl->BufferObj, + ctx->Shared->NullBufferObj); } } @@ -106,7 +108,8 @@ static void init_generic_currval(GLcontext *ctx) cl->Stride = 0; cl->StrideB = 0; cl->Enabled = 1; - cl->BufferObj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, &cl->BufferObj, + ctx->Shared->NullBufferObj); } } @@ -150,7 +153,7 @@ static void init_mat_currval(GLcontext *ctx) cl->Stride = 0; cl->StrideB = 0; cl->Enabled = 1; - cl->BufferObj = ctx->Array.NullBufferObj; + cl->BufferObj = ctx->Shared->NullBufferObj; } } diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 5d35ec9c11..6871ee5cab 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -671,7 +671,7 @@ void vbo_use_buffer_objects(GLcontext *ctx) GLsizei size = VBO_VERT_BUFFER_SIZE; /* Make sure this func is only used once */ - assert(exec->vtx.bufferobj == ctx->Array.NullBufferObj); + assert(exec->vtx.bufferobj == ctx->Shared->NullBufferObj); if (exec->vtx.buffer_map) { _mesa_align_free(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; @@ -697,7 +697,7 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) */ _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, - ctx->Array.NullBufferObj); + ctx->Shared->NullBufferObj); ASSERT(!exec->vtx.buffer_map); exec->vtx.buffer_map = (GLfloat *)ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE, 64); diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index dae778e741..ea87dede64 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -161,7 +161,7 @@ void vbo_rebase_prims( GLcontext *ctx, GL_ELEMENT_ARRAY_BUFFER, ib->obj); - tmp_ib.obj = ctx->Array.NullBufferObj; + tmp_ib.obj = ctx->Shared->NullBufferObj; tmp_ib.ptr = tmp_indices; tmp_ib.count = ib->count; tmp_ib.type = ib->type; diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 56a9fafac4..2f6a1998ea 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -459,7 +459,7 @@ replay_init( struct copy_context *copy ) dst->Ptr = copy->dstbuf + offset; dst->Enabled = GL_TRUE; dst->Normalized = src->Normalized; - dst->BufferObj = ctx->Array.NullBufferObj; + dst->BufferObj = ctx->Shared->NullBufferObj; dst->_MaxElement = copy->dstbuf_size; /* may be less! */ offset += copy->varying[i].size; @@ -479,7 +479,7 @@ replay_init( struct copy_context *copy ) */ copy->dstib.count = 0; /* duplicates dstelt_nr */ copy->dstib.type = GL_UNSIGNED_INT; - copy->dstib.obj = ctx->Array.NullBufferObj; + copy->dstib.obj = ctx->Shared->NullBufferObj; copy->dstib.ptr = copy->dstelt; } diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index fbc856e93b..3ed6b34fbf 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -221,7 +221,7 @@ static void split_prims( struct split_context *split) ib.count = count; ib.type = GL_UNSIGNED_INT; - ib.obj = split->ctx->Array.NullBufferObj; + ib.obj = split->ctx->Shared->NullBufferObj; ib.ptr = elts; tmpprim = *prim; -- cgit v1.2.3 From 9bb6684799f00fabc313ee50be671454e498d8a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 13:36:20 -0600 Subject: mesa: array object comments --- src/mesa/main/mtypes.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3debbe9f2d..b24366d0fe 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1557,6 +1557,8 @@ struct gl_array_object /** Name of the array object as received from glGenVertexArrayAPPLE. */ GLuint Name; + /** XXX Need a refcount here */ + /** Conventional vertex arrays */ /*@{*/ struct gl_client_array Vertex; @@ -1583,7 +1585,10 @@ struct gl_array_object */ struct gl_array_attrib { + /** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */ struct gl_array_object *ArrayObj; + + /** The default vertex array object */ struct gl_array_object *DefaultArrayObj; GLint ActiveTexture; /**< Client Active Texture */ -- cgit v1.2.3 From 1030bf0ded2a88a5e27f7a4d393c11cfde3d3c5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 13:52:26 -0600 Subject: mesa: reference counting for gl_array_object Every kind of object that can be shared by multiple contexts should be refcounted. --- src/mesa/main/arrayobj.c | 67 +++++++++++++++++++++++++++++++++++++++++++++--- src/mesa/main/arrayobj.h | 23 ++++++++++++----- src/mesa/main/mtypes.h | 3 ++- src/mesa/main/varray.c | 4 +-- 4 files changed, 83 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 2646c12ccc..71f4216bd3 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -94,10 +94,69 @@ void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) { (void) ctx; + _glthread_DESTROY_MUTEX(obj->Mutex); _mesa_free(obj); } +/** + * Set ptr to arrayObj w/ reference counting. + */ +void +_mesa_reference_array_object(GLcontext *ctx, + struct gl_array_object **ptr, + struct gl_array_object *arrayObj) +{ + if (*ptr == arrayObj) + return; + + if (*ptr) { + /* Unreference the old array object */ + GLboolean deleteFlag = GL_FALSE; + struct gl_array_object *oldObj = *ptr; + + _glthread_LOCK_MUTEX(oldObj->Mutex); + ASSERT(oldObj->RefCount > 0); + oldObj->RefCount--; +#if 0 + printf("ArrayObj %p %d DECR to %d\n", + (void *) oldObj, oldObj->Name, oldObj->RefCount); +#endif + deleteFlag = (oldObj->RefCount == 0); + _glthread_UNLOCK_MUTEX(oldObj->Mutex); + + if (deleteFlag) { + ASSERT(ctx->Driver.DeleteArrayObject); + ctx->Driver.DeleteArrayObject(ctx, oldObj); + } + + *ptr = NULL; + } + ASSERT(!*ptr); + + if (arrayObj) { + /* reference new array object */ + _glthread_LOCK_MUTEX(arrayObj->Mutex); + if (arrayObj->RefCount == 0) { + /* this array's being deleted (look just above) */ + /* Not sure this can every really happen. Warn if it does. */ + _mesa_problem(NULL, "referencing deleted array object"); + *ptr = NULL; + } + else { + arrayObj->RefCount++; +#if 0 + printf("ArrayObj %p %d INCR to %d\n", + (void *) arrayObj, arrayObj->Name, arrayObj->RefCount); +#endif + *ptr = arrayObj; + } + _glthread_UNLOCK_MUTEX(arrayObj->Mutex); + } +} + + + static void init_array(GLcontext *ctx, struct gl_client_array *array, GLint size, GLint type) @@ -130,6 +189,9 @@ _mesa_initialize_array_object( GLcontext *ctx, obj->Name = name; + _glthread_INIT_MUTEX(obj->Mutex); + obj->RefCount = 1; + /* Init the individual arrays */ init_array(ctx, &obj->Vertex, 4, GL_FLOAT); init_array(ctx, &obj->Normal, 3, GL_FLOAT); @@ -227,7 +289,6 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) if (!newObj) { /* If this is a new array object id, allocate an array object now. */ - newObj = (*ctx->Driver.NewArrayObject)(ctx, id); if (!newObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE"); @@ -237,11 +298,9 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) } } - ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; - ctx->Array.ArrayObj = newObj; - + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj); /* Pass BindVertexArray call to device driver */ if (ctx->Driver.BindArrayObject && newObj) diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index c7d66ec166..9c4036af5a 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -41,17 +41,26 @@ * Internal functions */ -struct gl_array_object * _mesa_new_array_object( GLcontext *ctx, - GLuint name ); +extern struct gl_array_object * +_mesa_new_array_object( GLcontext *ctx, GLuint name ); -void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ); -void _mesa_initialize_array_object( GLcontext *ctx, - struct gl_array_object *obj, GLuint name ); +extern void +_mesa_reference_array_object(GLcontext *ctx, + struct gl_array_object **ptr, + struct gl_array_object *arrayObj); -void _mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_initialize_array_object( GLcontext *ctx, + struct gl_array_object *obj, GLuint name ); -void _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ); + +extern void +_mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b24366d0fe..d11df535f2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1557,7 +1557,8 @@ struct gl_array_object /** Name of the array object as received from glGenVertexArrayAPPLE. */ GLuint Name; - /** XXX Need a refcount here */ + GLint RefCount; + _glthread_Mutex Mutex; /** Conventional vertex arrays */ /*@{*/ diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 4d153b1c0b..a9c9162be1 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1039,7 +1039,7 @@ void _mesa_init_varray(GLcontext *ctx) { ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); - ctx->Array.ArrayObj = ctx->Array.DefaultArrayObj; - + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, + ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ } -- cgit v1.2.3 From 56cfa4de9150514af46d040c3cdb24def301b3a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 14:15:24 -0600 Subject: demos: delete vertex array objects upon exit --- progs/demos/vao_demo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/progs/demos/vao_demo.c b/progs/demos/vao_demo.c index ce416712fe..206e06fc6c 100644 --- a/progs/demos/vao_demo.c +++ b/progs/demos/vao_demo.c @@ -260,6 +260,8 @@ static void Key( unsigned char key, int x, int y ) (void) y; switch (key) { case 27: + (*delete_vertex_arrays)( 1, & cube_array_obj ); + (*delete_vertex_arrays)( 1, & oct_array_obj ); glutDestroyWindow(Win); exit(0); break; -- cgit v1.2.3 From 32b851c80792623195069d7a41a5808cff3b2f6f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 14:26:17 -0600 Subject: mesa: clean-up vertex array object VBO unbinding and delete/refcounting Don't really delete vertex array objects until the refcount hits zero. At that time, unbind any pointers to VBOs. --- src/mesa/main/arrayobj.c | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 71f4216bd3..b4d1a77b97 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -68,6 +68,32 @@ lookup_arrayobj(GLcontext *ctx, GLuint id) } +/** + * For all the vertex arrays in the array object, unbind any pointers + * to any buffer objects (VBOs). + * This is done just prior to array object destruction. + */ +static void +unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) +{ + GLuint i; + + _mesa_reference_buffer_object(ctx, &obj->Vertex.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Normal.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Color.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->SecondaryColor.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->FogCoord.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Index.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->EdgeFlag.BufferObj, NULL); + + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + _mesa_reference_buffer_object(ctx, &obj->TexCoord[i].BufferObj, NULL); + + for (i = 0; i < VERT_ATTRIB_MAX; i++) + _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj,NULL); +} + + /** * Allocate and initialize a new vertex array object. * @@ -94,6 +120,7 @@ void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) { (void) ctx; + unbind_array_object_vbos(ctx, obj); _glthread_DESTROY_MUTEX(obj->Mutex); _mesa_free(obj); } @@ -240,15 +267,6 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) } -static void -unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) -{ - if (bufObj != ctx->Shared->NullBufferObj) { - _mesa_reference_buffer_object(ctx, &bufObj, NULL); - } -} - - /**********************************************************************/ /* API Functions */ /**********************************************************************/ @@ -275,7 +293,7 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) return; /* rebinding the same array object- no change */ /* - * Get pointer to new array object (newBufObj) + * Get pointer to new array object (newObj) */ if (id == 0) { /* The spec says there is no array object named 0, but we use @@ -334,7 +352,6 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) if ( obj != NULL ) { ASSERT( obj->Name == ids[i] ); - /* If the array object is currently bound, the spec says "the binding * for that object reverts to zero and the default vertex array * becomes current." @@ -343,28 +360,13 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) CALL_BindVertexArrayAPPLE( ctx->Exec, (0) ); } -#if FEATURE_ARB_vertex_buffer_object - /* Unbind any buffer objects that might be bound to arrays in - * this array object. - */ - unbind_buffer_object( ctx, obj->Vertex.BufferObj ); - unbind_buffer_object( ctx, obj->Normal.BufferObj ); - unbind_buffer_object( ctx, obj->Color.BufferObj ); - unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); - unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); - unbind_buffer_object( ctx, obj->Index.BufferObj ); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); - } - unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); - for (i = 0; i < VERT_ATTRIB_MAX; i++) { - unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); - } -#endif - /* The ID is immediately freed for re-use */ _mesa_remove_array_object(ctx, obj); - ctx->Driver.DeleteArrayObject(ctx, obj); + + /* Unreference the array object. + * If refcount hits zero, the object will be deleted. + */ + _mesa_reference_array_object(ctx, &obj, NULL); } } -- cgit v1.2.3 From fa95ecb467d656e293a12c089b3e85fcbbadb848 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 May 2009 14:33:18 -0600 Subject: mesa: make the array object save/remove functions static --- src/mesa/main/arrayobj.c | 14 +++++++------- src/mesa/main/arrayobj.h | 7 ------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index b4d1a77b97..8ec73b9526 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -243,8 +243,8 @@ _mesa_initialize_array_object( GLcontext *ctx, /** * Add the given array object to the array object pool. */ -void -_mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ) +static void +save_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ @@ -257,8 +257,8 @@ _mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ) * Remove the given array object from the array object pool. * Do not deallocate the array object though. */ -void -_mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) +static void +remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) { if (obj->Name > 0) { /* remove from hash table */ @@ -312,7 +312,7 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE"); return; } - _mesa_save_array_object(ctx, newObj); + save_array_object(ctx, newObj); } } @@ -361,7 +361,7 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) } /* The ID is immediately freed for re-use */ - _mesa_remove_array_object(ctx, obj); + remove_array_object(ctx, obj); /* Unreference the array object. * If refcount hits zero, the object will be deleted. @@ -415,7 +415,7 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE"); return; } - _mesa_save_array_object(ctx, obj); + save_array_object(ctx, obj); arrays[i] = first + i; } diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 9c4036af5a..9c2f340cfa 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -56,13 +56,6 @@ extern void _mesa_initialize_array_object( GLcontext *ctx, struct gl_array_object *obj, GLuint name ); -extern void -_mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ); - -extern void -_mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ); - - /* * API functions -- cgit v1.2.3 From b7f2b7e93609836260ca7eef635776073b8f7069 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 8 May 2009 09:04:10 +1000 Subject: nouveau: use dri state tracker for dri1 --- src/gallium/winsys/drm/nouveau/Makefile | 2 +- src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h | 28 ------- src/gallium/winsys/drm/nouveau/dri2/Makefile | 2 +- src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h | 28 +++++++ .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 86 ++++++++++++++++++++++ .../winsys/drm/nouveau/drm/nouveau_drm_api.h | 2 + .../winsys/drm/nouveau/drm/nouveau_winsys_pipe.h | 2 + 7 files changed, 120 insertions(+), 30 deletions(-) delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h create mode 100644 src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile index f8c8135854..be4cad6f9e 100644 --- a/src/gallium/winsys/drm/nouveau/Makefile +++ b/src/gallium/winsys/drm/nouveau/Makefile @@ -2,7 +2,7 @@ TOP = ../../../../.. include $(TOP)/configs/current -SUBDIRS = drm dri dri2 +SUBDIRS = drm dri2 default install clean: @for dir in $(SUBDIRS) ; do \ diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h deleted file mode 100644 index 1207c2d609..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _NOUVEAU_DRI_ -#define _NOUVEAU_DRI_ - -#include "xf86drm.h" -#include "drm.h" -#include "nouveau_drm.h" - -struct nouveau_dri { - uint32_t device_id; /**< \brief PCI device ID */ - uint32_t width; /**< \brief width in pixels of display */ - uint32_t height; /**< \brief height in scanlines of display */ - uint32_t depth; /**< \brief depth of display (8, 15, 16, 24) */ - uint32_t bpp; /**< \brief bit depth of display (8, 16, 24, 32) */ - - uint32_t bus_type; /**< \brief ths bus type */ - uint32_t bus_mode; /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */ - - uint32_t front_offset; /**< \brief front buffer offset */ - uint32_t front_pitch; /**< \brief front buffer pitch */ - uint32_t back_offset; /**< \brief private back buffer offset */ - uint32_t back_pitch; /**< \brief private back buffer pitch */ - uint32_t depth_offset; /**< \brief private depth buffer offset */ - uint32_t depth_pitch; /**< \brief private depth buffer pitch */ - -}; - -#endif - diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile index 377a80d518..024ab150cb 100644 --- a/src/gallium/winsys/drm/nouveau/dri2/Makefile +++ b/src/gallium/winsys/drm/nouveau/dri2/Makefile @@ -1,7 +1,7 @@ TOP = ../../../../../.. include $(TOP)/configs/current -LIBNAME = nouveau_dri2.so +LIBNAME = nouveau_dri.so PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h new file mode 100644 index 0000000000..1207c2d609 --- /dev/null +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h @@ -0,0 +1,28 @@ +#ifndef _NOUVEAU_DRI_ +#define _NOUVEAU_DRI_ + +#include "xf86drm.h" +#include "drm.h" +#include "nouveau_drm.h" + +struct nouveau_dri { + uint32_t device_id; /**< \brief PCI device ID */ + uint32_t width; /**< \brief width in pixels of display */ + uint32_t height; /**< \brief height in scanlines of display */ + uint32_t depth; /**< \brief depth of display (8, 15, 16, 24) */ + uint32_t bpp; /**< \brief bit depth of display (8, 16, 24, 32) */ + + uint32_t bus_type; /**< \brief ths bus type */ + uint32_t bus_mode; /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */ + + uint32_t front_offset; /**< \brief front buffer offset */ + uint32_t front_pitch; /**< \brief front buffer pitch */ + uint32_t back_offset; /**< \brief private back buffer offset */ + uint32_t back_pitch; /**< \brief private back buffer pitch */ + uint32_t depth_offset; /**< \brief private depth buffer offset */ + uint32_t depth_pitch; /**< \brief private depth buffer pitch */ + +}; + +#endif + diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index a558fda140..b355a1391d 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -7,9 +7,68 @@ #include "nouveau_channel.h" #include "nouveau_bo.h" +static struct pipe_surface * +dri_surface_from_handle(struct pipe_screen *screen, + unsigned handle, + enum pipe_format format, + unsigned width, + unsigned height, + unsigned pitch) +{ + struct pipe_surface *surface = NULL; + struct pipe_texture *texture = NULL; + struct pipe_texture templat; + struct pipe_buffer *buf = NULL; + + buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle); + if (!buf) + return NULL; + + memset(&templat, 0, sizeof(templat)); + templat.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY | + NOUVEAU_TEXTURE_USAGE_LINEAR; + templat.target = PIPE_TEXTURE_2D; + templat.last_level = 0; + templat.depth[0] = 1; + templat.format = format; + templat.width[0] = width; + templat.height[0] = height; + pf_get_block(templat.format, &templat.block); + + texture = screen->texture_blanket(screen, + &templat, + &pitch, + buf); + + /* we don't need the buffer from this point on */ + pipe_buffer_reference(&buf, NULL); + + if (!texture) + return NULL; + + surface = screen->get_tex_surface(screen, texture, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* we don't need the texture from this point on */ + pipe_texture_reference(&texture, NULL); + return surface; +} + +static struct pipe_surface * +nouveau_dri1_front_surface(struct pipe_context *pipe) +{ + return nouveau_screen(pipe->screen)->front; +} + +static struct dri1_api nouveau_dri1_api = { + nouveau_dri1_front_surface, +}; + static struct pipe_screen * nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) { + struct dri1_create_screen_arg *dri1 = (void *)arg; struct pipe_winsys *ws; struct nouveau_winsys *nvws; struct nouveau_device *dev = NULL; @@ -67,6 +126,33 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) return NULL; } + if (arg->mode == DRM_CREATE_DRI1) { + struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); + struct nouveau_dri *nvdri = dri1->ddx_info; + enum pipe_format format; + + if (nvdri->bpp == 16) + format = PIPE_FORMAT_R5G6B5_UNORM; + else + format = PIPE_FORMAT_A8R8G8B8_UNORM; + + nvpws->front = dri_surface_from_handle(nvpws->pscreen, + nvdri->front_offset, + format, + nvdri->width, + nvdri->height, + nvdri->front_pitch * + (nvdri->bpp / 8)); + if (!nvpws->front) { + debug_printf("%s: error referencing front buffer\n", + __func__); + ws->destroy(ws); + return NULL; + } + + dri1->api = &nouveau_dri1_api; + } + return nouveau_pipe_winsys(ws)->pscreen; } diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h index 2782c83c0e..cc237bfc13 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h @@ -1,5 +1,7 @@ #ifndef __NOUVEAU_DRM_API_H__ #define __NOUVEAU_DRM_API_H__ #include "state_tracker/drm_api.h" +#include "state_tracker/dri1_api.h" +#include "nouveau_dri.h" #endif diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h index 10e1e269e8..ec10f1e00c 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h @@ -29,6 +29,8 @@ struct nouveau_pipe_winsys { unsigned nr_pctx; struct pipe_context **pctx; + + struct pipe_surface *front; }; static INLINE struct nouveau_pipe_winsys * -- cgit v1.2.3 From 9e02fa45320c724c69839dae5aaa47034eae5125 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 8 May 2009 09:11:17 +1000 Subject: nouveau: remove dri1 code now we're using the dri state tracker --- src/gallium/winsys/drm/nouveau/Makefile | 2 +- src/gallium/winsys/drm/nouveau/dri/Makefile | 16 +- .../winsys/drm/nouveau/dri/nouveau_context.c | 118 -------- .../winsys/drm/nouveau/dri/nouveau_context.h | 53 ---- src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c | 73 ----- .../winsys/drm/nouveau/dri/nouveau_screen.c | 330 --------------------- .../winsys/drm/nouveau/dri/nouveau_screen.h | 16 - .../winsys/drm/nouveau/dri/nouveau_swapbuffers.c | 115 ------- .../winsys/drm/nouveau/dri/nouveau_swapbuffers.h | 11 - src/gallium/winsys/drm/nouveau/dri2/Makefile | 26 -- 10 files changed, 5 insertions(+), 755 deletions(-) delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_context.c delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_context.h delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c delete mode 100644 src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h delete mode 100644 src/gallium/winsys/drm/nouveau/dri2/Makefile diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile index be4cad6f9e..e275b2d9e7 100644 --- a/src/gallium/winsys/drm/nouveau/Makefile +++ b/src/gallium/winsys/drm/nouveau/Makefile @@ -2,7 +2,7 @@ TOP = ../../../../.. include $(TOP)/configs/current -SUBDIRS = drm dri2 +SUBDIRS = drm dri default install clean: @for dir in $(SUBDIRS) ; do \ diff --git a/src/gallium/winsys/drm/nouveau/dri/Makefile b/src/gallium/winsys/drm/nouveau/dri/Makefile index f7db6201fe..024ab150cb 100644 --- a/src/gallium/winsys/drm/nouveau/dri/Makefile +++ b/src/gallium/winsys/drm/nouveau/dri/Makefile @@ -3,9 +3,8 @@ include $(TOP)/configs/current LIBNAME = nouveau_dri.so -MINIGLX_SOURCES = - PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \ $(TOP)/src/gallium/drivers/nv04/libnv04.a \ $(TOP)/src/gallium/drivers/nv10/libnv10.a \ @@ -13,22 +12,15 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/nv30/libnv30.a \ $(TOP)/src/gallium/drivers/nv40/libnv40.a \ $(TOP)/src/gallium/drivers/nv50/libnv50.a - -DRIVER_SOURCES = \ - nouveau_context.c \ - nouveau_screen.c \ - nouveau_swapbuffers.c \ - nouveau_lock.c + +DRIVER_SOURCES = C_SOURCES = \ $(COMMON_GALLIUM_SOURCES) \ $(DRIVER_SOURCES) -ASM_SOURCES = +include ../../Makefile.template -DRIVER_DEFINES = $(shell pkg-config libdrm_nouveau --cflags) DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs) -include ../../Makefile.template - symlinks: diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c deleted file mode 100644 index deb6ffcff1..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c +++ /dev/null @@ -1,118 +0,0 @@ -#include
        -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "nouveau_context.h" -#include "nouveau_screen.h" - -#include "nouveau_drmif.h" - -GLboolean -nouveau_context_create(const __GLcontextModes *glVis, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ - __DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv; - struct nouveau_screen *nv_screen = driScrnPriv->private; - struct nouveau_context *nv; - struct pipe_context *pipe; - struct st_context *st_share = NULL; - - if (sharedContextPrivate) - st_share = ((struct nouveau_context *)sharedContextPrivate)->st; - - nv = CALLOC_STRUCT(nouveau_context); - if (!nv) - return GL_FALSE; - - { - struct nouveau_device_priv *nvdev = - nouveau_device(nv_screen->device); - - nvdev->ctx = driContextPriv->hHWContext; - nvdev->lock = (drmLock *)&driScrnPriv->pSAREA->lock; - } - - pipe = drm_api_hooks.create_context(nv_screen->pscreen); - if (!pipe) { - FREE(nv); - return GL_FALSE; - } - pipe->priv = nv; - - driContextPriv->driverPrivate = nv; - nv->dri_screen = driScrnPriv; - - driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache, - nv->dri_screen->myNum, "nouveau"); - - nv->st = st_create_context(pipe, glVis, st_share); - return GL_TRUE; -} - -void -nouveau_context_destroy(__DRIcontextPrivate *driContextPriv) -{ - struct nouveau_context *nv = driContextPriv->driverPrivate; - - assert(nv); - - st_finish(nv->st); - st_destroy_context(nv->st); - - FREE(nv); -} - -GLboolean -nouveau_context_bind(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - struct nouveau_context *nv; - struct nouveau_framebuffer *draw, *read; - - if (!driContextPriv) { - st_make_current(NULL, NULL, NULL); - return GL_TRUE; - } - - nv = driContextPriv->driverPrivate; - draw = driDrawPriv->driverPrivate; - read = driReadPriv->driverPrivate; - - st_make_current(nv->st, draw->stfb, read->stfb); - - if ((nv->dri_drawable != driDrawPriv) || - (nv->last_stamp != driDrawPriv->lastStamp)) { - nv->dri_drawable = driDrawPriv; - st_resize_framebuffer(draw->stfb, driDrawPriv->w, - driDrawPriv->h); - nv->last_stamp = driDrawPriv->lastStamp; - } - - if (driDrawPriv != driReadPriv) { - st_resize_framebuffer(read->stfb, driReadPriv->w, - driReadPriv->h); - } - - return GL_TRUE; -} - -GLboolean -nouveau_context_unbind(__DRIcontextPrivate *driContextPriv) -{ - struct nouveau_context *nv = driContextPriv->driverPrivate; - (void)nv; - - st_flush(nv->st, 0, NULL); - return GL_TRUE; -} - diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h deleted file mode 100644 index 2779b092e6..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __NOUVEAU_CONTEXT_DRI_H__ -#define __NOUVEAU_CONTEXT_DRI_H__ - -#include -#include - -#include "nouveau/nouveau_winsys.h" - -#define NOUVEAU_ERR(fmt, args...) debug_printf("%s: "fmt, __func__, ##args) - -struct nouveau_framebuffer { - struct st_framebuffer *stfb; -}; - -struct nouveau_context { - struct st_context *st; - - /* DRI stuff */ - __DRIscreenPrivate *dri_screen; - __DRIdrawablePrivate *dri_drawable; - unsigned int last_stamp; - driOptionCache dri_option_cache; - drm_context_t drm_context; - drmLock drm_lock; - int locked; -}; - -extern GLboolean nouveau_context_create(const __GLcontextModes *, - __DRIcontextPrivate *, void *); -extern void nouveau_context_destroy(__DRIcontextPrivate *); -extern GLboolean nouveau_context_bind(__DRIcontextPrivate *, - __DRIdrawablePrivate *draw, - __DRIdrawablePrivate *read); -extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *); - -extern void nouveau_contended_lock(struct nouveau_context *nv); -extern void LOCK_HARDWARE(struct nouveau_context *nv); -extern void UNLOCK_HARDWARE(struct nouveau_context *nv); - -#ifdef DEBUG -extern int __nouveau_debug; - -#define DEBUG_BO (1 << 0) - -#define DBG(flag, ...) do { \ - if (__nouveau_debug & (DEBUG_##flag)) \ - NOUVEAU_ERR(__VA_ARGS__); \ -} while(0) -#else -#define DBG(flag, ...) -#endif - -#endif diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c deleted file mode 100644 index 92f5bd09c9..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include -#include "nouveau_context.h" -#include "nouveau_screen.h" -#include "nouveau_drmif.h" - -pipe_static_mutex(lockMutex); - -/* Lock the hardware and validate our state. - */ -void -LOCK_HARDWARE(struct nouveau_context *nv) -{ - struct nouveau_screen *nv_screen = nv->dri_screen->private; - struct nouveau_device *dev = nv_screen->device; - struct nouveau_device_priv *nvdev = nouveau_device(dev); - char __ret=0; - - assert(!nv->locked); - pipe_mutex_lock(lockMutex); - - DRM_CAS(nvdev->lock, nvdev->ctx, - (DRM_LOCK_HELD | nvdev->ctx), __ret); - - if (__ret) { - drmGetLock(nvdev->fd, nvdev->ctx, 0); - nouveau_contended_lock(nv); - } - nv->locked = 1; -} - -/* Unlock the hardware using the global current context - */ -void -UNLOCK_HARDWARE(struct nouveau_context *nv) -{ - struct nouveau_screen *nv_screen = nv->dri_screen->private; - struct nouveau_device *dev = nv_screen->device; - struct nouveau_device_priv *nvdev = nouveau_device(dev); - - assert(nv->locked); - nv->locked = 0; - - DRM_UNLOCK(nvdev->fd, nvdev->lock, nvdev->ctx); - - pipe_mutex_unlock(lockMutex); -} diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c deleted file mode 100644 index 4e9b76a909..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c +++ /dev/null @@ -1,330 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include "nouveau_context.h" -#include "nouveau_screen.h" -#include "nouveau_swapbuffers.h" -#include "nouveau_dri.h" - -#include "nouveau_drm.h" -#include "nouveau_drmif.h" - -#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12 -#error nouveau_drm.h version does not match expected version -#endif - -/* Extension stuff, enabling of extensions handled by Gallium's GL state - * tracker. But, we still need to define the entry points we want. - */ -#define need_GL_ARB_fragment_program -#define need_GL_ARB_multisample -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_point_parameters -#define need_GL_ARB_shader_objects -#define need_GL_ARB_texture_compression -#define need_GL_ARB_vertex_program -#define need_GL_ARB_vertex_shader -#define need_GL_ARB_vertex_buffer_object -#define need_GL_EXT_compiled_vertex_array -#define need_GL_EXT_fog_coord -#define need_GL_EXT_secondary_color -#define need_GL_EXT_framebuffer_object -#define need_GL_VERSION_2_0 -#define need_GL_VERSION_2_1 -#include "extension_helper.h" - -const struct dri_extension card_extensions[] = -{ - { "GL_ARB_multisample", GL_ARB_multisample_functions }, - { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions }, - { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, - { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, - { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, - { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, - { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, - { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions }, - { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions }, - { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions }, - { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, - { NULL, 0 } -}; - -PUBLIC const char __driConfigOptions[] = -DRI_CONF_BEGIN -DRI_CONF_END; -static const GLuint __driNConfigOptions = 0; - -extern const struct dri_extension common_extensions[]; -extern const struct dri_extension nv40_extensions[]; - -static GLboolean -nouveau_create_buffer(__DRIscreenPrivate * driScrnPriv, - __DRIdrawablePrivate * driDrawPriv, - const __GLcontextModes *glVis, GLboolean pixmapBuffer) -{ - struct nouveau_framebuffer *nvfb; - enum pipe_format colour, depth, stencil; - - if (pixmapBuffer) - return GL_FALSE; - - nvfb = CALLOC_STRUCT(nouveau_framebuffer); - if (!nvfb) - return GL_FALSE; - - if (glVis->redBits == 5) - colour = PIPE_FORMAT_R5G6B5_UNORM; - else - colour = PIPE_FORMAT_A8R8G8B8_UNORM; - - if (glVis->depthBits == 16) - depth = PIPE_FORMAT_Z16_UNORM; - else if (glVis->depthBits == 24) - depth = PIPE_FORMAT_Z24S8_UNORM; - else - depth = PIPE_FORMAT_NONE; - - if (glVis->stencilBits == 8) - stencil = PIPE_FORMAT_Z24S8_UNORM; - else - stencil = PIPE_FORMAT_NONE; - - nvfb->stfb = st_create_framebuffer(glVis, colour, depth, stencil, - driDrawPriv->w, driDrawPriv->h, - (void*)nvfb); - if (!nvfb->stfb) { - free(nvfb); - return GL_FALSE; - } - - driDrawPriv->driverPrivate = (void *)nvfb; - return GL_TRUE; -} - -static void -nouveau_destroy_buffer(__DRIdrawablePrivate * driDrawPriv) -{ - struct nouveau_framebuffer *nvfb; - - nvfb = (struct nouveau_framebuffer *)driDrawPriv->driverPrivate; - st_unreference_framebuffer(nvfb->stfb); - free(nvfb); -} - -static __DRIconfig ** -nouveau_fill_in_modes(__DRIscreenPrivate *psp, - unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer) -{ - __DRIconfig **configs; - unsigned depth_buffer_factor; - unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; - - static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, - }; - - uint8_t depth_bits_array[3]; - uint8_t stencil_bits_array[3]; - uint8_t msaa_samples_array[1]; - - depth_bits_array[0] = 0; - depth_bits_array[1] = depth_bits; - depth_bits_array[2] = depth_bits; - - /* Just like with the accumulation buffer, always provide some modes - * with a stencil buffer. It will be a sw fallback, but some apps won't - * care about that. - */ - stencil_bits_array[0] = 0; - stencil_bits_array[1] = 0; - if (depth_bits == 24) - stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits; - stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; - - msaa_samples_array[0] = 0; - - depth_buffer_factor = - ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; - back_buffer_factor = (have_back_buffer) ? 3 : 1; - - if (pixel_bits == 16) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } - - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, back_buffer_modes, - back_buffer_factor, msaa_samples_array, 1); - if (configs == NULL) { - fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", - __func__, __LINE__); - return NULL; - } - - return configs; -} - -static struct pipe_surface * -dri_surface_from_handle(struct pipe_screen *screen, - unsigned handle, - enum pipe_format format, - unsigned width, - unsigned height, - unsigned pitch) -{ - struct pipe_surface *surface = NULL; - struct pipe_texture *texture = NULL; - struct pipe_texture templat; - struct pipe_buffer *buf = NULL; - - buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle); - if (!buf) - return NULL; - - memset(&templat, 0, sizeof(templat)); - templat.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY | - NOUVEAU_TEXTURE_USAGE_LINEAR; - templat.target = PIPE_TEXTURE_2D; - templat.last_level = 0; - templat.depth[0] = 1; - templat.format = format; - templat.width[0] = width; - templat.height[0] = height; - pf_get_block(templat.format, &templat.block); - - texture = screen->texture_blanket(screen, - &templat, - &pitch, - buf); - - /* we don't need the buffer from this point on */ - pipe_buffer_reference(&buf, NULL); - - if (!texture) - return NULL; - - surface = screen->get_tex_surface(screen, texture, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); - - /* we don't need the texture from this point on */ - pipe_texture_reference(&texture, NULL); - return surface; -} - -static const __DRIconfig ** -nouveau_screen_create(__DRIscreenPrivate *psp) -{ - struct nouveau_dri *nv_dri = psp->pDevPriv; - struct nouveau_screen *nv_screen; - static const __DRIversion ddx_expected = - { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; - static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = - { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; - - if (!driCheckDriDdxDrmVersions2("nouveau", - &psp->dri_version, &dri_expected, - &psp->ddx_version, &ddx_expected, - &psp->drm_version, &drm_expected)) { - return NULL; - } - - if (drm_expected.patch != psp->drm_version.patch) { - fprintf(stderr, "Incompatible DRM patch level.\n" - "Expected: %d\n" "Current : %d\n", - drm_expected.patch, psp->drm_version.patch); - return NULL; - } - - driInitExtensions(NULL, card_extensions, GL_FALSE); - - if (psp->devPrivSize != sizeof(struct nouveau_dri)) { - NOUVEAU_ERR("DRI struct mismatch between DDX/DRI\n"); - return NULL; - } - - nv_screen = CALLOC_STRUCT(nouveau_screen); - if (!nv_screen) - return NULL; - - nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0); - - nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, NULL); - if (!nv_screen->pscreen) { - FREE(nv_screen); - return NULL; - } - nv_screen->pscreen->flush_frontbuffer = nouveau_flush_frontbuffer; - - { - enum pipe_format format; - - if (nv_dri->bpp == 16) - format = PIPE_FORMAT_R5G6B5_UNORM; - else - format = PIPE_FORMAT_A8R8G8B8_UNORM; - - nv_screen->fb = dri_surface_from_handle(nv_screen->pscreen, - nv_dri->front_offset, - format, - nv_dri->width, - nv_dri->height, - nv_dri->front_pitch * - nv_dri->bpp / 8); - } - - driParseOptionInfo(&nv_screen->option_cache, - __driConfigOptions, __driNConfigOptions); - - nv_screen->driScrnPriv = psp; - psp->private = (void *)nv_screen; - - return (const __DRIconfig **) - nouveau_fill_in_modes(psp, nv_dri->bpp, - (nv_dri->bpp == 16) ? 16 : 24, - (nv_dri->bpp == 16) ? 0 : 8, 1); -} - -static void -nouveau_screen_destroy(__DRIscreenPrivate *driScrnPriv) -{ - struct nouveau_screen *nv_screen = driScrnPriv->private; - - driScrnPriv->private = NULL; - FREE(nv_screen); -} - -const struct __DriverAPIRec -driDriverAPI = { - .InitScreen = nouveau_screen_create, - .DestroyScreen = nouveau_screen_destroy, - .CreateContext = nouveau_context_create, - .DestroyContext = nouveau_context_destroy, - .CreateBuffer = nouveau_create_buffer, - .DestroyBuffer = nouveau_destroy_buffer, - .SwapBuffers = nouveau_swap_buffers, - .MakeCurrent = nouveau_context_bind, - .UnbindContext = nouveau_context_unbind, - .CopySubBuffer = nouveau_copy_sub_buffer, - - .InitScreen2 = NULL, /* one day, I promise! */ -}; - diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h deleted file mode 100644 index ac078f3c63..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __NOUVEAU_SCREEN_DRI_H__ -#define __NOUVEAU_SCREEN_DRI_H__ - -#include "xmlconfig.h" - -struct nouveau_screen { - __DRIscreenPrivate *driScrnPriv; - driOptionCache option_cache; - - struct nouveau_device *device; - - struct pipe_screen *pscreen; - struct pipe_surface *fb; -}; - -#endif diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c deleted file mode 100644 index 9c841a0b2d..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c +++ /dev/null @@ -1,115 +0,0 @@ -#include
        -#include -#include - -#include -#include -#include -#include - -#include "nouveau_context.h" -#include "nouveau_screen.h" -#include "nouveau_swapbuffers.h" - -#include "nouveau_pushbuf.h" - -void -nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf, - const drm_clip_rect_t *rect) -{ - struct nouveau_context *nv = dPriv->driContextPriv->driverPrivate; - struct nouveau_screen *nv_screen = nv->dri_screen->private; - struct pipe_context *pipe = nv->st->pipe; - drm_clip_rect_t *pbox; - int nbox, i; - - LOCK_HARDWARE(nv); - if (!dPriv->numClipRects) { - UNLOCK_HARDWARE(nv); - return; - } - pbox = dPriv->pClipRects; - nbox = dPriv->numClipRects; - - for (i = 0; i < nbox; i++, pbox++) { - int sx, sy, dx, dy, w, h; - - sx = pbox->x1 - dPriv->x; - sy = pbox->y1 - dPriv->y; - dx = pbox->x1; - dy = pbox->y1; - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - - pipe->surface_copy(pipe, nv_screen->fb, dx, dy, surf, - sx, sy, w, h); - } - - pipe->flush(pipe, 0, NULL); - UNLOCK_HARDWARE(nv); - - if (nv->last_stamp != dPriv->lastStamp) { - struct nouveau_framebuffer *nvfb = dPriv->driverPrivate; - st_resize_framebuffer(nvfb->stfb, dPriv->w, dPriv->h); - nv->last_stamp = dPriv->lastStamp; - } -} - -void -nouveau_copy_sub_buffer(__DRIdrawablePrivate *dPriv, int x, int y, int w, int h) -{ - struct nouveau_framebuffer *nvfb = dPriv->driverPrivate; - struct pipe_surface *surf; - - st_get_framebuffer_surface(nvfb->stfb, ST_SURFACE_BACK_LEFT, &surf); - if (surf) { - drm_clip_rect_t rect; - rect.x1 = x; - rect.y1 = y; - rect.x2 = x + w; - rect.y2 = y + h; - - st_notify_swapbuffers(nvfb->stfb); - nouveau_copy_buffer(dPriv, surf, &rect); - } -} - -void -nouveau_swap_buffers(__DRIdrawablePrivate *dPriv) -{ - struct nouveau_framebuffer *nvfb = dPriv->driverPrivate; - struct pipe_surface *surf; - - st_get_framebuffer_surface(nvfb->stfb, ST_SURFACE_BACK_LEFT, &surf); - if (surf) { - st_notify_swapbuffers(nvfb->stfb); - nouveau_copy_buffer(dPriv, surf, NULL); - } -} - -void -nouveau_flush_frontbuffer(struct pipe_screen *pscreen, struct pipe_surface *ps, - void *context_private) -{ - struct nouveau_context *nv = context_private; - __DRIdrawablePrivate *dPriv = nv->dri_drawable; - - nouveau_copy_buffer(dPriv, ps, NULL); -} - -void -nouveau_contended_lock(struct nouveau_context *nv) -{ - struct nouveau_context *nv_sub = (struct nouveau_context*)nv; - __DRIdrawablePrivate *dPriv = nv_sub->dri_drawable; - __DRIscreenPrivate *sPriv = nv_sub->dri_screen; - - /* If the window moved, may need to set a new cliprect now. - * - * NOTE: This releases and regains the hw lock, so all state - * checking must be done *after* this call: - */ - if (dPriv) - DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv); -} - diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h deleted file mode 100644 index 4ca9cc2283..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __NOUVEAU_SWAPBUFFERS_H__ -#define __NOUVEAU_SWAPBUFFERS_H__ - -void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *, - const drm_clip_rect_t *); -void nouveau_copy_sub_buffer(__DRIdrawablePrivate *, int x, int y, int w, int h); -void nouveau_swap_buffers(__DRIdrawablePrivate *); -void nouveau_flush_frontbuffer(struct pipe_screen *, struct pipe_surface *, - void *context_private); - -#endif diff --git a/src/gallium/winsys/drm/nouveau/dri2/Makefile b/src/gallium/winsys/drm/nouveau/dri2/Makefile deleted file mode 100644 index 024ab150cb..0000000000 --- a/src/gallium/winsys/drm/nouveau/dri2/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TOP = ../../../../../.. -include $(TOP)/configs/current - -LIBNAME = nouveau_dri.so - -PIPE_DRIVERS = \ - $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ - $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \ - $(TOP)/src/gallium/drivers/nv04/libnv04.a \ - $(TOP)/src/gallium/drivers/nv10/libnv10.a \ - $(TOP)/src/gallium/drivers/nv20/libnv20.a \ - $(TOP)/src/gallium/drivers/nv30/libnv30.a \ - $(TOP)/src/gallium/drivers/nv40/libnv40.a \ - $(TOP)/src/gallium/drivers/nv50/libnv50.a - -DRIVER_SOURCES = - -C_SOURCES = \ - $(COMMON_GALLIUM_SOURCES) \ - $(DRIVER_SOURCES) - -include ../../Makefile.template - -DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs) - -symlinks: -- cgit v1.2.3 From 71b1c92405de2848de4b7effdbc236da1a4815bd Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 8 May 2009 09:22:16 +1000 Subject: nouveau: respect GALLIUM_STATE_TRACKERS_DIRS --- src/gallium/winsys/drm/nouveau/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile index e275b2d9e7..6c9cbef26d 100644 --- a/src/gallium/winsys/drm/nouveau/Makefile +++ b/src/gallium/winsys/drm/nouveau/Makefile @@ -2,7 +2,7 @@ TOP = ../../../../.. include $(TOP)/configs/current -SUBDIRS = drm dri +SUBDIRS = drm $(GALLIUM_STATE_TRACKERS_DIRS) default install clean: @for dir in $(SUBDIRS) ; do \ -- cgit v1.2.3 From 14365aa0ef278ac6e04a8c6e6d37e6625b0a309a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 2 May 2009 17:37:20 +0200 Subject: r300: fix compiler warnings --- src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h | 2 ++ src/mesa/drivers/dri/radeon/radeon_common.c | 1 + src/mesa/drivers/dri/radeon/radeon_cs_legacy.c | 8 -------- src/mesa/drivers/dri/radeon/radeon_texture.c | 1 + 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h index 6f1a0b4535..2d6b49257d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h +++ b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h @@ -1,3 +1,5 @@ +#include + #ifndef RADEON_CS_WRAPPER_H #define RADEON_CS_WRAPPER_H diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index ee3ee9ca50..daf03a9856 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -62,6 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/bufferobj.h" #include "main/buffers.h" #include "main/depth.h" +#include "main/polygon.h" #include "main/shaders.h" #include "main/texstate.h" #include "main/varray.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c index b47b095cf2..e4ee2b9915 100644 --- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c @@ -261,14 +261,6 @@ static int cs_set_age(struct radeon_cs *cs) return 0; } -static void dump_cmdbuf(struct radeon_cs *cs) -{ - int i; - for (i = 0; i < cs->cdw; i++){ - fprintf(stderr,"%x: %08x\n", i, cs->packets[i]); - } - -} static int cs_emit(struct radeon_cs *cs) { struct cs_manager_legacy *csm = (struct cs_manager_legacy*)cs->csm; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 35ed542431..0f1d9c2158 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -38,6 +38,7 @@ #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" +#include "main/texgetimage.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ -- cgit v1.2.3 From dc8c7177592fc804f00409d53049af8e6b55f331 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 2 May 2009 19:34:57 +0200 Subject: r300: moar cleanup - remove unused r300UpdateClipPlanes function - move reg definition to r300_reg.h - remove incorrect forward definition of tnl_UpdateFixedFunctionProgram and add proper #include - remove unreachable code --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 6 +----- src/mesa/drivers/dri/r300/r300_reg.h | 3 +++ src/mesa/drivers/dri/r300/r300_state.c | 19 +------------------ src/mesa/drivers/dri/r300/r300_state.h | 4 ---- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index afca0e24a6..6ae724bff9 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -55,9 +55,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "radeon_reg.h" -#define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200 -# define RADEON_ONE_REG_WR (1 << 15) - /** # of dwords reserved for additional instructions that may need to be written * during flushing. */ @@ -71,7 +68,6 @@ static unsigned packet0_count(r300ContextPtr r300, uint32_t *pkt) drm_r300_cmd_header_t *t = (drm_r300_cmd_header_t*)pkt; return t->packet0.count; } - return 0; } #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) @@ -111,7 +107,7 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom) } else { BEGIN_BATCH_NO_AUTOSTATE(5 + ndw); } - OUT_BATCH_REGVAL(R300_VAP_PVS_UPLOAD_ADDRESS, addr); + OUT_BATCH_REGVAL(R300_VAP_PVS_VECTOR_INDX_REG, addr); OUT_BATCH(CP_PACKET0(R300_VAP_PVS_UPLOAD_DATA, ndw-1) | RADEON_ONE_REG_WR); for (i = 0; i < ndw; i++) { OUT_BATCH(atom->cmd[i+1]); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 79dd1e1fa2..c22616b95f 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -3178,6 +3178,9 @@ enum { # define R300_W_SRC_RAS (1 << 2) +/* Packet0 field ordering to write all values to the same reg */ +#define RADEON_ONE_REG_WR (1 << 15) + /* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR. * Two parameter dwords: * 0. VAP_VTX_FMT: The first parameter is not written to hardware diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 99441a22fd..330f1dab49 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -53,6 +53,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "shader/prog_statevars.h" #include "vbo/vbo.h" #include "tnl/tnl.h" +#include "tnl/t_vp_build.h" #include "r300_context.h" #include "r300_ioctl.h" @@ -2467,24 +2468,6 @@ static void r300RenderMode(GLcontext * ctx, GLenum mode) (void)mode; } -void r300UpdateClipPlanes( GLcontext *ctx ) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint p; - - for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - GLint *ip = (GLint *)ctx->Transform._ClipUserPlane[p]; - - R300_STATECHANGE( rmesa, vpucp[p] ); - rmesa->hw.vpucp[p].cmd[R300_VPUCP_X] = ip[0]; - rmesa->hw.vpucp[p].cmd[R300_VPUCP_Y] = ip[1]; - rmesa->hw.vpucp[p].cmd[R300_VPUCP_Z] = ip[2]; - rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3]; - } - } -} - /** * Initialize driver's state callback functions */ diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index 247a20ee51..3921efa8e3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -50,16 +50,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. r300->radeon.hw.is_dirty = GL_TRUE; \ } while(0) -// r300_state.c -extern int future_hw_tcl_on; -void _tnl_UpdateFixedFunctionProgram (GLcontext * ctx); void r300UpdateViewportOffset (GLcontext * ctx); void r300UpdateDrawBuffer (GLcontext * ctx); void r300UpdateStateParameters (GLcontext * ctx, GLuint new_state); void r300UpdateShaders (r300ContextPtr rmesa); void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); -void r300UpdateClipPlanes (GLcontext * ctx); void r300InitStateFuncs (struct dd_function_table *functions); #endif /* __R300_STATE_H__ */ -- cgit v1.2.3 From a7bb95bf142ac9727a4223639742a8524f9c724b Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 5 May 2009 14:45:51 +0200 Subject: r300: add missing texture format Fixes piglit/texdepth --- src/mesa/drivers/dri/r300/r300_texstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 2d7ad55521..443fafe5e2 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -117,6 +117,7 @@ static const struct tx_table { _ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)), _ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)), _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)), + _ASSIGN(S8_Z24, R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8)), _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)), /* *INDENT-ON* */ }; -- cgit v1.2.3 From 25a4156a8b0bc59f7d3f077526b7e3e350b072ea Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:49:22 +0100 Subject: wgl: Implement ShareLists. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 2 +- .../state_trackers/wgl/shared/stw_context.c | 24 ++++++++++++++++++++++ src/gallium/state_trackers/wgl/shared/stw_public.h | 2 ++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 7 +------ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index b259ea91f5..62af765211 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -562,7 +562,7 @@ DrvShareLists( if (DBG) debug_printf( "%s\n", __FUNCTION__ ); - return FALSE; + return stw_share_lists(dhglrc1, dhglrc2); } BOOL APIENTRY diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 473e3308c6..e172f09bdf 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -74,6 +74,30 @@ stw_copy_context( return ret; } +BOOL +stw_share_lists( + UINT_PTR hglrc1, + UINT_PTR hglrc2 ) +{ + struct stw_context *ctx1; + struct stw_context *ctx2; + BOOL ret = FALSE; + + pipe_mutex_lock( stw_dev->mutex ); + + ctx1 = stw_lookup_context_locked( hglrc1 ); + ctx2 = stw_lookup_context_locked( hglrc2 ); + + if (ctx1 && ctx2 && + ctx1->pfi == ctx2->pfi) { + ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); + } + + pipe_mutex_unlock( stw_dev->mutex ); + + return ret; +} + UINT_PTR stw_create_layer_context( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h index 59d709a6d4..7fe9cfb356 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_public.h +++ b/src/gallium/state_trackers/wgl/shared/stw_public.h @@ -37,6 +37,8 @@ BOOL stw_copy_context( UINT_PTR hglrcSrc, UINT_PTR stw_create_layer_context( HDC hdc, int iLayerPlane ); +BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 ); + BOOL stw_delete_context( UINT_PTR hglrc ); BOOL diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index 30e42e0ec5..a131292f7a 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -186,12 +186,7 @@ wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) { - (void) hglrc1; - (void) hglrc2; - - assert( 0 ); - - return FALSE; + return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; } WINGDIAPI BOOL APIENTRY -- cgit v1.2.3 From b25168c34c60760a33ca9e8336ac76cf1219f143 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:52:54 +0100 Subject: mesa: Make _mesa_share_state thread safe. --- src/mesa/main/context.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1a290f251a..ddbc631e67 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1394,14 +1394,21 @@ _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) { if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { struct gl_shared_state *oldSharedState = ctx->Shared; + GLint RefCount; ctx->Shared = ctxToShare->Shared; + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); ctx->Shared->RefCount++; + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); update_default_objects(ctx); - oldSharedState->RefCount--; - if (oldSharedState->RefCount == 0) { + _glthread_LOCK_MUTEX(oldSharedState->Mutex); + RefCount = --oldSharedState->RefCount; + _glthread_UNLOCK_MUTEX(oldSharedState->Mutex); + + if (RefCount == 0) { _mesa_free_shared_state(ctx, oldSharedState); } -- cgit v1.2.3 From 082a086e9dffb78b73269ac3524f899e9f780ef9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:53:17 +0100 Subject: wgl: Remove unused variable. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index e172f09bdf..336eccef71 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -109,7 +109,6 @@ stw_create_layer_context( GLvisual *visual = NULL; struct pipe_screen *screen = NULL; struct pipe_context *pipe = NULL; - UINT_PTR hglrc = 0; if(!stw_dev) return 0; -- cgit v1.2.3 From 3a43ea4946bc5965267f9b689378697fcab020c6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:53:51 +0100 Subject: wgl: Add assertion for missing function. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 336eccef71..d532b1563b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -64,6 +64,7 @@ stw_copy_context( if (src && dst) { /* FIXME */ + assert(0); (void) src; (void) dst; (void) mask; -- cgit v1.2.3 From 26ffd445861f405e295644df1cbac29458a6054f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 May 2009 19:58:08 +0100 Subject: wgl: Enforce a minimum 1x1 framebuffer size. --- .../state_trackers/wgl/shared/stw_context.c | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index d532b1563b..b61f74f69b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -278,19 +278,30 @@ stw_release_context( /* Find the width and height of the window named by hdc. */ static void -stw_get_window_size( HDC hdc, GLuint *width, GLuint *height ) +stw_get_window_size( HDC hdc, GLuint *pwidth, GLuint *pheight ) { - if (WindowFromDC( hdc )) { - RECT rect; + GLuint width, height; + HWND hwnd; - GetClientRect( WindowFromDC( hdc ), &rect ); - *width = rect.right - rect.left; - *height = rect.bottom - rect.top; + hwnd = WindowFromDC( hdc ); + if (hwnd) { + RECT rect; + GetClientRect( hwnd, &rect ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; } else { - *width = GetDeviceCaps( hdc, HORZRES ); - *height = GetDeviceCaps( hdc, VERTRES ); + width = GetDeviceCaps( hdc, HORZRES ); + height = GetDeviceCaps( hdc, VERTRES ); } + + if(width < 1) + width = 1; + if(height < 1) + height = 1; + + *pwidth = width; + *pheight = height; } UINT_PTR -- cgit v1.2.3 From 48c7aa2648877efab4aac45b50ee2a4c79178536 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 May 2009 20:41:17 +0100 Subject: stw: fix potential uninitialized use of curctx --- src/gallium/state_trackers/wgl/shared/stw_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index b61f74f69b..dd97e48b14 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -348,7 +348,7 @@ stw_make_current( struct stw_framebuffer *fb; GLuint width = 0; GLuint height = 0; - struct stw_context *curctx; + struct stw_context *curctx = NULL; if (!stw_dev) return FALSE; -- cgit v1.2.3 From 5f5181021e50e830bc4a88cfd3f5249ad962619b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 08:00:42 +0100 Subject: scons: mingw is broken with -O1 and higher --- scons/gallium.py | 2 ++ scons/generic.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scons/gallium.py b/scons/gallium.py index 696ddd025f..c7e74d7e59 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -317,6 +317,8 @@ def generate(env): if gcc: if debug: cflags += ['-O0', '-g3'] + elif env['toolchain'] == 'crossmingw': + cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken else: cflags += ['-O3', '-g3'] if env['profile']: diff --git a/scons/generic.py b/scons/generic.py index 03563e4c62..29ddf76d6f 100644 --- a/scons/generic.py +++ b/scons/generic.py @@ -398,6 +398,8 @@ def generate(env): if gcc: if debug: ccflags += ['-O0', '-g3'] + elif env['toolchain'] == 'crossmingw': + ccflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken else: ccflags += ['-O3', '-g0'] if env['profile']: -- cgit v1.2.3 From 4a333c64faf78dd39f07574bb94f62ba48995e7d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 09:24:37 +0100 Subject: util/upload: catch failures to map_range and return error Caller may be able to do something about this - eg flush and retry. --- src/gallium/auxiliary/util/u_upload_mgr.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index d9c0d7afa8..2eb98068c8 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -70,7 +70,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_screen *screen, } -static INLINE void +static INLINE enum pipe_error my_buffer_write(struct pipe_screen *screen, struct pipe_buffer *buf, unsigned offset, unsigned size, unsigned dirty_size, @@ -84,12 +84,14 @@ my_buffer_write(struct pipe_screen *screen, assert(size); map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); - assert(map); - if(map) { - memcpy(map + offset, data, size); - pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size); - pipe_buffer_unmap(screen, buf); - } + if (map == NULL) + return PIPE_ERROR_OUT_OF_MEMORY; + + memcpy(map + offset, data, size); + pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size); + pipe_buffer_unmap(screen, buf); + + return PIPE_OK; } /* Release old buffer. @@ -162,12 +164,14 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload, /* Copy the data, using map_range if available: */ - my_buffer_write( upload->screen, - upload->buffer, - upload->offset, - size, - alloc_size, - data ); + ret = my_buffer_write( upload->screen, + upload->buffer, + upload->offset, + size, + alloc_size, + data ); + if (ret) + return ret; /* Emit the return values: */ -- cgit v1.2.3 From 01280cff537544299fe0c5f1a282abde8e69b1f3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 11:46:08 +0100 Subject: mesa/st: cope with non-ibo index data in st_draw_feedback.c Previously only non-indexed or indicies-in-a-vbo cases were handled in this code. This change adds the missing regular indices-in-memory case. --- src/mesa/state_tracker/st_draw_feedback.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index e533afd051..32502a9cda 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -196,13 +196,10 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_vertex_elements(draw, vp->num_inputs, velements); if (ib) { - unsigned indexSize; struct gl_buffer_object *bufobj = ib->obj; - struct st_buffer_object *stobj = st_buffer_object(bufobj); + unsigned indexSize; void *map; - index_buffer_handle = stobj->buffer; - switch (ib->type) { case GL_UNSIGNED_INT: indexSize = 4; @@ -215,9 +212,19 @@ st_feedback_draw_vbo(GLcontext *ctx, return; } - map = pipe_buffer_map(pipe->screen, index_buffer_handle, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer(draw, indexSize, map); + if (bufobj && bufobj->Name) { + struct st_buffer_object *stobj = st_buffer_object(bufobj); + + index_buffer_handle = stobj->buffer; + + map = pipe_buffer_map(pipe->screen, index_buffer_handle, + PIPE_BUFFER_USAGE_CPU_READ); + + draw_set_mapped_element_buffer(draw, indexSize, map); + } + else { + draw_set_mapped_element_buffer(draw, indexSize, (void *) ib->ptr); + } } else { /* no index/element buffer */ @@ -252,7 +259,7 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_mapped_vertex_buffer(draw, i, NULL); } } - if (ib) { + if (index_buffer_handle) { pipe_buffer_unmap(pipe->screen, index_buffer_handle); draw_set_mapped_element_buffer(draw, 0, NULL); } -- cgit v1.2.3 From 626b6f37eaf81eeb0eb069f18c98c6ffa463647e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 7 May 2009 18:21:56 +0100 Subject: wgl: Export pixelformats with accumulation bits. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 8d6955f390..b81d2b59a4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -119,6 +119,7 @@ stw_pixelformat_add( struct stw_device *stw_dev, const struct stw_pf_color_info *color, const struct stw_pf_depth_info *depth, + unsigned accum, boolean doublebuffer, unsigned samples ) { @@ -167,11 +168,11 @@ stw_pixelformat_add( pfi->pfd.cBlueShift = color->shift.blue; pfi->pfd.cAlphaBits = color->bits.alpha; pfi->pfd.cAlphaShift = color->shift.alpha; - pfi->pfd.cAccumBits = 0; - pfi->pfd.cAccumRedBits = 0; - pfi->pfd.cAccumGreenBits = 0; - pfi->pfd.cAccumBlueBits = 0; - pfi->pfd.cAccumAlphaBits = 0; + pfi->pfd.cAccumBits = 4*accum; + pfi->pfd.cAccumRedBits = accum; + pfi->pfd.cAccumGreenBits = accum; + pfi->pfd.cAccumBlueBits = accum; + pfi->pfd.cAccumAlphaBits = accum; pfi->pfd.cDepthBits = depth->bits.depth; pfi->pfd.cStencilBits = depth->bits.stencil; pfi->pfd.cAuxBuffers = 0; @@ -228,7 +229,8 @@ stw_pixelformat_init( void ) PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) continue; - stw_pixelformat_add( stw_dev, color, depth, doublebuffer, samples ); + stw_pixelformat_add( stw_dev, color, depth, 0, doublebuffer, samples ); + stw_pixelformat_add( stw_dev, color, depth, 16, doublebuffer, samples ); } } } -- cgit v1.2.3 From 6826bad6a75e78729dd472ea26c87787c90ada4c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 19:27:30 +0100 Subject: mesa/st: remove redundant call to st_finish in CopyTexSubImage Rendering should already have been flushed, any synchronization will be done by the driver or memory manager. --- src/mesa/state_tracker/st_cb_texture.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b7b791d9a4..98f109fc65 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1315,9 +1315,6 @@ st_copy_texsubimage(GLcontext *ctx, GLboolean use_fallback = GL_TRUE; GLboolean matching_base_formats; - /* any rendering in progress must complete before we grab the fb image */ - st_finish(ctx->st); - /* make sure finalize_textures has been called? */ if (0) st_validate_state(ctx->st); -- cgit v1.2.3 From d5c2ad8514ce8064d83febf647c9e726788b7924 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 19:48:06 +0100 Subject: mesa/st: keep surface_copy arguments positive The src/dest x,y, and w,h arguments of the pipe->surface_copy function are unsigned and the drivers aren't expecting negative (or extremly-large unsigned) values as inputs. Trim the requests at the state-tracker level before passing down. --- src/mesa/state_tracker/st_cb_drawpixels.c | 43 ++++++++++++++++++++++++++++--- src/mesa/state_tracker/st_cb_texture.c | 28 ++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 08dc7c930e..89725cfe8d 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -910,6 +910,34 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, st_validate_state(st); + if (srcx < 0) { + width -= -srcx; + dstx += -srcx; + srcx = 0; + } + + if (srcy < 0) { + height -= -srcy; + dsty += -srcy; + srcy = 0; + } + + if (dstx < 0) { + width -= -dstx; + srcx += -dstx; + dstx = 0; + } + + if (dsty < 0) { + height -= -dsty; + srcy += -dsty; + dsty = 0; + } + + if (width < 0 || height < 0) + return; + + if (type == GL_STENCIL) { /* can't use texturing to do stencil */ copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty); @@ -951,15 +979,24 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, } } + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { + srcy = ctx->DrawBuffer->Height - srcy - height; + + if (srcy < 0) { + height -= -srcy; + srcy = 0; + } + + if (height < 0) + return; + } + pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, texFormat, 0, width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) return; - if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - srcy = ctx->DrawBuffer->Height - srcy - height; - } if (srcFormat == texFormat) { /* copy source framebuffer surface into mipmap/texture */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 98f109fc65..b182106fd5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1337,6 +1337,34 @@ st_copy_texsubimage(GLcontext *ctx, return; } + if (srcX < 0) { + width -= -srcX; + destX += -srcX; + srcX = 0; + } + + if (srcY < 0) { + height -= -srcY; + destY += -srcY; + srcY = 0; + } + + if (destX < 0) { + width -= -destX; + srcX += -destX; + destX = 0; + } + + if (destY < 0) { + height -= -destY; + srcY += -destY; + destY = 0; + } + + if (width < 0 || height < 0) + return; + + assert(strb); assert(strb->surface); assert(stImage->pt); -- cgit v1.2.3 From 606a5476131059b012bb2522b204ed8b868db122 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 17:07:01 +0100 Subject: pb: Dump the fenced buffer sizes. --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 044e8e1dd3..4698efa69c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -531,16 +531,17 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) pipe_mutex_lock(fenced_list->mutex); - debug_printf("%10s %7s %10s %s\n", - "buffer", "reference.count", "fence", "signalled"); + debug_printf("%10s %7s %7s %10s %s\n", + "buffer", "size", "refcount", "fence", "signalled"); curr = fenced_list->unfenced.next; next = curr->next; while(curr != &fenced_list->unfenced) { fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); assert(!fenced_buf->fence); - debug_printf("%10p %7u\n", + debug_printf("%10p %7u %7u\n", fenced_buf, + fenced_buf->base.base.size, fenced_buf->base.base.reference.count); curr = next; next = curr->next; @@ -552,8 +553,9 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) int signaled; fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); signaled = ops->fence_signalled(ops, fenced_buf->fence, 0); - debug_printf("%10p %7u %10p %s\n", + debug_printf("%10p %7u %7u %10p %s\n", fenced_buf, + fenced_buf->base.base.size, fenced_buf->base.base.reference.count, fenced_buf->fence, signaled == 0 ? "y" : "n"); -- cgit v1.2.3 From 1248ff7d45ce4b78af8c7a091cb64f1f992f88dd Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 18:53:52 +0100 Subject: pb: Save the stack backtrace when creating/mapping a debug buffer. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 102 ++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index f1a05be46e..cedf745bda 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -40,6 +40,7 @@ #include "util/u_memory.h" #include "util/u_double_list.h" #include "util/u_time.h" +#include "util/u_debug_stack.h" #include "pb_buffer.h" #include "pb_bufmgr.h" @@ -48,6 +49,10 @@ #ifdef DEBUG +#define PB_DEBUG_CREATE_BACKTRACE 8 +#define PB_DEBUG_MAP_BACKTRACE 8 + + /** * Convenience macro (type safe). */ @@ -69,6 +74,14 @@ struct pb_debug_buffer size_t underflow_size; size_t overflow_size; + + struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE]; + + pipe_mutex mutex; + unsigned map_count; + struct debug_stack_frame map_backtrace[PB_DEBUG_MAP_BACKTRACE]; + + struct list_head head; }; @@ -80,6 +93,9 @@ struct pb_debug_manager size_t underflow_size; size_t overflow_size; + + pipe_mutex mutex; + struct list_head list; }; @@ -189,6 +205,9 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf) max_ofs == buf->overflow_size - 1 ? "+" : ""); } + if(underflow || overflow) + debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE); + debug_assert(!underflow && !overflow); /* re-fill if not aborted */ @@ -207,11 +226,18 @@ static void pb_debug_buffer_destroy(struct pb_buffer *_buf) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + struct pb_debug_manager *mgr = buf->mgr; assert(!pipe_is_referenced(&buf->base.base.reference)); pb_debug_buffer_check(buf); + pipe_mutex_lock(mgr->mutex); + LIST_DEL(&buf->head); + pipe_mutex_unlock(mgr->mutex); + + pipe_mutex_destroy(buf->mutex); + pb_reference(&buf->buffer, NULL); FREE(buf); } @@ -230,6 +256,13 @@ pb_debug_buffer_map(struct pb_buffer *_buf, if(!map) return NULL; + if(map) { + pipe_mutex_lock(buf->mutex); + ++buf->map_count; + debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE); + pipe_mutex_unlock(buf->mutex); + } + return (uint8_t *)map + buf->underflow_size; } @@ -238,6 +271,13 @@ static void pb_debug_buffer_unmap(struct pb_buffer *_buf) { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + + pipe_mutex_lock(buf->mutex); + assert(buf->map_count); + if(buf->map_count) + --buf->map_count; + pipe_mutex_unlock(buf->mutex); + pb_unmap(buf->buffer); pb_debug_buffer_check(buf); @@ -262,6 +302,14 @@ pb_debug_buffer_validate(struct pb_buffer *_buf, { struct pb_debug_buffer *buf = pb_debug_buffer(_buf); + pipe_mutex_lock(buf->mutex); + if(buf->map_count) { + debug_printf("%s: attempting to validate a mapped buffer\n", __FUNCTION__); + debug_printf("last map backtrace is\n"); + debug_backtrace_dump(buf->map_backtrace, PB_DEBUG_MAP_BACKTRACE); + } + pipe_mutex_unlock(buf->mutex); + pb_debug_buffer_check(buf); return pb_validate(buf->buffer, vl, flags); @@ -288,6 +336,31 @@ pb_debug_buffer_vtbl = { }; +static void +pb_debug_manager_dump(struct pb_debug_manager *mgr) +{ + struct list_head *curr, *next; + struct pb_debug_buffer *buf; + + pipe_mutex_lock(mgr->mutex); + + curr = mgr->list.next; + next = curr->next; + while(curr != &mgr->list) { + buf = LIST_ENTRY(struct pb_debug_buffer, curr, head); + + debug_printf("buffer = %p\n", buf); + debug_printf(" .size = %p\n", buf->base.base.size); + debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE); + + curr = next; + next = curr->next; + } + + pipe_mutex_unlock(mgr->mutex); +} + + static struct pb_buffer * pb_debug_manager_create_buffer(struct pb_manager *_mgr, size_t size, @@ -312,6 +385,13 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, &real_desc); if(!buf->buffer) { FREE(buf); +#if 0 + pipe_mutex_lock(mgr->mutex); + debug_printf("%s: failed to create buffer\n", __FUNCTION__); + if(!LIST_IS_EMPTY(&mgr->list)) + pb_debug_manager_dump(mgr); + pipe_mutex_unlock(mgr->mutex); +#endif return NULL; } @@ -331,8 +411,16 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, buf->underflow_size = mgr->underflow_size; buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size; + debug_backtrace_capture(buf->create_backtrace, 1, PB_DEBUG_CREATE_BACKTRACE); + pb_debug_buffer_fill(buf); + pipe_mutex_init(buf->mutex); + + pipe_mutex_lock(mgr->mutex); + LIST_ADDTAIL(&buf->head, &mgr->list); + pipe_mutex_unlock(mgr->mutex); + return &buf->base; } @@ -351,6 +439,15 @@ static void pb_debug_manager_destroy(struct pb_manager *_mgr) { struct pb_debug_manager *mgr = pb_debug_manager(_mgr); + + pipe_mutex_lock(mgr->mutex); + if(!LIST_IS_EMPTY(&mgr->list)) { + debug_printf("%s: unfreed buffers\n", __FUNCTION__); + pb_debug_manager_dump(mgr); + } + pipe_mutex_unlock(mgr->mutex); + + pipe_mutex_destroy(mgr->mutex); mgr->provider->destroy(mgr->provider); FREE(mgr); } @@ -375,7 +472,10 @@ pb_debug_manager_create(struct pb_manager *provider, mgr->provider = provider; mgr->underflow_size = underflow_size; mgr->overflow_size = overflow_size; - + + pipe_mutex_init(mgr->mutex); + LIST_INITHEAD(&mgr->list); + return &mgr->base; } -- cgit v1.2.3 From bb9ea58f9502c7e54d03e3c2c21d20749f796c7c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 28 Apr 2009 19:46:56 +0100 Subject: wgl: UINT_PTR null value is an integral type, so return 0 instead of NULL. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 0b5dd78ec6..473e3308c6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -276,12 +276,12 @@ stw_get_current_context( void ) struct stw_context *ctx; if(!glcurctx) - return NULL; + return 0; ctx = (struct stw_context *)glcurctx->DriverCtx; assert(ctx); if(!ctx) - return NULL; + return 0; return ctx->hglrc; } -- cgit v1.2.3 From 482be01db02d3ea224e01c24c4d1638229d6a4dc Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 29 Apr 2009 14:21:41 +0100 Subject: trivial: add line-flat.c --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/line-flat.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 progs/trivial/line-flat.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 69c71cbaf6..e255cdadc5 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -30,6 +30,7 @@ SOURCES = \ fs-tri.c \ line-clip.c \ line-cull.c \ + line-flat.c \ line-smooth.c \ line-stipple-wide.c \ line-userclip-clip.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 480630e210..0333418ad8 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -26,6 +26,7 @@ progs = [ 'fs-tri', 'line-clip', 'line-cull', + 'line-flat', 'line-smooth', 'line-stipple-wide', 'line-userclip-clip', diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c new file mode 100644 index 0000000000..14f0ac0782 --- /dev/null +++ b/progs/trivial/line-flat.c @@ -0,0 +1,147 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + + +#define CI_OFFSET_1 16 +#define CI_OFFSET_2 32 + + +GLenum doubleBuffer; + +static void Init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + glClearColor(0.0, 0.0, 1.0, 0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + glShadeModel(GL_FLAT); + + glBegin(GL_LINES); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -30.0); + + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -30.0); + + + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -30.0); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -30.0); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From af09ba96e9e2d783fb0538a82513716c1c9aed3b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 10:59:19 +0100 Subject: gallium/draw: cope with unused vertex_elements --- src/gallium/auxiliary/draw/draw_pt.h | 1 + src/gallium/auxiliary/draw/draw_pt_fetch.c | 8 +++++++- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 6f3e1e0289..8ef0ea8011 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -187,6 +187,7 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw ); struct pt_fetch; void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vertex_input_count, unsigned vertex_size ); void draw_pt_fetch_run( struct pt_fetch *fetch, diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c index 505d32f2c3..65c3a34c34 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "util/u_memory.h" +#include "util/u_math.h" #include "draw/draw_context.h" #include "draw/draw_private.h" #include "draw/draw_vbuf.h" @@ -56,9 +57,11 @@ struct pt_fetch { * */ void draw_pt_fetch_prepare( struct pt_fetch *fetch, + unsigned vs_input_count, unsigned vertex_size ) { struct draw_context *draw = fetch->draw; + unsigned nr_inputs; unsigned i, nr = 0; unsigned dst_offset = 0; struct translate_key key; @@ -89,8 +92,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch, dst_offset += 4 * sizeof(float); } + assert( draw->pt.nr_vertex_elements >= vs_input_count ); - for (i = 0; i < draw->pt.nr_vertex_elements; i++) { + nr_inputs = MIN2( vs_input_count, draw->pt.nr_vertex_elements ); + + for (i = 0; i < nr_inputs; i++) { key.element[nr].input_format = draw->pt.vertex_element[i].src_format; key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index; key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 11ac90fc56..df6c265b7e 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -77,8 +77,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, draw_pt_fetch_prepare( fpme->fetch, + vs->info.num_inputs, fpme->vertex_size ); - /* XXX: it's not really gl rasterization rules we care about here, * but gl vs dx9 clip spaces. */ -- cgit v1.2.3 From d075cb4fc8c130f2e8f40356e7872fcc7ce3dcd1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 30 Apr 2009 12:24:08 +0100 Subject: wgl: Include alpha bits in pixel format's cColorBits field. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 9e642cbdd4..8d6955f390 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -158,7 +158,7 @@ stw_pixelformat_add( pfi->pfd.iPixelType = PFD_TYPE_RGBA; - pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue; + pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha; pfi->pfd.cRedBits = color->bits.red; pfi->pfd.cRedShift = color->shift.red; pfi->pfd.cGreenBits = color->bits.green; -- cgit v1.2.3 From e99729d63d50dd7e1dffc8b739b6f9decc834925 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 12:35:59 +0100 Subject: progs/trivial: add vbo-noninterleaved test --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/vbo-noninterleaved.c | 139 +++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 progs/trivial/vbo-noninterleaved.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index e255cdadc5..69b0408bbd 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -139,6 +139,7 @@ SOURCES = \ tristrip-flat.c \ tristrip.c \ vbo-drawarrays.c \ + vbo-noninterleaved.c \ vbo-drawelements.c \ vbo-drawrange.c \ vp-array.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 0333418ad8..03ccb1436d 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -135,6 +135,7 @@ progs = [ 'tristrip-flat', 'tristrip', 'vbo-drawarrays', + 'vbo-noninterleaved', 'vbo-drawelements', 'vbo-drawrange', 'vp-array', diff --git a/progs/trivial/vbo-noninterleaved.c b/progs/trivial/vbo-noninterleaved.c new file mode 100644 index 0000000000..0672ca50ff --- /dev/null +++ b/progs/trivial/vbo-noninterleaved.c @@ -0,0 +1,139 @@ +/* Basic VBO */ + +#include +#include +#include +#include +#include +#include +#include + + +struct { + GLfloat pos[4][4]; + GLfloat col[4][4]; +} verts = +{ + /* Position: a quad + */ + { + { 0.9, -0.9, 0.0, 1.0 }, + { 0.9, 0.9, 0.0, 1.0 }, + { -0.9, 0.9, 0.0, 1.0 }, + { -0.9, -0.9, 0.0, 1.0 }, + }, + + /* Color: all red + */ + { + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + { 1.0, 0.0, 0.0, 1.0 }, + }, + + +}; + +GLuint arrayObj, elementObj; + +static void Init( void ) +{ + GLint errno; + GLuint prognum; + + static const char *prog1 = + "!!ARBvp1.0\n" + "MOV result.color, vertex.color;\n" + "MOV result.position, vertex.position;\n" + "END\n"; + + glGenProgramsARB(1, &prognum); + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog1), (const GLubyte *) prog1); + + assert(glIsProgramARB(prognum)); + errno = glGetError(); + printf("glGetError = %d\n", errno); + if (errno != GL_NO_ERROR) + { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + + + glEnableClientState( GL_VERTEX_ARRAY ); + glEnableClientState( GL_COLOR_ARRAY ); + + glGenBuffersARB(1, &arrayObj); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB); + + glVertexPointer( 4, GL_FLOAT, sizeof(verts.pos[0]), 0 ); + glColorPointer( 4, GL_FLOAT, sizeof(verts.col[0]), (void *)(4*4*sizeof(float)) ); + +} + + + +static void Display( void ) +{ + glClearColor(0.3, 0.3, 0.3, 1); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glEnable(GL_VERTEX_PROGRAM_ARB); + +// glDrawArrays( GL_TRIANGLES, 0, 3 ); +// glDrawArrays( GL_TRIANGLES, 1, 3 ); + glDrawArrays( GL_QUADS, 0, 4 ); + + glFlush(); +} + + +static void Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + /*glTranslatef( 0.0, 0.0, -15.0 );*/ +} + + +static void Key( unsigned char key, int x, int y ) +{ + (void) x; + (void) y; + switch (key) { + case 27: + exit(0); + break; + } + glutPostRedisplay(); +} + + + + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition( 0, 0 ); + glutInitWindowSize( 250, 250 ); + glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); + glutCreateWindow(argv[0]); + glewInit(); + glutReshapeFunc( Reshape ); + glutKeyboardFunc( Key ); + glutDisplayFunc( Display ); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From f628d7f5eebe9743f85ea8edf7c09b32cf393e4a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Apr 2009 13:09:34 +0100 Subject: gallium/tgsi: hack around linker/archiver breakage Add a dummy function which exists only so that tgsi_text_translate() doesn't get magic-ed out of the libtgsi.a archive by the build system. Don't remove unless you know this has been fixed - check on mingw/scons builds as well. --- src/gallium/auxiliary/tgsi/tgsi_transform.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c index 062c1be938..bc9c18fd4a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c @@ -198,3 +198,30 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, return ctx->ti; } + + +#include "tgsi_text.h" + +extern int tgsi_transform_foo( struct tgsi_token *tokens_out, + uint max_tokens_out ); + +/* This function exists only so that tgsi_text_translate() doesn't get + * magic-ed out of the libtgsi.a archive by the build system. Don't + * remove unless you know this has been fixed - check on mingw/scons + * builds as well. + */ +int +tgsi_transform_foo( struct tgsi_token *tokens_out, + uint max_tokens_out ) +{ + const char *text = + "FRAG1.1\n" + "DCL IN[0], COLOR, CONSTANT\n" + "DCL OUT[0], COLOR\n" + " 0: MOV OUT[0], IN[0]\n" + " 1: END"; + + return tgsi_text_translate( text, + tokens_out, + max_tokens_out ); +} -- cgit v1.2.3 From be3f9dd26cf59cadc21e4d5cc27dd199c9752b1c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 30 Apr 2009 13:10:58 +0100 Subject: util: Limit the stack walk to avoid referencing undefined memory. --- src/gallium/auxiliary/util/u_debug_stack.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c index e9891fde8a..528a1c394b 100644 --- a/src/gallium/auxiliary/util/u_debug_stack.c +++ b/src/gallium/auxiliary/util/u_debug_stack.c @@ -62,6 +62,8 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, #ifdef PIPE_ARCH_X86 while(nr_frames) { + const void **next_frame_pointer; + if(!frame_pointer) break; @@ -72,7 +74,14 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, --nr_frames; } - frame_pointer = (const void **)frame_pointer[0]; + next_frame_pointer = (const void **)frame_pointer[0]; + + /* Limit the stack walk to avoid referencing undefined memory */ + if((uintptr_t)next_frame_pointer <= (uintptr_t)frame_pointer || + (uintptr_t)next_frame_pointer > (uintptr_t)frame_pointer + 64*1024) + break; + + frame_pointer = next_frame_pointer; } #endif -- cgit v1.2.3 From 0d0417cc75c3f7047a783c42a76bf378d8ab1397 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 16:12:17 +0100 Subject: scons: Don't use deprecated Options. --- SConstruct | 10 +++++----- common.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index 1e5fd71adc..89144f7579 100644 --- a/SConstruct +++ b/SConstruct @@ -41,16 +41,16 @@ else: default_drivers = 'all' default_winsys = 'all' -opts = Options('config.py') +opts = Variables('config.py') common.AddOptions(opts) -opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetrackers, +opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers, ['mesa', 'python'])) -opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers, +opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers, ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300'])) -opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys, +opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys, ['xlib', 'intel', 'gdi', 'radeon'])) -opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) +opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0'))) env = Environment( options = opts, diff --git a/common.py b/common.py index f1c6372abd..e57429eb75 100644 --- a/common.py +++ b/common.py @@ -46,13 +46,13 @@ else: def AddOptions(opts): try: - from SCons.Options.BoolOption import BoolOption - except ImportError: from SCons.Variables.BoolVariable import BoolVariable as BoolOption - try: - from SCons.Options.EnumOption import EnumOption except ImportError: + from SCons.Options.BoolOption import BoolOption + try: from SCons.Variables.EnumVariable import EnumVariable as EnumOption + except ImportError: + from SCons.Options.EnumOption import EnumOption opts.Add(BoolOption('debug', 'debug build', 'no')) opts.Add(BoolOption('profile', 'profile build', 'no')) #opts.Add(BoolOption('quiet', 'quiet command lines', 'no')) -- cgit v1.2.3 From 1ed90091be0a79977eb6c055ba1da56114d52f53 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 16:30:08 +0100 Subject: wgl: Implemente SwapLayerBuffers. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 2 +- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 12 ++++++++++++ src/gallium/state_trackers/wgl/shared/stw_public.h | 3 +++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 5 +---- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index 3711982fd2..b259ea91f5 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -583,7 +583,7 @@ DrvSwapLayerBuffers( if (DBG) debug_printf( "%s\n", __FUNCTION__ ); - return FALSE; + return stw_swap_layer_buffers( hdc, fuPlanes ); } BOOL APIENTRY diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 4348b8f326..f66f429542 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -237,6 +237,18 @@ stw_swap_buffers( } +BOOL +stw_swap_layer_buffers( + HDC hdc, + UINT fuPlanes ) +{ + if(fuPlanes & WGL_SWAP_MAIN_PLANE) + return stw_swap_buffers(hdc); + + return FALSE; +} + + boolean stw_framebuffer_init_thread(void) { diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h index 39d377c16b..59d709a6d4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_public.h +++ b/src/gallium/state_trackers/wgl/shared/stw_public.h @@ -50,6 +50,9 @@ BOOL stw_make_current( HDC hdc, UINT_PTR hglrc ); BOOL stw_swap_buffers( HDC hdc ); +BOOL +stw_swap_layer_buffers( HDC hdc, UINT fuPlanes ); + PROC stw_get_proc_address( LPCSTR lpszProc ); int stw_pixelformat_describe( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index e06d2640b4..30e42e0ec5 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -100,10 +100,7 @@ wglSwapLayerBuffers( HDC hdc, UINT fuPlanes ) { - (void) hdc; - (void) fuPlanes; - - return FALSE; + return stw_swap_layer_buffers( hdc, fuPlanes ); } WINGDIAPI PROC APIENTRY -- cgit v1.2.3 From 751f73e2812cf8185c775a91c16cf8565b85536d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 1 May 2009 18:20:42 +0100 Subject: mesa/main: set PREFER_DP4 to match position_invarient code This is a quick fix for z fighting in quake4 caused by the mismatch between vertex transformation here and in the position_invarient code. Full fix would be to make this driver-tunable and adjust both position_invarient and ffvertex_prog.c code to respect driver preferences. --- src/mesa/main/ffvertex_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 1ce5685af4..82e1c4af66 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -319,7 +319,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) * multiplications with DP4's or with MUL/MAD's? SSE works better * with the latter, drivers may differ. */ -#define PREFER_DP4 0 +#define PREFER_DP4 1 /* Use uregs to represent registers internally, translate to Mesa's -- cgit v1.2.3 From b6e8256899a9a93c665c34e10efcc918f2fcc095 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 May 2009 12:12:28 +0100 Subject: mesa: more complete fix for transform_invarient glitches Add a new flag mvp_with_dp4 in the context, and use that to switch both ffvertex.c and programopt.c vertex transformation code to either DP4 or MUL/MAD implementations. --- src/mesa/main/context.c | 13 ++++ src/mesa/main/context.h | 4 ++ src/mesa/main/ffvertex_prog.c | 16 +++-- src/mesa/main/mtypes.h | 6 ++ src/mesa/shader/programopt.c | 119 +++++++++++++++++++++++++++++++++++- src/mesa/state_tracker/st_context.c | 6 ++ 6 files changed, 153 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 016284de9a..d780f91f04 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1522,4 +1522,17 @@ _mesa_Flush(void) } +/** + * Set mvp_with_dp4 flag. If a driver has a preference for DP4 over + * MUL/MAD, or vice versa, call this function to register that. + * Otherwise we default to MUL/MAD. + */ +void +_mesa_set_mvp_with_dp4( GLcontext *ctx, + GLboolean flag ) +{ + ctx->mvp_with_dp4 = flag; +} + + /*@}*/ diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index ecc1cec779..5b57d88029 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -151,6 +151,10 @@ extern struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx); +void +_mesa_set_mvp_with_dp4( GLcontext *ctx, + GLboolean flag ); + /** \name Miscellaneous */ /*@{*/ diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 82e1c4af66..43325b1352 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -315,12 +315,6 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) */ #define DISASSEM 0 -/* Should be tunable by the driver - do we want to do matrix - * multiplications with DP4's or with MUL/MAD's? SSE works better - * with the latter, drivers may differ. - */ -#define PREFER_DP4 1 - /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. @@ -348,6 +342,7 @@ struct tnl_program { const struct state_key *state; struct gl_vertex_program *program; GLint max_inst; /** number of instructions allocated for program */ + GLboolean mvp_with_dp4; GLuint temp_in_use; GLuint temp_reserved; @@ -775,7 +770,7 @@ static struct ureg get_eye_position( struct tnl_program *p ) p->eye_position = reserve_temp(p); - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, 0, modelview ); @@ -881,7 +876,7 @@ static void build_hpos( struct tnl_program *p ) struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); struct ureg mvp[4]; - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, 0, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); @@ -1574,7 +1569,7 @@ static void build_texture_transform( struct tnl_program *p ) struct ureg in = (!is_undef(out_texgen) ? out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); - if (PREFER_DP4) { + if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, 0, texmat ); emit_matrix_transform_vec4( p, out, texmat, in ); @@ -1708,6 +1703,7 @@ static void build_tnl_program( struct tnl_program *p ) static void create_new_program( const struct state_key *key, struct gl_vertex_program *program, + GLboolean mvp_with_dp4, GLuint max_temps) { struct tnl_program p; @@ -1721,6 +1717,7 @@ create_new_program( const struct state_key *key, p.transformed_normal = undef; p.identity = undef; p.temp_in_use = 0; + p.mvp_with_dp4 = mvp_with_dp4; if (max_temps >= sizeof(int) * 8) p.temp_reserved = 0; @@ -1776,6 +1773,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) return NULL; create_new_program( &key, prog, + ctx->mvp_with_dp4, ctx->Const.VertexProgram.MaxTemps ); #if 0 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 30c7cca3b5..ed6b1062bd 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2977,6 +2977,12 @@ struct __GLcontextRec /** software compression/decompression supported or not */ GLboolean Mesa_DXTn; + /** + * Use dp4 (rather than mul/mad) instructions for position + * transformation? + */ + GLboolean mvp_with_dp4; + /** Core tnl module support */ struct gl_tnl_module TnlModule; diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index ecd98dc85c..f70c75cec8 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -45,8 +45,8 @@ * into a vertex program. * May be used to implement the position_invariant option. */ -void -_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) +static void +_mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog) { struct prog_instruction *newInst; const GLuint origLen = vprog->Base.NumInstructions; @@ -113,6 +113,121 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) } +static void +_mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog) +{ + struct prog_instruction *newInst; + const GLuint origLen = vprog->Base.NumInstructions; + const GLuint newLen = origLen + 4; + GLuint hposTemp; + GLuint i; + + /* + * Setup state references for the modelview/projection matrix. + * XXX we should check if these state vars are already declared. + */ + static const gl_state_index mvpState[4][STATE_LENGTH] = { + { STATE_MVP_MATRIX, 0, 0, 0, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 1, 1, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 2, 2, STATE_MATRIX_TRANSPOSE }, + { STATE_MVP_MATRIX, 0, 3, 3, STATE_MATRIX_TRANSPOSE }, + }; + GLint mvpRef[4]; + + for (i = 0; i < 4; i++) { + mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters, + mvpState[i]); + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glProgramString(inserting position_invariant code)"); + return; + } + + /* TEMP hposTemp; */ + hposTemp = vprog->Base.NumTemporaries++; + + /* + * Generated instructions: + * emit_op2(p, OPCODE_MUL, tmp, 0, swizzle1(src,X), mat[0]); + * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Y), mat[1], tmp); + * emit_op3(p, OPCODE_MAD, tmp, 0, swizzle1(src,Z), mat[2], tmp); + * emit_op3(p, OPCODE_MAD, dest, 0, swizzle1(src,W), mat[3], tmp); + */ + _mesa_init_instructions(newInst, 4); + + newInst[0].Opcode = OPCODE_MUL; + newInst[0].DstReg.File = PROGRAM_TEMPORARY; + newInst[0].DstReg.Index = hposTemp; + newInst[0].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[0].SrcReg[0].File = PROGRAM_INPUT; + newInst[0].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[0].SrcReg[0].Swizzle = SWIZZLE_XXXX; + newInst[0].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[0].SrcReg[1].Index = mvpRef[0]; + newInst[0].SrcReg[1].Swizzle = SWIZZLE_NOOP; + + for (i = 1; i <= 2; i++) { + newInst[i].Opcode = OPCODE_MAD; + newInst[i].DstReg.File = PROGRAM_TEMPORARY; + newInst[i].DstReg.Index = hposTemp; + newInst[i].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[i].SrcReg[0].File = PROGRAM_INPUT; + newInst[i].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[i].SrcReg[0].Swizzle = MAKE_SWIZZLE4(i,i,i,i); + newInst[i].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[i].SrcReg[1].Index = mvpRef[i]; + newInst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP; + newInst[i].SrcReg[2].File = PROGRAM_TEMPORARY; + newInst[i].SrcReg[2].Index = hposTemp; + newInst[1].SrcReg[2].Swizzle = SWIZZLE_NOOP; + } + + newInst[3].Opcode = OPCODE_MAD; + newInst[3].DstReg.File = PROGRAM_OUTPUT; + newInst[3].DstReg.Index = VERT_RESULT_HPOS; + newInst[3].DstReg.WriteMask = WRITEMASK_XYZW; + newInst[3].SrcReg[0].File = PROGRAM_INPUT; + newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS; + newInst[3].SrcReg[0].Swizzle = SWIZZLE_WWWW; + newInst[3].SrcReg[1].File = PROGRAM_STATE_VAR; + newInst[3].SrcReg[1].Index = mvpRef[3]; + newInst[3].SrcReg[1].Swizzle = SWIZZLE_NOOP; + newInst[3].SrcReg[2].File = PROGRAM_TEMPORARY; + newInst[3].SrcReg[2].Index = hposTemp; + newInst[3].SrcReg[2].Swizzle = SWIZZLE_NOOP; + + + /* Append original instructions after new instructions */ + _mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen); + + /* free old instructions */ + _mesa_free_instructions(vprog->Base.Instructions, origLen); + + /* install new instructions */ + vprog->Base.Instructions = newInst; + vprog->Base.NumInstructions = newLen; + vprog->Base.InputsRead |= VERT_BIT_POS; + vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS); +} + + +void +_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog) +{ + if (ctx->mvp_with_dp4) + _mesa_insert_mvp_dp4_code( ctx, vprog ); + else + _mesa_insert_mvp_mad_code( ctx, vprog ); +} + + + + + /** * Append extra instructions onto the given fragment program to implement diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 92a630eff9..2a1f21c51c 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -177,6 +177,12 @@ struct st_context *st_create_context(struct pipe_context *pipe, ctx = _mesa_create_context(visual, shareCtx, &funcs, NULL); + /* XXX: need a capability bit in gallium to query if the pipe + * driver prefers DP4 or MUL/MAD for vertex transformation. + */ + if (debug_get_bool_option("MESA_MVP_DP4", FALSE)) + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); + return st_create_context_priv(ctx, pipe); } -- cgit v1.2.3 From d56b0e6847255410ccb958068f0828fd2543aaba Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 5 May 2009 13:00:44 +0100 Subject: progs/trivial: add test for vertex program invarient transform --- progs/trivial/Makefile | 1 + progs/trivial/SConscript | 1 + progs/trivial/vp-tri-invariant.c | 147 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 progs/trivial/vp-tri-invariant.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 69b0408bbd..22de83fa79 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -147,6 +147,7 @@ SOURCES = \ vp-clip.c \ vp-line-clip.c \ vp-tri.c \ + vp-tri-invariant.c \ vp-tri-swap.c \ vp-tri-tex.c \ vp-tri-imm.c \ diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 03ccb1436d..9a1f3575bd 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -143,6 +143,7 @@ progs = [ 'vp-clip', 'vp-line-clip', 'vp-tri', + 'vp-tri-invariant', 'vp-tri-swap', 'vp-tri-tex', 'vp-tri-imm', diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c new file mode 100644 index 0000000000..ff24139365 --- /dev/null +++ b/progs/trivial/vp-tri-invariant.c @@ -0,0 +1,147 @@ +/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ + +#include +#include +#include +#include +#include +#include + + +#define CI_OFFSET_1 16 +#define CI_OFFSET_2 32 + + +GLenum doubleBuffer; + +static void Init(void) +{ + GLint errno; + GLuint prognum; + + static const char *prog1 = + "!!ARBvp1.0\n" + "OPTION ARB_position_invariant ;" + "MOV result.color, vertex.color;\n" + "END\n"; + + + glGenProgramsARB(1, &prognum); + + glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); + glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog1), (const GLubyte *) prog1); + + errno = glGetError(); + printf("glGetError = %d\n", errno); + if (errno != GL_NO_ERROR) + { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + glClearColor(0.0, 0.0, 1.0, 0.0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); +/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */ + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_VERTEX_PROGRAM_ARB); + + glBegin(GL_TRIANGLES); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -0.0); + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -0.0); + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -0.0); + glEnd(); + + glFlush(); + + if (doubleBuffer) { + glutSwapBuffers(); + } +} + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + + type = GLUT_RGB | GLUT_ALPHA; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + glewInit(); + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 4d28fcfeaa6be438f6739fddcb0661ae97a68919 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:49:22 +0100 Subject: wgl: Implement ShareLists. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 2 +- .../state_trackers/wgl/shared/stw_context.c | 24 ++++++++++++++++++++++ src/gallium/state_trackers/wgl/shared/stw_public.h | 2 ++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 7 +------ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index b259ea91f5..62af765211 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -562,7 +562,7 @@ DrvShareLists( if (DBG) debug_printf( "%s\n", __FUNCTION__ ); - return FALSE; + return stw_share_lists(dhglrc1, dhglrc2); } BOOL APIENTRY diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 473e3308c6..e172f09bdf 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -74,6 +74,30 @@ stw_copy_context( return ret; } +BOOL +stw_share_lists( + UINT_PTR hglrc1, + UINT_PTR hglrc2 ) +{ + struct stw_context *ctx1; + struct stw_context *ctx2; + BOOL ret = FALSE; + + pipe_mutex_lock( stw_dev->mutex ); + + ctx1 = stw_lookup_context_locked( hglrc1 ); + ctx2 = stw_lookup_context_locked( hglrc2 ); + + if (ctx1 && ctx2 && + ctx1->pfi == ctx2->pfi) { + ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); + } + + pipe_mutex_unlock( stw_dev->mutex ); + + return ret; +} + UINT_PTR stw_create_layer_context( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h index 59d709a6d4..7fe9cfb356 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_public.h +++ b/src/gallium/state_trackers/wgl/shared/stw_public.h @@ -37,6 +37,8 @@ BOOL stw_copy_context( UINT_PTR hglrcSrc, UINT_PTR stw_create_layer_context( HDC hdc, int iLayerPlane ); +BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 ); + BOOL stw_delete_context( UINT_PTR hglrc ); BOOL diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c index 30e42e0ec5..a131292f7a 100644 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c @@ -186,12 +186,7 @@ wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) { - (void) hglrc1; - (void) hglrc2; - - assert( 0 ); - - return FALSE; + return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; } WINGDIAPI BOOL APIENTRY -- cgit v1.2.3 From d88faf91e9fe222636b33540298ee64bc6f4416c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:52:54 +0100 Subject: mesa: Make _mesa_share_state thread safe. --- src/mesa/main/context.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index d780f91f04..60c48289e4 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1397,14 +1397,21 @@ _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) { if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { struct gl_shared_state *oldSharedState = ctx->Shared; + GLint RefCount; ctx->Shared = ctxToShare->Shared; + + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); ctx->Shared->RefCount++; + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); update_default_objects(ctx); - oldSharedState->RefCount--; - if (oldSharedState->RefCount == 0) { + _glthread_LOCK_MUTEX(oldSharedState->Mutex); + RefCount = --oldSharedState->RefCount; + _glthread_UNLOCK_MUTEX(oldSharedState->Mutex); + + if (RefCount == 0) { _mesa_free_shared_state(ctx, oldSharedState); } -- cgit v1.2.3 From 692263aad695c66669a0001fb3ac6d7a0bd84c94 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:53:17 +0100 Subject: wgl: Remove unused variable. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index e172f09bdf..336eccef71 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -109,7 +109,6 @@ stw_create_layer_context( GLvisual *visual = NULL; struct pipe_screen *screen = NULL; struct pipe_context *pipe = NULL; - UINT_PTR hglrc = 0; if(!stw_dev) return 0; -- cgit v1.2.3 From d78b5952c10d5c65cd7d679b291c217ebd30cc4a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 1 May 2009 18:53:51 +0100 Subject: wgl: Add assertion for missing function. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 336eccef71..d532b1563b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -64,6 +64,7 @@ stw_copy_context( if (src && dst) { /* FIXME */ + assert(0); (void) src; (void) dst; (void) mask; -- cgit v1.2.3 From d5eac43a2e06ff30f9e6f74e49493ef5d64cd309 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 6 May 2009 19:58:08 +0100 Subject: wgl: Enforce a minimum 1x1 framebuffer size. --- .../state_trackers/wgl/shared/stw_context.c | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index d532b1563b..b61f74f69b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -278,19 +278,30 @@ stw_release_context( /* Find the width and height of the window named by hdc. */ static void -stw_get_window_size( HDC hdc, GLuint *width, GLuint *height ) +stw_get_window_size( HDC hdc, GLuint *pwidth, GLuint *pheight ) { - if (WindowFromDC( hdc )) { - RECT rect; + GLuint width, height; + HWND hwnd; - GetClientRect( WindowFromDC( hdc ), &rect ); - *width = rect.right - rect.left; - *height = rect.bottom - rect.top; + hwnd = WindowFromDC( hdc ); + if (hwnd) { + RECT rect; + GetClientRect( hwnd, &rect ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; } else { - *width = GetDeviceCaps( hdc, HORZRES ); - *height = GetDeviceCaps( hdc, VERTRES ); + width = GetDeviceCaps( hdc, HORZRES ); + height = GetDeviceCaps( hdc, VERTRES ); } + + if(width < 1) + width = 1; + if(height < 1) + height = 1; + + *pwidth = width; + *pheight = height; } UINT_PTR -- cgit v1.2.3 From ee7982718685cd2398a895caf5e7cd90b6ee12f9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 6 May 2009 20:41:17 +0100 Subject: stw: fix potential uninitialized use of curctx --- src/gallium/state_trackers/wgl/shared/stw_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index b61f74f69b..dd97e48b14 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -348,7 +348,7 @@ stw_make_current( struct stw_framebuffer *fb; GLuint width = 0; GLuint height = 0; - struct stw_context *curctx; + struct stw_context *curctx = NULL; if (!stw_dev) return FALSE; -- cgit v1.2.3 From 222d7841e939d13bf29148c0cba5c7513050fa1e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 08:00:42 +0100 Subject: scons: mingw is broken with -O1 and higher --- scons/gallium.py | 2 ++ scons/generic.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scons/gallium.py b/scons/gallium.py index 696ddd025f..c7e74d7e59 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -317,6 +317,8 @@ def generate(env): if gcc: if debug: cflags += ['-O0', '-g3'] + elif env['toolchain'] == 'crossmingw': + cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken else: cflags += ['-O3', '-g3'] if env['profile']: diff --git a/scons/generic.py b/scons/generic.py index 03563e4c62..29ddf76d6f 100644 --- a/scons/generic.py +++ b/scons/generic.py @@ -398,6 +398,8 @@ def generate(env): if gcc: if debug: ccflags += ['-O0', '-g3'] + elif env['toolchain'] == 'crossmingw': + ccflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken else: ccflags += ['-O3', '-g0'] if env['profile']: -- cgit v1.2.3 From e6a3801f3daaaf7e7e048ad0c43e838bac6a2d9a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 09:24:37 +0100 Subject: util/upload: catch failures to map_range and return error Caller may be able to do something about this - eg flush and retry. --- src/gallium/auxiliary/util/u_upload_mgr.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index d9c0d7afa8..2eb98068c8 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -70,7 +70,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_screen *screen, } -static INLINE void +static INLINE enum pipe_error my_buffer_write(struct pipe_screen *screen, struct pipe_buffer *buf, unsigned offset, unsigned size, unsigned dirty_size, @@ -84,12 +84,14 @@ my_buffer_write(struct pipe_screen *screen, assert(size); map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE); - assert(map); - if(map) { - memcpy(map + offset, data, size); - pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size); - pipe_buffer_unmap(screen, buf); - } + if (map == NULL) + return PIPE_ERROR_OUT_OF_MEMORY; + + memcpy(map + offset, data, size); + pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size); + pipe_buffer_unmap(screen, buf); + + return PIPE_OK; } /* Release old buffer. @@ -162,12 +164,14 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload, /* Copy the data, using map_range if available: */ - my_buffer_write( upload->screen, - upload->buffer, - upload->offset, - size, - alloc_size, - data ); + ret = my_buffer_write( upload->screen, + upload->buffer, + upload->offset, + size, + alloc_size, + data ); + if (ret) + return ret; /* Emit the return values: */ -- cgit v1.2.3 From 33d2ca7624968fc972c917f15fa947df36916296 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 11:46:08 +0100 Subject: mesa/st: cope with non-ibo index data in st_draw_feedback.c Previously only non-indexed or indicies-in-a-vbo cases were handled in this code. This change adds the missing regular indices-in-memory case. --- src/mesa/state_tracker/st_draw_feedback.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index e533afd051..32502a9cda 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -196,13 +196,10 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_vertex_elements(draw, vp->num_inputs, velements); if (ib) { - unsigned indexSize; struct gl_buffer_object *bufobj = ib->obj; - struct st_buffer_object *stobj = st_buffer_object(bufobj); + unsigned indexSize; void *map; - index_buffer_handle = stobj->buffer; - switch (ib->type) { case GL_UNSIGNED_INT: indexSize = 4; @@ -215,9 +212,19 @@ st_feedback_draw_vbo(GLcontext *ctx, return; } - map = pipe_buffer_map(pipe->screen, index_buffer_handle, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer(draw, indexSize, map); + if (bufobj && bufobj->Name) { + struct st_buffer_object *stobj = st_buffer_object(bufobj); + + index_buffer_handle = stobj->buffer; + + map = pipe_buffer_map(pipe->screen, index_buffer_handle, + PIPE_BUFFER_USAGE_CPU_READ); + + draw_set_mapped_element_buffer(draw, indexSize, map); + } + else { + draw_set_mapped_element_buffer(draw, indexSize, (void *) ib->ptr); + } } else { /* no index/element buffer */ @@ -252,7 +259,7 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_mapped_vertex_buffer(draw, i, NULL); } } - if (ib) { + if (index_buffer_handle) { pipe_buffer_unmap(pipe->screen, index_buffer_handle); draw_set_mapped_element_buffer(draw, 0, NULL); } -- cgit v1.2.3 From 44a996b185c446eab7038a10153db7e7496bf2c9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 7 May 2009 18:21:56 +0100 Subject: wgl: Export pixelformats with accumulation bits. --- src/gallium/state_trackers/wgl/shared/stw_pixelformat.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index 8d6955f390..b81d2b59a4 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -119,6 +119,7 @@ stw_pixelformat_add( struct stw_device *stw_dev, const struct stw_pf_color_info *color, const struct stw_pf_depth_info *depth, + unsigned accum, boolean doublebuffer, unsigned samples ) { @@ -167,11 +168,11 @@ stw_pixelformat_add( pfi->pfd.cBlueShift = color->shift.blue; pfi->pfd.cAlphaBits = color->bits.alpha; pfi->pfd.cAlphaShift = color->shift.alpha; - pfi->pfd.cAccumBits = 0; - pfi->pfd.cAccumRedBits = 0; - pfi->pfd.cAccumGreenBits = 0; - pfi->pfd.cAccumBlueBits = 0; - pfi->pfd.cAccumAlphaBits = 0; + pfi->pfd.cAccumBits = 4*accum; + pfi->pfd.cAccumRedBits = accum; + pfi->pfd.cAccumGreenBits = accum; + pfi->pfd.cAccumBlueBits = accum; + pfi->pfd.cAccumAlphaBits = accum; pfi->pfd.cDepthBits = depth->bits.depth; pfi->pfd.cStencilBits = depth->bits.stencil; pfi->pfd.cAuxBuffers = 0; @@ -228,7 +229,8 @@ stw_pixelformat_init( void ) PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) continue; - stw_pixelformat_add( stw_dev, color, depth, doublebuffer, samples ); + stw_pixelformat_add( stw_dev, color, depth, 0, doublebuffer, samples ); + stw_pixelformat_add( stw_dev, color, depth, 16, doublebuffer, samples ); } } } -- cgit v1.2.3 From 507f4e7a7448fb246febefe8819b7b3ac70a35b4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 19:27:30 +0100 Subject: mesa/st: remove redundant call to st_finish in CopyTexSubImage Rendering should already have been flushed, any synchronization will be done by the driver or memory manager. --- src/mesa/state_tracker/st_cb_texture.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b7b791d9a4..98f109fc65 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1315,9 +1315,6 @@ st_copy_texsubimage(GLcontext *ctx, GLboolean use_fallback = GL_TRUE; GLboolean matching_base_formats; - /* any rendering in progress must complete before we grab the fb image */ - st_finish(ctx->st); - /* make sure finalize_textures has been called? */ if (0) st_validate_state(ctx->st); -- cgit v1.2.3 From e90beb93a89f77bffce8ab3d54457ea65868e93c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 7 May 2009 19:48:06 +0100 Subject: mesa/st: keep surface_copy arguments positive The src/dest x,y, and w,h arguments of the pipe->surface_copy function are unsigned and the drivers aren't expecting negative (or extremly-large unsigned) values as inputs. Trim the requests at the state-tracker level before passing down. --- src/mesa/state_tracker/st_cb_drawpixels.c | 43 ++++++++++++++++++++++++++++--- src/mesa/state_tracker/st_cb_texture.c | 28 ++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 08dc7c930e..89725cfe8d 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -910,6 +910,34 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, st_validate_state(st); + if (srcx < 0) { + width -= -srcx; + dstx += -srcx; + srcx = 0; + } + + if (srcy < 0) { + height -= -srcy; + dsty += -srcy; + srcy = 0; + } + + if (dstx < 0) { + width -= -dstx; + srcx += -dstx; + dstx = 0; + } + + if (dsty < 0) { + height -= -dsty; + srcy += -dsty; + dsty = 0; + } + + if (width < 0 || height < 0) + return; + + if (type == GL_STENCIL) { /* can't use texturing to do stencil */ copy_stencil_pixels(ctx, srcx, srcy, width, height, dstx, dsty); @@ -951,15 +979,24 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, } } + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { + srcy = ctx->DrawBuffer->Height - srcy - height; + + if (srcy < 0) { + height -= -srcy; + srcy = 0; + } + + if (height < 0) + return; + } + pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, texFormat, 0, width, height, 1, PIPE_TEXTURE_USAGE_SAMPLER); if (!pt) return; - if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { - srcy = ctx->DrawBuffer->Height - srcy - height; - } if (srcFormat == texFormat) { /* copy source framebuffer surface into mipmap/texture */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 98f109fc65..b182106fd5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1337,6 +1337,34 @@ st_copy_texsubimage(GLcontext *ctx, return; } + if (srcX < 0) { + width -= -srcX; + destX += -srcX; + srcX = 0; + } + + if (srcY < 0) { + height -= -srcY; + destY += -srcY; + srcY = 0; + } + + if (destX < 0) { + width -= -destX; + srcX += -destX; + destX = 0; + } + + if (destY < 0) { + height -= -destY; + srcY += -destY; + destY = 0; + } + + if (width < 0 || height < 0) + return; + + assert(strb); assert(strb->surface); assert(stImage->pt); -- cgit v1.2.3 From b6e226109612057762eb7d0bf73f39a93c69e6c3 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 8 May 2009 14:23:45 +0100 Subject: wgl: Grow the maximum number of pixel formats to cope with the new accum pixel formats. Fix a segfault when using softpipe. --- src/gallium/state_trackers/wgl/shared/stw_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h index 969e3843e7..e097f1f71e 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ b/src/gallium/state_trackers/wgl/shared/stw_device.h @@ -37,7 +37,7 @@ #include "stw_pixelformat.h" -#define STW_MAX_PIXELFORMATS 128 +#define STW_MAX_PIXELFORMATS 256 struct pipe_screen; -- cgit v1.2.3 From a67c29a268bdfecb910b929e05c0ea02c720caa6 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 8 May 2009 16:40:21 +0200 Subject: radeon: IRQ always enabled in DRI2 path no need to query kernel for it --- src/mesa/drivers/dri/radeon/radeon_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 56dbe74688..5aeb968d41 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1081,8 +1081,7 @@ radeonCreateScreen2(__DRIscreenPrivate *sPriv) screen->drmSupportsPointSprites = 1; screen->drmSupportsCubeMapsR100 = 1; screen->drmSupportsVertexProgram = 1; - - ret = radeonGetParam(sPriv, RADEON_PARAM_IRQ_NR, &screen->irq); + screen->irq = 1; ret = radeonGetParam(sPriv, RADEON_PARAM_DEVICE_ID, &device_id); if (ret) { -- cgit v1.2.3 From ccaa6463a7a327bb5fe122af41ea77e158439cce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 12:17:11 -0600 Subject: mesa: more shader debug code (disabled) --- src/mesa/shader/shader_api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 8f414a0889..a8390d3094 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1509,6 +1509,10 @@ _mesa_use_program(GLcontext *ctx, GLuint program) shProg->Shaders[i]->Name, shProg->Shaders[i]->Type); } + if (shProg->VertexProgram) + printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); + if (shProg->FragmentProgram) + printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); } } else { -- cgit v1.2.3 From 40cba5489d963d4903d9c2385775f880824310da Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 12:18:44 -0600 Subject: glsl: set vertex/fragment program Ids to aid with debugging --- src/mesa/shader/slang/slang_link.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 1fdf4db054..798eb13f20 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -712,6 +712,8 @@ _slang_link(GLcontext *ctx, struct gl_vertex_program *linked_vprog = vertex_program(_mesa_clone_program(ctx, &vertProg->Base)); shProg->VertexProgram = linked_vprog; /* refcount OK */ + /* vertex program ID not significant; just set Id for debugging purposes */ + shProg->VertexProgram->Base.Id = shProg->Name; ASSERT(shProg->VertexProgram->Base.RefCount == 1); } @@ -720,6 +722,8 @@ _slang_link(GLcontext *ctx, struct gl_fragment_program *linked_fprog = fragment_program(_mesa_clone_program(ctx, &fragProg->Base)); shProg->FragmentProgram = linked_fprog; /* refcount OK */ + /* vertex program ID not significant; just set Id for debugging purposes */ + shProg->FragmentProgram->Base.Id = shProg->Name; ASSERT(shProg->FragmentProgram->Base.RefCount == 1); } -- cgit v1.2.3 From e2cf522de09bc4afa18ef8d98db69973ee489d58 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 12:43:58 -0600 Subject: i965: don't use GRF regs 126,127 for WM programs They seem to be used for something else and using them for shader temps seems to lead to GPU lock-ups. Call _mesa_warning() when we run out of temps. Also, clean up some debug code. --- src/mesa/drivers/dri/i965/brw_wm.h | 2 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 2f80a60c12..59ead757b5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -242,6 +242,8 @@ struct brw_wm_compile { GLuint cur_inst; /**< index of current instruction */ + GLboolean out_of_regs; /**< ran out of GRF registers? */ + /** Mapping from Mesa registers to hardware registers */ struct { GLboolean inited; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index cc2c6ab189..efe8b5126c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -96,8 +96,15 @@ alloc_grf(struct brw_wm_compile *c) for (r = 0; r < BRW_WM_MAX_GRF; r++) { assert(c->used_grf[r]); } - /*printf("Really out of temp regs!\n");*/ - return 60; + + /* really, no free GRF regs found */ + if (!c->out_of_regs) { + /* print warning once per compilation */ + _mesa_warning(NULL, "i965: ran out of registers for fragment program"); + c->out_of_regs = GL_TRUE; + } + + return -1; } @@ -143,7 +150,12 @@ static struct brw_reg alloc_tmp(struct brw_wm_compile *c) /* if we need to allocate another temp, grow the tmp_regs[] array */ if (c->tmp_index == c->tmp_max) { - c->tmp_regs[ c->tmp_max++ ] = alloc_grf(c); + int r = alloc_grf(c); + if (r < 0) { + /*printf("Out of temps in %s\n", __FUNCTION__);*/ + r = 50; /* XXX random register! */ + } + c->tmp_regs[ c->tmp_max++ ] = r; } /* form the GRF register */ @@ -210,6 +222,8 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, } assert(index < 256); + assert(component < 4); + /* see if we've already allocated a HW register for this Mesa register */ if (c->wm_regs[file][index][component].inited) { /* yes, re-use */ @@ -218,9 +232,10 @@ get_reg(struct brw_wm_compile *c, int file, int index, int component, else { /* no, allocate new register */ int grf = alloc_grf(c); + /*printf("alloc grf %d for reg %d:%d.%d\n", grf, file, index, component);*/ if (grf < 0) { /* totally out of temps */ - grf = 70; /* XXX !!!! */ + grf = 51; /* XXX random register! */ } reg = brw_vec8_grf(grf, 0); @@ -373,6 +388,10 @@ static void prealloc_reg(struct brw_wm_compile *c) for (i = 0; i < reg_index; i++) prealloc_grf(c, i); + /* Don't use GRF 126, 127. Using them seems to lead to GPU lock-ups */ + prealloc_grf(c, 126); + prealloc_grf(c, 127); + /* An instruction may reference up to three constants. * They'll be found in these registers. * XXX alloc these on demand! @@ -385,7 +404,7 @@ static void prealloc_reg(struct brw_wm_compile *c) } #if 0 printf("USE CONST BUFFER? %d\n", c->fp->use_const_buffer); - printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index); + printf("AFTER PRE_ALLOC, reg_index = %d\n", reg_index); #endif } @@ -2717,6 +2736,8 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) struct brw_compile *p = &c->func; struct brw_indirect stack_index = brw_indirect(0, 0); + c->out_of_regs = GL_FALSE; + prealloc_reg(c); brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); -- cgit v1.2.3 From 87fbc9a14ed2bdd24d84c38431abbf7b0c275998 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 12:44:38 -0600 Subject: mesa: issue warning for out of bounds array indexes --- src/mesa/main/api_validate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 27049486ee..d5c604c56a 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -184,6 +184,8 @@ _mesa_validate_DrawElements(GLcontext *ctx, ctx->Array.ElementArrayBufferObj); if (max >= ctx->Array._MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ + _mesa_warning(ctx, "glDrawElements() index=%u is " + "out of bounds (max=%u)", max, ctx->Array._MaxElement); return GL_FALSE; } } -- cgit v1.2.3 From cc58fbcf2c5c88f406818db60910f537e03610d6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 14:32:19 -0600 Subject: glsl: check number of varying variables against the limit Link fails if too many varying vars. --- src/mesa/shader/slang/slang_link.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 798eb13f20..2bc8809661 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -97,7 +97,8 @@ bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit) * which inputs are centroid-sampled, invariant, etc. */ static GLboolean -link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) +link_varying_vars(GLcontext *ctx, + struct gl_shader_program *shProg, struct gl_program *prog) { GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; @@ -156,8 +157,12 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) var->Flags); } + if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { + link_error(shProg, "Too many varying variables"); + return GL_FALSE; + } + /* Map varying[i] to varying[j]. - * Plus, set prog->Input/OutputFlags[] as described above. * Note: the loop here takes care of arrays or large (sz>4) vars. */ { @@ -729,11 +734,11 @@ _slang_link(GLcontext *ctx, /* link varying vars */ if (shProg->VertexProgram) { - if (!link_varying_vars(shProg, &shProg->VertexProgram->Base)) + if (!link_varying_vars(ctx, shProg, &shProg->VertexProgram->Base)) return; } if (shProg->FragmentProgram) { - if (!link_varying_vars(shProg, &shProg->FragmentProgram->Base)) + if (!link_varying_vars(ctx, shProg, &shProg->FragmentProgram->Base)) return; } -- cgit v1.2.3 From 17a354a119370df9196a010a31fc71cd8712ec46 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 14:34:15 -0600 Subject: mesa: assertions to check for too many vertex outputs or fragment inputs --- src/mesa/main/context.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ddbc631e67..5e0f2d7b1b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -602,6 +602,10 @@ _mesa_init_constants(GLcontext *ctx) ASSERT(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS); ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX); ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX); + + /* check that we don't exceed various 32-bit bitfields */ + ASSERT(VERT_RESULT_MAX <= 32); + ASSERT(FRAG_ATTRIB_MAX <= 32); } -- cgit v1.2.3 From 4e762395ef7e8c332c16fd0c11025cfa52763a45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 14:34:43 -0600 Subject: mesa: raise MAX_VARYING (number of shader varying vars) to 16 16 is the limit for now because of various 32-bit bitfields. --- src/mesa/main/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 2a9fdf9ca0..888e08ff93 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -187,7 +187,7 @@ #define MAX_PROGRAM_TEMPS 256 #define MAX_PROGRAM_ADDRESS_REGS 2 #define MAX_UNIFORMS 1024 /**< number of vec4 uniforms */ -#define MAX_VARYING 8 /**< number of float[4] vectors */ +#define MAX_VARYING 16 /**< number of float[4] vectors */ #define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS #define MAX_PROGRAM_INPUTS 32 #define MAX_PROGRAM_OUTPUTS 32 -- cgit v1.2.3 From f09e5a5b637822b89ba19b2e306b83f8fc3809d0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 13:48:41 -0600 Subject: i965: const qualifiers --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 0a3debb101..d7f75e3685 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1225,7 +1225,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) for (insn = 0; insn < nr_insns; insn++) { - struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; + const struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; struct brw_reg args[3], dst; GLuint i; @@ -1238,7 +1238,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) */ if (inst->Opcode != OPCODE_SWZ) for (i = 0; i < 3; i++) { - struct prog_src_register *src = &inst->SrcReg[i]; + const struct prog_src_register *src = &inst->SrcReg[i]; index = src->Index; file = src->File; if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src) -- cgit v1.2.3 From 6fec2eb1433c8d533b0a9afb73a2162db8dd9a7b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 15:04:12 -0600 Subject: mesa: set version to 7.5-rc1 --- Makefile | 2 +- src/mesa/main/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a77825e8f9..4282b78f49 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ ultrix-gcc: # Rules for making release tarballs -VERSION=7.5-devel +VERSION=7.5-rc1 DIRECTORY = Mesa-$(VERSION) LIB_NAME = MesaLib-$(VERSION) DEMO_NAME = MesaDemos-$(VERSION) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index ba027465d4..072037bbd7 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 5 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5" +#define MESA_VERSION_STRING "7.5-rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 9b3d748f0274c4d7bf25dab2b31458ca83dcc7d5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 May 2009 15:07:22 -0600 Subject: mesa: omit files that were removed from git --- Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Makefile b/Makefile index 4282b78f49..7a9ad88518 100644 --- a/Makefile +++ b/Makefile @@ -402,7 +402,6 @@ DEMO_FILES = \ $(DIRECTORY)/progs/osdemos/Makefile \ $(DIRECTORY)/progs/osdemos/*.c \ $(DIRECTORY)/progs/xdemos/Makefile* \ - $(DIRECTORY)/progs/xdemos/descrip.mms \ $(DIRECTORY)/progs/xdemos/*.[chf] \ $(DIRECTORY)/progs/redbook/Makefile* \ $(DIRECTORY)/progs/redbook/README \ @@ -418,9 +417,6 @@ DEMO_FILES = \ $(DIRECTORY)/progs/windml/*.c \ $(DIRECTORY)/progs/windml/*.bmp \ $(DIRECTORY)/progs/ggi/*.c \ - $(DIRECTORY)/windows/VC6/progs/demos/*.dsp \ - $(DIRECTORY)/windows/VC6/progs/progs.dsw \ - $(DIRECTORY)/windows/VC7/progs/demos/*.vcproj \ $(DIRECTORY)/windows/VC7/progs/progs.sln GLUT_FILES = \ @@ -430,14 +426,11 @@ GLUT_FILES = \ $(DIRECTORY)/src/glut/glx/depend \ $(DIRECTORY)/src/glut/glx/glut.pc.in \ $(DIRECTORY)/src/glut/glx/*def \ - $(DIRECTORY)/src/glut/glx/descrip.mms \ - $(DIRECTORY)/src/glut/glx/mms_depend \ $(DIRECTORY)/src/glut/glx/*.[ch] \ $(DIRECTORY)/src/glut/beos/*.[ch] \ $(DIRECTORY)/src/glut/beos/*.cpp \ $(DIRECTORY)/src/glut/beos/Makefile \ $(DIRECTORY)/src/glut/dos/*.[ch] \ - $(DIRECTORY)/src/glut/dos/Makefile.DJ \ $(DIRECTORY)/src/glut/dos/PC_HW/*.[chS] \ $(DIRECTORY)/src/glut/ggi/*.[ch] \ $(DIRECTORY)/src/glut/ggi/Makefile \ -- cgit v1.2.3 From b6e94f71c2bfc63497e2c8265179f19babe87688 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 8 May 2009 12:46:18 -0700 Subject: intel: Put the constant texcoords used in metaops into a vbo. Make this be its own function for setup/teardown of the binding of these texcoords. No performance difference in the engine demo (I just felt dirty not using a VBO for this), and I think it should be more resilient to interference from current GL state. --- src/mesa/drivers/dri/intel/intel_context.h | 8 +++ src/mesa/drivers/dri/intel/intel_pixel.c | 83 +++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_pixel.h | 3 + src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 15 +---- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 33 ++-------- 5 files changed, 102 insertions(+), 40 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index d798225ddd..f385027596 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -161,12 +161,20 @@ struct intel_context struct { struct gl_fragment_program *bitmap_fp; struct gl_vertex_program *passthrough_vp; + struct gl_buffer_object *texcoord_vbo; struct gl_fragment_program *saved_fp; GLboolean saved_fp_enable; struct gl_vertex_program *saved_vp; GLboolean saved_vp_enable; + GLboolean saved_texcoord_enable; + struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; + GLenum saved_texcoord_type; + GLsizei saved_texcoord_size, saved_texcoord_stride; + const void *saved_texcoord_ptr; + int saved_active_texture; + GLint saved_vp_x, saved_vp_y; GLsizei saved_vp_width, saved_vp_height; GLenum saved_matrix_mode; diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index fc0ac0b79c..cbdda6b1f9 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -27,9 +27,12 @@ #include "main/enums.h" #include "main/state.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/enable.h" #include "main/matrix.h" +#include "main/texstate.h" +#include "main/varray.h" #include "main/viewport.h" #include "swrast/swrast.h" #include "shader/arbprogram.h" @@ -334,6 +337,85 @@ intel_meta_restore_fragment_program(struct intel_context *intel) _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); } +static const float default_texcoords[4][2] = { { 0.0, 0.0 }, + { 1.0, 0.0 }, + { 1.0, 1.0 }, + { 0.0, 1.0 } }; + +void +intel_meta_set_default_texrect(struct intel_context *intel) +{ + GLcontext *ctx = &intel->ctx; + struct gl_client_array *old_texcoord_array; + + intel->meta.saved_active_texture = ctx->Texture.CurrentUnit; + if (intel->meta.saved_array_vbo == NULL) { + _mesa_reference_buffer_object(ctx, &intel->meta.saved_array_vbo, + ctx->Array.ArrayBufferObj); + } + + old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0]; + intel->meta.saved_texcoord_type = old_texcoord_array->Type; + intel->meta.saved_texcoord_size = old_texcoord_array->Size; + intel->meta.saved_texcoord_stride = old_texcoord_array->Stride; + intel->meta.saved_texcoord_enable = old_texcoord_array->Enabled; + intel->meta.saved_texcoord_ptr = old_texcoord_array->Ptr; + _mesa_reference_buffer_object(ctx, &intel->meta.saved_texcoord_vbo, + old_texcoord_array->BufferObj); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + + if (intel->meta.texcoord_vbo == NULL) { + GLuint vbo_name; + + _mesa_GenBuffersARB(1, &vbo_name); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords), + default_texcoords, GL_STATIC_DRAW_ARB); + _mesa_reference_buffer_object(ctx, &intel->meta.texcoord_vbo, + ctx->Array.ArrayBufferObj); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + intel->meta.texcoord_vbo->Name); + } + _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL); + + _mesa_Enable(GL_TEXTURE_COORD_ARRAY); +} + +void +intel_meta_restore_texcoords(struct intel_context *intel) +{ + GLcontext *ctx = &intel->ctx; + + /* Restore the old TexCoordPointer */ + if (intel->meta.saved_texcoord_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + intel->meta.saved_texcoord_vbo->Name); + _mesa_reference_buffer_object(ctx, &intel->meta.saved_texcoord_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + + _mesa_TexCoordPointer(intel->meta.saved_texcoord_size, + intel->meta.saved_texcoord_type, + intel->meta.saved_texcoord_stride, + intel->meta.saved_texcoord_ptr); + if (!intel->meta.saved_texcoord_enable) + _mesa_Disable(GL_TEXTURE_COORD_ARRAY); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + + intel->meta.saved_active_texture); + + if (intel->meta.saved_array_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + intel->meta.saved_array_vbo->Name); + _mesa_reference_buffer_object(ctx, &intel->meta.saved_array_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + void intelInitPixelFuncs(struct dd_function_table *functions) { @@ -355,5 +437,6 @@ intel_free_pixel_state(struct intel_context *intel) _mesa_reference_vertprog(ctx, &intel->meta.passthrough_vp, NULL); _mesa_reference_fragprog(ctx, &intel->meta.bitmap_fp, NULL); + _mesa_reference_buffer_object(ctx, &intel->meta.texcoord_vbo, NULL); } diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index cb41fa182c..6acf0813c8 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -40,6 +40,9 @@ void intel_meta_set_fragment_program(struct intel_context *intel, const char *prog_string); void intel_meta_restore_fragment_program(struct intel_context *intel); void intel_free_pixel_state(struct intel_context *intel); +void intel_meta_set_default_texrect(struct intel_context *intel); +void intel_meta_set_default_texrect(struct intel_context *intel); +void intel_meta_restore_texcoords(struct intel_context *intel); GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 1db7f5594e..b20840b9a0 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -360,7 +360,6 @@ intel_texture_bitmap(GLcontext * ctx, "END\n"; GLuint texname; GLfloat vertices[4][4]; - GLfloat texcoords[4][2]; GLint old_active_texture; GLubyte *unpacked_bitmap; GLubyte *a8_bitmap; @@ -485,22 +484,12 @@ intel_texture_bitmap(GLcontext * ctx, vertices[3][2] = dst_z; vertices[3][3] = 1.0; - texcoords[0][0] = 0.0; - texcoords[0][1] = 0.0; - texcoords[1][0] = 1.0; - texcoords[1][1] = 0.0; - texcoords[2][0] = 1.0; - texcoords[2][1] = 1.0; - texcoords[3][0] = 0.0; - texcoords[3][1] = 1.0; - _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); - _mesa_ClientActiveTextureARB(GL_TEXTURE0); - _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords); _mesa_Enable(GL_VERTEX_ARRAY); - _mesa_Enable(GL_TEXTURE_COORD_ARRAY); + intel_meta_set_default_texrect(intel); CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + intel_meta_restore_texcoords(intel); intel_meta_restore_transform(intel); intel_meta_restore_fragment_program(intel); intel_meta_restore_vertex_program(intel); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index e8d5ac8569..abcdcd5724 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -70,7 +70,6 @@ intel_texture_drawpixels(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); GLuint texname; GLfloat vertices[4][4]; - GLfloat texcoords[4][2]; GLfloat z; GLint old_active_texture; GLenum internalFormat; @@ -169,22 +168,13 @@ intel_texture_drawpixels(GLcontext * ctx, vertices[3][2] = z; vertices[3][3] = 1.0; - texcoords[0][0] = 0.0; - texcoords[0][1] = 0.0; - texcoords[1][0] = 1.0; - texcoords[1][1] = 0.0; - texcoords[2][0] = 1.0; - texcoords[2][1] = 1.0; - texcoords[3][0] = 0.0; - texcoords[3][1] = 1.0; - _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices); - _mesa_ClientActiveTextureARB(GL_TEXTURE0); - _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords); _mesa_Enable(GL_VERTEX_ARRAY); - _mesa_Enable(GL_TEXTURE_COORD_ARRAY); + intel_meta_set_default_texrect(intel); + CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + intel_meta_restore_texcoords(intel); intel_meta_restore_transform(intel); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); @@ -208,7 +198,6 @@ intel_stencil_drawpixels(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); GLuint texname, rb_name, fb_name, old_fb_name; GLfloat vertices[4][2]; - GLfloat texcoords[4][2]; struct intel_renderbuffer *irb; struct intel_renderbuffer *depth_irb; struct gl_renderbuffer *rb; @@ -343,7 +332,6 @@ intel_stencil_drawpixels(GLcontext * ctx, _mesa_free(stencil_pixels); intel_meta_set_passthrough_transform(intel); - vertices[0][0] = x; vertices[0][1] = y; vertices[1][0] = x + width * ctx->Pixel.ZoomX; @@ -353,22 +341,13 @@ intel_stencil_drawpixels(GLcontext * ctx, vertices[3][0] = x; vertices[3][1] = y + height * ctx->Pixel.ZoomY; - texcoords[0][0] = 0.0; - texcoords[0][1] = 0.0; - texcoords[1][0] = 1.0; - texcoords[1][1] = 0.0; - texcoords[2][0] = 1.0; - texcoords[2][1] = 1.0; - texcoords[3][0] = 0.0; - texcoords[3][1] = 1.0; - _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); - _mesa_ClientActiveTextureARB(GL_TEXTURE0); - _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &texcoords); _mesa_Enable(GL_VERTEX_ARRAY); - _mesa_Enable(GL_TEXTURE_COORD_ARRAY); + intel_meta_set_default_texrect(intel); + CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + intel_meta_restore_texcoords(intel); intel_meta_restore_transform(intel); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); -- cgit v1.2.3 From 1d663ae2925ffadf419ddbea9eca8d5706ea6510 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 7 May 2009 22:50:19 -0700 Subject: intel: Add a metaops version of glGenerateMipmapEXT/SGIS_generate_mipmaps. In addition to being HW accelerated, it avoids the incorrect (black) rendering of the mipmaps that SW was doing in fbo-generatemipmap. Improves the performance of the mipmap generation and drawing in fbo-generatemipmap by 30%. --- src/mesa/drivers/dri/i915/intel_generatemipmap.c | 1 + src/mesa/drivers/dri/i965/Makefile | 1 + src/mesa/drivers/dri/i965/intel_generatemipmap.c | 1 + src/mesa/drivers/dri/intel/intel_context.h | 2 + src/mesa/drivers/dri/intel/intel_generatemipmap.c | 283 ++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_pixel.c | 1 + src/mesa/drivers/dri/intel/intel_tex.c | 56 +---- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 22 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 10 +- 10 files changed, 303 insertions(+), 76 deletions(-) create mode 120000 src/mesa/drivers/dri/i915/intel_generatemipmap.c create mode 120000 src/mesa/drivers/dri/i965/intel_generatemipmap.c create mode 100644 src/mesa/drivers/dri/intel/intel_generatemipmap.c diff --git a/src/mesa/drivers/dri/i915/intel_generatemipmap.c b/src/mesa/drivers/dri/i915/intel_generatemipmap.c new file mode 120000 index 0000000000..4c6b37ada0 --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_generatemipmap.c @@ -0,0 +1 @@ +../intel/intel_generatemipmap.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 4913c25f74..9712c38725 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -14,6 +14,7 @@ DRIVER_SOURCES = \ intel_decode.c \ intel_extensions.c \ intel_fbo.c \ + intel_generatemipmap.c \ intel_mipmap_tree.c \ intel_regions.c \ intel_screen.c \ diff --git a/src/mesa/drivers/dri/i965/intel_generatemipmap.c b/src/mesa/drivers/dri/i965/intel_generatemipmap.c new file mode 120000 index 0000000000..4c6b37ada0 --- /dev/null +++ b/src/mesa/drivers/dri/i965/intel_generatemipmap.c @@ -0,0 +1 @@ +../intel/intel_generatemipmap.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index f385027596..c16732d7b5 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -168,6 +168,8 @@ struct intel_context struct gl_vertex_program *saved_vp; GLboolean saved_vp_enable; + struct gl_fragment_program *tex2d_fp; + GLboolean saved_texcoord_enable; struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; GLenum saved_texcoord_type; diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c new file mode 100644 index 0000000000..02804b51fa --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c @@ -0,0 +1,283 @@ +/* + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt + * + */ + +#include "main/glheader.h" +#include "main/enums.h" +#include "main/image.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/bufferobj.h" +#include "main/teximage.h" +#include "main/texenv.h" +#include "main/texobj.h" +#include "main/texstate.h" +#include "main/texparam.h" +#include "main/varray.h" +#include "main/attrib.h" +#include "main/enable.h" +#include "main/buffers.h" +#include "main/fbobject.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/depth.h" +#include "main/hash.h" +#include "main/mipmap.h" +#include "main/blend.h" +#include "glapi/dispatch.h" +#include "swrast/swrast.h" + +#include "intel_screen.h" +#include "intel_context.h" +#include "intel_batchbuffer.h" +#include "intel_pixel.h" +#include "intel_tex.h" +#include "intel_mipmap_tree.h" + +static const char *intel_fp_tex2d = + "!!ARBfp1.0\n" + "TEX result.color, fragment.texcoord[0], texture[0], 2D;\n" + "END\n"; + +static GLboolean +intel_generate_mipmap_level(GLcontext *ctx, GLuint tex_name, + int level, int width, int height) +{ + struct intel_context *intel = intel_context(ctx); + GLfloat vertices[4][2]; + GLint status; + + /* Set to source from the previous level */ + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, level - 1); + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level - 1); + + /* Set to draw into the current level */ + _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, + tex_name, + level); + /* Choose to render to the color attachment. */ + _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + + status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) + return GL_FALSE; + + intel_meta_set_passthrough_transform(intel); + + /* XXX: Doing it right would involve setting up the transformation to do + * 0-1 mapping or something, and not changing the vertex data. + */ + vertices[0][0] = 0; + vertices[0][1] = 0; + vertices[1][0] = width; + vertices[1][1] = 0; + vertices[2][0] = width; + vertices[2][1] = height; + vertices[3][0] = 0; + vertices[3][1] = height; + + _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); + _mesa_Enable(GL_VERTEX_ARRAY); + intel_meta_set_default_texrect(intel); + + CALL_DrawArrays(ctx->Exec, (GL_TRIANGLE_FAN, 0, 4)); + + intel_meta_restore_texcoords(intel); + intel_meta_restore_transform(intel); + + return GL_TRUE; +} + +static GLboolean +intel_generate_mipmap_2d(GLcontext *ctx, + GLenum target, + struct gl_texture_object *texObj) +{ + struct intel_context *intel = intel_context(ctx); + GLint old_active_texture; + int level, max_levels, start_level, end_level; + GLuint fb_name; + GLboolean success = GL_FALSE; + struct gl_framebuffer *saved_fbo = NULL; + + _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | + GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT); + _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); + old_active_texture = ctx->Texture.CurrentUnit; + _mesa_reference_framebuffer(&saved_fbo, ctx->DrawBuffer); + + _mesa_Disable(GL_POLYGON_STIPPLE); + _mesa_Disable(GL_DEPTH_TEST); + _mesa_Disable(GL_STENCIL_TEST); + _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + _mesa_DepthMask(GL_FALSE); + + /* Bind the given texture to GL_TEXTURE_2D with linear filtering for our + * minification. + */ + _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); + _mesa_Enable(GL_TEXTURE_2D); + _mesa_BindTexture(GL_TEXTURE_2D, texObj->Name); + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_NEAREST); + _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + /* Bind the new renderbuffer to the color attachment point. */ + _mesa_GenFramebuffersEXT(1, &fb_name); + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name); + + intel_meta_set_fragment_program(intel, &intel->meta.tex2d_fp, + intel_fp_tex2d); + intel_meta_set_passthrough_vertex_program(intel); + + max_levels = _mesa_max_texture_levels(ctx, texObj->Target); + start_level = texObj->BaseLevel; + end_level = texObj->MaxLevel; + + /* Loop generating level+1 from level. */ + for (level = start_level; level < end_level && level < max_levels - 1; level++) { + const struct gl_texture_image *srcImage; + int width, height; + + srcImage = _mesa_select_tex_image(ctx, texObj, target, level); + if (srcImage->Border != 0) + goto fail; + + width = srcImage->Width / 2; + if (width < 1) + width = 1; + height = srcImage->Height / 2; + if (height < 1) + height = 1; + + if (width == srcImage->Width && + height == srcImage->Height) { + /* Neither _mesa_max_texture_levels nor texObj->MaxLevel are the + * maximum texture level for the object, so break out when we've gone + * over the edge. + */ + break; + } + + /* Make sure that there's space allocated for the target level. + * We could skip this if there's already space allocated and save some + * time. + */ + _mesa_TexImage2D(GL_TEXTURE_2D, level + 1, srcImage->InternalFormat, + width, height, 0, + GL_RGBA, GL_UNSIGNED_INT, NULL); + + if (!intel_generate_mipmap_level(ctx, texObj->Name, level + 1, + width, height)) + goto fail; + } + + success = GL_TRUE; + +fail: + intel_meta_restore_fragment_program(intel); + intel_meta_restore_vertex_program(intel); + + _mesa_DeleteFramebuffersEXT(1, &fb_name); + _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); + if (saved_fbo) + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, saved_fbo->Name); + _mesa_reference_framebuffer(&saved_fbo, NULL); + _mesa_PopClientAttrib(); + _mesa_PopAttrib(); + + return success; +} + + +/** + * Generate new mipmap data from BASE+1 to BASE+p (the minimally-sized mipmap + * level). + * + * The texture object's miptree must be mapped. + * + * It would be really nice if this was just called by Mesa whenever mipmaps + * needed to be regenerated, rather than us having to remember to do so in + * each texture image modification path. + * + * This function should also include an accelerated path. + */ +void +intel_generate_mipmap(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) +{ + struct intel_context *intel = intel_context(ctx); + struct intel_texture_object *intelObj = intel_texture_object(texObj); + GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + int face, i; + + /* HW path */ + if (target == GL_TEXTURE_2D && + ctx->Extensions.EXT_framebuffer_object && + ctx->Extensions.ARB_fragment_program && + ctx->Extensions.ARB_vertex_program) { + GLboolean success; + + /* We'll be accessing this texture using GL entrypoints, which should + * be resilient against other access to this texture. + */ + _mesa_unlock_texture(ctx, texObj); + success = intel_generate_mipmap_2d(ctx, target, texObj); + _mesa_lock_texture(ctx, texObj); + + if (success) + return; + } + + /* SW path */ + intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); + _mesa_generate_mipmap(ctx, target, texObj); + intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); + + /* Update the level information in our private data in the new images, since + * it didn't get set as part of a normal TexImage path. + */ + for (face = 0; face < nr_faces; face++) { + for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) { + struct intel_texture_image *intelImage; + + intelImage = intel_texture_image(texObj->Image[face][i]); + if (intelImage == NULL) + break; + + intelImage->level = i; + intelImage->face = face; + /* Unreference the miptree to signal that the new Data is a bare + * pointer from mesa. + */ + intel_miptree_release(intel, &intelImage->mt); + } + } +} diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index cbdda6b1f9..36a684b3b8 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -437,6 +437,7 @@ intel_free_pixel_state(struct intel_context *intel) _mesa_reference_vertprog(ctx, &intel->meta.passthrough_vp, NULL); _mesa_reference_fragprog(ctx, &intel->meta.bitmap_fp, NULL); + _mesa_reference_fragprog(ctx, &intel->meta.tex2d_fp, NULL); _mesa_reference_buffer_object(ctx, &intel->meta.texcoord_vbo, NULL); } diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index ae0994b183..fbd6e1d0c3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -158,60 +158,6 @@ timed_memcpy(void *dest, const void *src, size_t n) } #endif /* DO_DEBUG */ -/** - * Generate new mipmap data from BASE+1 to BASE+p (the minimally-sized mipmap - * level). - * - * The texture object's miptree must be mapped. - * - * It would be really nice if this was just called by Mesa whenever mipmaps - * needed to be regenerated, rather than us having to remember to do so in - * each texture image modification path. - * - * This function should also include an accelerated path. - */ -void -intel_generate_mipmap(GLcontext *ctx, GLenum target, - struct gl_texture_object *texObj) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(texObj); - GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - int face, i; - - _mesa_generate_mipmap(ctx, target, texObj); - - /* Update the level information in our private data in the new images, since - * it didn't get set as part of a normal TexImage path. - */ - for (face = 0; face < nr_faces; face++) { - for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) { - struct intel_texture_image *intelImage; - - intelImage = intel_texture_image(texObj->Image[face][i]); - if (intelImage == NULL) - break; - - intelImage->level = i; - intelImage->face = face; - /* Unreference the miptree to signal that the new Data is a bare - * pointer from mesa. - */ - intel_miptree_release(intel, &intelImage->mt); - } - } -} - -static void intelGenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(texObj); - - intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); - intel_generate_mipmap(ctx, target, texObj); - intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); -} - void intelInitTextureFuncs(struct dd_function_table *functions) { @@ -227,7 +173,7 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->CopyTexSubImage1D = intelCopyTexSubImage1D; functions->CopyTexSubImage2D = intelCopyTexSubImage2D; functions->GetTexImage = intelGetTexImage; - functions->GenerateMipmap = intelGenerateMipmap; + functions->GenerateMipmap = intel_generate_mipmap; /* compressed texture functions */ functions->CompressedTexImage2D = intelCompressedTexImage2D; diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 08437aa0e2..7c2b26ef1d 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -158,7 +158,7 @@ do_copy_texsubimage(struct intel_context *intel, /* GL_SGIS_generate_mipmap */ if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, texObj); + intel_generate_mipmap(ctx, target, texObj); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 1f192dafbe..b71fe2a7ae 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -316,7 +316,6 @@ intelTexImage(GLcontext * ctx, GLint postConvHeight = height; GLint texelBytes, sizeInBytes; GLuint dstRowStride = 0, srcRowStride = texImage->RowStride; - GLboolean needs_map; DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); @@ -482,15 +481,8 @@ intelTexImage(GLcontext * ctx, LOCK_HARDWARE(intel); - /* Two cases where we need a mapping of the miptree: when the user supplied - * data is mapped as well (non-PBO, memcpy upload) or when we're going to do - * (software) mipmap generation. - */ - needs_map = (pixels != NULL) || (level == texObj->BaseLevel && - texObj->GenerateMipmap); - if (intelImage->mt) { - if (needs_map) + if (pixels != NULL) texImage->Data = intel_miptree_image_map(intel, intelImage->mt, intelImage->face, @@ -547,22 +539,22 @@ intelTexImage(GLcontext * ctx, format, type, pixels, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } - - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, texObj); - } } _mesa_unmap_teximage_pbo(ctx, unpack); if (intelImage->mt) { - if (needs_map) + if (pixels != NULL) intel_miptree_image_unmap(intel, intelImage->mt); texImage->Data = NULL; } UNLOCK_HARDWARE(intel); + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + intel_generate_mipmap(ctx, target, texObj); + } } void diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index f86de56897..48104de2a9 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -101,11 +101,6 @@ intelTexSubimage(GLcontext * ctx, _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage"); } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - intel_generate_mipmap(ctx, target, texObj); - } - _mesa_unmap_teximage_pbo(ctx, packing); if (intelImage->mt) { @@ -114,6 +109,11 @@ intelTexSubimage(GLcontext * ctx, } UNLOCK_HARDWARE(intel); + + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + intel_generate_mipmap(ctx, target, texObj); + } } -- cgit v1.2.3 From c230767d6956b63a2b101acb48f98823bb5dd31a Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Fri, 8 May 2009 11:13:57 -0600 Subject: mesa: Fixed a texture memory leak The current texture for any particular texture unit is given an additional reference in update_texture_state(); but if the context is closed before that texture can be released (which is quite frequent in normal use, unless a program unbinds and deletes the texture and renders without it to force a call to update_texture_state(), the memory is lost. This affects general Mesa; but the i965 is particularly affected because it allocates a considerable amount of additional memory for each allocated texture. --- src/mesa/main/texstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 5453331c67..6e0c0c688a 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -791,6 +791,9 @@ _mesa_free_texture_data(GLcontext *ctx) /* unreference current textures */ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { + /* The _Current texture could account for another reference */ + _mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL); + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { _mesa_reference_texobj(&ctx->Texture.Unit[u].CurrentTex[tgt], NULL); } -- cgit v1.2.3 From 44a4abfd4f8695809eaec07df8eeb191d6e017d7 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Fri, 8 May 2009 14:40:38 -0600 Subject: i965: fix segfault on low memory conditions When out of memory (in at least one case, triggered by a longrunning memory leak), this code will segfault and crash. By checking for the out-of-memory condition, the system can continue, and will report the out-of-memory error later, a much preferable outcome. --- src/mesa/drivers/dri/i965/brw_wm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 90d74c2885..cd65f57bbc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -146,6 +146,13 @@ static void do_wm_prog( struct brw_context *brw, if (c == NULL) { brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data)); c = brw->wm.compile_data; + if (c == NULL) { + /* Ouch - big out of memory problem. Can't continue + * without triggering a segfault, no way to signal, + * so just return. + */ + return; + } } else { memset(c, 0, sizeof(*brw->wm.compile_data)); } -- cgit v1.2.3 From fc6d89145df6fc7a1c2ce648b474c3f203ca87c7 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Fri, 8 May 2009 14:42:47 -0600 Subject: i965: fix memory leak in context/renderbuffer region management A temporary change to the intelMakeCurrent() function to make it work with frame buffer objects causes the static regions associated with the context (the front_region, back_region, and depth_region) to take on an additional reference, with no corresponding release. This causes a memory leak if a program repeatedly creates and destroys contexts. The fix is the corresponding hack, to unreference these regions when the context is deleted, but only if the framebuffer objects are still present and the same regions are still referenced within. Both sets of code have comment blocks referring to each other. --- src/mesa/drivers/dri/intel/intel_context.c | 64 ++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index a6d8729d8f..8b3e50f9b6 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -774,13 +774,64 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) intel->prim.vb_bo = NULL; if (release_texture_heaps) { - /* This share group is about to go away, free our private - * texture object data. + /* Nothing is currently done here to free texture heaps; + * but we're not using the texture heap utilities, so I + * rather think we shouldn't. I've taken a look, and can't + * find any private texture data hanging around anywhere, but + * I'm not yet certain there isn't any at all... */ - if (INTEL_DEBUG & DEBUG_TEXTURE) + /* if (INTEL_DEBUG & DEBUG_TEXTURE) fprintf(stderr, "do something to free texture heaps\n"); + */ } + /* XXX In intelMakeCurrent() below, the context's static regions are + * referenced inside the frame buffer; it's listed as a hack, + * with a comment of "XXX FBO temporary fix-ups!", but + * as long as it's there, we should release the regions here. + * The do/while loop around the block is used to allow the + * "continue" statements inside the block to exit the block, + * to avoid many layers of "if" constructs. + */ + do { + __DRIdrawablePrivate * driDrawPriv = intel->driDrawable; + struct intel_framebuffer *intel_fb; + struct intel_renderbuffer *irbDepth, *irbStencil; + if (!driDrawPriv) { + /* We're already detached from the drawable; exit this block. */ + continue; + } + intel_fb = (struct intel_framebuffer *) driDrawPriv->driverPrivate; + if (!intel_fb) { + /* The frame buffer is already gone; exit this block. */ + continue; + } + irbDepth = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); + irbStencil = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); + + /* If the regions of the frame buffer still match the regions + * of the context, release them. If they've changed somehow, + * leave them alone. + */ + if (intel_fb->color_rb[0] && intel_fb->color_rb[0]->region == intel->front_region) { + intel_renderbuffer_set_region(intel_fb->color_rb[0], NULL); + } + if (intel_fb->color_rb[1] && intel_fb->color_rb[1]->region == intel->back_region) { + intel_renderbuffer_set_region(intel_fb->color_rb[1], NULL); + } + + if (irbDepth && irbDepth->region == intel->depth_region) { + intel_renderbuffer_set_region(irbDepth, NULL); + } + /* Usually, the stencil buffer is the same as the depth buffer; + * but they're handled separately in MakeCurrent, so we'll + * handle them separately here. + */ + if (irbStencil && irbStencil->region == intel->depth_region) { + intel_renderbuffer_set_region(irbStencil, NULL); + } + } while (0); + intel_region_release(&intel->front_region); intel_region_release(&intel->back_region); intel_region_release(&intel->depth_region); @@ -789,6 +840,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) /* free the Mesa context */ _mesa_free_context_data(&intel->ctx); + + } } @@ -817,7 +870,10 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, if (driDrawPriv != driReadPriv) intel_update_renderbuffers(driContextPriv, driReadPriv); } else { - /* XXX FBO temporary fix-ups! */ + /* XXX FBO temporary fix-ups! These are released in + * intelDextroyContext(), above. Changes here should be + * reflected there. + */ /* if the renderbuffers don't have regions, init them from the context */ struct intel_renderbuffer *irbDepth = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); -- cgit v1.2.3 From 1d112207716774b32c0cc846304c2c50bf40e812 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Fri, 8 May 2009 14:51:11 -0600 Subject: i965: improve debug logging Looking for memory leaks that were causing crashes in my environment in a situation where valgrind would not work, I ended up improving the i965 debug traces so I could better see where the memory was being allocated and where it was going, in the regions and miptrees code, and in the state caches. These traces were specific enough that external scripts could determine what elements were not being released, and where the memory leaks were. I also ended up creating my own backtrace code in intel_regions.c, to determine exactly where regions were being allocated and for what, since valgrind wasn't working. Because it was useful, I left it in, but disabled and compiled out. It can be activated by changing a flag at the top of the file. --- src/mesa/drivers/dri/i965/brw_state_cache.c | 6 ++ src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 6 +- src/mesa/drivers/dri/intel/intel_regions.c | 88 ++++++++++++++++++++++---- 3 files changed, 86 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 320d886c99..e40d7a0416 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -521,6 +521,9 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache) void brw_state_cache_check_size(struct brw_context *brw) { + if (INTEL_DEBUG & DEBUG_STATE) + _mesa_printf("%s (n_items=%d)\n", __FUNCTION__, brw->cache.n_items); + /* un-tuned guess. We've got around 20 state objects for a total of around * 32k, so 1000 of them is around 1.5MB. */ @@ -537,6 +540,9 @@ brw_destroy_cache(struct brw_context *brw, struct brw_cache *cache) { GLuint i; + if (INTEL_DEBUG & DEBUG_STATE) + _mesa_printf("%s\n", __FUNCTION__); + brw_clear_cache(brw, cache); for (i = 0; i < BRW_MAX_CACHE; i++) { dri_bo_unreference(cache->last_bo[i]); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 6e1e034e53..f3652720ec 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -62,9 +62,10 @@ intel_miptree_create_internal(struct intel_context *intel, GLboolean ok; struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1); - DBG("%s target %s format %s level %d..%d\n", __FUNCTION__, + DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(internal_format), first_level, last_level); + _mesa_lookup_enum_by_nr(internal_format), + first_level, last_level, mt); mt->target = target_to_target(target); mt->internal_format = internal_format; @@ -89,6 +90,7 @@ intel_miptree_create_internal(struct intel_context *intel, if (!ok) { free(mt); + DBG("%s not okay - returning NULL\n", __FUNCTION__); return NULL; } diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 0aa5b8c02c..534e75efe1 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -52,12 +52,66 @@ #define FILE_DEBUG_FLAG DEBUG_REGION +/* This should be set to the maximum backtrace size desired. + * Set it to 0 to disable backtrace debugging. + */ +#define DEBUG_BACKTRACE_SIZE 0 + +#if DEBUG_BACKTRACE_SIZE == 0 +/* Use the standard debug output */ +#define _DBG(...) DBG(__VA_ARGS__) +#else +/* Use backtracing debug output */ +#define _DBG(...) {debug_backtrace(); DBG(__VA_ARGS__);} + +/* Backtracing debug support */ +#include + +static void +debug_backtrace(void) +{ + void *trace[DEBUG_BACKTRACE_SIZE]; + char **strings = NULL; + int traceSize; + register int i; + + traceSize = backtrace(trace, DEBUG_BACKTRACE_SIZE); + strings = backtrace_symbols(trace, traceSize); + if (strings == NULL) { + DBG("no backtrace:"); + return; + } + + /* Spit out all the strings with a colon separator. Ignore + * the first, since we don't really care about the call + * to debug_backtrace() itself. Skip until the final "/" in + * the trace to avoid really long lines. + */ + for (i = 1; i < traceSize; i++) { + char *p = strings[i], *slash = strings[i]; + while (*p) { + if (*p++ == '/') { + slash = p; + } + } + + DBG("%s:", slash); + } + + /* Free up the memory, and we're done */ + free(strings); +} + +#endif + + + /* XXX: Thread safety? */ GLubyte * intel_region_map(struct intel_context *intel, struct intel_region *region) { - DBG("%s\n", __FUNCTION__); + _DBG("%s %p\n", __FUNCTION__, region); if (!region->map_refcount++) { if (region->pbo) intel_region_cow(intel, region); @@ -72,7 +126,7 @@ intel_region_map(struct intel_context *intel, struct intel_region *region) void intel_region_unmap(struct intel_context *intel, struct intel_region *region) { - DBG("%s\n", __FUNCTION__); + _DBG("%s %p\n", __FUNCTION__, region); if (!--region->map_refcount) { dri_bo_unmap(region->buffer); region->map = NULL; @@ -87,10 +141,10 @@ intel_region_alloc_internal(struct intel_context *intel, { struct intel_region *region; - DBG("%s\n", __FUNCTION__); - - if (buffer == NULL) + if (buffer == NULL) { + _DBG("%s <-- NULL\n", __FUNCTION__); return NULL; + } region = calloc(sizeof(*region), 1); region->cpp = cpp; @@ -104,6 +158,7 @@ intel_region_alloc_internal(struct intel_context *intel, region->tiling = I915_TILING_NONE; region->bit_6_swizzle = I915_BIT_6_SWIZZLE_NONE; + _DBG("%s <-- %p\n", __FUNCTION__, region); return region; } @@ -158,7 +213,7 @@ void intel_region_reference(struct intel_region **dst, struct intel_region *src) { if (src) - DBG("%s %p %d\n", __FUNCTION__, src, src->refcount); + _DBG("%s %p %d\n", __FUNCTION__, src, src->refcount); assert(*dst == NULL); if (src) { @@ -172,10 +227,12 @@ intel_region_release(struct intel_region **region_handle) { struct intel_region *region = *region_handle; - if (region == NULL) + if (region == NULL) { + _DBG("%s NULL\n", __FUNCTION__); return; + } - DBG("%s %p %d\n", __FUNCTION__, region, region->refcount - 1); + _DBG("%s %p %d\n", __FUNCTION__, region, region->refcount - 1); ASSERT(region->refcount > 0); region->refcount--; @@ -251,7 +308,7 @@ intel_region_data(struct intel_context *intel, { GLboolean locked = GL_FALSE; - DBG("%s\n", __FUNCTION__); + _DBG("%s\n", __FUNCTION__); if (intel == NULL) return; @@ -293,7 +350,7 @@ intel_region_copy(struct intel_context *intel, GLuint src_offset, GLuint srcx, GLuint srcy, GLuint width, GLuint height) { - DBG("%s\n", __FUNCTION__); + _DBG("%s\n", __FUNCTION__); if (intel == NULL) return; @@ -326,7 +383,7 @@ intel_region_fill(struct intel_context *intel, GLuint dstx, GLuint dsty, GLuint width, GLuint height, GLuint color) { - DBG("%s\n", __FUNCTION__); + _DBG("%s\n", __FUNCTION__); if (intel == NULL) return; @@ -356,6 +413,8 @@ intel_region_attach_pbo(struct intel_context *intel, if (region->pbo == pbo) return; + _DBG("%s %p %p\n", __FUNCTION__, region, pbo); + /* If there is already a pbo attached, break the cow tie now. * Don't call intel_region_release_pbo() as that would * unnecessarily allocate a new buffer we would have to immediately @@ -385,6 +444,7 @@ void intel_region_release_pbo(struct intel_context *intel, struct intel_region *region) { + _DBG("%s %p\n", __FUNCTION__, region); assert(region->buffer == region->pbo->buffer); region->pbo->region = NULL; region->pbo = NULL; @@ -412,7 +472,7 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region) assert(region->cpp * region->pitch * region->height == pbo->Base.Size); - DBG("%s (%d bytes)\n", __FUNCTION__, pbo->Base.Size); + _DBG("%s %p (%d bytes)\n", __FUNCTION__, region, pbo->Base.Size); /* Now blit from the texture buffer to the new buffer: */ @@ -459,6 +519,10 @@ intel_recreate_static(struct intel_context *intel, if (region == NULL) { region = calloc(sizeof(*region), 1); region->refcount = 1; + _DBG("%s creating new region %p\n", __FUNCTION__, region); + } + else { + _DBG("%s %p\n", __FUNCTION__, region); } if (intel->ctx.Visual.rgbBits == 24) -- cgit v1.2.3 From 4816764777485b46f360eb6f86dea243d1809221 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 15:28:09 -0700 Subject: r300-gallium: Finish space accounting. Still broken... --- src/gallium/drivers/r300/r300_context.h | 7 +++- src/gallium/drivers/r300/r300_emit.c | 60 ++++++++++++++++++++++++++++++--- src/gallium/drivers/r300/r300_emit.h | 2 ++ src/gallium/drivers/r300/r300_render.c | 23 ++----------- 4 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 6f62998b35..96f1f11246 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -264,6 +264,11 @@ struct r300_context { /* Draw module. Used mostly for SW TCL. */ struct draw_context* draw; + /* Vertex buffer for rendering. */ + struct pipe_buffer* vbo; + /* Offset into the VBO. */ + size_t vbo_offset; + /* Various CSO state objects. */ /* Blend state. */ struct r300_blend_state* blend_state; @@ -289,7 +294,7 @@ struct r300_context { /* Texture states. */ struct r300_texture* textures[8]; int texture_count; - /* Vertex buffers. */ + /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; int vertex_buffer_count; /* Vertex information. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 01bac5f759..ab17af799b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -296,6 +296,30 @@ void r300_emit_texture(struct r300_context* r300, END_CS; } +void r300_emit_vertex_buffer(struct r300_context* r300) +{ + CS_LOCALS(r300); + + debug_printf("r300: Preparing vertex buffer %p for render, " + "vertex size %d\n", r300->vbo, + r300->vertex_info.vinfo.size); + /* Set the pointer to our vertex buffer. The emitted values are this: + * PACKET3 [3D_LOAD_VBPNTR] + * COUNT [1] + * FORMAT [size | stride << 8] + * OFFSET [offset into BO] + * VBPNTR [relocated BO] + */ + BEGIN_CS(7); + OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3); + OUT_CS(1); + OUT_CS(r300->vertex_info.vinfo.size | + (r300->vertex_info.vinfo.size << 8)); + OUT_CS(r300->vbo_offset); + OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); + END_CS; +} + void r300_emit_vertex_format_state(struct r300_context* r300) { int i; @@ -421,20 +445,41 @@ void r300_flush_textures(struct r300_context* r300) void r300_emit_dirty_state(struct r300_context* r300) { struct r300_screen* r300screen = r300_screen(r300->context.screen); + struct r300_texture* tex; int i; int dirty_tex = 0; - if (!(r300->dirty_hw)) { + if (!(r300->dirty_state)) { return; } r300_update_derived_state(r300); /* XXX check size */ - struct r300_texture* fb_tex = - (struct r300_texture*)r300->framebuffer_state.cbufs[0]; - r300->winsys->add_buffer(r300->winsys, fb_tex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); + /* Color buffers... */ + for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { + tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]; + //assert(tex && tex->buffer && "cbuf is marked, but NULL!"); + if (!tex->buffer) return; + r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + } + /* ...depth buffer... */ + if (r300->framebuffer_state.zsbuf) { + tex = (struct r300_texture*)r300->framebuffer_state.zsbuf; + //assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + if (!tex->buffer) return; + r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + } + /* ...and vertex buffer. */ + if (r300->vbo) { + r300->winsys->add_buffer(r300->winsys, r300->vbo, + RADEON_GEM_DOMAIN_GTT, 0); + } else { + debug_printf("No VBO while emitting dirty state!\n"); + } + if (r300->winsys->validate(r300->winsys)) { /* XXX */ r300->context.flush(&r300->context, 0, NULL); @@ -519,4 +564,9 @@ void r300_emit_dirty_state(struct r300_context* r300) r300_emit_vertex_format_state(r300); r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT; } + + /* Finally, emit the VBO. */ + r300_emit_vertex_buffer(r300); + + r300->dirty_hw++; } diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 31dbc7ab85..36e14f69f7 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -62,6 +62,8 @@ void r300_emit_scissor_state(struct r300_context* r300, void r300_emit_texture(struct r300_context* r300, struct r300_texture* tex, unsigned offset); +void r300_emit_vertex_buffer(struct r300_context* r300); + void r300_emit_vertex_format_state(struct r300_context* r300); void r300_emit_vertex_shader(struct r300_context* r300, diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index cbd84d7c56..29b66cee7e 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -180,27 +180,10 @@ static void prepare_render(struct r300_render* render, unsigned count) CS_LOCALS(r300); - /* Make sure that all possible state is emitted. */ - r300_emit_dirty_state(r300); + r300->vbo = render->vbo; + r300->vbo_offset = render->vbo_offset; - debug_printf("r300: Preparing vertex buffer %p for render, " - "vertex size %d, vertex count %d\n", render->vbo, - r300->vertex_info.vinfo.size, count); - /* Set the pointer to our vertex buffer. The emitted values are this: - * PACKET3 [3D_LOAD_VBPNTR] - * COUNT [1] - * FORMAT [size | stride << 8] - * OFFSET [0] - * VBPNTR [relocated BO] - */ - BEGIN_CS(7); - OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3); - OUT_CS(1); - OUT_CS(r300->vertex_info.vinfo.size | - (r300->vertex_info.vinfo.size << 8)); - OUT_CS(render->vbo_offset); - OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); - END_CS; + r300_emit_dirty_state(r300); } static void r300_render_draw_arrays(struct vbuf_render* render, -- cgit v1.2.3 From cd59933d9f70c6acea63013f1b773b545026bf81 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 16:50:42 -0700 Subject: r300-gallium, radeon: A couple cleanups. Trying to track down goddamn bugs. :C --- src/gallium/drivers/r300/r300_context.c | 4 ---- src/gallium/drivers/r300/r300_state.c | 3 +++ src/gallium/drivers/r300/r300_texture.c | 1 + src/gallium/winsys/drm/radeon/core/radeon_r300.c | 8 +++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 6bdf544a05..a4e89c37d1 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -34,10 +34,6 @@ static boolean r300_draw_range_elements(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); int i; - if (r300->dirty_state) { - r300_emit_dirty_state(r300); - } - for (i = 0; i < r300->vertex_buffer_count; i++) { void* buf = pipe_buffer_map(pipe->screen, r300->vertex_buffers[i].buffer, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 184a23c9e6..0143e228c4 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -562,14 +562,17 @@ static void r300_set_viewport_state(struct pipe_context* pipe, r300->viewport_state->vte_control = R300_VTX_W0_FMT; if (state->scale[0] != 1.0f) { + assert(state->scale[0] != 0.0f); r300->viewport_state->xscale = state->scale[0]; r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA; } if (state->scale[1] != 1.0f) { + assert(state->scale[1] != 0.0f); r300->viewport_state->yscale = state->scale[1]; r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA; } if (state->scale[2] != 1.0f) { + assert(state->scale[2] != 0.0f); r300->viewport_state->zscale = state->scale[2]; r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA; } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index fe91f4e184..6c9d3b7412 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -187,6 +187,7 @@ static struct pipe_texture* tex->stride); pipe_buffer_reference(&tex->buffer, buffer); + debug_printf("%p is the buffer\n", tex->buffer); return (struct pipe_texture*)tex; } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index da233203d7..5dcce20cd5 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -62,6 +62,7 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) if (retval == RADEON_CS_SPACE_OP_TO_BIG) { /* We might as well HCF, since this is not going to fit in the card, * period. */ + /* XXX just drop it on the floor instead */ exit(1); } else if (retval == RADEON_CS_SPACE_FLUSH) { /* We must flush before more rendering can commence. */ @@ -128,14 +129,19 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) { struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; - int retval = 0; + struct radeon_cs_space_check* sc = priv->sc; + int retval = 1; + /* Emit the CS. */ retval = radeon_cs_emit(priv->cs); if (retval) { debug_printf("radeon: Bad CS, dumping...\n"); radeon_cs_print(priv->cs, stderr); } radeon_cs_erase(priv->cs); + + /* Clean out BOs. */ + memset(sc, 0, sizeof(struct radeon_cs_space_check) * RADEON_MAX_BOS); } /* Helper function to do the ioctls needed for setup and init. */ -- cgit v1.2.3 From bed917641cfde06b9ff609760ba20b498a65cefa Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 17:09:32 -0700 Subject: radeon-gallium: Shut up Valgrind. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 5dcce20cd5..556f1d9b87 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -147,9 +147,9 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) /* Helper function to do the ioctls needed for setup and init. */ static void do_ioctls(struct r300_winsys* winsys, int fd) { - struct drm_radeon_gem_info info; - drm_radeon_getparam_t gp; - int target; + struct drm_radeon_gem_info info = {0}; + drm_radeon_getparam_t gp = {0}; + int target = 0; int retval; gp.value = ⌖ -- cgit v1.2.3 From 1b26c2bbaefe3608b96d9351c0f2eac80274891c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 19:40:38 -0700 Subject: r300-gallium, radeon: BO handling fixes, some useful asserts. --- src/gallium/drivers/r300/r300_emit.c | 4 ++-- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index ab17af799b..38b1682415 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -459,7 +459,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* Color buffers... */ for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]; - //assert(tex && tex->buffer && "cbuf is marked, but NULL!"); + assert(tex && tex->buffer && "cbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); @@ -467,7 +467,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* ...depth buffer... */ if (r300->framebuffer_state.zsbuf) { tex = (struct r300_texture*)r300->framebuffer_state.zsbuf; - //assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 556f1d9b87..cbe1652302 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -37,6 +37,8 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, * find a slot for it otherwise. */ for (i = 0; i < RADEON_MAX_BOS; i++) { if (sc[i].bo == bo) { + sc[i].read_domains |= rd; + sc[i].write_domain |= wd; return; } else if (sc[i].bo == NULL) { sc[i].bo = bo; @@ -52,11 +54,15 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, static boolean radeon_r300_validate(struct r300_winsys* winsys) { - int retval; + int retval, i; struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; struct radeon_cs_space_check* sc = priv->sc; + debug_printf("Validation count: %d\n", priv->bo_count); + for (i = 0; i < priv->bo_count; i++) { + debug_printf("BO %d: %p rd: %d wd: %d\n", i, sc[i].bo, sc[i].read_domains, sc[i].write_domain); + } retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); if (retval == RADEON_CS_SPACE_OP_TO_BIG) { -- cgit v1.2.3 From ce758a21b9984cce14db4234fbe353d06a3a2d32 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 22:05:18 -0700 Subject: r300-gallium: Fix bad cast. Space accounting completely works now. Boy, is my face red. :C --- src/gallium/drivers/r300/r300_emit.c | 4 ++-- src/gallium/drivers/r300/r300_texture.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 38b1682415..c73d5a0b44 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -458,7 +458,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* XXX check size */ /* Color buffers... */ for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { - tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]; + tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, @@ -466,7 +466,7 @@ void r300_emit_dirty_state(struct r300_context* r300) } /* ...depth buffer... */ if (r300->framebuffer_state.zsbuf) { - tex = (struct r300_texture*)r300->framebuffer_state.zsbuf; + tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture; assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 6c9d3b7412..5ea9f56247 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -86,8 +86,6 @@ static struct pipe_texture* r300_texture_create(struct pipe_screen* screen, const struct pipe_texture* template) { - /* XXX struct r300_screen* r300screen = r300_screen(screen); */ - struct r300_texture* tex = CALLOC_STRUCT(r300_texture); if (!tex) { @@ -187,7 +185,6 @@ static struct pipe_texture* tex->stride); pipe_buffer_reference(&tex->buffer, buffer); - debug_printf("%p is the buffer\n", tex->buffer); return (struct pipe_texture*)tex; } -- cgit v1.2.3 From c6d2b4a495affbaf0fbc53cf54159a7b2b4f6085 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 22:45:56 -0700 Subject: r300-gallium: vs: Add writemasks. --- src/gallium/drivers/r300/r300_state_tcl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index d84912de48..c52ce258c2 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -169,7 +169,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) | R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) | R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) | - R300_PVS_DST_WE_XYZW; + R300_PVS_DST_WE(dst->DstRegister.WriteMask); switch (count) { case 3: vs->instructions[i].inst3 = -- cgit v1.2.3 From e669ce01d4ee1e785671c811140e4e95e9a7548e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 22:46:12 -0700 Subject: r300-gallium: vs: Add scalar setup, RSQ. Icky icky icky icky. Icky icky, icky icky. Icky. --- src/gallium/drivers/r300/r300_state_tcl.c | 39 ++++++++++++++++++++++++++----- src/gallium/drivers/r300/r300_state_tcl.h | 2 ++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index c52ce258c2..a3b9277cf7 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -135,6 +135,8 @@ static uint32_t r300_vs_op(unsigned op) case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: return R300_VE_ADD; + case TGSI_OPCODE_RSQ: + return R300_PVS_DST_MATH_INST | R300_ME_RECIP_DX; case TGSI_OPCODE_MAD: return R300_PVS_DST_MACRO_INST | R300_PVS_MACRO_OP_2CLK_MADD; default: @@ -158,12 +160,30 @@ static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) } } +/* XXX icky icky icky icky */ +static uint32_t r300_vs_scalar_swiz(struct tgsi_full_src_register* reg) +{ + if (reg->SrcRegister.Extended) { + return reg->SrcRegisterExtSwz.ExtSwizzleX | + (reg->SrcRegisterExtSwz.ExtSwizzleX << 3) | + (reg->SrcRegisterExtSwz.ExtSwizzleX << 6) | + (reg->SrcRegisterExtSwz.ExtSwizzleX << 9); + } else { + return reg->SrcRegister.SwizzleX | + (reg->SrcRegister.SwizzleX << 3) | + (reg->SrcRegister.SwizzleX << 6) | + (reg->SrcRegister.SwizzleX << 9); + } +} + +/* XXX scalar stupidity */ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, struct r300_vs_asm* assembler, struct tgsi_full_src_register* src, struct tgsi_full_dst_register* dst, unsigned op, - unsigned count) + unsigned count, + boolean is_scalar) { int i = vs->instruction_count; vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) | @@ -190,7 +210,9 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[0].SrcRegister)) | R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) | - R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0])); + /* XXX the icky, it burns */ + R300_PVS_SRC_SWIZZLE(is_scalar ? r300_vs_scalar_swiz(&src[0]) + : r300_vs_swiz(&src[0])); break; } vs->instruction_count++; @@ -201,11 +223,16 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, struct tgsi_full_instruction* inst) { switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_RSQ: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 1, TRUE); + break; case TGSI_OPCODE_ADD: case TGSI_OPCODE_MUL: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, - 2); + 2, FALSE); break; case TGSI_OPCODE_DP3: /* Set alpha swizzle to zero for src0 and src1 */ @@ -235,19 +262,19 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, case TGSI_OPCODE_DP4: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, - 2); + 2, FALSE); break; case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: inst->FullSrcRegisters[1] = r300_constant_zero; r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, - 2); + 2, FALSE); break; case TGSI_OPCODE_MAD: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, - 3); + 3, FALSE); break; case TGSI_OPCODE_END: break; diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index e2e1357d43..94d8baa503 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -35,6 +35,8 @@ # define R300_VE_DOT_PRODUCT 1 # define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 +#define R300_PVS_DST_MATH_INST (1 << 6) +# define R300_ME_RECIP_DX 6 #define R300_PVS_DST_MACRO_INST (1 << 7) # define R300_PVS_MACRO_OP_2CLK_MADD 0 #define R300_PVS_DST_REG_TYPE(x) ((x) << 8) -- cgit v1.2.3 From 9b1077714889a5c331c0e208f36233767d39d875 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 22:52:32 -0700 Subject: r300-gallium: vs: Add MAX. --- src/gallium/drivers/r300/r300_state_tcl.c | 7 +++++++ src/gallium/drivers/r300/r300_state_tcl.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index a3b9277cf7..b8a1dd45d5 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -135,6 +135,8 @@ static uint32_t r300_vs_op(unsigned op) case TGSI_OPCODE_MOV: case TGSI_OPCODE_SWZ: return R300_VE_ADD; + case TGSI_OPCODE_MAX: + return R300_VE_MAXIMUM; case TGSI_OPCODE_RSQ: return R300_PVS_DST_MATH_INST | R300_ME_RECIP_DX; case TGSI_OPCODE_MAD: @@ -271,6 +273,11 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2, FALSE); break; + case TGSI_OPCODE_MAX: + r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], inst->Instruction.Opcode, + 2, FALSE); + break; case TGSI_OPCODE_MAD: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 94d8baa503..204e1d31c3 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -35,6 +35,7 @@ # define R300_VE_DOT_PRODUCT 1 # define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 +# define R300_VE_MAXIMUM 7 #define R300_PVS_DST_MATH_INST (1 << 6) # define R300_ME_RECIP_DX 6 #define R300_PVS_DST_MACRO_INST (1 << 7) -- cgit v1.2.3 From 7e347a0f49bd737f1a219fe8001c8ddb4f8c3d85 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 8 May 2009 22:54:52 -0700 Subject: r300-gallium: vs: Add SLT, clean up MAX. This should be all the opcodes for basic TCL. --- src/gallium/drivers/r300/r300_state_tcl.c | 9 ++++----- src/gallium/drivers/r300/r300_state_tcl.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index b8a1dd45d5..410a756773 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -137,6 +137,8 @@ static uint32_t r300_vs_op(unsigned op) return R300_VE_ADD; case TGSI_OPCODE_MAX: return R300_VE_MAXIMUM; + case TGSI_OPCODE_SLT: + return R300_VE_SET_LESS_THAN; case TGSI_OPCODE_RSQ: return R300_PVS_DST_MATH_INST | R300_ME_RECIP_DX; case TGSI_OPCODE_MAD: @@ -232,6 +234,8 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, break; case TGSI_OPCODE_ADD: case TGSI_OPCODE_MUL: + case TGSI_OPCODE_MAX: + case TGSI_OPCODE_SLT: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2, FALSE); @@ -273,11 +277,6 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 2, FALSE); break; - case TGSI_OPCODE_MAX: - r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, - &inst->FullDstRegisters[0], inst->Instruction.Opcode, - 2, FALSE); - break; case TGSI_OPCODE_MAD: r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index 204e1d31c3..d5d425e9d6 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -36,6 +36,7 @@ # define R300_VE_MULTIPLY 2 # define R300_VE_ADD 3 # define R300_VE_MAXIMUM 7 +# define R300_VE_SET_LESS_THAN 10 #define R300_PVS_DST_MATH_INST (1 << 6) # define R300_ME_RECIP_DX 6 #define R300_PVS_DST_MACRO_INST (1 << 7) -- cgit v1.2.3 From c4c5bf31a743bc53a9dbdef7807928dacae7958a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 9 May 2009 00:28:49 -0700 Subject: r300-gallium: Start VS dumper. --- src/gallium/drivers/r300/r300_debug.c | 90 ++++----------------- src/gallium/drivers/r300/r300_debug.h | 146 ++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 76 deletions(-) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index dd63136c9d..1ff72172eb 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -30,81 +30,6 @@ static void r300_dump_fs(struct r300_fragment_shader* fs) } } -static char* r500_fs_swiz[] = { - " R", - " G", - " B", - " A", - " 0", - ".5", - " 1", - " U", -}; - -static char* r500_fs_op_rgb[] = { - "MAD", - "DP3", - "DP4", - "D2A", - "MIN", - "MAX", - "---", - "CND", - "CMP", - "FRC", - "SOP", - "MDH", - "MDV", -}; - -static char* r500_fs_op_alpha[] = { - "MAD", - " DP", - "MIN", - "MAX", - "---", - "CND", - "CMP", - "FRC", - "EX2", - "LN2", - "RCP", - "RSQ", - "SIN", - "COS", - "MDH", - "MDV", -}; - -static char* r500_fs_mask[] = { - "NONE", - "R ", - " G ", - "RG ", - " B ", - "R B ", - " GB ", - "RGB ", - " A", - "R A", - " G A", - "RG A", - " BA", - "R BA", - " GBA", - "RGBA", -}; - -static char* r500_fs_tex[] = { - " NOP", - " LD", - "TEXKILL", - " PROJ", - "LODBIAS", - " LOD", - " DXDY", -}; - void r500_fs_dump(struct r500_fragment_shader* fs) { int i; @@ -225,12 +150,25 @@ void r500_fs_dump(struct r500_fragment_shader* fs) } } +static void r300_vs_op_dump(uint32_t op) +{ + if (op & 0x81) { + debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n"); + } else if (op & 0x80) { + debug_printf(" PVS_MACRO_OP_2CLK_MADD\n"); + } else if (op & 0x40) { + debug_printf("%s\n", r300_vs_me_ops[op & 0x1f]); + } else { + debug_printf("%s\n", r300_vs_ve_ops[op & 0x1f]); + } +} + void r300_vs_dump(struct r300_vertex_shader* vs) { int i; for (i = 0; i < vs->instruction_count; i++) { - debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0); + r300_vs_op_dump(vs->instructions[i].inst0); debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1); debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2); debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3); diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h index a1f873656d..6306594099 100644 --- a/src/gallium/drivers/r300/r300_debug.h +++ b/src/gallium/drivers/r300/r300_debug.h @@ -27,6 +27,152 @@ #include "r300_state_shader.h" #include "r300_state_tcl.h" +static char* r500_fs_swiz[] = { + " R", + " G", + " B", + " A", + " 0", + ".5", + " 1", + " U", +}; + +static char* r500_fs_op_rgb[] = { + "MAD", + "DP3", + "DP4", + "D2A", + "MIN", + "MAX", + "---", + "CND", + "CMP", + "FRC", + "SOP", + "MDH", + "MDV", +}; + +static char* r500_fs_op_alpha[] = { + "MAD", + " DP", + "MIN", + "MAX", + "---", + "CND", + "CMP", + "FRC", + "EX2", + "LN2", + "RCP", + "RSQ", + "SIN", + "COS", + "MDH", + "MDV", +}; + +static char* r500_fs_mask[] = { + "NONE", + "R ", + " G ", + "RG ", + " B ", + "R B ", + " GB ", + "RGB ", + " A", + "R A", + " G A", + "RG A", + " BA", + "R BA", + " GBA", + "RGBA", +}; + +static char* r500_fs_tex[] = { + " NOP", + " LD", + "TEXKILL", + " PROJ", + "LODBIAS", + " LOD", + " DXDY", +}; + +static char* r300_vs_ve_ops[] = { + /* R300 vector ops */ + " VE_NO_OP", + " VE_DOT_PRODUCT", + " VE_MULTIPLY", + " VE_ADD", + " VE_MULTIPLY_ADD", + " VE_DISTANCE_FACTOR", + " VE_FRACTION", + " VE_MAXIMUM", + " VE_MINIMUM", + "VE_SET_GREATER_THAN_EQUAL", + " VE_SET_LESS_THAN", + " VE_MULTIPLYX2_ADD", + " VE_MULTIPLY_CLAMP", + " VE_FLT2FIX_DX", + " VE_FLT2FIX_DX_RND", + /* R500 vector ops */ + " VE_PRED_SET_EQ_PUSH", + " VE_PRED_SET_GT_PUSH", + " VE_PRED_SET_GTE_PUSH", + " VE_PRED_SET_NEQ_PUSH", + " VE_COND_WRITE_EQ", + " VE_COND_WRITE_GT", + " VE_COND_WRITE_GTE", + " VE_COND_WRITE_NEQ", + " VE_SET_GREATER_THAN", + " VE_SET_EQUAL", + " VE_SET_NOT_EQUAL", + " (reserved)", + " (reserved)", + " (reserved)", +}; + +static char* r300_vs_me_ops[] = { + /* R300 math ops */ + " ME_NO_OP", + " ME_EXP_BASE2_DX", + " ME_LOG_BASE2_DX", + " ME_EXP_BASEE_FF", + " ME_LIGHT_COEFF_DX", + " ME_POWER_FUNC_FF", + " ME_RECIP_DX", + " ME_RECIP_FF", + " ME_RECIP_SQRT_DX", + " ME_RECIP_SQRT_FF", + " ME_MULTIPLY", + " ME_EXP_BASE2_FULL_DX", + " ME_LOG_BASE2_FULL_DX", + " ME_POWER_FUNC_FF_CLAMP_B", + "ME_POWER_FUNC_FF_CLAMP_B1", + "ME_POWER_FUNC_FF_CLAMP_01", + " ME_SIN", + " ME_COS", + /* R500 math ops */ + " ME_LOG_BASE2_IEEE", + " ME_RECIP_IEEE", + " ME_RECIP_SQRT_IEEE", + " ME_PRED_SET_EQ", + " ME_PRED_SET_GT", + " ME_PRED_SET_GTE", + " ME_PRED_SET_NEQ", + " ME_PRED_SET_CLR", + " ME_PRED_SET_INV", + " ME_PRED_SET_POP", + " ME_PRED_SET_RESTORE", + " (reserved)", + " (reserved)", + " (reserved)", +}; + void r500_fs_dump(struct r500_fragment_shader* fs); void r300_vs_dump(struct r300_vertex_shader* vs); -- cgit v1.2.3 From a738d2b4c2979d7d54064f2ad08da401b28a473b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 9 May 2009 00:38:07 -0700 Subject: r300-gallium: vs: Make imms work, cleanup some of the switches. --- src/gallium/drivers/r300/r300_state_tcl.c | 38 +++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 410a756773..ed9164db49 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -71,16 +71,13 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, { switch (src->File) { case TGSI_FILE_NULL: - /* Probably a zero or one swizzle */ - return R300_PVS_SRC_REG_INPUT; - break; case TGSI_FILE_INPUT: + /* Probably a zero or one swizzle */ return R300_PVS_SRC_REG_INPUT; - break; case TGSI_FILE_TEMPORARY: return R300_PVS_SRC_REG_TEMPORARY; - break; case TGSI_FILE_CONSTANT: + case TGSI_FILE_IMMEDIATE: return R300_PVS_SRC_REG_CONSTANT; default: debug_printf("r300: vs: Unimplemented src type %d\n", src->File); @@ -89,16 +86,32 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler, return 0; } +static INLINE unsigned r300_vs_src(struct r300_vs_asm* assembler, + struct tgsi_src_register* src) +{ + switch (src->File) { + case TGSI_FILE_NULL: + case TGSI_FILE_INPUT: + case TGSI_FILE_TEMPORARY: + case TGSI_FILE_CONSTANT: + return src->Index; + case TGSI_FILE_IMMEDIATE: + return src->Index + assembler->imm_offset; + default: + debug_printf("r300: vs: Unimplemented src type %d\n", src->File); + break; + } + return 0; +} + static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler, struct tgsi_dst_register* dst) { switch (dst->File) { case TGSI_FILE_TEMPORARY: return R300_PVS_DST_REG_TEMPORARY; - break; case TGSI_FILE_OUTPUT: return R300_PVS_DST_REG_OUT; - break; default: debug_printf("r300: vs: Unimplemented dst type %d\n", dst->File); break; @@ -112,10 +125,8 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler, switch (dst->File) { case TGSI_FILE_TEMPORARY: return dst->Index; - break; case TGSI_FILE_OUTPUT: return assembler->tab[dst->Index]; - break; default: debug_printf("r300: vs: Unimplemented dst %d\n", dst->File); break; @@ -199,21 +210,24 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs, vs->instructions[i].inst3 = R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[2].SrcRegister)) | - R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) | + R300_PVS_SRC_OFFSET(r300_vs_src(assembler, + &src[2].SrcRegister)) | R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[2])); /* Fall through */ case 2: vs->instructions[i].inst2 = R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[1].SrcRegister)) | - R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) | + R300_PVS_SRC_OFFSET(r300_vs_src(assembler, + &src[1].SrcRegister)) | R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[1])); /* Fall through */ case 1: vs->instructions[i].inst1 = R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler, &src[0].SrcRegister)) | - R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) | + R300_PVS_SRC_OFFSET(r300_vs_src(assembler, + &src[0].SrcRegister)) | /* XXX the icky, it burns */ R300_PVS_SRC_SWIZZLE(is_scalar ? r300_vs_scalar_swiz(&src[0]) : r300_vs_swiz(&src[0])); -- cgit v1.2.3 From 53c2cc8fefa07723fc456d94eda292e201c41dae Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 9 May 2009 00:43:05 -0700 Subject: radeon-gallium: Clean up some of the BO counting logic. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index cbe1652302..be70ead68d 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -35,21 +35,19 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, /* Check to see if this BO is already in line for validation; * find a slot for it otherwise. */ - for (i = 0; i < RADEON_MAX_BOS; i++) { + assert(priv->bo_count <= RADEON_MAX_BOS); + for (i = 0; i < priv->bo_count; i++) { if (sc[i].bo == bo) { sc[i].read_domains |= rd; sc[i].write_domain |= wd; return; - } else if (sc[i].bo == NULL) { - sc[i].bo = bo; - sc[i].read_domains = rd; - sc[i].write_domain = wd; - priv->bo_count = i + 1; - return; } } - assert(FALSE && "Oh God too many BOs!"); + sc[priv->bo_count].bo = bo; + sc[priv->bo_count].read_domains = rd; + sc[priv->bo_count].write_domain = wd; + priv->bo_count++; } static boolean radeon_r300_validate(struct r300_winsys* winsys) @@ -148,6 +146,7 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) /* Clean out BOs. */ memset(sc, 0, sizeof(struct radeon_cs_space_check) * RADEON_MAX_BOS); + priv->bo_count = 0; } /* Helper function to do the ioctls needed for setup and init. */ -- cgit v1.2.3 From 13e0ff0df1bb75993bded7b248dd37f58fbfd22c Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sat, 9 May 2009 12:56:27 +0200 Subject: radeon: don't include cs uncondionaly --- src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h index 2d6b49257d..6f1a0b4535 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h +++ b/src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h @@ -1,5 +1,3 @@ -#include - #ifndef RADEON_CS_WRAPPER_H #define RADEON_CS_WRAPPER_H -- cgit v1.2.3 From c8c0953294daf9176bc89c28484410e9b7de2b93 Mon Sep 17 00:00:00 2001 From: Hanno Böck Date: Sat, 9 May 2009 16:17:37 -0600 Subject: gallium: replace lib with $(LIB_DIR) --- src/gallium/winsys/drm/intel/dri/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile index a4704bc050..ac0891a646 100644 --- a/src/gallium/winsys/drm/intel/dri/Makefile +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -21,5 +21,5 @@ include ../../Makefile.template DRI_LIB_DEPS += -ldrm_intel symlinks: $(TOP)/$(LIB_DIR)/gallium - @rm -f $(TOP)/lib/gallium/i965_dri.so - ln -s i915_dri.so $(TOP)/lib/gallium/i965_dri.so + @rm -f $(TOP)/$(LIB_DIR)/gallium/i965_dri.so + ln -s i915_dri.so $(TOP)/$(LIB_DIR)/gallium/i965_dri.so -- cgit v1.2.3 From 31865904d89929364025bfadcde153b4ea9ce7e3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 9 May 2009 16:21:16 -0600 Subject: mesa: added more gallium Makefiles to tarball list --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 7a9ad88518..69d3ecacd7 100644 --- a/Makefile +++ b/Makefile @@ -327,6 +327,7 @@ GALLIUM_FILES = \ $(DIRECTORY)/src/gallium/*/*/*/SConscript \ $(DIRECTORY)/src/gallium/*/*/*/*.[ch] \ $(DIRECTORY)/src/gallium/*/*/*/*.py \ + $(DIRECTORY)/src/gallium/*/*/*/*/Makefile \ $(DIRECTORY)/src/gallium/*/*/*/*/*.[ch] \ -- cgit v1.2.3 From 98bb5c610dc68d8e9a185216ce9d2dc6d278c114 Mon Sep 17 00:00:00 2001 From: Joel Bosveld Date: Sun, 10 May 2009 18:26:40 +0200 Subject: radeon: add support for new dri2 interfaces & fix single buffer rendering --- src/mesa/drivers/dri/radeon/radeon_common.c | 39 +++++++ .../drivers/dri/radeon/radeon_common_context.c | 115 ++++++++++++++++++--- .../drivers/dri/radeon/radeon_common_context.h | 16 +++ 3 files changed, 154 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index daf03a9856..decea4518e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -678,6 +678,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { rrbColor = radeon_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); radeon->front_cliprects = GL_TRUE; + radeon->front_buffer_dirty = GL_TRUE; } else { rrbColor = radeon_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); radeon->front_cliprects = GL_FALSE; @@ -793,6 +794,24 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) if (RADEON_DEBUG & DEBUG_DRI) fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr( mode )); + + if (ctx->DrawBuffer->Name == 0) { + radeonContextPtr radeon = RADEON_CONTEXT(ctx); + + const GLboolean was_front_buffer_rendering = + radeon->is_front_buffer_rendering; + + radeon->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) || + (mode == GL_FRONT); + + /* If we weren't front-buffer rendering before but we are now, make sure + * that the front-buffer has actually been allocated. + */ + if (!was_front_buffer_rendering && radeon->is_front_buffer_rendering) { + radeon_update_renderbuffers(radeon->dri.context, + radeon->dri.context->driDrawablePriv); + } + } radeon_draw_buffer(ctx, ctx->DrawBuffer); } @@ -1046,6 +1065,26 @@ void radeonFlush(GLcontext *ctx) if (radeon->cmdbuf.cs->cdw) rcommonFlushCmdBuf(radeon, __FUNCTION__); + + if ((ctx->DrawBuffer->Name == 0) && radeon->front_buffer_dirty) { + __DRIscreen *const screen = radeon->radeonScreen->driScreen; + + if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) + && (screen->dri2.loader->flushFrontBuffer != NULL)) { + (*screen->dri2.loader->flushFrontBuffer)(radeon->dri.drawable, + radeon->dri.drawable->loaderPrivate); + + /* Only clear the dirty bit if front-buffer rendering is no longer + * enabled. This is done so that the dirty bit can only be set in + * glDrawBuffer. Otherwise the dirty bit would have to be set at + * each of N places that do rendering. This has worse performances, + * but it is much easier to get correct. + */ + if (radeon->is_front_buffer_rendering) { + radeon->front_buffer_dirty = GL_FALSE; + } + } + } } /* Make sure all commands have been sent to the hardware and have diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 3e713628ec..124b587bab 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -406,6 +406,23 @@ radeon_make_renderbuffer_current(radeonContextPtr radeon, } } +static unsigned +radeon_bits_per_pixel(const struct radeon_renderbuffer *rb) +{ + switch (rb->base._ActualFormat) { + case GL_RGB5: + case GL_DEPTH_COMPONENT16: + return 16; + case GL_RGB8: + case GL_RGBA8: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH24_STENCIL8_EXT: + case GL_STENCIL_INDEX8_EXT: + return 32; + default: + return 0; + } +} void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) @@ -426,22 +443,63 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) draw = drawable->driverPrivate; screen = context->driScreenPriv; radeon = (radeonContextPtr) context->driverPrivate; - i = 0; - if (draw->color_rb[0]) - attachments[i++] = __DRI_BUFFER_FRONT_LEFT; - if (draw->color_rb[1]) - attachments[i++] = __DRI_BUFFER_BACK_LEFT; - if (radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH)) - attachments[i++] = __DRI_BUFFER_DEPTH; - if (radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL)) - attachments[i++] = __DRI_BUFFER_STENCIL; + + if ((screen->dri2.loader->base.version > 2) + && (screen->dri2.loader->getBuffersWithFormat != NULL)) { + struct radeon_renderbuffer *depth_rb; + struct radeon_renderbuffer *stencil_rb; + + i = 0; + if ((radeon->is_front_buffer_rendering || !draw->color_rb[1]) + && draw->color_rb[0]) { + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; + attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]); + } + + if (draw->color_rb[1]) { + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + attachments[i++] = radeon_bits_per_pixel(draw->color_rb[1]); + } + + depth_rb = radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH); + stencil_rb = radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL); + + if ((depth_rb != NULL) && (stencil_rb != NULL)) { + attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL; + attachments[i++] = radeon_bits_per_pixel(depth_rb); + } else if (depth_rb != NULL) { + attachments[i++] = __DRI_BUFFER_DEPTH; + attachments[i++] = radeon_bits_per_pixel(depth_rb); + } else if (stencil_rb != NULL) { + attachments[i++] = __DRI_BUFFER_STENCIL; + attachments[i++] = radeon_bits_per_pixel(stencil_rb); + } + + buffers = (*screen->dri2.loader->getBuffersWithFormat)(drawable, + &drawable->w, + &drawable->h, + attachments, i / 2, + &count, + drawable->loaderPrivate); + } else { + i = 0; + if (draw->color_rb[0]) + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; + if (draw->color_rb[1]) + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + if (radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH)) + attachments[i++] = __DRI_BUFFER_DEPTH; + if (radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL)) + attachments[i++] = __DRI_BUFFER_STENCIL; - buffers = (*screen->dri2.loader->getBuffers)(drawable, - &drawable->w, - &drawable->h, - attachments, i, - &count, - drawable->loaderPrivate); + buffers = (*screen->dri2.loader->getBuffers)(drawable, + &drawable->w, + &drawable->h, + attachments, i, + &count, + drawable->loaderPrivate); + } + if (buffers == NULL) return; @@ -466,6 +524,10 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) rb = draw->color_rb[0]; regname = "dri2 front buffer"; break; + case __DRI_BUFFER_FAKE_FRONT_LEFT: + rb = draw->color_rb[0]; + regname = "dri2 fake front buffer"; + break; case __DRI_BUFFER_BACK_LEFT: rb = draw->color_rb[1]; regname = "dri2 back buffer"; @@ -474,6 +536,10 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) rb = radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH); regname = "dri2 depth buffer"; break; + case __DRI_BUFFER_DEPTH_STENCIL: + rb = radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH); + regname = "dri2 depth / stencil buffer"; + break; case __DRI_BUFFER_STENCIL: rb = radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL); regname = "dri2 stencil buffer"; @@ -535,7 +601,24 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) radeon_renderbuffer_set_bo(rb, bo); radeon_bo_unref(bo); - + + if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) { + rb = radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL); + if (rb != NULL) { + struct radeon_bo *stencil_bo = NULL; + + if (rb->bo) { + uint32_t name = radeon_gem_name_bo(rb->bo); + if (name == buffers[i].name) + continue; + } + + stencil_bo = bo; + radeon_bo_ref(stencil_bo); + radeon_renderbuffer_set_bo(rb, stencil_bo); + radeon_bo_unref(stencil_bo); + } + } } driUpdateFramebufferSize(radeon->glCtx, drawable); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 181688cbe4..446c2f6269 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -463,6 +463,22 @@ struct radeon_context { GLboolean constant_cliprect; /* use for FBO or DRI2 rendering */ GLboolean front_cliprects; + /** + * Set if rendering has occured to the drawable's front buffer. + * + * This is used in the DRI2 case to detect that glFlush should also copy + * the contents of the fake front buffer to the real front buffer. + */ + GLboolean front_buffer_dirty; + + /** + * Track whether front-buffer rendering is currently enabled + * + * A separate flag is used to track this in order to support MRT more + * easily. + */ + GLboolean is_front_buffer_rendering; + struct { struct gl_fragment_program *bitmap_fp; struct gl_vertex_program *passthrough_vp; -- cgit v1.2.3 From 2223615e0a897434b41f86d22c41cb5dc9f8d67a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 09:46:56 -0600 Subject: mesa: Fixed a texture memory leak The current texture for any particular texture unit is given an additional reference in update_texture_state(); but if the context is closed before that texture can be released (which is quite frequent in normal use, unless a program unbinds and deletes the texture and renders without it to force a call to update_texture_state(), the memory is lost. This affects general Mesa; but the i965 is particularly affected because it allocates a considerable amount of additional memory for each allocated texture. (cherry picked from master, commit c230767d6956b63a2b101acb48f98823bb5dd31a) --- src/mesa/main/texstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 73f8a5339e..cef58d7a49 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -780,6 +780,9 @@ _mesa_free_texture_data(GLcontext *ctx) /* unreference current textures */ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { + /* The _Current texture could account for another reference */ + _mesa_reference_texobj(&ctx->Texture.Unit[u]._Current, NULL); + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { _mesa_reference_texobj(&ctx->Texture.Unit[u].CurrentTex[tgt], NULL); } -- cgit v1.2.3 From 7c2fe42dedcd9f437f2b3fae92963d4c4c56fe03 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 09:38:32 -0600 Subject: mesa: better handling/printing of driver-specific opcodes, register files Drivers such as i965 define extra instruction opcodes and register files. Improve the program printing code to handle those opcodes/files better. --- src/mesa/shader/prog_instruction.c | 7 +++++-- src/mesa/shader/prog_print.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index ae3a003fee..44c961927a 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -343,7 +343,10 @@ _mesa_opcode_string(gl_inst_opcode opcode) { if (opcode < MAX_OPCODE) return InstInfo[opcode].Name; - else - return "OP?"; + else { + static char s[20]; + _mesa_snprintf(s, sizeof(s), "OP%u", opcode); + return s; + } } diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index e6f9a91069..de7fef1f86 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -75,7 +75,11 @@ file_string(gl_register_file f, gl_prog_print_mode mode) case PROGRAM_UNDEFINED: return "UNDEFINED"; default: - return "Unknown program file!"; + { + static char s[20]; + _mesa_snprintf(s, sizeof(s), "FILE%u", f); + return s; + } } } @@ -736,7 +740,10 @@ _mesa_fprint_instruction_opt(FILE *f, mode, prog); } else { - _mesa_fprintf(f, "Other opcode %d\n", inst->Opcode); + fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, + mode, prog); } break; } -- cgit v1.2.3 From 6697311b21a65dbea9236413a3afc759a592afd7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 09:39:52 -0600 Subject: i965: handle extended swizzle terms (0,1) in get_src_reg() Fixes failed assertion in progs/glsl/twoside.c (but still wrong rendering). --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index efe8b5126c..2b2df7329c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -509,6 +509,14 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c, const GLuint nr = 1; const GLuint component = GET_SWZ(src->Swizzle, channel); + /* Extended swizzle terms */ + if (component == SWIZZLE_ZERO) { + return brw_imm_f(0.0F); + } + else if (component == SWIZZLE_ONE) { + return brw_imm_f(1.0F); + } + if (c->fp->use_const_buffer && (src->File == PROGRAM_STATE_VAR || src->File == PROGRAM_CONSTANT || -- cgit v1.2.3 From 7c3d7353d7b46f5ce2b411f08f9e4c158f1610e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 10:02:18 -0600 Subject: mesa: updated comments for _mesa_generate_mipmap() --- src/mesa/main/mipmap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index bc8658beff..47db2acdf0 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1478,9 +1478,12 @@ next_mipmap_level_size(GLenum target, GLint border, /** - * For GL_SGIX_generate_mipmap: - * Generate a complete set of mipmaps from texObj's base-level image. + * Automatic mipmap generation. + * This is the fallback/default function for ctx->Driver.GenerateMipmap(). + * Generate a complete set of mipmaps from texObj's BaseLevel image. * Stop at texObj's MaxLevel or when we get to the 1x1 texture. + * For cube maps, target will be one of + * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP. */ void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, -- cgit v1.2.3 From 2e22bd8460ebbb2dd85417d8e5e670fa651d0da9 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 11 May 2009 09:04:15 -0700 Subject: radeon-gallium: Support new info ioctls in addition to classic getparams. This makes non-hybrid kernels like newttm from drm-next-radeon work while avoiding breakage with Fedora/Ubuntu/etc. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 42 +++++++++++++++++------- src/gallium/winsys/drm/radeon/core/radeon_r300.h | 11 +++++++ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index be70ead68d..56b0d00842 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -152,44 +152,62 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) /* Helper function to do the ioctls needed for setup and init. */ static void do_ioctls(struct r300_winsys* winsys, int fd) { - struct drm_radeon_gem_info info = {0}; + struct drm_radeon_gem_info gem_info = {0}; drm_radeon_getparam_t gp = {0}; + struct drm_radeon_info info = {0}; int target = 0; int retval; + info.value = ⌖ gp.value = ⌖ /* First, get the number of pixel pipes */ - gp.param = RADEON_PARAM_NUM_GB_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); + info.request = RADEON_INFO_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, error number %d\n", + fprintf(stderr, "%s: New ioctl for GB pipe count failed " + "(error number %d), trying classic ioctl...\n", __FUNCTION__, retval); - exit(1); + gp.param = RADEON_PARAM_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)); + if (retval) { + fprintf(stderr, "%s: Failed to get GB pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } } winsys->gb_pipes = target; /* Then, get PCI ID */ - gp.param = RADEON_PARAM_DEVICE_ID; - retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); + info.request = RADEON_INFO_DEVICE_ID; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get PCI ID, error number %d\n", + fprintf(stderr, "%s: New ioctl for PCI ID failed " + "(error number %d), trying classic ioctl...\n", __FUNCTION__, retval); - exit(1); + gp.param = RADEON_PARAM_DEVICE_ID; + retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)); + if (retval) { + fprintf(stderr, "%s: Failed to get PCI ID, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } } winsys->pci_id = target; /* Finally, retrieve MM info */ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, - &info, sizeof(info)); + &gem_info, sizeof(gem_info)); if (retval) { fprintf(stderr, "%s: Failed to get MM info, error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->gart_size = info.gart_size; + winsys->gart_size = gem_info.gart_size; /* XXX */ - winsys->vram_size = info.vram_visible; + winsys->vram_size = gem_info.vram_visible; } struct r300_winsys* diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index 5c373cd084..98586746cd 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -31,5 +31,16 @@ #include "radeon_buffer.h" +/* protect us from bonghits */ +#ifndef RADEON_INFO_NUM_GB_PIPES +#define RADEON_INFO_NUM_GB_PIPES 0 +#endif +#ifndef RADEON_INFO_DEVICE_ID +#define RADEON_INFO_DEVICE_ID 0 +#endif +#ifndef DRM_RADEON_INFO +#define DRM_RADEON_INFO 0x1 +#endif + struct r300_winsys* radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys); -- cgit v1.2.3 From f38a02212fef426dd3f86e5d0f52126e4132a003 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 11 May 2009 09:55:28 -0700 Subject: radeon-gallium: Forgot a typedef. --- src/gallium/winsys/drm/radeon/core/radeon_r300.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index 98586746cd..19c7ed2626 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -40,6 +40,11 @@ #endif #ifndef DRM_RADEON_INFO #define DRM_RADEON_INFO 0x1 +struct drm_radeon_info { + uint32_t request; + uint32_t pad; + uint64_t value; +}; #endif struct r300_winsys* -- cgit v1.2.3 From e9f8b7f1b9fee80fd705864d047cc017059143f8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 11 May 2009 09:57:57 -0700 Subject: r300-gallium: Cleanup PSC for HW TCL. Still dies in assert, but at least it's not my assert anymore. :3 --- src/gallium/drivers/r300/r300_state_derived.c | 35 ++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index c4c9784a00..caa5f3b543 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -162,26 +162,40 @@ static void r300_vs_tab_routes(struct r300_context* r300, static void r300_vertex_psc(struct r300_context* r300, struct r300_vertex_format* vformat) { + struct r300_screen* r300screen = r300_screen(r300->context.screen); struct vertex_info* vinfo = &vformat->vinfo; int* tab = vformat->vs_tab; uint32_t temp; - int i; + int i, attrib_count; - debug_printf("r300: attrib count: %d\n", vinfo->num_attribs); - for (i = 0; i < vinfo->num_attribs; i++) { - debug_printf("r300: attrib: offset %d, interp %d, size %d," - " tab %d\n", vinfo->attrib[i].src_index, - vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, - tab[i]); + /* Vertex shaders have no semantics on their inputs, + * so PSC should just route stuff based on their info, + * and not on attrib information. */ + if (r300screen->caps->has_tcl) { + attrib_count = r300->vs->info.num_inputs; + debug_printf("r300: routing %d attribs in psc for vs\n", + attrib_count); + } else { + attrib_count = vinfo->num_attribs; + debug_printf("r300: attrib count: %d\n", attrib_count); + for (i = 0; i < attrib_count; i++) { + debug_printf("r300: attrib: offset %d, interp %d, size %d," + " tab %d\n", vinfo->attrib[i].src_index, + vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, + tab[i]); + } } - for (i = 0; i < vinfo->num_attribs; i++) { + for (i = 0; i < attrib_count; i++) { /* Make sure we have a proper destination for our attribute */ assert(tab[i] != -1); /* Add the attribute to the PSC table. */ - temp = translate_vertex_data_type(vinfo->attrib[i].emit) | - (tab[i] << R300_DST_VEC_LOC_SHIFT); + temp = r300screen->caps->has_tcl ? + R300_DATA_TYPE_FLOAT_4 : + translate_vertex_data_type(vinfo->attrib[i].emit); + temp |= tab[i] << R300_DST_VEC_LOC_SHIFT; + if (i & 1) { vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff; vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16; @@ -206,7 +220,6 @@ static void r300_vertex_psc(struct r300_context* r300, /* Update the vertex format. */ static void r300_update_vertex_format(struct r300_context* r300) { - struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_vertex_format vformat; int i; -- cgit v1.2.3 From b315ec43eed981b867bc3af16d0e6dc4d050e9ae Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 11 May 2009 10:07:40 -0700 Subject: r300-gallium: Cleanup some compile warnings. --- src/gallium/drivers/r300/r300_surface.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 4dd5b8af99..33bc4ad0ca 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -23,19 +23,17 @@ #include "r300_surface.h" -static void r300_surface_setup(struct pipe_context* pipe, - struct pipe_surface* dest, +static void r300_surface_setup(struct r300_context* r300, + struct r300_texture* dest, unsigned x, unsigned y, unsigned w, unsigned h) { - struct r300_context* r300 = r300_context(pipe); - struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; - struct r300_texture* tex = (struct r300_texture*)dest->texture; - unsigned pixpitch = tex->stride / tex->tex.block.size; + struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; + unsigned pixpitch = dest->stride / dest->tex.block.size; CS_LOCALS(r300); /* Make sure our target BO is okay. */ - r300->winsys->add_buffer(r300->winsys, tex->buffer, + r300->winsys->add_buffer(r300->winsys, dest->buffer, 0, RADEON_GEM_DOMAIN_VRAM); if (r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); @@ -71,9 +69,9 @@ static void r300_surface_setup(struct pipe_context* pipe, /* Setup colorbuffer. */ OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1); - OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); + OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); OUT_CS_REG(R300_RB3D_COLORPITCH0, pixpitch | - r300_translate_colorformat(tex->tex.format)); + r300_translate_colorformat(dest->tex.format)); OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0xf); END_CS; @@ -110,7 +108,7 @@ static void r300_surface_fill(struct pipe_context* pipe, return; } - r300_surface_setup(r300, dest, x, y, w, h); + r300_surface_setup(r300, tex, x, y, w, h); /* Vertex shader setup */ if (caps->has_tcl) { -- cgit v1.2.3 From 64f60bc04666dbe2b53c951a2fbab06e2628ee1b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 11 May 2009 10:09:59 -0700 Subject: r300-gallium: Setup surface in r300_surface_copy. I haven't tested, but this may unbreak surface copies. --- src/gallium/drivers/r300/r300_surface.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 33bc4ad0ca..d6f3fe1466 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -225,6 +225,8 @@ static void r300_surface_copy(struct pipe_context* pipe, srcx, srcy, w, h); } + r300_surface_setup(r300, desttex, x, y, w, h); + r300_emit_sampler(r300, &r300_sampler_copy_state, 0); r300_emit_texture(r300, srctex, 0); r300_flush_textures(r300); -- cgit v1.2.3 From 783e43064b64feb87e0457f96c2275160389f84c Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Mon, 11 May 2009 21:44:49 +0200 Subject: r300-gallium: unbreak build --- src/gallium/drivers/r300/r300_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index d6f3fe1466..3198c97378 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -225,7 +225,7 @@ static void r300_surface_copy(struct pipe_context* pipe, srcx, srcy, w, h); } - r300_surface_setup(r300, desttex, x, y, w, h); + r300_surface_setup(r300, desttex, destx, desty, w, h); r300_emit_sampler(r300, &r300_sampler_copy_state, 0); r300_emit_texture(r300, srctex, 0); -- cgit v1.2.3 From f5cf181c65293fd9097f63192c09f44b9c82c633 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 16:08:01 -0600 Subject: trivial: destroy window upon exit --- progs/trivial/tri.c | 1 + 1 file changed, 1 insertion(+) diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c index d44cb6a9fe..cac3fcb7d9 100644 --- a/progs/trivial/tri.c +++ b/progs/trivial/tri.c @@ -60,6 +60,7 @@ static void Key(unsigned char key, int x, int y) { switch (key) { case 27: + glutDestroyWindow(win); exit(0); default: glutPostRedisplay(); -- cgit v1.2.3 From f104e4d666dfccda6f5ad817693216733ddede44 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 11 May 2009 16:09:39 -0600 Subject: st: do proper refcounting for framebuffer surfaces --- src/mesa/state_tracker/st_atom_framebuffer.c | 16 ++++++++++------ src/mesa/state_tracker/st_context.c | 7 +++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index df0f0931ea..536293683e 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -98,8 +98,6 @@ update_framebuffer_state( struct st_context *st ) struct st_renderbuffer *strb; GLuint i; - memset(framebuffer, 0, sizeof(*framebuffer)); - framebuffer->width = fb->Width; framebuffer->height = fb->Height; @@ -120,12 +118,19 @@ update_framebuffer_state( struct st_context *st ) } if (strb->surface) { - framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface; + pipe_surface_reference(&framebuffer->cbufs[framebuffer->nr_cbufs], + strb->surface); framebuffer->nr_cbufs++; } } } + for (i = framebuffer->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&framebuffer->cbufs[i], NULL); + } + /* + * Depth/Stencil renderbuffer/surface. + */ strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer); if (strb) { strb = st_renderbuffer(strb->Base.Wrapped); @@ -133,15 +138,14 @@ update_framebuffer_state( struct st_context *st ) /* rendering to a GL texture, may have to update surface */ update_renderbuffer_surface(st, strb); } - - framebuffer->zsbuf = strb->surface; + pipe_surface_reference(&framebuffer->zsbuf, strb->surface); } else { strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer); if (strb) { strb = st_renderbuffer(strb->Base.Wrapped); assert(strb->surface); - framebuffer->zsbuf = strb->surface; + pipe_surface_reference(&framebuffer->zsbuf, strb->surface); } } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 2a1f21c51c..e536029e86 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -233,6 +233,7 @@ void st_destroy_context( struct st_context *st ) struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; GLcontext *ctx = st->ctx; + GLuint i; /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st->cso_context); @@ -240,6 +241,12 @@ void st_destroy_context( struct st_context *st ) st_reference_fragprog(st, &st->fp, NULL); st_reference_vertprog(st, &st->vp, NULL); + /* release framebuffer surfaces */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&st->state.framebuffer.cbufs[i], NULL); + } + pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL); + _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); _vbo_DestroyContext(st->ctx); -- cgit v1.2.3 From 64f36ff9fbe7e12c79cd72ceb68ed5967979445f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 28 Apr 2009 10:08:57 -0700 Subject: Test either GL_FRONT_LEFT or GL_FRONT for front-buffer rendering For non-stereo visuals, which is all we support, we treat GL_FRONT_LEFT as GL_FRONT. However, they are technically different, and they have different enum values. Test for either one to determine if we're in front-buffer rendering mode. This fix was suggested by Pierre Willenbrock. Signed-off-by: Ian Romanick (cherry picked from commit 2085cf24628be7cd297ab0f9ef5ce02bd5a006e2) --- src/mesa/drivers/dri/intel/intel_buffers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index ecac5bf020..b86cafea24 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -326,7 +326,8 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode) const GLboolean was_front_buffer_rendering = intel->is_front_buffer_rendering; - intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT); + intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) + || (mode == GL_FRONT); /* If we weren't front-buffer rendering before but we are now, make sure * that the front-buffer has actually been allocated. -- cgit v1.2.3 From 46b81b0cc883df0ef7d998be36ae6cbf80257cd2 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 12 May 2009 08:01:22 +0200 Subject: glXChooseVisual: Only consider fbconfig if we can get the corresponding visual. This can fail, e.g. when XLIB_SKIP_ARGB_VISUALS=1 is set. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524794 and http://bugs.freedesktop.org/show_bug.cgi?id=21600 . --- src/glx/x11/glxcmds.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index b9e0706d31..ec3e69e4fe 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1319,30 +1319,31 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList) ** Eliminate visuals that don't meet minimum requirements ** Compute a score for those that do ** Remember which visual, if any, got the highest score + ** If no visual is acceptable, return None + ** Otherwise, create an XVisualInfo list with just the selected X visual + ** and return this. */ for ( modes = psc->visuals ; modes != NULL ; modes = modes->next ) { if ( fbconfigs_compatible( & test_config, modes ) && ((best_config == NULL) || (fbconfig_compare( (const __GLcontextModes * const * const)&modes, &best_config ) < 0)) ) { - best_config = modes; + XVisualInfo visualTemplate; + XVisualInfo *newList; + int i; + + visualTemplate.screen = screen; + visualTemplate.visualid = modes->visualID; + newList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask, + &visualTemplate, &i ); + + if (newList) { + Xfree(visualList); + visualList = newList; + best_config = modes; + } } } - /* - ** If no visual is acceptable, return None - ** Otherwise, create an XVisualInfo list with just the selected X visual - ** and return this. - */ - if (best_config != NULL) { - XVisualInfo visualTemplate; - int i; - - visualTemplate.screen = screen; - visualTemplate.visualid = best_config->visualID; - visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask, - &visualTemplate, &i ); - } - return visualList; } -- cgit v1.2.3 From 0bfa8dfaaf49703eb5c3237b5cae6201b8755e4d Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Tue, 12 May 2009 09:32:11 +0200 Subject: radeon: avoid segfault in radeon_update_renderbuffers() if using DRI1 Basically the same as 43d9020ff1e975e7f4f9480d9ef24f0b9fb2141f for intel. Bug 21688. Signed-off-by: Tormod Volden --- src/mesa/drivers/dri/radeon/radeon_common_context.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 124b587bab..6fb6f92cb9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -428,7 +428,7 @@ void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) { unsigned int attachments[10]; - __DRIbuffer *buffers; + __DRIbuffer *buffers = NULL; __DRIscreen *screen; struct radeon_renderbuffer *rb; int i, count; @@ -444,7 +444,8 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) screen = context->driScreenPriv; radeon = (radeonContextPtr) context->driverPrivate; - if ((screen->dri2.loader->base.version > 2) + if (screen->dri2.loader + && (screen->dri2.loader->base.version > 2) && (screen->dri2.loader->getBuffersWithFormat != NULL)) { struct radeon_renderbuffer *depth_rb; struct radeon_renderbuffer *stencil_rb; @@ -481,7 +482,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) attachments, i / 2, &count, drawable->loaderPrivate); - } else { + } else if (screen->dri2.loader) { i = 0; if (draw->color_rb[0]) attachments[i++] = __DRI_BUFFER_FRONT_LEFT; -- cgit v1.2.3 From 05c19ec7f0717549c010afc0b6cdc81962d32675 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 12 May 2009 13:04:32 +0200 Subject: r300/r500: make sure we detect constant buffer changes This was broken with last merge see f48473e42511f8d37a239a07f791bc0a87209e5b for explanations. --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 6eaad76550..2a880e6d14 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -281,7 +281,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) r300_fp->translated = GL_TRUE; - r300UpdateStateParameters(ctx, _NEW_PROGRAM); + r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); if (r300_fp->error || (RADEON_DEBUG & DEBUG_PIXEL)) r300->vtbl.FragmentProgramDump(&r300_fp->code); -- cgit v1.2.3 From c514c1f99493147bbba7a1dbe157c0492f4cf2eb Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 12 May 2009 13:05:57 +0200 Subject: radeon: glReadBuffer set _NEW_BUFFERS, not _NEW_PIXEL This was broken with last merge see 62043b27575c378c027251316421e4699f461108 for explanations --- src/mesa/drivers/dri/r200/r200_state.c | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_state.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index a06ea17e79..6802e190a7 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2319,7 +2319,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { _mesa_update_framebuffer(ctx); /* this updates the DrawBuffer's Width/Height if it's a FBO */ _mesa_update_draw_buffer_bounds(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 217a16818e..301ede3aed 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2221,7 +2221,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) r300ResetHwState(rmesa); r300UpdateStateParameters(ctx, _NEW_PROGRAM | - _NEW_PROGRAM_CONSTANTS); + _NEW_PROGRAM_CONSTANTS); return; } } @@ -2441,7 +2441,7 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) _vbo_InvalidateState(ctx, new_state); _tnl_InvalidateState(ctx, new_state); - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { _mesa_update_framebuffer(ctx); /* this updates the DrawBuffer's Width/Height if it's a FBO */ _mesa_update_draw_buffer_bounds(ctx); diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index d9a7ef6061..34c8cb42fa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2094,7 +2094,7 @@ GLboolean radeonValidateState( GLcontext *ctx ) r100ContextPtr rmesa = R100_CONTEXT(ctx); GLuint new_state = rmesa->radeon.NewGLState; - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + if (new_state & _NEW_BUFFERS) { _mesa_update_framebuffer(ctx); /* this updates the DrawBuffer's Width/Height if it's a FBO */ _mesa_update_draw_buffer_bounds(ctx); -- cgit v1.2.3 From 6d63dec41f5399dbe5561175c1652d2ac5ffd4bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 May 2009 09:05:31 -0600 Subject: swrast: update/restore the opt_sample_rgb/rgba_2d() functions --- src/mesa/swrast/s_texfilter.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 31bfb5c952..0067d3eeb7 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1329,7 +1329,7 @@ static void opt_sample_rgb_2d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -1351,9 +1351,9 @@ opt_sample_rgb_2d(GLcontext *ctx, GLint j = IFLOOR(texcoords[k][1] * height) & rowMask; GLint pos = (j << shift) | i; GLchan *texel = ((GLchan *) img->Data) + 3*pos; - rgba[k][RCOMP] = texel[0]; - rgba[k][GCOMP] = texel[1]; - rgba[k][BCOMP] = texel[2]; + rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]); + rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]); + rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]); } } @@ -1370,7 +1370,7 @@ static void opt_sample_rgba_2d(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], - const GLfloat lambda[], GLchan rgba[][4]) + const GLfloat lambda[], GLfloat rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -1392,7 +1392,10 @@ opt_sample_rgba_2d(GLcontext *ctx, const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ - COPY_4V(rgba[i], texel); + rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]); + rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]); + rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]); + rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]); } } @@ -1425,7 +1428,6 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { -#if 0 case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); @@ -1434,7 +1436,6 @@ sample_lambda_2d(GLcontext *ctx, opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; -#endif default: sample_nearest_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart ); @@ -1484,7 +1485,6 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { -#if 0 case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); @@ -1493,7 +1493,6 @@ sample_lambda_2d(GLcontext *ctx, opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; -#endif default: sample_nearest_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart ); @@ -3180,7 +3179,6 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { /* check for a few optimized cases */ -#if 0 const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; ASSERT(t->MinFilter == GL_NEAREST); if (t->WrapS == GL_REPEAT && @@ -3197,10 +3195,6 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } -#else - if (0) - ; -#endif else { return &sample_nearest_2d; } -- cgit v1.2.3 From 0fc5fa85bf858ba2ad88995f65cc48b2dab1298d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 12 May 2009 10:03:08 -0700 Subject: i915: Fix driver after HW glGenerateMipmap commit. --- src/mesa/drivers/dri/i915/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 9f4bd1699f..beaf9a4b12 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -19,6 +19,7 @@ DRIVER_SOURCES = \ intel_batchbuffer.c \ intel_clear.c \ intel_extensions.c \ + intel_generatemipmap.c \ intel_mipmap_tree.c \ intel_tex_layout.c \ intel_tex_image.c \ -- cgit v1.2.3 From aa422b262509bc0763a50f63a51a1730139ea52f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 10 May 2009 09:45:43 -0700 Subject: intel: Map write-only buffer objects through the GTT when possible. This looks to be a win of a few percent in cairogears with new vbo code, thanks to not polluting caches. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 16 ++++++++++++++-- src/mesa/drivers/dri/intel/intel_buffer_objects.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index f6b0d769c6..0db1f392c0 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -214,6 +214,7 @@ intel_bufferobj_map(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); GLboolean read_only = (access == GL_READ_ONLY_ARB); + GLboolean write_only = (access == GL_WRITE_ONLY_ARB); assert(intel_obj); @@ -225,7 +226,14 @@ intel_bufferobj_map(GLcontext * ctx, return NULL; } - dri_bo_map(intel_obj->buffer, !read_only); + if (write_only && intel->intelScreen->kernel_exec_fencing) { + drm_intel_gem_bo_map_gtt(intel_obj->buffer); + intel_obj->mapped_gtt = GL_TRUE; + } else { + drm_intel_bo_map(intel_obj->buffer, !read_only); + intel_obj->mapped_gtt = GL_FALSE; + } + obj->Pointer = intel_obj->buffer->virtual; return obj->Pointer; } @@ -243,7 +251,11 @@ intel_bufferobj_unmap(GLcontext * ctx, assert(intel_obj); if (intel_obj->buffer != NULL) { assert(obj->Pointer); - dri_bo_unmap(intel_obj->buffer); + if (intel_obj->mapped_gtt) { + drm_intel_gem_bo_unmap_gtt(intel_obj->buffer); + } else { + drm_intel_bo_unmap(intel_obj->buffer); + } obj->Pointer = NULL; } return GL_TRUE; diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.h b/src/mesa/drivers/dri/intel/intel_buffer_objects.h index bf6dbd58f2..7ef723833c 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.h @@ -46,6 +46,7 @@ struct intel_buffer_object struct intel_region *region; /* Is there a zero-copy texture associated with this (pixel) buffer object? */ + GLboolean mapped_gtt; }; -- cgit v1.2.3 From d4a42b0ce6455d03be70aa56aacd779be193aca4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 10 May 2009 10:08:32 -0700 Subject: intel: Skip the DRI2 renderbuffer update when doing Viewport on an FBO. --- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 8b3e50f9b6..7c77a1c819 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -393,7 +393,7 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) if (!driContext->driScreenPriv->dri2.enabled) return; - if (!intel->internal_viewport_call) { + if (!intel->internal_viewport_call && ctx->DrawBuffer->Name == 0) { intel_update_renderbuffers(driContext, driContext->driDrawablePriv); if (driContext->driDrawablePriv != driContext->driReadablePriv) intel_update_renderbuffers(driContext, driContext->driReadablePriv); -- cgit v1.2.3 From 723bc9452fee2602fa702699141e91b87872e621 Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Tue, 12 May 2009 19:38:17 +0200 Subject: progs/trivial: update .gitignore with new binaries --- progs/trivial/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore index 8dcb20a68f..dce733a70a 100644 --- a/progs/trivial/.gitignore +++ b/progs/trivial/.gitignore @@ -19,6 +19,7 @@ fs-tri line line-clip line-cull +line-flat line-smooth line-stipple-wide line-userclip @@ -130,6 +131,7 @@ tristrip-flat vbo-drawarrays vbo-drawelements vbo-drawrange +vbo-noninterleaved vp-array vp-array-int vp-clip @@ -139,6 +141,7 @@ vp-tri-cb vp-tri-cb-pos vp-tri-cb-tex vp-tri-imm +vp-tri-invariant vp-tri-swap vp-tri-tex vp-unfilled -- cgit v1.2.3 From 62c0c7d81a3f271b7dc7177467f9c884e89f9eee Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Tue, 12 May 2009 21:41:48 +0200 Subject: r300-gallium: duplicate tokens in create_fs_state This was all phoenix64's idea. Credit goes to him --- src/gallium/drivers/r300/r300_state.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0143e228c4..80e11d6ecf 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -289,6 +289,7 @@ static void* r300_create_fs_state(struct pipe_context* pipe, /* Copy state directly into shader. */ fs->state = *shader; + fs->state.tokens = tgsi_dup_tokens(shader->tokens); tgsi_scan_shader(shader->tokens, &fs->info); @@ -317,6 +318,8 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) /* Delete fragment shader state. */ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader) { + struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader + FREE(fs->state.tokens); FREE(shader); } -- cgit v1.2.3 From 167a6b08048573079c7d5e5f36da3de69d487b6f Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Tue, 12 May 2009 22:01:59 +0200 Subject: r300-gallium: add missing semicolon Yeah, that was stupid --- src/gallium/drivers/r300/r300_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 80e11d6ecf..2118f7706f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -318,7 +318,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) /* Delete fragment shader state. */ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader) { - struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader + struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader; FREE(fs->state.tokens); FREE(shader); } -- cgit v1.2.3 From 4d244fb8999440a1876281574eb045f0a5895e9e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 May 2009 09:16:27 -0600 Subject: i965: comment --- src/mesa/drivers/dri/i965/brw_wm_iz.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.c b/src/mesa/drivers/dri/i965/brw_wm_iz.c index bd60ac9b31..8fd067abe7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.c +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.c @@ -116,6 +116,10 @@ const struct { { C, 0, 1, 1, 1 } }; +/** + * \param line_aa AA_NEVER, AA_ALWAYS or AA_SOMETIMES + * \param lookup bitmask of IZ_* flags + */ void brw_wm_lookup_iz( GLuint line_aa, GLuint lookup, struct brw_wm_prog_key *key ) -- cgit v1.2.3 From 5590798f6d338e93ae6bee82ba5224568237ec18 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 May 2009 14:07:51 -0600 Subject: i965: increase BRW_EU_MAX_INSN --- src/mesa/drivers/dri/i965/brw_eu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 62c98bd8bb..bc7756ceab 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -97,7 +97,7 @@ struct brw_glsl_call; #define BRW_EU_MAX_INSN_STACK 5 -#define BRW_EU_MAX_INSN 4000 +#define BRW_EU_MAX_INSN 10000 struct brw_compile { struct brw_instruction store[BRW_EU_MAX_INSN]; -- cgit v1.2.3 From 10c4a10b979bddd099287dec5b69243c2ade8ade Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 May 2009 14:08:52 -0600 Subject: i965: enable additional code in emit_fb_write() Not 100% sure this is right, but the invalid assertion is fixed... --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 2b2df7329c..23caf59435 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -814,27 +814,26 @@ static void emit_fb_write(struct brw_wm_compile *c, } if (c->key.dest_depth_reg) { - GLuint comp = c->key.dest_depth_reg / 2; - GLuint off = c->key.dest_depth_reg % 2; + const GLuint comp = c->key.dest_depth_reg / 2; + const GLuint off = c->key.dest_depth_reg % 2; - assert(comp == 1); - assert(off == 0); -#if 0 - /* XXX do we need this code? comp always 1, off always 0, it seems */ if (off != 0) { + /* XXX this code needs review/testing */ + struct brw_reg arg1_0 = get_src_reg(c, inst, 1, comp); + struct brw_reg arg1_1 = get_src_reg(c, inst, 1, comp+1); + brw_push_insn_state(p); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, brw_message_reg(nr), offset(arg1[comp],1)); + brw_MOV(p, brw_message_reg(nr), offset(arg1_0, 1)); /* 2nd half? */ - brw_MOV(p, brw_message_reg(nr+1), arg1[comp+1]); + brw_MOV(p, brw_message_reg(nr+1), arg1_1); brw_pop_insn_state(p); } else -#endif { - struct brw_reg src = get_src_reg(c, inst, 1, 1); - brw_MOV(p, brw_message_reg(nr), src); + struct brw_reg src = get_src_reg(c, inst, 1, 1); + brw_MOV(p, brw_message_reg(nr), src); } nr += 2; } -- cgit v1.2.3 From 5568f2f601fbd974af402da92548904f6fafc6dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 09:27:31 -0600 Subject: mesa: reference counting for gl_array_object Every kind of object that can be shared by multiple contexts should be refcounted. (cherry picked from commit 1030bf0ded2a88a5e27f7a4d393c11cfde3d3c5a) --- src/mesa/main/arrayobj.c | 67 +++++++++++++++++++++++++++++++++++++++++++++--- src/mesa/main/arrayobj.h | 23 ++++++++++++----- src/mesa/main/mtypes.h | 3 +++ src/mesa/main/varray.c | 4 +-- 4 files changed, 84 insertions(+), 13 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index b04095fd16..ccb5b8e157 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -94,10 +94,69 @@ void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) { (void) ctx; + _glthread_DESTROY_MUTEX(obj->Mutex); _mesa_free(obj); } +/** + * Set ptr to arrayObj w/ reference counting. + */ +void +_mesa_reference_array_object(GLcontext *ctx, + struct gl_array_object **ptr, + struct gl_array_object *arrayObj) +{ + if (*ptr == arrayObj) + return; + + if (*ptr) { + /* Unreference the old array object */ + GLboolean deleteFlag = GL_FALSE; + struct gl_array_object *oldObj = *ptr; + + _glthread_LOCK_MUTEX(oldObj->Mutex); + ASSERT(oldObj->RefCount > 0); + oldObj->RefCount--; +#if 0 + printf("ArrayObj %p %d DECR to %d\n", + (void *) oldObj, oldObj->Name, oldObj->RefCount); +#endif + deleteFlag = (oldObj->RefCount == 0); + _glthread_UNLOCK_MUTEX(oldObj->Mutex); + + if (deleteFlag) { + ASSERT(ctx->Driver.DeleteArrayObject); + ctx->Driver.DeleteArrayObject(ctx, oldObj); + } + + *ptr = NULL; + } + ASSERT(!*ptr); + + if (arrayObj) { + /* reference new array object */ + _glthread_LOCK_MUTEX(arrayObj->Mutex); + if (arrayObj->RefCount == 0) { + /* this array's being deleted (look just above) */ + /* Not sure this can every really happen. Warn if it does. */ + _mesa_problem(NULL, "referencing deleted array object"); + *ptr = NULL; + } + else { + arrayObj->RefCount++; +#if 0 + printf("ArrayObj %p %d INCR to %d\n", + (void *) arrayObj, arrayObj->Name, arrayObj->RefCount); +#endif + *ptr = arrayObj; + } + _glthread_UNLOCK_MUTEX(arrayObj->Mutex); + } +} + + + static void init_array(GLcontext *ctx, struct gl_client_array *array, GLint size, GLint type) @@ -129,6 +188,9 @@ _mesa_initialize_array_object( GLcontext *ctx, obj->Name = name; + _glthread_INIT_MUTEX(obj->Mutex); + obj->RefCount = 1; + /* Init the individual arrays */ init_array(ctx, &obj->Vertex, 4, GL_FLOAT); init_array(ctx, &obj->Normal, 3, GL_FLOAT); @@ -226,7 +288,6 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) if (!newObj) { /* If this is a new array object id, allocate an array object now. */ - newObj = (*ctx->Driver.NewArrayObject)(ctx, id); if (!newObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE"); @@ -236,11 +297,9 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) } } - ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; - ctx->Array.ArrayObj = newObj; - + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj); /* Pass BindVertexArray call to device driver */ if (ctx->Driver.BindArrayObject && newObj) diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index c7d66ec166..9c4036af5a 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -41,17 +41,26 @@ * Internal functions */ -struct gl_array_object * _mesa_new_array_object( GLcontext *ctx, - GLuint name ); +extern struct gl_array_object * +_mesa_new_array_object( GLcontext *ctx, GLuint name ); -void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ); -void _mesa_initialize_array_object( GLcontext *ctx, - struct gl_array_object *obj, GLuint name ); +extern void +_mesa_reference_array_object(GLcontext *ctx, + struct gl_array_object **ptr, + struct gl_array_object *arrayObj); -void _mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_initialize_array_object( GLcontext *ctx, + struct gl_array_object *obj, GLuint name ); -void _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ); +extern void +_mesa_save_array_object( GLcontext *ctx, struct gl_array_object *obj ); + +extern void +_mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ed6b1062bd..50dc2def87 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1557,6 +1557,9 @@ struct gl_array_object /** Name of the array object as received from glGenVertexArrayAPPLE. */ GLuint Name; + GLint RefCount; + _glthread_Mutex Mutex; + /** Conventional vertex arrays */ /*@{*/ struct gl_client_array Vertex; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 106252e460..72b3e834b3 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1050,7 +1050,7 @@ void _mesa_init_varray(GLcontext *ctx) { ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0); - ctx->Array.ArrayObj = ctx->Array.DefaultArrayObj; - + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, + ctx->Array.DefaultArrayObj); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ } -- cgit v1.2.3 From 7ae4ce9e22e39d78e2d31164c05a3b267fb48e3c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 09:32:53 -0600 Subject: mesa: clean-up vertex array object VBO unbinding and delete/refcounting Don't really delete vertex array objects until the refcount hits zero. At that time, unbind any pointers to VBOs. (cherry picked from commit 32b851c80792623195069d7a41a5808cff3b2f6f) --- src/mesa/main/arrayobj.c | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index ccb5b8e157..0fa5f0de55 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -68,6 +68,32 @@ lookup_arrayobj(GLcontext *ctx, GLuint id) } +/** + * For all the vertex arrays in the array object, unbind any pointers + * to any buffer objects (VBOs). + * This is done just prior to array object destruction. + */ +static void +unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) +{ + GLuint i; + + _mesa_reference_buffer_object(ctx, &obj->Vertex.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Normal.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Color.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->SecondaryColor.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->FogCoord.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Index.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->EdgeFlag.BufferObj, NULL); + + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + _mesa_reference_buffer_object(ctx, &obj->TexCoord[i].BufferObj, NULL); + + for (i = 0; i < VERT_ATTRIB_MAX; i++) + _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj,NULL); +} + + /** * Allocate and initialize a new vertex array object. * @@ -94,6 +120,7 @@ void _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj ) { (void) ctx; + unbind_array_object_vbos(ctx, obj); _glthread_DESTROY_MUTEX(obj->Mutex); _mesa_free(obj); } @@ -239,15 +266,6 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) } -static void -unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) -{ - if (bufObj != ctx->Array.NullBufferObj) { - _mesa_reference_buffer_object(ctx, &bufObj, NULL); - } -} - - /**********************************************************************/ /* API Functions */ /**********************************************************************/ @@ -274,7 +292,7 @@ _mesa_BindVertexArrayAPPLE( GLuint id ) return; /* rebinding the same array object- no change */ /* - * Get pointer to new array object (newBufObj) + * Get pointer to new array object (newObj) */ if (id == 0) { /* The spec says there is no array object named 0, but we use @@ -333,7 +351,6 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) if ( obj != NULL ) { ASSERT( obj->Name == ids[i] ); - /* If the array object is currently bound, the spec says "the binding * for that object reverts to zero and the default vertex array * becomes current." @@ -342,28 +359,13 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) CALL_BindVertexArrayAPPLE( ctx->Exec, (0) ); } -#if FEATURE_ARB_vertex_buffer_object - /* Unbind any buffer objects that might be bound to arrays in - * this array object. - */ - unbind_buffer_object( ctx, obj->Vertex.BufferObj ); - unbind_buffer_object( ctx, obj->Normal.BufferObj ); - unbind_buffer_object( ctx, obj->Color.BufferObj ); - unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); - unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); - unbind_buffer_object( ctx, obj->Index.BufferObj ); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); - } - unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); - for (i = 0; i < VERT_ATTRIB_MAX; i++) { - unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); - } -#endif - /* The ID is immediately freed for re-use */ _mesa_remove_array_object(ctx, obj); - ctx->Driver.DeleteArrayObject(ctx, obj); + + /* Unreference the array object. + * If refcount hits zero, the object will be deleted. + */ + _mesa_reference_array_object(ctx, &obj, NULL); } } -- cgit v1.2.3 From 3e74faa02948624cfbaf1f03854f27e0c9130759 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 09:47:13 -0600 Subject: mesa: delete array objects before buffer objects during context tear-down The former may point to the later. --- src/mesa/main/context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 60c48289e4..ec0dc12a3e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1005,10 +1005,11 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_query_data(ctx); #endif + _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); + #if FEATURE_ARB_vertex_buffer_object _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); #endif - _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); /* free dispatch tables */ _mesa_free(ctx->Exec); -- cgit v1.2.3 From 2e4e34689022ecfcc7dc107427db90cc52a94d63 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 10:28:00 -0600 Subject: intel: create a private gl_array_object for intel_clear_tris(), fix bug 21638 gl_array_object encapsulates a set of vertex arrays (see the GL_APPLE_vertex_array_object extension). Create a private gl_array_object for drawing the quad for intel_clear_tris() so we don't have to worry about the user's vertex array state. This fixes the no-op glClear bug #21638 and removes the need to call _mesa_PushClientAttrib() and _mesa_PopClientAttrib(). --- src/mesa/drivers/dri/intel/intel_clear.c | 93 ++++++++++++++++++++---------- src/mesa/drivers/dri/intel/intel_context.c | 3 + src/mesa/drivers/dri/intel/intel_context.h | 8 +++ 3 files changed, 75 insertions(+), 29 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index aed95c7c56..eb0d890f47 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -30,6 +30,7 @@ #include "main/enums.h" #include "main/image.h" #include "main/mtypes.h" +#include "main/arrayobj.h" #include "main/attrib.h" #include "main/blend.h" #include "main/bufferobj.h" @@ -66,6 +67,45 @@ BUFFER_BIT_COLOR6 | \ BUFFER_BIT_COLOR7) + +/** + * Per-context one-time init of things for intl_clear_tris(). + * Basically set up a private array object for vertex/color arrays. + */ +static void +init_clear(GLcontext *ctx) +{ + struct intel_context *intel = intel_context(ctx); + struct gl_array_object *arraySave = NULL; + const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name; + const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name; + + /* create new array object */ + intel->clear.arrayObj = _mesa_new_array_object(ctx, ~0); + + /* save current array object, bind new one */ + _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj); + + /* one-time setup of vertex arrays (pos, color) */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), intel->clear.color); + _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), intel->clear.vertices); + _mesa_Enable(GL_COLOR_ARRAY); + _mesa_Enable(GL_VERTEX_ARRAY); + + /* restore original array object */ + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); + _mesa_reference_array_object(ctx, &arraySave, NULL); + + /* restore original buffer objects */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer); + _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer); +} + + + /** * Perform glClear where mask contains only color, depth, and/or stencil. * @@ -78,14 +118,16 @@ void intel_clear_tris(GLcontext *ctx, GLbitfield mask) { struct intel_context *intel = intel_context(ctx); - GLfloat vertices[4][3]; - GLfloat color[4][4]; GLfloat dst_z; struct gl_framebuffer *fb = ctx->DrawBuffer; int i; GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE; GLuint saved_shader_program = 0; unsigned int saved_active_texture; + struct gl_array_object *arraySave = NULL; + + if (!intel->clear.arrayObj) + init_clear(ctx); assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) == 0); @@ -98,7 +140,6 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) GL_STENCIL_BUFFER_BIT | GL_TRANSFORM_BIT | GL_CURRENT_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); saved_active_texture = ctx->Texture.CurrentUnit; /* Disable existing GL state we don't want to apply to a clear. */ @@ -149,18 +190,14 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) } } -#if FEATURE_ARB_vertex_buffer_object - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); -#endif + /* save current array object, bind our private one */ + _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj); + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, intel->clear.arrayObj); intel_meta_set_passthrough_transform(intel); for (i = 0; i < 4; i++) { - color[i][0] = ctx->Color.ClearColor[0]; - color[i][1] = ctx->Color.ClearColor[1]; - color[i][2] = ctx->Color.ClearColor[2]; - color[i][3] = ctx->Color.ClearColor[3]; + COPY_4FV(intel->clear.color[i], ctx->Color.ClearColor); } /* convert clear Z from [0,1] to NDC coord in [-1,1] */ @@ -169,23 +206,18 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) /* Prepare the vertices, which are the same regardless of which buffer we're * drawing to. */ - vertices[0][0] = fb->_Xmin; - vertices[0][1] = fb->_Ymin; - vertices[0][2] = dst_z; - vertices[1][0] = fb->_Xmax; - vertices[1][1] = fb->_Ymin; - vertices[1][2] = dst_z; - vertices[2][0] = fb->_Xmax; - vertices[2][1] = fb->_Ymax; - vertices[2][2] = dst_z; - vertices[3][0] = fb->_Xmin; - vertices[3][1] = fb->_Ymax; - vertices[3][2] = dst_z; - - _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &color); - _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_COLOR_ARRAY); - _mesa_Enable(GL_VERTEX_ARRAY); + intel->clear.vertices[0][0] = fb->_Xmin; + intel->clear.vertices[0][1] = fb->_Ymin; + intel->clear.vertices[0][2] = dst_z; + intel->clear.vertices[1][0] = fb->_Xmax; + intel->clear.vertices[1][1] = fb->_Ymin; + intel->clear.vertices[1][2] = dst_z; + intel->clear.vertices[2][0] = fb->_Xmax; + intel->clear.vertices[2][1] = fb->_Ymax; + intel->clear.vertices[2][2] = dst_z; + intel->clear.vertices[3][0] = fb->_Xmin; + intel->clear.vertices[3][1] = fb->_Ymax; + intel->clear.vertices[3][2] = dst_z; while (mask != 0) { GLuint this_mask = 0; @@ -246,8 +278,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) if (saved_shader_program) _mesa_UseProgramObjectARB(saved_shader_program); - _mesa_PopClientAttrib(); _mesa_PopAttrib(); + + /* restore current array object */ + _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave); + _mesa_reference_array_object(ctx, &arraySave, NULL); } static const char *buffer_names[] = { diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index a6d8729d8f..07d53aad23 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -28,6 +28,7 @@ #include "main/glheader.h" #include "main/context.h" +#include "main/arrayobj.h" #include "main/extensions.h" #include "main/framebuffer.h" #include "main/imports.h" @@ -755,6 +756,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) INTEL_FIREVERTICES(intel); + _mesa_delete_array_object(&intel->ctx, intel->clear.arrayObj); + intel->vtbl.destroy(intel); release_texture_heaps = (intel->ctx.Shared->RefCount == 1); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index d798225ddd..f45e24ca3a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -215,6 +215,14 @@ struct intel_context GLuint ClearColor565; GLuint ClearColor8888; + /* info for intel_clear_tris() */ + struct + { + struct gl_array_object *arrayObj; + GLfloat vertices[4][3]; + GLfloat color[4][4]; + } clear; + /* Offsets of fields within the current vertex: */ GLuint coloroffset; -- cgit v1.2.3 From a892acef982bd17df81ae16131381a558208c112 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 11:15:00 -0600 Subject: st/mesa: enable GL_APPLE_vertex_array_object for gallium drivers --- src/mesa/state_tracker/st_cb_bufferobjects.c | 5 +++++ src/mesa/state_tracker/st_extensions.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index a94e11fff1..f5d802055f 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -28,6 +28,7 @@ #include "main/imports.h" #include "main/mtypes.h" +#include "main/arrayobj.h" #include "main/bufferobj.h" #include "st_inlines.h" @@ -307,4 +308,8 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions->MapBufferRange = st_bufferobj_map_range; functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions->UnmapBuffer = st_bufferobj_unmap; + + /* For GL_APPLE_vertex_array_object */ + functions->NewArrayObject = _mesa_new_array_object; + functions->DeleteArrayObject = _mesa_delete_array_object; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 8f6be50774..d526dfcf52 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -168,6 +168,8 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; + ctx->Extensions.APPLE_vertex_array_object = GL_TRUE; + ctx->Extensions.NV_blend_square = GL_TRUE; ctx->Extensions.NV_texgen_reflection = GL_TRUE; -- cgit v1.2.3 From a566b6d8ffa45728231f9040b15f86d403304c87 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 11:19:00 -0600 Subject: intel: enable GL_APPLE_vertex_array_object No special driver changes are needed for this extension. --- src/mesa/drivers/dri/intel/intel_extensions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 9ec1b4ec2f..1e8b1878ab 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -48,6 +48,7 @@ #define need_GL_EXT_point_parameters #define need_GL_EXT_secondary_color #define need_GL_EXT_stencil_two_side +#define need_GL_APPLE_vertex_array_object #define need_GL_ATI_separate_stencil #define need_GL_ATI_envmap_bumpmap #define need_GL_NV_point_sprite @@ -95,6 +96,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_texture_lod_bias", NULL }, { "GL_3DFX_texture_compression_FXT1", NULL }, { "GL_APPLE_client_storage", NULL }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions}, { "GL_MESA_pack_invert", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, -- cgit v1.2.3 From ac5bf63f7408414bf8d7993ad77d92b76830cec6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 11:24:11 -0600 Subject: docs: GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers --- docs/relnotes-7.6.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html index 77ce013d43..82c0c2e947 100644 --- a/docs/relnotes-7.6.html +++ b/docs/relnotes-7.6.html @@ -43,6 +43,7 @@ tbd
        • OpenVG front-end (state tracker for Gallium). This was written by Zack Rusin at Tungsten Graphics. +
        • GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers.
        -- cgit v1.2.3 From 99960393edb3d6c0d3702cf51b59c2e4189117c7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 May 2009 11:31:35 -0600 Subject: intel: added null ptr check Fixes segfault in context tear-down when glClear was never called. --- src/mesa/drivers/dri/intel/intel_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 07d53aad23..5dc3df395d 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -756,7 +756,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) INTEL_FIREVERTICES(intel); - _mesa_delete_array_object(&intel->ctx, intel->clear.arrayObj); + if (intel->clear.arrayObj) + _mesa_delete_array_object(&intel->ctx, intel->clear.arrayObj); intel->vtbl.destroy(intel); -- cgit v1.2.3 From 038f0bf5916df5bae1145d234589e5fd528bb7fa Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Fri, 8 May 2009 18:58:41 -0400 Subject: Remove subpixel offset from viewport Remove an eigth-pixel offset of the viewport inherited from R100 code. This seems not to be necessary and causes blurring when sampling textures 1:1. https://bugs.freedesktop.org/show_bug.cgi?id=20340 --- src/mesa/drivers/dri/r300/r300_state.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 301ede3aed..b82399574a 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -923,12 +923,6 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, * Window position and viewport transformation */ -/* - * To correctly position primitives: - */ -#define SUBPIXEL_X 0.125 -#define SUBPIXEL_Y 0.125 - static void r300UpdateWindow(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -949,9 +943,9 @@ static void r300UpdateWindow(GLcontext * ctx) } GLfloat sx = v[MAT_SX]; - GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X; + GLfloat tx = v[MAT_TX] + xoffset; GLfloat sy = v[MAT_SY] * y_scale; - GLfloat ty = (v[MAT_TY] * y_scale) + y_bias + SUBPIXEL_Y; + GLfloat ty = (v[MAT_TY] * y_scale) + y_bias; GLfloat sz = v[MAT_SZ] * depthScale; GLfloat tz = v[MAT_TZ] * depthScale; @@ -990,8 +984,8 @@ void r300UpdateViewportOffset(GLcontext * ctx) GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; const GLfloat *v = ctx->Viewport._WindowMap.m; - GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X; - GLfloat ty = (-v[MAT_TY]) + yoffset + SUBPIXEL_Y; + GLfloat tx = v[MAT_TX] + xoffset; + GLfloat ty = (-v[MAT_TY]) + yoffset; if (rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] != r300PackFloat32(tx) || rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] != r300PackFloat32(ty)) { -- cgit v1.2.3 From 34eab5dd9c837769f1259e1f900b4528586d23b2 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 6 May 2009 22:45:33 -0400 Subject: Call _mesa_update_stencil() before accessing ctx->Stencil._Enabled ctx->Stencil._Enabled is derived state and not immediately updated when the stencil parameters are changed; we need to make sure that it is up-to-date before accessing it. https://bugs.freedesktop.org/show_bug.cgi?id=21608 --- src/mesa/drivers/dri/radeon/radeon_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index decea4518e..2f55dadcb9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -744,6 +744,8 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) if (ctx->Driver.Enable) { ctx->Driver.Enable(ctx, GL_DEPTH_TEST, (ctx->Depth.Test && fb->Visual.depthBits > 0)); + /* Need to update the derived ctx->Stencil._Enabled first */ + _mesa_update_stencil(ctx); ctx->Driver.Enable(ctx, GL_STENCIL_TEST, (ctx->Stencil._Enabled && fb->Visual.stencilBits > 0)); } else { -- cgit v1.2.3 From ea6a74abbe4053b958d640425e061f0ceec92291 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 6 May 2009 22:42:50 -0400 Subject: Don't use an alpha texture format for GLX_TEXTURE_FORMAT_RGB_EXT In r300SetTexBuffer2(), if the passed in text glx_texture_format is GLX_TEXTURE_FORMAT_RGB_EXT, then we should use an RGB-only texture format, even if the DRI buffer has four channels. https://bugs.freedesktop.org/show_bug.cgi?id=21609 --- src/mesa/drivers/dri/r300/r300_texstate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 443fafe5e2..6d6a90aa88 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -449,7 +449,10 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val = rb->pitch; switch (rb->cpp) { case 4: - t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); + if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); + else + t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); t->pp_txfilter |= tx_table[2].filter; pitch_val /= 4; break; -- cgit v1.2.3 From ca792be42b238bd1c8f8a99ad72ea8558cbbfc32 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 9 May 2009 15:23:34 -0400 Subject: radeon: Don't crash generating mipmaps when pixels=NULL When a NULL value of pixels is passed to TexImage2D and SGIS_generate_mipmap is enabled, don't try to generate the mipmap tree: we don't have data yet for the texture and will crash. https://bugs.freedesktop.org/show_bug.cgi?id=21648 --- src/mesa/drivers/dri/radeon/radeon_texture.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 0f1d9c2158..564da19f58 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -612,11 +612,10 @@ static void radeon_teximage( _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } - } - - /* SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - radeon_generate_mipmap(ctx, texObj->Target, texObj); + /* SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + radeon_generate_mipmap(ctx, texObj->Target, texObj); + } } _mesa_unmap_teximage_pbo(ctx, packing); @@ -741,12 +740,12 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, int level, _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + radeon_generate_mipmap(ctx, texObj->Target, texObj); + } } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - radeon_generate_mipmap(ctx, texObj->Target, texObj); - } radeon_teximage_unmap(image); _mesa_unmap_teximage_pbo(ctx, packing); -- cgit v1.2.3 From 7cd57e35b6427068b87c2fdb6c2aadef57f53520 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 13 May 2009 19:43:04 -0400 Subject: R1xx/r2xx: Don't use an alpha texture format for GLX_TEXTURE_FORMAT_RGB_EXT In r*00SetTexBuffer2(), if the passed in text glx_texture_format is GLX_TEXTURE_FORMAT_RGB_EXT, then we should use an RGB-only texture format, even if the DRI buffer has four channels. https://bugs.freedesktop.org/show_bug.cgi?id=21609 --- src/mesa/drivers/dri/r200/r200_texstate.c | 5 ++++- src/mesa/drivers/dri/radeon/radeon_texstate.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index eee54cd73b..ed1995e147 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -850,7 +850,10 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val = rb->pitch; switch (rb->cpp) { case 4: - t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format; + if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; + else + t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format; t->pp_txfilter |= tx_table_le[MESA_FORMAT_ARGB8888].filter; break; case 3: diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index e4df33766e..279bcd4df6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -722,7 +722,10 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ pitch_val = rb->pitch; switch (rb->cpp) { case 4: - t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format; + if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; + else + t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format; t->pp_txfilter |= tx_table[MESA_FORMAT_ARGB8888].filter; break; case 3: -- cgit v1.2.3 From 15601e970250e12f5d566ba782aae06d9714fbdc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 13 May 2009 17:01:03 -0700 Subject: r300-gallium: Space accounting for textures. --- src/gallium/drivers/r300/r300_emit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index c73d5a0b44..cd5c38a0c7 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -460,7 +460,6 @@ void r300_emit_dirty_state(struct r300_context* r300) for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); - if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); } @@ -468,10 +467,16 @@ void r300_emit_dirty_state(struct r300_context* r300) if (r300->framebuffer_state.zsbuf) { tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture; assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); - if (!tex->buffer) return; r300->winsys->add_buffer(r300->winsys, tex->buffer, 0, RADEON_GEM_DOMAIN_VRAM); } + /* ...textures... */ + for (i = 0; i < r300->texture_count; i++) { + tex = r300->textures[i]; + assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + r300->winsys->add_buffer(r300->winsys, tex->buffer, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + } /* ...and vertex buffer. */ if (r300->vbo) { r300->winsys->add_buffer(r300->winsys, r300->vbo, -- cgit v1.2.3 From d3912e301fd707738b0952cd11e19f34b87765b8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 13 May 2009 17:24:47 -0700 Subject: r300-gallium: Clean up outdated comments. --- src/gallium/drivers/r300/r300_chipset.c | 3 --- src/gallium/drivers/r300/r300_context.c | 1 - 2 files changed, 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 9d95ad918c..db09f27bfa 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -349,7 +349,4 @@ void r300_parse_chipset(struct r300_capabilities* caps) caps->pci_id); break; } - - /* XXX SW TCL is broken so no forcing it off right now - caps->has_tcl = FALSE; */ } diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index a4e89c37d1..a1cdea30de 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -129,7 +129,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, if (!r300) return NULL; - /* XXX this could be refactored now? */ r300->winsys = r300_winsys; r300->context.winsys = (struct pipe_winsys*)r300_winsys; -- cgit v1.2.3 From 09c04db3c900e4ed833d060853b48c7ca23697e1 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 14 May 2009 11:07:49 +0200 Subject: r300: Make sure to drop current hardware state reference to texture objects. Fixes potential texture object leaks. --- src/mesa/drivers/dri/r300/r300_context.c | 7 +++++++ src/mesa/drivers/dri/r300/r300_texstate.c | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 12bee1a8fb..8f0effd83e 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/matrix.h" #include "main/extensions.h" #include "main/state.h" +#include "main/texobj.h" #include "main/bufferobj.h" #include "swrast/swrast.h" @@ -500,6 +501,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) r300ContextPtr r300 = (r300ContextPtr) driContextPriv->driverPrivate; radeonContextPtr radeon = (radeonContextPtr) r300; radeonContextPtr current = ctx ? RADEON_CONTEXT(ctx) : NULL; + int i; if (RADEON_DEBUG & DEBUG_DRI) { fprintf(stderr, "Destroying context !\n"); @@ -553,6 +555,11 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) assert(is_empty_list(&r300->swapped)); } + /* Drop texture object references from current hardware state */ + for (i = 0; i < 8; i++) { + _mesa_reference_texobj(&r300->state.texture.unit[i].texobj, NULL); + } + radeonCleanupContext(&r300->radeon); #ifdef USER_BUFFERS diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index abe613e27b..f6ae4b675b 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -557,12 +557,15 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - struct gl_texture_object *tObj = texUnit->_Current; - r300TexObjPtr t = (r300TexObjPtr) tObj->DriverData; + struct gl_texture_object *tObj = texUnit->_ReallyEnabled ? + texUnit->_Current : NULL; + r300TexObjPtr t = tObj ? (r300TexObjPtr) tObj->DriverData : NULL; /* Fallback if there's a texture border */ - if (tObj->Image[0][tObj->BaseLevel]->Border > 0) - return GL_FALSE; + if (tObj && tObj->Image[0][tObj->BaseLevel]->Border > 0) { + tObj = NULL; + t = NULL; + } /* Update state if this is a different texture object to last * time. @@ -579,11 +582,14 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit) } _mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj); - t->base.bound |= (1 << unit); - driUpdateTextureLRU(&t->base); /* XXX: should be locked! */ + + if (t) { + t->base.bound |= (1 << unit); + driUpdateTextureLRU(&t->base); /* XXX: should be locked! */ + } } - return !t->border_fallback; + return !t || !t->border_fallback; } void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, @@ -651,7 +657,7 @@ static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit) } else if (texUnit->_ReallyEnabled) { return GL_FALSE; } else { - return GL_TRUE; + return r300UpdateTexture(ctx, unit); } } -- cgit v1.2.3 From 76a64958a4ca38ec27b63a909979c493c507b952 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 14 May 2009 17:24:19 +0200 Subject: r300: don't send now forbidden register to kernel when with memory manager --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 51 ++++++++++++++++++++++++++++---- src/mesa/drivers/dri/r300/r300_context.h | 10 +++++-- src/mesa/drivers/dri/r300/r300_state.c | 22 +++++++++----- 3 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 6ae724bff9..a0d99ddfb6 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -308,6 +308,34 @@ static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom) END_BATCH(); } +static void emit_gb_misc(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + BATCH_LOCALS(&r300->radeon); + + if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) { + BEGIN_BATCH_NO_AUTOSTATE(4); + OUT_BATCH(atom->cmd[0]); + OUT_BATCH(atom->cmd[1]); + OUT_BATCH(atom->cmd[2]); + OUT_BATCH(atom->cmd[3]); + END_BATCH(); + } +} + +static void emit_shade_misc(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + BATCH_LOCALS(&r300->radeon); + + if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) { + BEGIN_BATCH_NO_AUTOSTATE(2); + OUT_BATCH(atom->cmd[0]); + OUT_BATCH(atom->cmd[1]); + END_BATCH(); + } +} + static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -464,7 +492,10 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(gb_enable, always, 2, 0); r300->hw.gb_enable.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GB_ENABLE, 1); ALLOC_STATE(gb_misc, always, R300_GB_MISC_CMDSIZE, 0); - r300->hw.gb_misc.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GB_MSPOS0, 5); + r300->hw.gb_misc.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GB_MSPOS0, 3); + r300->hw.gb_misc.emit = emit_gb_misc; + ALLOC_STATE(gb_misc2, always, R300_GB_MISC2_CMDSIZE, 0); + r300->hw.gb_misc2.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, 0x401C, 2); ALLOC_STATE(txe, always, R300_TXE_CMDSIZE, 0); r300->hw.txe.cmd[R300_TXE_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_TX_ENABLE, 1); ALLOC_STATE(ga_point_s0, always, 5, 0); @@ -479,8 +510,11 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.lcntl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GA_LINE_CNTL, 1); ALLOC_STATE(ga_line_stipple, always, 4, 0); r300->hw.ga_line_stipple.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GA_LINE_STIPPLE_VALUE, 3); - ALLOC_STATE(shade, always, 5, 0); - r300->hw.shade.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GA_ENHANCE, 4); + ALLOC_STATE(shade, always, 2, 0); + r300->hw.shade.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GA_ENHANCE, 1); + r300->hw.shade.emit = emit_shade_misc; + ALLOC_STATE(shade2, always, 4, 0); + r300->hw.shade2.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, 0x4278, 3); ALLOC_STATE(polygon_mode, always, 4, 0); r300->hw.polygon_mode.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_GA_POLY_MODE, 3); ALLOC_STATE(fogp, always, 3, 0); @@ -587,8 +621,15 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.rb3d_dither_ctl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_DITHER_CTL, 9); ALLOC_STATE(rb3d_aaresolve_ctl, always, 2, 0); r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_AARESOLVE_CTL, 1); - ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); + if (is_r500) { + ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); + } else { + ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = (2 << 30); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = (2 << 30); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = (2 << 30); + } ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0); r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_ZB_CNTL, 3); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 379977b2c7..d45e4beec0 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -116,9 +116,11 @@ typedef struct r300_context *r300ContextPtr; #define R300_GB_MISC_MSPOS_0 1 #define R300_GB_MISC_MSPOS_1 2 #define R300_GB_MISC_TILE_CONFIG 3 -#define R300_GB_MISC_SELECT 4 -#define R300_GB_MISC_AA_CONFIG 5 -#define R300_GB_MISC_CMDSIZE 6 +#define R300_GB_MISC_CMDSIZE 4 +#define R300_GB_MISC2_CMD_0 0 +#define R300_GB_MISC2_SELECT 1 +#define R300_GB_MISC2_AA_CONFIG 2 +#define R300_GB_MISC2_CMDSIZE 3 #define R300_TXE_CMD_0 0 #define R300_TXE_ENABLE 1 @@ -307,6 +309,7 @@ struct r300_hw_state { struct radeon_state_atom pvs; /* pvs_cntl (22D0) */ struct radeon_state_atom gb_enable; /* (4008) */ struct radeon_state_atom gb_misc; /* Multisampling position shifts ? (4010) */ + struct radeon_state_atom gb_misc2; /* Multisampling position shifts ? (4010) */ struct radeon_state_atom ga_point_s0; /* S Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) (4200) */ struct radeon_state_atom ga_triangle_stipple; /* (4214) */ struct radeon_state_atom ps; /* pointsize (421C) */ @@ -314,6 +317,7 @@ struct r300_hw_state { struct radeon_state_atom lcntl; /* line control */ struct radeon_state_atom ga_line_stipple; /* (4260) */ struct radeon_state_atom shade; + struct radeon_state_atom shade2; struct radeon_state_atom polygon_mode; struct radeon_state_atom fogp; /* fog parameters (4294) */ struct radeon_state_atom ga_soft_reset; /* (429C) */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index b82399574a..7a025aa56f 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -829,18 +829,19 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode) R300_STATECHANGE(rmesa, shade); rmesa->hw.shade.cmd[1] = 0x00000002; + R300_STATECHANGE(rmesa, shade2); switch (mode) { case GL_FLAT: - rmesa->hw.shade.cmd[2] = R300_RE_SHADE_MODEL_FLAT; + rmesa->hw.shade2.cmd[1] = R300_RE_SHADE_MODEL_FLAT; break; case GL_SMOOTH: - rmesa->hw.shade.cmd[2] = R300_RE_SHADE_MODEL_SMOOTH; + rmesa->hw.shade2.cmd[1] = R300_RE_SHADE_MODEL_SMOOTH; break; default: return; } - rmesa->hw.shade.cmd[3] = 0x00000000; - rmesa->hw.shade.cmd[4] = 0x00000000; + rmesa->hw.shade2.cmd[2] = 0x00000000; + rmesa->hw.shade2.cmd[3] = 0x00000000; } static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, @@ -2079,8 +2080,8 @@ static void r300ResetHwState(r300ContextPtr r300) } /* XXX: Enable anti-aliasing? */ - r300->hw.gb_misc.cmd[R300_GB_MISC_AA_CONFIG] = GB_AA_CONFIG_AA_DISABLE; - r300->hw.gb_misc.cmd[R300_GB_MISC_SELECT] = 0; + r300->hw.gb_misc2.cmd[R300_GB_MISC2_AA_CONFIG] = GB_AA_CONFIG_AA_DISABLE; + r300->hw.gb_misc2.cmd[R300_GB_MISC2_SELECT] = 0; r300->hw.ga_point_s0.cmd[1] = r300PackFloat32(0.0); r300->hw.ga_point_s0.cmd[2] = r300PackFloat32(0.0); @@ -2151,8 +2152,13 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.rb3d_aaresolve_ctl.cmd[1] = 0; - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = 0x00000000; - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = 0xffffffff; + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = 0x00000000; + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = 0xffffffff; + } else { + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = (2 << 30); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = (2 << 30); + } r300->hw.zb_depthclearvalue.cmd[1] = 0; -- cgit v1.2.3 From bc3270e99f5c39544aaf831742db14796ab83a6a Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Wed, 13 May 2009 20:38:33 -0600 Subject: i965: send all warnings through _mesa_warning() One warning message: drm_i915_getparam: -22 was still being sent to fprintf(). This causes all Piglit tests to fail, even with MESA_DEBUG=0. Using _mesa_warning() to emit the message allows the general Mesa controls for messages like this to be applied. --- src/mesa/drivers/dri/intel/intel_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 65e62947ef..2728823142 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -236,7 +236,7 @@ intel_get_param(__DRIscreenPrivate *psp, int param, int *value) ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); if (ret) { - fprintf(stderr, "drm_i915_getparam: %d\n", ret); + _mesa_warning(NULL, "drm_i915_getparam: %d\n", ret); return GL_FALSE; } -- cgit v1.2.3 From ab6c4fa582972e25f8800c77b5dd5b3a83afc996 Mon Sep 17 00:00:00 2001 From: Robert Ellison Date: Wed, 13 May 2009 20:40:23 -0600 Subject: i965: fix 1D texture borders with GL_CLAMP_TO_BORDER With 1D textures, GL_TEXTURE_WRAP_T should be ignored (only GL_TEXTURE_WRAP_S should be respected). But the i965 hardware seems to follow the value of GL_TEXTURE_WRAP_T even when sampling 1D textures. This fix forces GL_TEXTURE_WRAP_T to be GL_REPEAT whenever 1D textures are used; this allows the texture to be sampled correctly, avoiding "imaginary" border elements in the T direction. This bug was demonstrated in the Piglit tex1d-2dborder test. With this fix, that test passes. --- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index c604ef0162..3fc18ff1f3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -178,6 +178,16 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CUBE; sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CUBE; } + else if (key->tex_target == GL_TEXTURE_1D) { + /* There's a bug in 1D texture sampling - it actually pays + * attention to the wrap_t value, though it should not. + * Override the wrap_t value here to GL_REPEAT to keep + * any nonexistent border pixels from floating in. + */ + sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r); + sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s); + sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP; + } else { sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r); sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s); -- cgit v1.2.3 From 96922d1b71dc1ba7375b4fea6439127e62c36073 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 14 May 2009 08:17:08 -0700 Subject: r300-gallium: Correct VTE setup for surface_fill, make surface_copy emit right. --- src/gallium/drivers/r300/r300_surface.c | 75 +++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 3198c97378..00eb4ebe7c 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -44,7 +44,22 @@ static void r300_surface_setup(struct r300_context* r300, r300_emit_dsa_state(r300, &dsa_clear_state); r300_emit_rs_state(r300, &rs_clear_state); - BEGIN_CS(15); + BEGIN_CS(24); + + /* Viewport setup */ + OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6); + OUT_CS_32F((float)w); + OUT_CS_32F((float)x); + OUT_CS_32F((float)h); + OUT_CS_32F((float)y); + OUT_CS_32F(1.0); + OUT_CS_32F(0.0); + + OUT_CS_REG(R300_VAP_VTE_CNTL, R300_VPORT_X_SCALE_ENA | + R300_VPORT_X_OFFSET_ENA | + R300_VPORT_Y_SCALE_ENA | + R300_VPORT_Y_OFFSET_ENA | + R300_VTX_XY_FMT | R300_VTX_Z_FMT); /* Pixel scissors. */ OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2); @@ -132,7 +147,7 @@ static void r300_surface_fill(struct pipe_context* pipe, r300_emit_rs_block_state(r300, &r300_rs_block_clear_state); } - BEGIN_CS(31); + BEGIN_CS(24); /* VAP stream control, mapping from input memory to PVS/RS memory */ if (caps->has_tcl) { @@ -159,18 +174,9 @@ static void r300_surface_fill(struct pipe_context* pipe, /* Disable textures */ OUT_CS_REG(R300_TX_ENABLE, 0x0); - /* Viewport setup */ - OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6); - OUT_CS_32F(1.0); - OUT_CS_32F((float)x); - OUT_CS_32F(1.0); - OUT_CS_32F((float)y); - OUT_CS_32F(1.0); - OUT_CS_32F(0.0); - /* The size of the point we're about to draw, in sixths of pixels */ OUT_CS_REG(R300_GA_POINT_SIZE, - ((h * 6) & R300_POINTSIZE_Y_MASK) | + ((h * 6) & R300_POINTSIZE_Y_MASK) | ((w * 6) << R300_POINTSIZE_X_SHIFT)); /* Packet3 with our point vertex */ @@ -178,8 +184,8 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | (1 << R300_PRIM_NUM_VERTICES_SHIFT)); /* Position */ - OUT_CS_32F(w / 2.0); - OUT_CS_32F(h / 2.0); + OUT_CS_32F(0.5); + OUT_CS_32F(0.5); OUT_CS_32F(1.0); OUT_CS_32F(1.0); /* Color */ @@ -225,6 +231,11 @@ static void r300_surface_copy(struct pipe_context* pipe, srcx, srcy, w, h); } + /* Add our source texture to the BO list before emitting anything. + * r300_surface_setup will flush if needed for us. */ + r300->winsys->add_buffer(r300->winsys, srctex->buffer, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + r300_surface_setup(r300, desttex, destx, desty, w, h); r300_emit_sampler(r300, &r300_sampler_copy_state, 0); @@ -233,7 +244,7 @@ static void r300_surface_copy(struct pipe_context* pipe, /* Vertex shader setup */ if (caps->has_tcl) { - r300_emit_vertex_shader(r300, &r300_texture_vertex_shader); + r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader); } else { BEGIN_CS(4); OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS); @@ -276,29 +287,29 @@ static void r300_surface_copy(struct pipe_context* pipe, OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2); /* Packet3 with our texcoords */ - OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8); + OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16); OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING | (4 << R300_PRIM_NUM_VERTICES_SHIFT)); /* (x , y ) */ - OUT_CS_32F((float)destx); - OUT_CS_32F((float)desty); - OUT_CS_32F((float)srcx); - OUT_CS_32F((float)srcy); + OUT_CS_32F((float)(destx / dest->width)); + OUT_CS_32F((float)(desty / dest->height)); + OUT_CS_32F((float)(srcx / dest->width)); + OUT_CS_32F((float)(srcy / dest->height)); /* (x , y + h) */ - OUT_CS_32F((float)destx); - OUT_CS_32F((float)(desty + h)); - OUT_CS_32F((float)srcx); - OUT_CS_32F((float)(srcy + h)); + OUT_CS_32F((float)(destx / dest->width)); + OUT_CS_32F((float)((desty + h) / dest->height)); + OUT_CS_32F((float)(srcx / dest->width)); + OUT_CS_32F((float)((srcy + h) / dest->height)); /* (x + w, y + h) */ - OUT_CS_32F((float)(destx + w)); - OUT_CS_32F((float)(desty + h)); - OUT_CS_32F((float)(srcx + w)); - OUT_CS_32F((float)(srcy + h)); + OUT_CS_32F((float)((destx + w) / dest->width)); + OUT_CS_32F((float)((desty + h) / dest->height)); + OUT_CS_32F((float)((srcx + w) / dest->width)); + OUT_CS_32F((float)((srcy + h) / dest->height)); /* (x + w, y ) */ - OUT_CS_32F((float)(destx + w)); - OUT_CS_32F((float)desty); - OUT_CS_32F((float)(srcx + w)); - OUT_CS_32F((float)srcy); + OUT_CS_32F((float)((destx + w) / dest->width)); + OUT_CS_32F((float)(desty / dest->height)); + OUT_CS_32F((float)((srcx + w) / dest->width)); + OUT_CS_32F((float)(srcy / dest->height)); OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); -- cgit v1.2.3 From d866abeffc7e4a29736fa35fb8ac09c3a28a44d6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 13 May 2009 18:18:29 -0700 Subject: intel: Use GL_FRONT_AND_BACK for stencil clearing. This comes from a radeon-rewrite fallback fix, but may also fix stencil clear failure when the polygon winding mode is flipped. --- src/mesa/drivers/dri/intel/intel_clear.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index eb0d890f47..488db2cf45 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -256,7 +256,8 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) if (this_mask & BUFFER_BIT_STENCIL) { _mesa_Enable(GL_STENCIL_TEST); _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - _mesa_StencilFuncSeparate(GL_FRONT, GL_ALWAYS, ctx->Stencil.Clear, + _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, + ctx->Stencil.Clear, ctx->Stencil.WriteMask[0]); } else { _mesa_Disable(GL_STENCIL_TEST); -- cgit v1.2.3 From 64980125c76b05501a6fe7fe20fe52438f459129 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 13 May 2009 19:08:17 -0700 Subject: intel: Use FRONT_AND_BACK for StencilOp as well. --- src/mesa/drivers/dri/intel/intel_clear.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 488db2cf45..4dfaee8a4a 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -255,7 +255,8 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) /* Control writing of the stencil clear value to stencil. */ if (this_mask & BUFFER_BIT_STENCIL) { _mesa_Enable(GL_STENCIL_TEST); - _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilOpSeparate(GL_FRONT_AND_BACK, + GL_REPLACE, GL_REPLACE, GL_REPLACE); _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, ctx->Stencil.Clear, ctx->Stencil.WriteMask[0]); -- cgit v1.2.3 From 0f5113deed91611ecdda6596542530b1849bb161 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 14 May 2009 09:49:45 -0700 Subject: i965: Fix register allocation of GLSL fp inputs. Before, if the VP output something that is in the attributes coming into the WM but which isn't used by the WM, then WM would end up reading subsequent varyings from the wrong places. This was visible with a GLSL demo using gl_PointSize in the VS and a varying in the WM, as point size is in the VUE but not used by the WM. There is now a regression test in piglit, glsl-unused-varying. --- src/mesa/drivers/dri/i965/brw_wm.c | 5 ++++- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_glsl.c | 31 +++++++++++++++++++++---------- src/mesa/drivers/dri/i965/brw_wm_pass2.c | 3 +-- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index cd65f57bbc..3e476fd3be 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -319,6 +319,9 @@ static void brw_wm_populate_key( struct brw_context *brw, key->drawable_height = brw->intel.driDrawable->h; } + /* CACHE_NEW_VS_PROG */ + key->vp_outputs_written = brw->vs.prog_data->outputs_written & DO_SETUP_BITS; + /* The unique fragment program ID */ key->program_string_id = fp->id; } @@ -357,7 +360,7 @@ const struct brw_tracked_state brw_wm_prog = { .brw = (BRW_NEW_FRAGMENT_PROGRAM | BRW_NEW_WM_INPUT_DIMENSIONS | BRW_NEW_REDUCED_PRIMITIVE), - .cache = 0 + .cache = CACHE_NEW_VS_PROG, }, .prepare = brw_prepare_wm_prog }; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 59ead757b5..fb15c03e83 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -75,6 +75,7 @@ struct brw_wm_prog_key { GLuint program_string_id:32; GLuint origin_x, origin_y; GLuint drawable_height; + GLuint vp_outputs_written; }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 23caf59435..4936703799 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -302,7 +302,7 @@ static void prealloc_reg(struct brw_wm_compile *c) { int i, j; struct brw_reg reg; - int nr_interp_regs = 0; + int urb_read_length = 0; GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted; GLuint reg_index = 0; @@ -366,18 +366,29 @@ static void prealloc_reg(struct brw_wm_compile *c) } /* fragment shader inputs */ - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { - if (inputs & (1<= VERT_RESULT_VAR0) + fp_input = i - VERT_RESULT_VAR0 + FRAG_ATTRIB_VAR0; + else if (i <= VERT_RESULT_TEX7) + fp_input = i; + else + fp_input = -1; + + if (fp_input >= 0 && inputs & (1 << fp_input)) { + urb_read_length = reg_index; + reg = brw_vec8_grf(reg_index, 0); + for (j = 0; j < 4; j++) + set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); + } + if (c->key.vp_outputs_written & (1 << i)) { + reg_index += 2; + } } c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; - c->prog_data.urb_read_length = nr_interp_regs * 2; + c->prog_data.urb_read_length = urb_read_length; c->prog_data.curb_read_length = c->nr_creg; c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, reg_index, 0); reg_index++; diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index 780edbc42e..08cac730c2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -70,7 +70,6 @@ static void prealloc_reg(struct brw_wm_compile *c, static void init_registers( struct brw_wm_compile *c ) { struct brw_context *brw = c->func.brw; - GLuint inputs = (brw->vs.prog_data->outputs_written & DO_SETUP_BITS); GLuint nr_interp_regs = 0; GLuint i = 0; GLuint j; @@ -85,7 +84,7 @@ static void init_registers( struct brw_wm_compile *c ) prealloc_reg(c, &c->creg[j], i++); for (j = 0; j < FRAG_ATTRIB_MAX; j++) { - if (inputs & (1<key.vp_outputs_written & (1< Date: Thu, 14 May 2009 10:56:32 -0700 Subject: i965: Fix varying payload reg assignment for the non-GLSL-instructions path. I don't have a testcase for this, but it seems clearly wrong. --- src/mesa/drivers/dri/i965/brw_wm_pass2.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index 08cac730c2..6faea018fb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -69,7 +69,6 @@ static void prealloc_reg(struct brw_wm_compile *c, */ static void init_registers( struct brw_wm_compile *c ) { - struct brw_context *brw = c->func.brw; GLuint nr_interp_regs = 0; GLuint i = 0; GLuint j; @@ -85,15 +84,18 @@ static void init_registers( struct brw_wm_compile *c ) for (j = 0; j < FRAG_ATTRIB_MAX; j++) { if (c->key.vp_outputs_written & (1< FRAG_ATTRIB_VAR0) - index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0); + int fp_index; + + if (j >= VERT_RESULT_VAR0) + fp_index = j - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0); + else if (j <= VERT_RESULT_TEX7) + fp_index = j; else - index = j; + fp_index = -1; + nr_interp_regs++; - prealloc_reg(c, &c->payload.input_interp[index], i++); + if (fp_index >= 0) + prealloc_reg(c, &c->payload.input_interp[fp_index], i++); } } -- cgit v1.2.3 From 65b9cd74e3145b416f2c9695a0c3bc7bd6b85e25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 May 2009 08:02:40 -0600 Subject: docs: updates from the 7.4 branch --- docs/news.html | 5 ++-- docs/relnotes-7.4.2.html | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/relnotes.html | 6 ++-- 3 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 docs/relnotes-7.4.2.html diff --git a/docs/news.html b/docs/news.html index 98cee9b8b8..8cf2f91dd0 100644 --- a/docs/news.html +++ b/docs/news.html @@ -11,9 +11,10 @@

        News

        -

        May tbd, 2009

        +

        May 15, 2009

        -Mesa 7.5 is released. +Mesa 7.4.2 is released. +This is a stable release fixing bugs since the 7.4.1 release.

        diff --git a/docs/relnotes-7.4.2.html b/docs/relnotes-7.4.2.html new file mode 100644 index 0000000000..7d066e418e --- /dev/null +++ b/docs/relnotes-7.4.2.html @@ -0,0 +1,74 @@ + + +Mesa Release Notes + + + + + + + +

        Mesa 7.4.2 Release Notes / May 15, 2009

        + +

        +Mesa 7.4.2 is a stable development release fixing bugs since the 7.4.1 release. +

        +

        +Mesa 7.4.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

        +

        +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

        + + +

        MD5 checksums

        +
        +172f5193154dad731387f97bd44ab68f  MesaLib-7.4.2.tar.gz
        +b10a76e32bde4645cfc34ea0416d7d8b  MesaLib-7.4.2.tar.bz2
        +cc6dfc2efd424cc342b84e6bcd78ce5d  MesaLib-7.4.2.zip
        +182a7e78aa7a480b3650a5c956dbddd1  MesaDemos-7.4.2.tar.gz
        +bf559a0485667a3bfa4513a23501579b  MesaDemos-7.4.2.tar.bz2
        +5379e622b65e8c22022dba34aeb6f4f9  MesaDemos-7.4.2.zip
        +7cc43c1c35bf6a279a16e063dea3b8c5  MesaGLUT-7.4.2.tar.gz
        +e0dfc44d537904a030861e5b3c760c11  MesaGLUT-7.4.2.tar.bz2
        +4a6cf5bbbac190d6ba97448b3098b7f4  MesaGLUT-7.4.2.zip
        +
        + + +

        Bug fixes

        +
          +
        • Fixed segfault when rendering to front buffer with DRI 1. +
        • Fixed swrast texture rectangle bug when wrap mode = GL_CLAMP_TO_BORDER and + filter mode = GL_LINEAR. (bug 21461) +
        • Fixed texture object mem leak during context destruction. +
        • Fixed a state validation bug in glCopyTex[Sub]Image() +
        • Fixed some i965 GLSL bugs. +
        • Fixed an R300 driver texture object bad memory reference. +
        + + + +

        Driver Status

        + +
        +Driver			Status
        +----------------------	----------------------
        +DRI drivers		varies with the driver
        +XMesa/GLX (on Xlib)	implements OpenGL 2.1
        +OSMesa (off-screen)	implements OpenGL 2.1
        +Windows/Win32		implements OpenGL 2.1
        +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
        +SVGA			unsupported
        +Wind River UGL		unsupported
        +DJGPP			unsupported
        +GGI			unsupported
        +BeOS			unsupported
        +Allegro			unsupported
        +D3D			unsupported
        +
        + + + diff --git a/docs/relnotes.html b/docs/relnotes.html index 298352038c..ca808af64c 100644 --- a/docs/relnotes.html +++ b/docs/relnotes.html @@ -10,8 +10,8 @@

        Mesa uses an even/odd version number scheme like the Linux kernel. -Odd numbered versions (such as 7.5) designate new developmental releases. -Even numbered versions (such as 7.4) designate stable releases. +Odd numbered versions (such as 6.5) designate new developmental releases. +Even numbered versions (such as 6.4) designate stable releases.

        @@ -20,7 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.

          -
        • 7.5 release notes +
        • 7.4.2 release notes
        • 7.4.1 release notes
        • 7.4 release notes
        • 7.3 release notes -- cgit v1.2.3 From 483e247804db914835173347b7f2a12c0f78d60e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 May 2009 08:03:56 -0600 Subject: mesa: bump version to 7.5-rc2 --- Makefile | 2 +- src/mesa/main/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 69d3ecacd7..acf83e6280 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ ultrix-gcc: # Rules for making release tarballs -VERSION=7.5-rc1 +VERSION=7.5-rc2 DIRECTORY = Mesa-$(VERSION) LIB_NAME = MesaLib-$(VERSION) DEMO_NAME = MesaDemos-$(VERSION) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 072037bbd7..e109f20df4 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 5 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5-rc1" +#define MESA_VERSION_STRING "7.5-rc2" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 5c5a46884899ea25cdf25545d6ab3d9a74eafa3a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 15 May 2009 11:41:42 -0700 Subject: i915: Only use the new 945 cube layout for compressed textures. The docs actually explain this, but not in a terribly clear manner. This nearly fixes the piglit cubemap testcase, except that something's going wrong with the nearest filtering at 2x2 sizes in the testcase. Looks good by visual inspection, though. Bug #21692 --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index d44a2f47b3..7cc1c096e4 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -454,7 +454,10 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) { switch (mt->target) { case GL_TEXTURE_CUBE_MAP: - i945_miptree_layout_cube(intel, mt); + if (mt->compressed) + i945_miptree_layout_cube(intel, mt); + else + i915_miptree_layout_cube(intel, mt); break; case GL_TEXTURE_3D: i945_miptree_layout_3d(intel, mt); -- cgit v1.2.3 From 4c6f82989983eecc0b3b724716cb3bcb675664c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 15 May 2009 12:32:51 -0700 Subject: i915: Use Stencil.Enabled instead of Stencil._Enabled in DrawBuffers. The _Enabled field isn't updated at the point that DrawBuffers is called, and the Driver.Enable() function does the testing for stencil buffer presence anyway. bug #21608 for Radeon --- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 4f4ea45b74..df5c3fc176 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -276,7 +276,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) ctx->Driver.Enable(ctx, GL_DEPTH_TEST, (ctx->Depth.Test && fb->Visual.depthBits > 0)); ctx->Driver.Enable(ctx, GL_STENCIL_TEST, - (ctx->Stencil._Enabled && fb->Visual.stencilBits > 0)); + (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0)); } else { /* Mesa's Stencil._Enabled field is updated when -- cgit v1.2.3 From b197a8ade3e1e6c67743111f12f27e0a4a985cd9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 12 May 2009 11:32:03 -0700 Subject: i915: Fix 945 cube map layout for the small mipmaps along the bottom. Bug #21691. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 7cc1c096e4..40bcf7a9af 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -55,6 +55,17 @@ static GLint step_offsets[6][2] = { [FACE_NEG_Z] = {-1, 1}, }; + +static GLint bottom_offsets[6] = { + [FACE_POS_X] = 16 + 0 * 8, + [FACE_POS_Y] = 16 + 1 * 8, + [FACE_POS_Z] = 16 + 2 * 8, + [FACE_NEG_X] = 16 + 3 * 8, + [FACE_NEG_Y] = 16 + 4 * 8, + [FACE_NEG_Z] = 16 + 5 * 8, +}; + + /** * Cube texture map layout for i830M-GM915. * @@ -297,7 +308,7 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) * +---+ +---+ +---+ +---+ +---+ +---+ * * The bottom row continues with the remaining 2x2 then the 1x1 mip contents - * in order, with each of them aligned to a 4x4 block boundary. Thus, for + * in order, with each of them aligned to a 8x8 block boundary. Thus, for * 32x32 cube maps and smaller, the bottom row layout is going to dictate the * pitch of the tree. For a tree with 4x4 images, the pitch is at least * 14 * 8 = 112 texels, for 2x2 it is at least 12 * 8 texels, and for 1x1 @@ -375,10 +386,11 @@ i945_miptree_layout_cube(struct intel_context *intel, x = (face - 4) * 8; break; } + break; case 2: y = mt->total_height - 4; - x = 16 + face * 8; + x = bottom_offsets[face]; break; case 1: -- cgit v1.2.3 From c4538e326a99fde3996f21866497f92ec14086df Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 22:47:31 +0100 Subject: st/egl: Use proper Makefile --- src/gallium/state_trackers/egl/Makefile | 36 ++++++++++++--------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile index 692a3c8b76..e825aa718b 100644 --- a/src/gallium/state_trackers/egl/Makefile +++ b/src/gallium/state_trackers/egl/Makefile @@ -1,29 +1,19 @@ -TARGET = libegldrm.a -CFILES = $(wildcard ./*.c) -OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) -GALLIUMDIR = ../.. -TOP = ../../../.. +TOP = ../../../.. +include $(TOP)/configs/current -include ${TOP}/configs/current +LIBNAME = egldrm -CFLAGS := \ - -I${GALLIUMDIR}/include \ - -I${GALLIUMDIR}/auxiliary \ - -I${TOP}/src/mesa/drivers/dri/common \ - -I${TOP}/src/mesa \ - -I$(TOP)/include \ - -I$(TOP)/src/egl/main \ - ${LIBDRM_CFLAGS} \ - ${CFLAGS} +LIBRARY_INCLUDES = \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -I$(TOP)/src/mesa \ + -I$(TOP)/include \ + -I$(TOP)/src/egl/main \ + $(shell pkg-config --cflags-only-I libdrm) -############################################# -.PHONY = all clean +C_SOURCES = $(wildcard ./*.c) -all: ${TARGET} -${TARGET}: ${OBJECTS} - ar rcs $@ $^ - -clean: - rm -rf ${OBJECTS} ${TARGET} +include ../../Makefile.template -- cgit v1.2.3 From 97ccdee68aef925d14ee4ee17eef307f55a3c92f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 22:54:07 +0100 Subject: gallium-intel: Build with scons --- src/gallium/winsys/drm/intel/SConscript | 7 +++++++ src/gallium/winsys/drm/intel/dri/SConscript | 15 +++++++++++++++ src/gallium/winsys/drm/intel/gem/SConscript | 17 +++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/gallium/winsys/drm/intel/SConscript create mode 100644 src/gallium/winsys/drm/intel/dri/SConscript create mode 100644 src/gallium/winsys/drm/intel/gem/SConscript diff --git a/src/gallium/winsys/drm/intel/SConscript b/src/gallium/winsys/drm/intel/SConscript new file mode 100644 index 0000000000..50d7b75ed6 --- /dev/null +++ b/src/gallium/winsys/drm/intel/SConscript @@ -0,0 +1,7 @@ +Import('*') + +SConscript(['gem/SConscript',]) + +if 'mesa' in env['statetrackers']: + + SConscript(['dri/SConscript']) diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript new file mode 100644 index 0000000000..b11a1927f7 --- /dev/null +++ b/src/gallium/winsys/drm/intel/dri/SConscript @@ -0,0 +1,15 @@ +Import('*') + +env = drienv.Clone() + +drivers = [ + softpipe, + i915simple, + inteldrm +] + +env.SharedLibrary( + target ='i915_dri.so', + source = COMMON_GALLIUM_SOURCES, + LIBS = drivers + mesa + auxiliaries + env['LIBS'], +) diff --git a/src/gallium/winsys/drm/intel/gem/SConscript b/src/gallium/winsys/drm/intel/gem/SConscript new file mode 100644 index 0000000000..ea8a2e55f6 --- /dev/null +++ b/src/gallium/winsys/drm/intel/gem/SConscript @@ -0,0 +1,17 @@ +Import('*') + +env = drienv.Clone() + +inteldrm_sources = [ + 'intel_be_api.c', + 'intel_be_batchbuffer.c', + 'intel_be_context.c', + 'intel_be_device.c', +] + +inteldrm = env.ConvenienceLibrary( + target ='inteldrm', + source = inteldrm_sources, +) + +Export('inteldrm') -- cgit v1.2.3 From 0307e609aa3e707eeb40051bd664d36f2340ba9b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 15 May 2009 16:24:59 -0700 Subject: mesa: Mark FBOs with compressed color attachments as FBO-incomplete. Both EXT_fbo and ARB_fbo agree on this. Fixes a segfault in the metaops mipmap generation in Intel for SGIS_generate_mipmap of S3TC textures in Regnum Online. Bug #21654. --- src/mesa/main/fbobject.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9c5a5908a2..dbd4c5848c 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -368,6 +368,11 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, att->Complete = GL_FALSE; return; } + if (texImage->TexFormat->TexelBytes == 0) { + att_incomplete("compressed internalformat"); + att->Complete = GL_FALSE; + return; + } } else if (format == GL_DEPTH) { if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) { -- cgit v1.2.3 From 22690482e692cb5ed2f84d3e69545c09292e3484 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 15 May 2009 17:32:21 -0700 Subject: intel: Don't complain on falling back from PBO fastpaths. Instead, stash the debug info under the handy debug flag. Bug #20053 --- src/mesa/drivers/dri/intel/intel_tex_image.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index b71fe2a7ae..ddbb13e74a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -208,7 +208,7 @@ try_pbo_upload(struct intel_context *intel, if (!pbo || intel->ctx._ImageTransferState || unpack->SkipPixels || unpack->SkipRows) { - _mesa_printf("%s: failure 1\n", __FUNCTION__); + DBG("%s: failure 1\n", __FUNCTION__); return GL_FALSE; } @@ -264,7 +264,7 @@ try_pbo_zcopy(struct intel_context *intel, if (!pbo || intel->ctx._ImageTransferState || unpack->SkipPixels || unpack->SkipRows) { - _mesa_printf("%s: failure 1\n", __FUNCTION__); + DBG("%s: failure 1\n", __FUNCTION__); return GL_FALSE; } @@ -283,7 +283,7 @@ try_pbo_zcopy(struct intel_context *intel, dst_stride = intelImage->mt->pitch; if (src_stride != dst_stride || dst_offset != 0 || src_offset != 0) { - _mesa_printf("%s: failure 2\n", __FUNCTION__); + DBG("%s: failure 2\n", __FUNCTION__); return GL_FALSE; } -- cgit v1.2.3 From c30f66118974f41f57e86d49f372b7c78f891223 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 04:17:00 +0200 Subject: trace: Move state dump functions to tr_dump_state.[c|h] --- src/gallium/drivers/trace/Makefile | 2 +- src/gallium/drivers/trace/SConscript | 2 +- src/gallium/drivers/trace/tr_context.c | 2 +- src/gallium/drivers/trace/tr_dump_state.c | 491 ++++++++++++++++++++++++++++++ src/gallium/drivers/trace/tr_dump_state.h | 78 +++++ src/gallium/drivers/trace/tr_screen.c | 2 +- src/gallium/drivers/trace/tr_state.c | 491 ------------------------------ src/gallium/drivers/trace/tr_state.h | 78 ----- 8 files changed, 573 insertions(+), 573 deletions(-) create mode 100644 src/gallium/drivers/trace/tr_dump_state.c create mode 100644 src/gallium/drivers/trace/tr_dump_state.h delete mode 100644 src/gallium/drivers/trace/tr_state.c delete mode 100644 src/gallium/drivers/trace/tr_state.h diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index e087db169a..188998d579 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -7,8 +7,8 @@ C_SOURCES = \ tr_buffer.c \ tr_context.c \ tr_dump.c \ + tr_dump_state.c \ tr_screen.c \ - tr_state.c \ tr_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/trace/SConscript b/src/gallium/drivers/trace/SConscript index 4215215d1a..4ab829a3a8 100644 --- a/src/gallium/drivers/trace/SConscript +++ b/src/gallium/drivers/trace/SConscript @@ -8,8 +8,8 @@ trace = env.ConvenienceLibrary( 'tr_buffer.c', 'tr_context.c', 'tr_dump.c', + 'tr_dump_state.c', 'tr_screen.c', - 'tr_state.c', 'tr_texture.c', ]) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 47280459a7..6a19233a9a 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -31,7 +31,7 @@ #include "pipe/p_screen.h" #include "tr_dump.h" -#include "tr_state.h" +#include "tr_dump_state.h" #include "tr_buffer.h" #include "tr_screen.h" #include "tr_texture.h" diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c new file mode 100644 index 0000000000..1b2b3493a6 --- /dev/null +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -0,0 +1,491 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_dump.h" + +#include "tr_dump.h" +#include "tr_dump_state.h" + + +void trace_dump_format(enum pipe_format format) +{ + trace_dump_enum(pf_name(format) ); +} + + +void trace_dump_block(const struct pipe_format_block *block) +{ + trace_dump_struct_begin("pipe_format_block"); + trace_dump_member(uint, block, size); + trace_dump_member(uint, block, width); + trace_dump_member(uint, block, height); + trace_dump_struct_end(); +} + + +static void trace_dump_reference(const struct pipe_reference *reference) +{ + trace_dump_struct_begin("pipe_reference"); + trace_dump_member(int, &reference->count, count); + trace_dump_struct_end(); +} + + +void trace_dump_template(const struct pipe_texture *templat) +{ + if(!templat) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_texture"); + + trace_dump_member(int, templat, target); + trace_dump_member(format, templat, format); + + trace_dump_member_begin("width"); + trace_dump_array(uint, templat->width, 1); + trace_dump_member_end(); + + trace_dump_member_begin("height"); + trace_dump_array(uint, templat->height, 1); + trace_dump_member_end(); + + trace_dump_member_begin("depth"); + trace_dump_array(uint, templat->depth, 1); + trace_dump_member_end(); + + trace_dump_member_begin("block"); + trace_dump_block(&templat->block); + trace_dump_member_end(); + + trace_dump_member(uint, templat, last_level); + trace_dump_member(uint, templat, tex_usage); + + trace_dump_struct_end(); +} + + +void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_rasterizer_state"); + + trace_dump_member(bool, state, flatshade); + trace_dump_member(bool, state, light_twoside); + trace_dump_member(uint, state, front_winding); + trace_dump_member(uint, state, cull_mode); + trace_dump_member(uint, state, fill_cw); + trace_dump_member(uint, state, fill_ccw); + trace_dump_member(bool, state, offset_cw); + trace_dump_member(bool, state, offset_ccw); + trace_dump_member(bool, state, scissor); + trace_dump_member(bool, state, poly_smooth); + trace_dump_member(bool, state, poly_stipple_enable); + trace_dump_member(bool, state, point_smooth); + trace_dump_member(bool, state, point_sprite); + trace_dump_member(bool, state, point_size_per_vertex); + trace_dump_member(bool, state, multisample); + trace_dump_member(bool, state, line_smooth); + trace_dump_member(bool, state, line_stipple_enable); + trace_dump_member(uint, state, line_stipple_factor); + trace_dump_member(uint, state, line_stipple_pattern); + trace_dump_member(bool, state, line_last_pixel); + trace_dump_member(bool, state, bypass_vs_clip_and_viewport); + trace_dump_member(bool, state, flatshade_first); + trace_dump_member(bool, state, gl_rasterization_rules); + + trace_dump_member(float, state, line_width); + trace_dump_member(float, state, point_size); + trace_dump_member(float, state, point_size_min); + trace_dump_member(float, state, point_size_max); + trace_dump_member(float, state, offset_units); + trace_dump_member(float, state, offset_scale); + + trace_dump_member_array(uint, state, sprite_coord_mode); + + trace_dump_struct_end(); +} + + +void trace_dump_poly_stipple(const struct pipe_poly_stipple *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_poly_stipple"); + + trace_dump_member_begin("stipple"); + trace_dump_array(uint, + state->stipple, + Elements(state->stipple)); + trace_dump_member_end(); + + trace_dump_struct_end(); +} + + +void trace_dump_viewport_state(const struct pipe_viewport_state *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_viewport_state"); + + trace_dump_member_array(float, state, scale); + trace_dump_member_array(float, state, translate); + + trace_dump_struct_end(); +} + + +void trace_dump_scissor_state(const struct pipe_scissor_state *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_scissor_state"); + + trace_dump_member(uint, state, minx); + trace_dump_member(uint, state, miny); + trace_dump_member(uint, state, maxx); + trace_dump_member(uint, state, maxy); + + trace_dump_struct_end(); +} + + +void trace_dump_clip_state(const struct pipe_clip_state *state) +{ + unsigned i; + + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_clip_state"); + + trace_dump_member_begin("ucp"); + trace_dump_array_begin(); + for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) { + trace_dump_elem_begin(); + trace_dump_array(float, state->ucp[i], 4); + trace_dump_elem_end(); + } + trace_dump_array_end(); + trace_dump_member_end(); + + trace_dump_member(uint, state, nr); + + trace_dump_struct_end(); +} + + +void trace_dump_constant_buffer(const struct pipe_constant_buffer *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_constant_buffer"); + + trace_dump_member(buffer_ptr, state, buffer); + + trace_dump_struct_end(); +} + + +void trace_dump_shader_state(const struct pipe_shader_state *state) +{ + static char str[8192]; + + if(!state) { + trace_dump_null(); + return; + } + + tgsi_dump_str(state->tokens, 0, str, sizeof(str)); + + trace_dump_struct_begin("pipe_shader_state"); + + trace_dump_member_begin("tokens"); + trace_dump_string(str); + trace_dump_member_end(); + + trace_dump_struct_end(); +} + + +void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state) +{ + unsigned i; + + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_depth_stencil_alpha_state"); + + trace_dump_member_begin("depth"); + trace_dump_struct_begin("pipe_depth_state"); + trace_dump_member(bool, &state->depth, enabled); + trace_dump_member(bool, &state->depth, writemask); + trace_dump_member(uint, &state->depth, func); + trace_dump_member(bool, &state->depth, occlusion_count); + trace_dump_struct_end(); + trace_dump_member_end(); + + trace_dump_member_begin("stencil"); + trace_dump_array_begin(); + for(i = 0; i < Elements(state->stencil); ++i) { + trace_dump_elem_begin(); + trace_dump_struct_begin("pipe_stencil_state"); + trace_dump_member(bool, &state->stencil[i], enabled); + trace_dump_member(uint, &state->stencil[i], func); + trace_dump_member(uint, &state->stencil[i], fail_op); + trace_dump_member(uint, &state->stencil[i], zpass_op); + trace_dump_member(uint, &state->stencil[i], zfail_op); + trace_dump_member(uint, &state->stencil[i], ref_value); + trace_dump_member(uint, &state->stencil[i], valuemask); + trace_dump_member(uint, &state->stencil[i], writemask); + trace_dump_struct_end(); + trace_dump_elem_end(); + } + trace_dump_array_end(); + trace_dump_member_end(); + + trace_dump_member_begin("alpha"); + trace_dump_struct_begin("pipe_alpha_state"); + trace_dump_member(bool, &state->alpha, enabled); + trace_dump_member(uint, &state->alpha, func); + trace_dump_member(float, &state->alpha, ref_value); + trace_dump_struct_end(); + trace_dump_member_end(); + + trace_dump_struct_end(); +} + + +void trace_dump_blend_state(const struct pipe_blend_state *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_blend_state"); + + trace_dump_member(bool, state, blend_enable); + + trace_dump_member(uint, state, rgb_func); + trace_dump_member(uint, state, rgb_src_factor); + trace_dump_member(uint, state, rgb_dst_factor); + + trace_dump_member(uint, state, alpha_func); + trace_dump_member(uint, state, alpha_src_factor); + trace_dump_member(uint, state, alpha_dst_factor); + + trace_dump_member(bool, state, logicop_enable); + trace_dump_member(uint, state, logicop_func); + + trace_dump_member(uint, state, colormask); + trace_dump_member(bool, state, dither); + + trace_dump_struct_end(); +} + + +void trace_dump_blend_color(const struct pipe_blend_color *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_blend_color"); + + trace_dump_member_array(float, state, color); + + trace_dump_struct_end(); +} + + +void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state) +{ + trace_dump_struct_begin("pipe_framebuffer_state"); + + trace_dump_member(uint, state, width); + trace_dump_member(uint, state, height); + trace_dump_member(uint, state, nr_cbufs); + trace_dump_member_array(ptr, state, cbufs); + trace_dump_member(ptr, state, zsbuf); + + trace_dump_struct_end(); +} + + +void trace_dump_sampler_state(const struct pipe_sampler_state *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_sampler_state"); + + trace_dump_member(uint, state, wrap_s); + trace_dump_member(uint, state, wrap_t); + trace_dump_member(uint, state, wrap_r); + trace_dump_member(uint, state, min_img_filter); + trace_dump_member(uint, state, min_mip_filter); + trace_dump_member(uint, state, mag_img_filter); + trace_dump_member(bool, state, compare_mode); + trace_dump_member(uint, state, compare_func); + trace_dump_member(bool, state, normalized_coords); + trace_dump_member(uint, state, prefilter); + trace_dump_member(float, state, shadow_ambient); + trace_dump_member(float, state, lod_bias); + trace_dump_member(float, state, min_lod); + trace_dump_member(float, state, max_lod); + trace_dump_member_array(float, state, border_color); + trace_dump_member(float, state, max_anisotropy); + + trace_dump_struct_end(); +} + + +void trace_dump_surface(const struct pipe_surface *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_surface"); + + trace_dump_reference(&state->reference); + + trace_dump_member(format, state, format); + trace_dump_member(uint, state, width); + trace_dump_member(uint, state, height); + + trace_dump_member(uint, state, layout); + trace_dump_member(uint, state, offset); + trace_dump_member(uint, state, usage); + + trace_dump_member(ptr, state, texture); + trace_dump_member(uint, state, face); + trace_dump_member(uint, state, level); + trace_dump_member(uint, state, zslice); + + trace_dump_struct_end(); +} + + +void trace_dump_transfer(const struct pipe_transfer *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_transfer"); + + trace_dump_member(format, state, format); + trace_dump_member(uint, state, width); + trace_dump_member(uint, state, height); + + trace_dump_member_begin("block"); + trace_dump_block(&state->block); + trace_dump_member_end(); + + trace_dump_member(uint, state, nblocksx); + trace_dump_member(uint, state, nblocksy); + trace_dump_member(uint, state, stride); + trace_dump_member(uint, state, usage); + + trace_dump_member(ptr, state, texture); + trace_dump_member(uint, state, face); + trace_dump_member(uint, state, level); + trace_dump_member(uint, state, zslice); + + trace_dump_struct_end(); +} + + +void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_vertex_buffer"); + + trace_dump_member(uint, state, stride); + trace_dump_member(uint, state, max_index); + trace_dump_member(uint, state, buffer_offset); + trace_dump_member(buffer_ptr, state, buffer); + + trace_dump_struct_end(); +} + + +void trace_dump_vertex_element(const struct pipe_vertex_element *state) +{ + if(!state) { + trace_dump_null(); + return; + } + + trace_dump_struct_begin("pipe_vertex_element"); + + trace_dump_member(uint, state, src_offset); + + trace_dump_member(uint, state, vertex_buffer_index); + trace_dump_member(uint, state, nr_components); + + trace_dump_member(format, state, src_format); + + trace_dump_struct_end(); +} diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h new file mode 100644 index 0000000000..05b821adb6 --- /dev/null +++ b/src/gallium/drivers/trace/tr_dump_state.h @@ -0,0 +1,78 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef TR_DUMP_STATE_H_ +#define TR_DUMP_STATE_H_ + +#include "pipe/p_format.h" +#include "pipe/p_state.h" +#include "pipe/p_shader_tokens.h" + + +void trace_dump_format(enum pipe_format format); + +void trace_dump_block(const struct pipe_format_block *block); + +void trace_dump_template(const struct pipe_texture *templat); + + +void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state); + +void trace_dump_poly_stipple(const struct pipe_poly_stipple *state); + +void trace_dump_viewport_state(const struct pipe_viewport_state *state); + +void trace_dump_scissor_state(const struct pipe_scissor_state *state); + +void trace_dump_clip_state(const struct pipe_clip_state *state); + +void trace_dump_constant_buffer(const struct pipe_constant_buffer *state); + +void trace_dump_token(const struct tgsi_token *token); + +void trace_dump_shader_state(const struct pipe_shader_state *state); + +void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state); + +void trace_dump_blend_state(const struct pipe_blend_state *state); + +void trace_dump_blend_color(const struct pipe_blend_color *state); + +void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state); + +void trace_dump_sampler_state(const struct pipe_sampler_state *state); + +void trace_dump_surface(const struct pipe_surface *state); + +void trace_dump_transfer(const struct pipe_transfer *state); + +void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state); + +void trace_dump_vertex_element(const struct pipe_vertex_element *state); + + +#endif /* TR_STATE_H */ diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 12a8535342..e659416aba 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -30,7 +30,7 @@ #include "tr_buffer.h" #include "tr_dump.h" -#include "tr_state.h" +#include "tr_dump_state.h" #include "tr_texture.h" #include "tr_screen.h" diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c deleted file mode 100644 index a9570c1aeb..0000000000 --- a/src/gallium/drivers/trace/tr_state.c +++ /dev/null @@ -1,491 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" -#include "tgsi/tgsi_dump.h" - -#include "tr_dump.h" -#include "tr_state.h" - - -void trace_dump_format(enum pipe_format format) -{ - trace_dump_enum(pf_name(format) ); -} - - -void trace_dump_block(const struct pipe_format_block *block) -{ - trace_dump_struct_begin("pipe_format_block"); - trace_dump_member(uint, block, size); - trace_dump_member(uint, block, width); - trace_dump_member(uint, block, height); - trace_dump_struct_end(); -} - - -static void trace_dump_reference(const struct pipe_reference *reference) -{ - trace_dump_struct_begin("pipe_reference"); - trace_dump_member(int, &reference->count, count); - trace_dump_struct_end(); -} - - -void trace_dump_template(const struct pipe_texture *templat) -{ - if(!templat) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_texture"); - - trace_dump_member(int, templat, target); - trace_dump_member(format, templat, format); - - trace_dump_member_begin("width"); - trace_dump_array(uint, templat->width, 1); - trace_dump_member_end(); - - trace_dump_member_begin("height"); - trace_dump_array(uint, templat->height, 1); - trace_dump_member_end(); - - trace_dump_member_begin("depth"); - trace_dump_array(uint, templat->depth, 1); - trace_dump_member_end(); - - trace_dump_member_begin("block"); - trace_dump_block(&templat->block); - trace_dump_member_end(); - - trace_dump_member(uint, templat, last_level); - trace_dump_member(uint, templat, tex_usage); - - trace_dump_struct_end(); -} - - -void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_rasterizer_state"); - - trace_dump_member(bool, state, flatshade); - trace_dump_member(bool, state, light_twoside); - trace_dump_member(uint, state, front_winding); - trace_dump_member(uint, state, cull_mode); - trace_dump_member(uint, state, fill_cw); - trace_dump_member(uint, state, fill_ccw); - trace_dump_member(bool, state, offset_cw); - trace_dump_member(bool, state, offset_ccw); - trace_dump_member(bool, state, scissor); - trace_dump_member(bool, state, poly_smooth); - trace_dump_member(bool, state, poly_stipple_enable); - trace_dump_member(bool, state, point_smooth); - trace_dump_member(bool, state, point_sprite); - trace_dump_member(bool, state, point_size_per_vertex); - trace_dump_member(bool, state, multisample); - trace_dump_member(bool, state, line_smooth); - trace_dump_member(bool, state, line_stipple_enable); - trace_dump_member(uint, state, line_stipple_factor); - trace_dump_member(uint, state, line_stipple_pattern); - trace_dump_member(bool, state, line_last_pixel); - trace_dump_member(bool, state, bypass_vs_clip_and_viewport); - trace_dump_member(bool, state, flatshade_first); - trace_dump_member(bool, state, gl_rasterization_rules); - - trace_dump_member(float, state, line_width); - trace_dump_member(float, state, point_size); - trace_dump_member(float, state, point_size_min); - trace_dump_member(float, state, point_size_max); - trace_dump_member(float, state, offset_units); - trace_dump_member(float, state, offset_scale); - - trace_dump_member_array(uint, state, sprite_coord_mode); - - trace_dump_struct_end(); -} - - -void trace_dump_poly_stipple(const struct pipe_poly_stipple *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_poly_stipple"); - - trace_dump_member_begin("stipple"); - trace_dump_array(uint, - state->stipple, - Elements(state->stipple)); - trace_dump_member_end(); - - trace_dump_struct_end(); -} - - -void trace_dump_viewport_state(const struct pipe_viewport_state *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_viewport_state"); - - trace_dump_member_array(float, state, scale); - trace_dump_member_array(float, state, translate); - - trace_dump_struct_end(); -} - - -void trace_dump_scissor_state(const struct pipe_scissor_state *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_scissor_state"); - - trace_dump_member(uint, state, minx); - trace_dump_member(uint, state, miny); - trace_dump_member(uint, state, maxx); - trace_dump_member(uint, state, maxy); - - trace_dump_struct_end(); -} - - -void trace_dump_clip_state(const struct pipe_clip_state *state) -{ - unsigned i; - - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_clip_state"); - - trace_dump_member_begin("ucp"); - trace_dump_array_begin(); - for(i = 0; i < PIPE_MAX_CLIP_PLANES; ++i) { - trace_dump_elem_begin(); - trace_dump_array(float, state->ucp[i], 4); - trace_dump_elem_end(); - } - trace_dump_array_end(); - trace_dump_member_end(); - - trace_dump_member(uint, state, nr); - - trace_dump_struct_end(); -} - - -void trace_dump_constant_buffer(const struct pipe_constant_buffer *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_constant_buffer"); - - trace_dump_member(buffer_ptr, state, buffer); - - trace_dump_struct_end(); -} - - -void trace_dump_shader_state(const struct pipe_shader_state *state) -{ - static char str[8192]; - - if(!state) { - trace_dump_null(); - return; - } - - tgsi_dump_str(state->tokens, 0, str, sizeof(str)); - - trace_dump_struct_begin("pipe_shader_state"); - - trace_dump_member_begin("tokens"); - trace_dump_string(str); - trace_dump_member_end(); - - trace_dump_struct_end(); -} - - -void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state) -{ - unsigned i; - - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_depth_stencil_alpha_state"); - - trace_dump_member_begin("depth"); - trace_dump_struct_begin("pipe_depth_state"); - trace_dump_member(bool, &state->depth, enabled); - trace_dump_member(bool, &state->depth, writemask); - trace_dump_member(uint, &state->depth, func); - trace_dump_member(bool, &state->depth, occlusion_count); - trace_dump_struct_end(); - trace_dump_member_end(); - - trace_dump_member_begin("stencil"); - trace_dump_array_begin(); - for(i = 0; i < Elements(state->stencil); ++i) { - trace_dump_elem_begin(); - trace_dump_struct_begin("pipe_stencil_state"); - trace_dump_member(bool, &state->stencil[i], enabled); - trace_dump_member(uint, &state->stencil[i], func); - trace_dump_member(uint, &state->stencil[i], fail_op); - trace_dump_member(uint, &state->stencil[i], zpass_op); - trace_dump_member(uint, &state->stencil[i], zfail_op); - trace_dump_member(uint, &state->stencil[i], ref_value); - trace_dump_member(uint, &state->stencil[i], valuemask); - trace_dump_member(uint, &state->stencil[i], writemask); - trace_dump_struct_end(); - trace_dump_elem_end(); - } - trace_dump_array_end(); - trace_dump_member_end(); - - trace_dump_member_begin("alpha"); - trace_dump_struct_begin("pipe_alpha_state"); - trace_dump_member(bool, &state->alpha, enabled); - trace_dump_member(uint, &state->alpha, func); - trace_dump_member(float, &state->alpha, ref_value); - trace_dump_struct_end(); - trace_dump_member_end(); - - trace_dump_struct_end(); -} - - -void trace_dump_blend_state(const struct pipe_blend_state *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_blend_state"); - - trace_dump_member(bool, state, blend_enable); - - trace_dump_member(uint, state, rgb_func); - trace_dump_member(uint, state, rgb_src_factor); - trace_dump_member(uint, state, rgb_dst_factor); - - trace_dump_member(uint, state, alpha_func); - trace_dump_member(uint, state, alpha_src_factor); - trace_dump_member(uint, state, alpha_dst_factor); - - trace_dump_member(bool, state, logicop_enable); - trace_dump_member(uint, state, logicop_func); - - trace_dump_member(uint, state, colormask); - trace_dump_member(bool, state, dither); - - trace_dump_struct_end(); -} - - -void trace_dump_blend_color(const struct pipe_blend_color *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_blend_color"); - - trace_dump_member_array(float, state, color); - - trace_dump_struct_end(); -} - - -void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state) -{ - trace_dump_struct_begin("pipe_framebuffer_state"); - - trace_dump_member(uint, state, width); - trace_dump_member(uint, state, height); - trace_dump_member(uint, state, nr_cbufs); - trace_dump_member_array(ptr, state, cbufs); - trace_dump_member(ptr, state, zsbuf); - - trace_dump_struct_end(); -} - - -void trace_dump_sampler_state(const struct pipe_sampler_state *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_sampler_state"); - - trace_dump_member(uint, state, wrap_s); - trace_dump_member(uint, state, wrap_t); - trace_dump_member(uint, state, wrap_r); - trace_dump_member(uint, state, min_img_filter); - trace_dump_member(uint, state, min_mip_filter); - trace_dump_member(uint, state, mag_img_filter); - trace_dump_member(bool, state, compare_mode); - trace_dump_member(uint, state, compare_func); - trace_dump_member(bool, state, normalized_coords); - trace_dump_member(uint, state, prefilter); - trace_dump_member(float, state, shadow_ambient); - trace_dump_member(float, state, lod_bias); - trace_dump_member(float, state, min_lod); - trace_dump_member(float, state, max_lod); - trace_dump_member_array(float, state, border_color); - trace_dump_member(float, state, max_anisotropy); - - trace_dump_struct_end(); -} - - -void trace_dump_surface(const struct pipe_surface *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_surface"); - - trace_dump_reference(&state->reference); - - trace_dump_member(format, state, format); - trace_dump_member(uint, state, width); - trace_dump_member(uint, state, height); - - trace_dump_member(uint, state, layout); - trace_dump_member(uint, state, offset); - trace_dump_member(uint, state, usage); - - trace_dump_member(ptr, state, texture); - trace_dump_member(uint, state, face); - trace_dump_member(uint, state, level); - trace_dump_member(uint, state, zslice); - - trace_dump_struct_end(); -} - - -void trace_dump_transfer(const struct pipe_transfer *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_transfer"); - - trace_dump_member(format, state, format); - trace_dump_member(uint, state, width); - trace_dump_member(uint, state, height); - - trace_dump_member_begin("block"); - trace_dump_block(&state->block); - trace_dump_member_end(); - - trace_dump_member(uint, state, nblocksx); - trace_dump_member(uint, state, nblocksy); - trace_dump_member(uint, state, stride); - trace_dump_member(uint, state, usage); - - trace_dump_member(ptr, state, texture); - trace_dump_member(uint, state, face); - trace_dump_member(uint, state, level); - trace_dump_member(uint, state, zslice); - - trace_dump_struct_end(); -} - - -void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_vertex_buffer"); - - trace_dump_member(uint, state, stride); - trace_dump_member(uint, state, max_index); - trace_dump_member(uint, state, buffer_offset); - trace_dump_member(buffer_ptr, state, buffer); - - trace_dump_struct_end(); -} - - -void trace_dump_vertex_element(const struct pipe_vertex_element *state) -{ - if(!state) { - trace_dump_null(); - return; - } - - trace_dump_struct_begin("pipe_vertex_element"); - - trace_dump_member(uint, state, src_offset); - - trace_dump_member(uint, state, vertex_buffer_index); - trace_dump_member(uint, state, nr_components); - - trace_dump_member(format, state, src_format); - - trace_dump_struct_end(); -} diff --git a/src/gallium/drivers/trace/tr_state.h b/src/gallium/drivers/trace/tr_state.h deleted file mode 100644 index 513ed0ac98..0000000000 --- a/src/gallium/drivers/trace/tr_state.h +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef TR_STATE_H -#define TR_STATE_H - -#include "pipe/p_format.h" -#include "pipe/p_state.h" -#include "pipe/p_shader_tokens.h" - - -void trace_dump_format(enum pipe_format format); - -void trace_dump_block(const struct pipe_format_block *block); - -void trace_dump_template(const struct pipe_texture *templat); - - -void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state); - -void trace_dump_poly_stipple(const struct pipe_poly_stipple *state); - -void trace_dump_viewport_state(const struct pipe_viewport_state *state); - -void trace_dump_scissor_state(const struct pipe_scissor_state *state); - -void trace_dump_clip_state(const struct pipe_clip_state *state); - -void trace_dump_constant_buffer(const struct pipe_constant_buffer *state); - -void trace_dump_token(const struct tgsi_token *token); - -void trace_dump_shader_state(const struct pipe_shader_state *state); - -void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state); - -void trace_dump_blend_state(const struct pipe_blend_state *state); - -void trace_dump_blend_color(const struct pipe_blend_color *state); - -void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state); - -void trace_dump_sampler_state(const struct pipe_sampler_state *state); - -void trace_dump_surface(const struct pipe_surface *state); - -void trace_dump_transfer(const struct pipe_transfer *state); - -void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state); - -void trace_dump_vertex_element(const struct pipe_vertex_element *state); - - -#endif /* TR_STATE_H */ -- cgit v1.2.3 From 3b4da4e9dac00f181380a9896ef3329964432c43 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 05:30:43 +0200 Subject: trace: Put shaders on a list in the context --- src/gallium/drivers/trace/Makefile | 1 + src/gallium/drivers/trace/SConscript | 1 + src/gallium/drivers/trace/tr_context.c | 41 ++++++++++++++++++----- src/gallium/drivers/trace/tr_context.h | 7 ++++ src/gallium/drivers/trace/tr_state.c | 50 ++++++++++++++++++++++++++++ src/gallium/drivers/trace/tr_state.h | 59 ++++++++++++++++++++++++++++++++++ 6 files changed, 151 insertions(+), 8 deletions(-) create mode 100644 src/gallium/drivers/trace/tr_state.c create mode 100644 src/gallium/drivers/trace/tr_state.h diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index 188998d579..94be0bfd5a 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -8,6 +8,7 @@ C_SOURCES = \ tr_context.c \ tr_dump.c \ tr_dump_state.c \ + tr_state.c \ tr_screen.c \ tr_texture.c diff --git a/src/gallium/drivers/trace/SConscript b/src/gallium/drivers/trace/SConscript index 4ab829a3a8..9b5af0d86f 100644 --- a/src/gallium/drivers/trace/SConscript +++ b/src/gallium/drivers/trace/SConscript @@ -10,6 +10,7 @@ trace = env.ConvenienceLibrary( 'tr_dump.c', 'tr_dump_state.c', 'tr_screen.c', + 'tr_state.c', 'tr_texture.c', ]) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 6a19233a9a..dee9ac57b4 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -32,10 +32,10 @@ #include "tr_dump.h" #include "tr_dump_state.h" +#include "tr_state.h" #include "tr_buffer.h" #include "tr_screen.h" #include "tr_texture.h" -#include "tr_context.h" static INLINE struct pipe_buffer * @@ -573,23 +573,30 @@ trace_context_create_fs_state(struct pipe_context *_pipe, trace_dump_call_end(); + result = trace_shader_create(tr_ctx, state, result); + return result; } static INLINE void trace_context_bind_fs_state(struct pipe_context *_pipe, - void *state) + void *_state) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_shader *tr_shdr = trace_shader(_state); struct pipe_context *pipe = tr_ctx->pipe; + void *state = tr_shdr ? tr_shdr->state : NULL; trace_dump_call_begin("pipe_context", "bind_fs_state"); trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->bind_fs_state(pipe, state);; + if (tr_shdr && tr_shdr->replaced) + state = tr_shdr->replaced; + + pipe->bind_fs_state(pipe, state); trace_dump_call_end(); } @@ -597,19 +604,23 @@ trace_context_bind_fs_state(struct pipe_context *_pipe, static INLINE void trace_context_delete_fs_state(struct pipe_context *_pipe, - void *state) + void *_state) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_shader *tr_shdr = trace_shader(_state); struct pipe_context *pipe = tr_ctx->pipe; + void *state = tr_shdr->state; trace_dump_call_begin("pipe_context", "delete_fs_state"); trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_fs_state(pipe, state);; + pipe->delete_fs_state(pipe, state); trace_dump_call_end(); + + trace_shader_destroy(tr_ctx, tr_shdr); } @@ -626,28 +637,35 @@ trace_context_create_vs_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(shader_state, state); - result = pipe->create_vs_state(pipe, state);; + result = pipe->create_vs_state(pipe, state); trace_dump_ret(ptr, result); trace_dump_call_end(); + result = trace_shader_create(tr_ctx, state, result); + return result; } static INLINE void trace_context_bind_vs_state(struct pipe_context *_pipe, - void *state) + void *_state) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_shader *tr_shdr = trace_shader(_state); struct pipe_context *pipe = tr_ctx->pipe; + void *state = tr_shdr ? tr_shdr->state : NULL; trace_dump_call_begin("pipe_context", "bind_vs_state"); trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); + if (tr_shdr && tr_shdr->replaced) + state = tr_shdr->replaced; + pipe->bind_vs_state(pipe, state);; trace_dump_call_end(); @@ -656,10 +674,12 @@ trace_context_bind_vs_state(struct pipe_context *_pipe, static INLINE void trace_context_delete_vs_state(struct pipe_context *_pipe, - void *state) + void *_state) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_shader *tr_shdr = trace_shader(_state); struct pipe_context *pipe = tr_ctx->pipe; + void *state = tr_shdr->state; trace_dump_call_begin("pipe_context", "delete_vs_state"); @@ -669,6 +689,8 @@ trace_context_delete_vs_state(struct pipe_context *_pipe, pipe->delete_vs_state(pipe, state);; trace_dump_call_end(); + + trace_shader_destroy(tr_ctx, tr_shdr); } @@ -1099,6 +1121,9 @@ trace_context_create(struct pipe_screen *_screen, if(!tr_ctx) goto error1; + pipe_mutex_init(tr_ctx->list_mutex); + make_empty_list(&tr_ctx->shaders); + tr_ctx->base.winsys = _screen->winsys; tr_ctx->base.screen = _screen; tr_ctx->base.destroy = trace_context_destroy; diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 2512a0a232..a7da7b9526 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -33,6 +33,7 @@ #include "util/u_debug.h" #include "pipe/p_context.h" +#include "tr_screen.h" #ifdef __cplusplus extern "C" { @@ -45,7 +46,13 @@ struct trace_context struct pipe_context *pipe; + /* for list on screen */ struct tr_list list; + + /* list of state objects */ + pipe_mutex list_mutex; + unsigned num_shaders; + struct tr_list shaders; }; diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c new file mode 100644 index 0000000000..c9ce63a0ed --- /dev/null +++ b/src/gallium/drivers/trace/tr_state.c @@ -0,0 +1,50 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "tr_state.h" + +#include "util/u_memory.h" +#include "util/u_simple_list.h" + +struct trace_shader * trace_shader_create(struct trace_context *tr_ctx, + const struct pipe_shader_state *state, + void *result) +{ + struct trace_shader *tr_shdr = CALLOC_STRUCT(trace_shader); + + tr_shdr->state = result; + + /* works on context as well */ + trace_screen_add_to_list(tr_ctx, shaders, tr_shdr); + + return tr_shdr; +} + +void trace_shader_destroy(struct trace_context *tr_ctx, + struct trace_shader *tr_shdr) +{ + trace_screen_remove_from_list(tr_ctx, shaders, tr_shdr); + + FREE(tr_shdr); +} diff --git a/src/gallium/drivers/trace/tr_state.h b/src/gallium/drivers/trace/tr_state.h new file mode 100644 index 0000000000..bca615c50e --- /dev/null +++ b/src/gallium/drivers/trace/tr_state.h @@ -0,0 +1,59 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TR_STATE_H_ +#define TR_STATE_H_ + +#include "tr_context.h" + +struct tgsi_token; + +struct trace_shader +{ + struct tr_list list; + + void *state; + void *replaced; + + struct tgsi_token *tokens; + struct tgsi_token *replaced_tokens; + + boolean disabled; +}; + + +static INLINE struct trace_shader * +trace_shader(void *state) +{ + return (struct trace_shader *)state; +} + +struct trace_shader * trace_shader_create(struct trace_context *tr_ctx, + const struct pipe_shader_state *state, + void *result); + +void trace_shader_destroy(struct trace_context *tr_ctx, + struct trace_shader *tr_shdr); + +#endif -- cgit v1.2.3 From ab95f389a59acd8f70fc6ce00d945511f0a45d8b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 05:59:24 +0200 Subject: trace: If either shader is disabled don't draw --- src/gallium/drivers/trace/tr_context.c | 13 +++++++++++++ src/gallium/drivers/trace/tr_context.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index dee9ac57b4..e51af2451b 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -121,6 +121,9 @@ trace_context_draw_arrays(struct pipe_context *_pipe, struct pipe_context *pipe = tr_ctx->pipe; boolean result; + if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) + return 0; + trace_dump_call_begin("pipe_context", "draw_arrays"); trace_dump_arg(ptr, pipe); @@ -150,6 +153,9 @@ trace_context_draw_elements(struct pipe_context *_pipe, struct pipe_buffer *indexBuffer = tr_buf->buffer; boolean result; + if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) + return 0; + trace_screen_user_buffer_update(_pipe->screen, indexBuffer); trace_dump_call_begin("pipe_context", "draw_elements"); @@ -187,6 +193,9 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, struct pipe_buffer *indexBuffer = tr_buf->buffer; boolean result; + if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) + return 0; + trace_screen_user_buffer_update(_pipe->screen, indexBuffer); trace_dump_call_begin("pipe_context", "draw_range_elements"); @@ -593,6 +602,8 @@ trace_context_bind_fs_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); + tr_ctx->curr.fs = tr_shdr; + if (tr_shdr && tr_shdr->replaced) state = tr_shdr->replaced; @@ -663,6 +674,8 @@ trace_context_bind_vs_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); + tr_ctx->curr.vs = tr_shdr; + if (tr_shdr && tr_shdr->replaced) state = tr_shdr->replaced; diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index a7da7b9526..86827f97b2 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -46,6 +46,12 @@ struct trace_context struct pipe_context *pipe; + /* current state */ + struct { + struct trace_shader *fs; + struct trace_shader *vs; + } curr; + /* for list on screen */ struct tr_list list; -- cgit v1.2.3 From ee05658798c047876ccd9e5cd33e12eee1dd8758 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 16 May 2009 01:19:44 +0100 Subject: trace: Unwrap buffer in texture_blanket --- src/gallium/drivers/trace/tr_screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index e659416aba..58855a8346 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -212,10 +212,12 @@ static struct pipe_texture * trace_screen_texture_blanket(struct pipe_screen *_screen, const struct pipe_texture *templat, const unsigned *ppitch, - struct pipe_buffer *buffer) + struct pipe_buffer *_buffer) { struct trace_screen *tr_scr = trace_screen(_screen); + struct trace_buffer *tr_buf = trace_buffer(_buffer); struct pipe_screen *screen = tr_scr->screen; + struct pipe_buffer *buffer = tr_buf->buffer; unsigned pitch = *ppitch; struct pipe_texture *result; -- cgit v1.2.3 From f04c38fa1fab0fe640b89d0de82fa44e2ee984a9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 16 May 2009 01:49:11 +0100 Subject: trace: Export enabled status --- src/gallium/drivers/trace/Makefile | 2 +- src/gallium/drivers/trace/tr_context.c | 2 +- src/gallium/drivers/trace/tr_screen.c | 23 ++++++++++++++++------- src/gallium/drivers/trace/tr_screen.h | 7 +++++++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index 94be0bfd5a..ecb69fb996 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -8,8 +8,8 @@ C_SOURCES = \ tr_context.c \ tr_dump.c \ tr_dump_state.c \ - tr_state.c \ tr_screen.c \ + tr_state.c \ tr_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index e51af2451b..a416628562 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1124,7 +1124,7 @@ trace_context_create(struct pipe_screen *_screen, if(!pipe) goto error1; - if(!trace_dump_trace_enabled()) + if(!trace_enabled()) goto error1; tr_scr = trace_screen(_screen); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 58855a8346..bc14248eeb 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -37,6 +37,8 @@ #include "pipe/p_inlines.h" +static boolean trace = FALSE; + static const char * trace_screen_get_name(struct pipe_screen *_screen) { @@ -820,16 +822,20 @@ trace_screen_destroy(struct pipe_screen *_screen) struct pipe_screen *screen = tr_scr->screen; trace_dump_call_begin("pipe_screen", "destroy"); - trace_dump_arg(ptr, screen); + trace_dump_call_end(); + trace_dump_trace_end(); screen->destroy(screen); - trace_dump_call_end(); + FREE(tr_scr); +} - trace_dump_trace_end(); - FREE(tr_scr); +boolean +trace_enabled(void) +{ + return trace; } @@ -844,10 +850,13 @@ trace_screen_create(struct pipe_screen *screen) trace_dump_init(); - if(!trace_dump_trace_begin()) - goto error1; + if(trace_dump_trace_begin()) { + trace_dumping_start(); + trace = TRUE; + } - trace_dumping_start(); + if (!trace) + goto error1; trace_dump_call_begin("", "pipe_screen_create"); diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 59f254166d..7fae182985 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -71,6 +71,13 @@ struct trace_screen }; +/* + * tr_screen.c + */ + +boolean +trace_enabled(void); + struct trace_screen * trace_screen(struct pipe_screen *screen); -- cgit v1.2.3 From 3259f52a9296c1b82cd18f405735e65d2b727144 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 16 May 2009 01:21:02 +0100 Subject: gallium-intel: Enable trace driver --- src/gallium/winsys/drm/intel/dri/Makefile | 1 + src/gallium/winsys/drm/intel/dri/SConscript | 1 + src/gallium/winsys/drm/intel/gem/intel_be_api.c | 145 ++++++++++++++++++++++++ 3 files changed, 147 insertions(+) diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile index ac0891a646..de39e759d8 100644 --- a/src/gallium/winsys/drm/intel/dri/Makefile +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -6,6 +6,7 @@ LIBNAME = i915_dri.so PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/i915simple/libi915simple.a diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript index b11a1927f7..e14e96e32f 100644 --- a/src/gallium/winsys/drm/intel/dri/SConscript +++ b/src/gallium/winsys/drm/intel/dri/SConscript @@ -5,6 +5,7 @@ env = drienv.Clone() drivers = [ softpipe, i915simple, + trace, inteldrm ] diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c index f4ef7c2d88..5853afa756 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -2,7 +2,11 @@ #include "intel_be_api.h" #include "i915simple/i915_winsys.h" +#ifndef DEBUG struct drm_api drm_api_hooks = +#else +static struct drm_api hooks = +#endif { /* intel_be_context.c */ .create_context = intel_be_create_context, @@ -13,3 +17,144 @@ struct drm_api drm_api_hooks = .handle_from_buffer = intel_be_handle_from_buffer, .global_handle_from_buffer = intel_be_global_handle_from_buffer, }; + + +/* + * Trace integration + */ + +#ifdef DEBUG +#include "trace/tr_screen.h" +#include "trace/tr_texture.h" +#include "trace/tr_buffer.h" +#include "trace/tr_context.h" + +static struct pipe_screen * +trace_drm_create_screen(int fd, struct drm_create_screen_arg *arg) +{ + struct pipe_screen *screen; + + if (arg && arg->mode != DRM_CREATE_NORMAL) + return NULL; + + screen = hooks.create_screen(fd, arg); + + return trace_screen_create(screen); +}; + +static struct pipe_context * +trace_drm_create_context(struct pipe_screen *_screen) +{ + struct pipe_screen *screen; + struct pipe_context *pipe; + + if (trace_enabled()) + screen = trace_screen(_screen)->screen; + else + screen = _screen; + + pipe = hooks.create_context(screen); + + if (trace_enabled()) + pipe = trace_context_create(_screen, pipe); + + return pipe; +}; + +static boolean +trace_drm_buffer_from_texture(struct pipe_texture *_texture, + struct pipe_buffer **_buffer, + unsigned *stride) +{ + struct pipe_texture *texture; + struct pipe_buffer *buffer = NULL; + boolean result; + + if (trace_enabled()) + texture = trace_texture(_texture)->texture; + else + texture = _texture; + + result = hooks.buffer_from_texture(texture, &buffer, stride); + + if (result && _buffer) + buffer = trace_buffer_create(trace_screen(texture->screen), buffer); + + if (_buffer) + *_buffer = buffer; + else + pipe_buffer_reference(&buffer, NULL); + + return result; +} + +static struct pipe_buffer * +trace_drm_buffer_from_handle(struct pipe_screen *_screen, + const char *name, + unsigned handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *result; + + if (trace_enabled()) + screen = trace_screen(_screen)->screen; + else + screen = _screen; + + result = hooks.buffer_from_handle(screen, name, handle); + + if (trace_enabled()) + result = trace_buffer_create(trace_screen(_screen), result); + + return result; +} + +static boolean +trace_drm_handle_from_buffer(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *buffer; + + if (trace_enabled()) { + screen = trace_screen(_screen)->screen; + buffer = trace_buffer(_buffer)->buffer; + } else { + screen = _screen; + buffer = _buffer; + } + + return hooks.handle_from_buffer(screen, buffer, handle); +} + +static boolean +trace_drm_global_handle_from_buffer(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *buffer; + + if (trace_enabled()) { + screen = trace_screen(_screen)->screen; + buffer = trace_buffer(_buffer)->buffer; + } else { + screen = _screen; + buffer = _buffer; + } + + return hooks.global_handle_from_buffer(screen, buffer, handle); +} + +struct drm_api drm_api_hooks = +{ + .create_screen = trace_drm_create_screen, + .create_context = trace_drm_create_context, + + .buffer_from_texture = trace_drm_buffer_from_texture, + .buffer_from_handle = trace_drm_buffer_from_handle, + .handle_from_buffer = trace_drm_handle_from_buffer, + .global_handle_from_buffer = trace_drm_global_handle_from_buffer, +}; +#endif -- cgit v1.2.3 From 42f16aa4e0d9f1c5f016919ed04c55430507234e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 22:24:57 +0200 Subject: r300: further cleanup - move extensions init into seperate function - move options handling into seperate function - create new structure to hold options values - use context->options.hw_tcl_enabled field instead of global hw_tcl_on and future_hw_tcl_on variables --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 5 +- src/mesa/drivers/dri/r300/r300_context.c | 104 +++++++++++++++---------------- src/mesa/drivers/dri/r300/r300_context.h | 10 ++- src/mesa/drivers/dri/r300/r300_emit.c | 2 +- src/mesa/drivers/dri/r300/r300_ioctl.c | 5 +- src/mesa/drivers/dri/r300/r300_render.c | 14 ++--- src/mesa/drivers/dri/r300/r300_state.c | 27 ++++---- 7 files changed, 82 insertions(+), 85 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index a0d99ddfb6..253378767b 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -420,12 +420,11 @@ int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom) void r300InitCmdBuf(r300ContextPtr r300) { int mtu; - int has_tcl = 1; + int has_tcl; int is_r500 = 0; int i; - if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) - has_tcl = 0; + has_tcl = r300->options.hw_tcl_enabled; if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) is_r500 = 1; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 70c7730be9..3c16e80d2b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -72,10 +72,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ -/* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */ -int future_hw_tcl_on = 1; -int hw_tcl_on = 1; - #define need_GL_VERSION_2_0 #define need_GL_ARB_point_parameters #define need_GL_ARB_vertex_program @@ -296,7 +292,7 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.MaxDrawBuffers = 1; /* currently bogus data */ - if (screen->chip_flags & RADEON_CHIPSET_TCL) { + if (r300->options.hw_tcl_enabled) { ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; ctx->Const.VertexProgram.MaxNativeInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; @@ -329,6 +325,47 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) } } +static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen) +{ + struct r300_options options = { 0 }; + + driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache, + screen->driScreen->myNum, "r300"); + + r300->disable_lowimpact_fallback = driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback"); + r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, "def_max_anisotropy"); + + options.stencil_two_side_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side"); + options.s3tc_force_enabled = driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable"); + options.s3tc_force_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc"); + + if (!(screen->chip_flags & RADEON_CHIPSET_TCL) || driQueryOptioni(&r300->radeon.optionCache, "tcl_mode") == DRI_CONF_TCL_SW) + options.hw_tcl_enabled = 0; + else + options.hw_tcl_enabled = 1; + + r300->options = options; +} + +static void r300InitGLExtensions(GLcontext *ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + + driInitExtensions(ctx, card_extensions, GL_TRUE); + if (r300->radeon.radeonScreen->kernel_mm) + driInitExtensions(ctx, mm_extensions, GL_FALSE); + + if (r300->options.stencil_two_side_disabled) + _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); + + if (ctx->Mesa_DXTn && !r300->options.s3tc_force_enabled) { + _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + _mesa_enable_extension(ctx, "GL_S3_s3tc"); + } else if (r300->options.s3tc_force_disabled) { + _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + } +} + /* Create the device specific rendering context. */ GLboolean r300CreateContext(const __GLcontextModes * glVisual, @@ -340,7 +377,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, struct dd_function_table functions; r300ContextPtr r300; GLcontext *ctx; - int tcl_mode; assert(glVisual); assert(driContextPriv); @@ -350,11 +386,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, if (!r300) return GL_FALSE; - if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) - hw_tcl_on = future_hw_tcl_on = 0; - - driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache, - screen->driScreen->myNum, "r300"); + r300ParseOptions(r300, screen); r300_init_vtbl(&r300->radeon); @@ -372,13 +404,14 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, } ctx = r300->radeon.glCtx; - r300InitConstValues(ctx, screen); - if (hw_tcl_on) + if (r300->options.hw_tcl_enabled) ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + r300InitConstValues(ctx, screen); + /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); @@ -400,56 +433,21 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); + if (!r300->options.hw_tcl_enabled) + r300InitSwtcl(ctx); + radeon_fbo_init(&r300->radeon); - radeonInitSpanFuncs( ctx ); + radeonInitSpanFuncs( ctx ); r300InitCmdBuf(r300); r300InitState(r300); r300InitShaderFunctions(r300); - if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) - r300InitSwtcl(ctx); - - driInitExtensions(ctx, card_extensions, GL_TRUE); - if (r300->radeon.radeonScreen->kernel_mm) - driInitExtensions(ctx, mm_extensions, GL_FALSE); if (screen->chip_family == CHIP_FAMILY_RS600 || screen->chip_family == CHIP_FAMILY_RS690 || screen->chip_family == CHIP_FAMILY_RS740) { r300->radeon.texture_row_align = 64; } - r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, - "def_max_anisotropy"); - - if (driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side")) - _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); - - if (ctx->Mesa_DXTn && !driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc")) { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - _mesa_enable_extension(ctx, "GL_S3_s3tc"); - } else if (driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable")) { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - } - - r300->disable_lowimpact_fallback = - driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback"); - - tcl_mode = driQueryOptioni(&r300->radeon.optionCache, "tcl_mode"); - if (driQueryOptionb(&r300->radeon.optionCache, "no_rast")) { - fprintf(stderr, "disabling 3D acceleration\n"); -#if R200_MERGED - FALLBACK(&r300->radeon, RADEON_FALLBACK_DISABLE, 1); -#endif - } - if (tcl_mode == DRI_CONF_TCL_SW || - !(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) { - if (r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) { - r300->radeon.radeonScreen->chip_flags &= - ~RADEON_CHIPSET_TCL; - fprintf(stderr, "Disabling HW TCL support\n"); - } - TCL_FALLBACK(r300->radeon.glCtx, - RADEON_TCL_FALLBACK_TCL_DISABLE, 1); - } + r300InitGLExtensions(ctx); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index d45e4beec0..ad8b5a2ae4 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -412,8 +412,6 @@ struct r300_vertex_shader_state { struct r300_vertex_shader_fragment program; }; -extern int hw_tcl_on; - #define COLOR_IS_RGBA #define TAG(x) r300##x #include "tnl_dd/t_dd_vertex.h" @@ -648,6 +646,14 @@ struct r300_context { GLboolean disable_lowimpact_fallback; + struct r300_options { + uint32_t conformance_mode:1; + uint32_t hw_tcl_enabled:1; + uint32_t s3tc_force_enabled:1; + uint32_t s3tc_force_disabled:1; + uint32_t stencil_two_side_disabled:1; + } options; + struct r300_swtcl_info swtcl; GLboolean vap_flush_needed; diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index a19b0f1960..20b77bc9ae 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -214,7 +214,7 @@ int r300EmitArrays(GLcontext * ctx) struct r300_vertex_program *prog = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - if (hw_tcl_on) { + if (rmesa->options.hw_tcl_enabled) { inputs = prog->inputs; InputsRead = prog->key.InputsRead; OutputsWritten = prog->key.OutputsWritten; diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index a7f5121da7..6766eb3eae 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -215,12 +215,11 @@ static void r300EmitClearState(GLcontext * ctx) BATCH_LOCALS(&r300->radeon); __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; int i; - int has_tcl = 1; + int has_tcl; int is_r500 = 0; GLuint vap_cntl; - if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) - has_tcl = 0; + has_tcl = r300->options.hw_tcl_enabled; if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) is_r500 = 1; diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index f87fee4af6..93fdc57588 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -74,8 +74,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" #include "r300_fragprog_common.h" -extern int future_hw_tcl_on; - /** * \brief Convert a OpenGL primitive type into a R300 primitive type. */ @@ -468,8 +466,8 @@ static GLboolean r300RunNonTCLRender(GLcontext * ctx, if (r300Fallback(ctx) >= R300_FALLBACK_RAST) return GL_TRUE; - if (!(rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) - return GL_TRUE; + if (rmesa->options.hw_tcl_enabled == GL_FALSE) + return GL_TRUE; if (!r300ValidateBuffers(ctx)) return GL_TRUE; @@ -483,16 +481,14 @@ static GLboolean r300RunTCLRender(GLcontext * ctx, r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program *vp; - hw_tcl_on = future_hw_tcl_on; - if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); - if (hw_tcl_on == GL_FALSE) + if (rmesa->options.hw_tcl_enabled == GL_FALSE) return GL_TRUE; if (r300Fallback(ctx) >= R300_FALLBACK_TCL) { - hw_tcl_on = GL_FALSE; + rmesa->options.hw_tcl_enabled = GL_FALSE; return GL_TRUE; } @@ -503,7 +499,7 @@ static GLboolean r300RunTCLRender(GLcontext * ctx, vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); if (vp->native == GL_FALSE) { - hw_tcl_on = GL_FALSE; + rmesa->options.hw_tcl_enabled = GL_FALSE; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 7a025aa56f..873ac4aaec 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -67,8 +67,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" -extern int future_hw_tcl_on; - static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4]) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -367,7 +365,7 @@ static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) GLint *ip; /* no VAP UCP on non-TCL chipsets */ - if (!(rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + if (!rmesa->options.hw_tcl_enabled) return; p = (GLint) plane - (GLint) GL_CLIP_PLANE0; @@ -386,7 +384,7 @@ static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) GLuint p; /* no VAP UCP on non-TCL chipsets */ - if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + if (!r300->options.hw_tcl_enabled) return; p = cap - GL_CLIP_PLANE0; @@ -1416,8 +1414,9 @@ static void r300SetupRSUnit(GLcontext * ctx) int fp_reg, high_rr; int col_ip, tex_ip; int rs_tex_count = 0; - int i, count, col_fmt; + int i, count, col_fmt, hw_tcl_on; + hw_tcl_on = r300->options.hw_tcl_enabled; if (hw_tcl_on) OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; else @@ -1552,8 +1551,9 @@ static void r500SetupRSUnit(GLcontext * ctx) int fp_reg, high_rr; int col_ip, tex_ip; int rs_tex_count = 0; - int i, count, col_fmt; + int i, count, col_fmt, hw_tcl_on; + hw_tcl_on = r300->options.hw_tcl_enabled; if (hw_tcl_on) OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; else @@ -1764,7 +1764,7 @@ static void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, pvs_num_cntrls = MIN2(6, vtx_mem_size/temp_count); R300_STATECHANGE(rmesa, vap_cntl); - if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) { + if (rmesa->options.hw_tcl_enabled) { rmesa->hw.vap_cntl.cmd[R300_VAP_CNTL_INSTR] = (pvs_num_slots << R300_PVS_NUM_SLOTS_SHIFT) | (pvs_num_cntrls << R300_PVS_NUM_CNTLRS_SHIFT) | @@ -1894,7 +1894,7 @@ static void r300SetupVertexProgram(r300ContextPtr rmesa) 0x400 area might have something to do with pixel shaders as it appears right after pfs programming. 0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */ //setup_vertex_shader_fragment(rmesa, 0x406, &unk4); - if (hw_tcl_on && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated) { + if (rmesa->options.hw_tcl_enabled && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated) { r300SetupRealVertexProgram(rmesa); } else { /* FIXME: This needs to be replaced by vertex shader generation code. */ @@ -1972,10 +1972,9 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) static void r300ResetHwState(r300ContextPtr r300) { GLcontext *ctx = r300->radeon.glCtx; - int has_tcl = 1; + int has_tcl; - if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) - has_tcl = 0; + has_tcl = r300->options.hw_tcl_enabled; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); @@ -2193,7 +2192,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) ctx = rmesa->radeon.glCtx; - if (rmesa->radeon.NewGLState && hw_tcl_on) { + if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) { rmesa->radeon.NewGLState = 0; for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { @@ -2217,7 +2216,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) r300TranslateVertexShader(vp); */ if (vp->translated == GL_FALSE) { fprintf(stderr, "Failing back to sw-tcl\n"); - hw_tcl_on = future_hw_tcl_on = 0; + rmesa->options.hw_tcl_enabled = 0; r300ResetHwState(rmesa); r300UpdateStateParameters(ctx, _NEW_PROGRAM | @@ -2425,7 +2424,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->vtbl.SetupRSUnit(ctx); - if ((rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL)) + if (rmesa->options.hw_tcl_enabled) r300SetupVertexProgram(rmesa); } -- cgit v1.2.3 From d6da805c4e6f060a4a531aba89d4a7db885767f4 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 22:28:39 +0200 Subject: r300: remove unnecessary switch cases --- src/mesa/drivers/dri/r300/r300_state.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 873ac4aaec..c0e3dbe994 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1917,14 +1917,6 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) state ? "GL_TRUE" : "GL_FALSE"); switch (cap) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - /* empty */ - break; - case GL_FOG: - /* empty */ - break; case GL_ALPHA_TEST: r300SetAlphaState(ctx); break; -- cgit v1.2.3 From 621f65ab86f94f7a228e5f96061a8e3451f15db0 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 22:33:27 +0200 Subject: r300: r300EmitArrays should never fail --- src/mesa/drivers/dri/r300/r300_emit.c | 9 ++------- src/mesa/drivers/dri/r300/r300_emit.h | 2 +- src/mesa/drivers/dri/r300/r300_render.c | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 20b77bc9ae..45e7074002 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -196,9 +196,8 @@ GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten) /* Emit vertex data to GART memory * Route inputs to the vertex processor - * This function should never return R300_FALLBACK_TCL when using software tcl. */ -int r300EmitArrays(GLcontext * ctx) +void r300EmitArrays(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -284,9 +283,7 @@ int r300EmitArrays(GLcontext * ctx) } } - if (nr > R300_MAX_AOS_ARRAYS) { - return R300_FALLBACK_TCL; - } + assert(nr <= R300_MAX_AOS_ARRAYS); for (i = 0; i < nr; i++) { int ci; @@ -341,8 +338,6 @@ int r300EmitArrays(GLcontext * ctx) r300VAPOutputCntl1(ctx, OutputsWritten); rmesa->radeon.tcl.aos_count = nr; - - return R300_FALLBACK_NONE; } void r300EmitCacheFlush(r300ContextPtr rmesa) diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index 80c22d5e9a..e6485e9bd7 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -216,7 +216,7 @@ void static INLINE cp_wait(radeonContextPtr radeon, unsigned char flags) } } -extern int r300EmitArrays(GLcontext * ctx); +extern void r300EmitArrays(GLcontext * ctx); extern int r300PrimitiveType(r300ContextPtr rmesa, int prim); extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 93fdc57588..4d2d9e761d 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -390,8 +390,7 @@ static GLboolean r300RunRender(GLcontext * ctx, fprintf(stderr, "%s\n", __FUNCTION__); r300UpdateShaders(rmesa); - if (r300EmitArrays(ctx)) - return GL_TRUE; + r300EmitArrays(ctx); r300UpdateShaderStates(rmesa); -- cgit v1.2.3 From 2240c0d33365189f975b84b06792e2a5ecb8b13a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 14 May 2009 02:07:49 +0200 Subject: r300: software fallbacking handling rewrite Until now falling back to software rasterizer worked only for TCL enabled cards. For non TCL cards we used to plug our rendering functions in r300InitSwtcl, and we had never restored original functions for software rasterizer. --- src/mesa/drivers/dri/r300/r300_context.c | 4 +- src/mesa/drivers/dri/r300/r300_context.h | 8 +- src/mesa/drivers/dri/r300/r300_render.c | 137 ++++++++++++++++++------------- src/mesa/drivers/dri/r300/r300_render.h | 49 +++++++++++ src/mesa/drivers/dri/r300/r300_state.c | 93 ++++++++++++++------- src/mesa/drivers/dri/r300/r300_swtcl.c | 10 +-- src/mesa/drivers/dri/r300/r300_swtcl.h | 6 ++ 7 files changed, 208 insertions(+), 99 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/r300_render.h diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 3c16e80d2b..5b22a11bca 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -332,7 +332,6 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen) driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache, screen->driScreen->myNum, "r300"); - r300->disable_lowimpact_fallback = driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback"); r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, "def_max_anisotropy"); options.stencil_two_side_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side"); @@ -344,6 +343,8 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen) else options.hw_tcl_enabled = 1; + options.conformance_mode = !driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback"); + r300->options = options; } @@ -405,6 +406,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, ctx = r300->radeon.glCtx; + r300->fallback = 0; if (r300->options.hw_tcl_enabled) ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index ad8b5a2ae4..d9e1944d71 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -587,10 +587,6 @@ struct r300_fragment_program_compiler { #define R300_MAX_AOS_ARRAYS 16 -#define R300_FALLBACK_NONE 0 -#define R300_FALLBACK_TCL 1 -#define R300_FALLBACK_RAST 2 - /* r300_swtcl.c */ struct r300_swtcl_info { @@ -644,8 +640,6 @@ struct r300_context { GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; - GLboolean disable_lowimpact_fallback; - struct r300_options { uint32_t conformance_mode:1; uint32_t hw_tcl_enabled:1; @@ -657,6 +651,8 @@ struct r300_context { struct r300_swtcl_info swtcl; GLboolean vap_flush_needed; + uint32_t fallback; + DECLARE_RENDERINPUTS(render_inputs_bitset); }; diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 4d2d9e761d..7edeaed6d8 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -50,6 +50,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * no bugs... */ +#include "r300_render.h" + #include "main/glheader.h" #include "main/state.h" #include "main/imports.h" @@ -73,6 +75,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_tex.h" #include "r300_emit.h" #include "r300_fragprog_common.h" +#include "r300_swtcl.h" /** * \brief Convert a OpenGL primitive type into a R300 primitive type. @@ -378,7 +381,7 @@ static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, COMMIT_BATCH(); } -static GLboolean r300RunRender(GLcontext * ctx, +static void r300RunRender(GLcontext * ctx, struct tnl_pipeline_stage *stage) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -407,51 +410,77 @@ static GLboolean r300RunRender(GLcontext * ctx, r300EmitCacheFlush(rmesa); radeonReleaseArrays(ctx, ~0); - - return GL_FALSE; } -#define FALLBACK_IF(expr) \ - do { \ - if (expr) { \ - if (1 || RADEON_DEBUG & DEBUG_FALLBACKS) \ - WARN_ONCE("Software fallback:%s\n", \ - #expr); \ - return R300_FALLBACK_RAST; \ - } \ - } while(0) - -static int r300Fallback(GLcontext * ctx) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - const unsigned back = ctx->Stencil._BackFace; - FALLBACK_IF(r300->radeon.Fallback); - - struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - if (fp && !fp->translated) { - r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - FALLBACK_IF(fp->error); +static const char *getFallbackString(uint32_t bit) +{ + switch (bit) { + case R300_FALLBACK_VERTEX_PROGRAM : + return "vertex program"; + case R300_FALLBACK_LINE_SMOOTH: + return "smooth lines"; + case R300_FALLBACK_POINT_SMOOTH: + return "smooth points"; + case R300_FALLBACK_POLYGON_SMOOTH: + return "smooth polygons"; + case R300_FALLBACK_LINE_STIPPLE: + return "line stipple"; + case R300_FALLBACK_POLYGON_STIPPLE: + return "polygon stipple"; + case R300_FALLBACK_STENCIL_TWOSIDE: + return "two-sided stencil"; + case R300_FALLBACK_RENDER_MODE: + return "render mode != GL_RENDER"; + case R300_FALLBACK_FRAGMENT_PROGRAM: + return "fragment program"; + case R300_FALLBACK_INVALID_BUFFERS: + return "invalid buffers"; + default: + return "unknown"; } +} - FALLBACK_IF(ctx->RenderMode != GL_RENDER); - - FALLBACK_IF(ctx->Stencil.Enabled && (ctx->Stencil.Ref[0] != ctx->Stencil.Ref[back] - || ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[back] - || ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[back])); - - if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) - FALLBACK_IF(ctx->Point.PointSprite); - - if (!r300->disable_lowimpact_fallback) { - FALLBACK_IF(ctx->Polygon.StippleFlag); - FALLBACK_IF(ctx->Multisample._Enabled); - FALLBACK_IF(ctx->Line.StippleFlag); - FALLBACK_IF(ctx->Line.SmoothFlag); - FALLBACK_IF(ctx->Point.SmoothFlag); +void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + r300ContextPtr rmesa = R300_CONTEXT(ctx); + uint32_t old_fallback = rmesa->fallback; + static uint32_t fallback_warn = 0; + + if (mode) { + if ((fallback_warn & bit) == 0) { + _mesa_fprintf(stderr, "WARNING! Falling back to software for %s\n", getFallbackString(bit)); + fallback_warn |= bit; + } + rmesa->fallback |= bit; + /* update only if we change from no raster fallbacks to some raster fallbacks */ + if (((old_fallback & R300_RASTER_FALLBACK_MASK) == 0) && + ((bit & R300_RASTER_FALLBACK_MASK) > 0)) { + + radeon_firevertices(&rmesa->radeon); + rmesa->radeon.swtcl.RenderIndex = ~0; + _swsetup_Wakeup( ctx ); + } + } else { + rmesa->fallback &= ~bit; + /* update only if we have disabled all raster fallbacks */ + if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) { + _swrast_flush( ctx ); + + tnl->Driver.Render.Start = r300RenderStart; + tnl->Driver.Render.Finish = r300RenderFinish; + tnl->Driver.Render.PrimitiveNotify = r300RenderPrimitive; + tnl->Driver.Render.ResetLineStipple = r300ResetLineStipple; + tnl->Driver.Render.BuildVertices = _tnl_build_vertices; + tnl->Driver.Render.CopyPV = _tnl_copy_pv; + tnl->Driver.Render.Interp = _tnl_interp; + + _tnl_invalidate_vertex_state( ctx, ~0 ); + _tnl_invalidate_vertices( ctx, ~0 ); + } } - - return R300_FALLBACK_NONE; + } static GLboolean r300RunNonTCLRender(GLcontext * ctx, @@ -462,23 +491,21 @@ static GLboolean r300RunNonTCLRender(GLcontext * ctx, if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); - if (r300Fallback(ctx) >= R300_FALLBACK_RAST) + if (rmesa->fallback & R300_RASTER_FALLBACK_MASK) return GL_TRUE; if (rmesa->options.hw_tcl_enabled == GL_FALSE) return GL_TRUE; - if (!r300ValidateBuffers(ctx)) - return GL_TRUE; + r300RunRender(ctx, stage); - return r300RunRender(ctx, stage); + return GL_FALSE; } static GLboolean r300RunTCLRender(GLcontext * ctx, struct tnl_pipeline_stage *stage) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct r300_vertex_program *vp; if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s\n", __FUNCTION__); @@ -486,23 +513,17 @@ static GLboolean r300RunTCLRender(GLcontext * ctx, if (rmesa->options.hw_tcl_enabled == GL_FALSE) return GL_TRUE; - if (r300Fallback(ctx) >= R300_FALLBACK_TCL) { - rmesa->options.hw_tcl_enabled = GL_FALSE; - return GL_TRUE; - } - - if (!r300ValidateBuffers(ctx)) - return GL_TRUE; - + /* Call it here so we can fallback early */ r300UpdateShaders(rmesa); - vp = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - if (vp->native == GL_FALSE) { - rmesa->options.hw_tcl_enabled = GL_FALSE; + r300SwitchFallback(ctx, R300_FALLBACK_INVALID_BUFFERS, !r300ValidateBuffers(ctx)); + + if (rmesa->fallback) return GL_TRUE; - } - return r300RunRender(ctx, stage); + r300RunRender(ctx, stage); + + return GL_FALSE; } const struct tnl_pipeline_stage _r300_render_stage = { diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h new file mode 100644 index 0000000000..fbc9581e06 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -0,0 +1,49 @@ +/* + * Copyright 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef __R300_RENDER_H__ +#define __R300_RENDER_H__ + +#include "main/mtypes.h" + +#define R300_FALLBACK_VERTEX_PROGRAM (1 << 0) +#define R300_TCL_FALLBACK_MASK 0x0000ffff + +#define R300_FALLBACK_LINE_SMOOTH (1 << 16) +#define R300_FALLBACK_POINT_SMOOTH (1 << 17) +#define R300_FALLBACK_POLYGON_SMOOTH (1 << 18) +#define R300_FALLBACK_LINE_STIPPLE (1 << 19) +#define R300_FALLBACK_POLYGON_STIPPLE (1 << 20) +#define R300_FALLBACK_STENCIL_TWOSIDE (1 << 21) +#define R300_FALLBACK_RENDER_MODE (1 << 22) +#define R300_FALLBACK_FRAGMENT_PROGRAM (1 << 23) +#define R300_FALLBACK_INVALID_BUFFERS (1 << 31) +#define R300_RASTER_FALLBACK_MASK 0xffff0000 + +extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); + +#endif diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c0e3dbe994..397a26c3df 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -64,6 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_fragprog_common.h" #include "r300_fragprog.h" #include "r500_fragprog.h" +#include "r300_render.h" #include "drirenderbuffer.h" @@ -574,10 +575,26 @@ static void r300SetDepthState(GLcontext * ctx) } } +static void r300CatchStencilFallback(GLcontext *ctx) +{ + const unsigned back = ctx->Stencil._BackFace; + + if (ctx->Stencil._Enabled && (ctx->Stencil.Ref[0] != ctx->Stencil.Ref[back] + || ctx->Stencil.ValueMask[0] != ctx->Stencil.ValueMask[back] + || ctx->Stencil.WriteMask[0] != ctx->Stencil.WriteMask[back])) { + r300SwitchFallback(ctx, R300_FALLBACK_STENCIL_TWOSIDE, GL_TRUE); + } else { + r300SwitchFallback(ctx, R300_FALLBACK_STENCIL_TWOSIDE, GL_FALSE); + } +} + static void r300SetStencilState(GLcontext * ctx, GLboolean state) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLboolean hw_stencil = GL_FALSE; + + r300CatchStencilFallback(ctx); + if (ctx->DrawBuffer) { struct radeon_renderbuffer *rrbStencil = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); @@ -593,10 +610,6 @@ static void r300SetStencilState(GLcontext * ctx, GLboolean state) r300->hw.zs.cmd[R300_ZS_CNTL_0] &= ~R300_STENCIL_ENABLE; } - } else { -#if R200_MERGED - FALLBACK(&r300->radeon, RADEON_FALLBACK_STENCIL, state); -#endif } } @@ -846,11 +859,14 @@ static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - GLuint refmask = - ((ctx->Stencil.Ref[0] & 0xff) << R300_STENCILREF_SHIFT) - | ((ctx->Stencil.ValueMask[0] & 0xff) << R300_STENCILMASK_SHIFT); - const unsigned back = ctx->Stencil._BackFace; + GLuint refmask; GLuint flag; + const unsigned back = ctx->Stencil._BackFace; + + r300CatchStencilFallback(ctx); + + refmask = ((ctx->Stencil.Ref[0] & 0xff) << R300_STENCILREF_SHIFT) + | ((ctx->Stencil.ValueMask[0] & 0xff) << R300_STENCILMASK_SHIFT); R300_STATECHANGE(rmesa, zs); rmesa->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_STENCIL_FRONT_BACK; @@ -878,6 +894,8 @@ static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) { r300ContextPtr rmesa = R300_CONTEXT(ctx); + r300CatchStencilFallback(ctx); + R300_STATECHANGE(rmesa, zs); rmesa->hw.zs.cmd[R300_ZS_CNTL_2] &= ~(R300_STENCILREF_MASK << @@ -894,6 +912,8 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, r300ContextPtr rmesa = R300_CONTEXT(ctx); const unsigned back = ctx->Stencil._BackFace; + r300CatchStencilFallback(ctx); + R300_STATECHANGE(rmesa, zs); /* It is easier to mask what's left.. */ rmesa->hw.zs.cmd[R300_ZS_CNTL_1] &= @@ -1934,14 +1954,31 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) case GL_CLIP_PLANE5: r300SetClipPlaneState(ctx, cap, state); break; + case GL_CULL_FACE: + r300UpdateCulling(ctx); + break; case GL_DEPTH_TEST: r300SetDepthState(ctx); break; - case GL_STENCIL_TEST: - r300SetStencilState(ctx, state); + case GL_LINE_SMOOTH: + if (rmesa->options.conformance_mode) + r300SwitchFallback(ctx, R300_FALLBACK_LINE_SMOOTH, ctx->Line.SmoothFlag); break; - case GL_CULL_FACE: - r300UpdateCulling(ctx); + case GL_LINE_STIPPLE: + if (rmesa->options.conformance_mode) + r300SwitchFallback(ctx, R300_FALLBACK_LINE_STIPPLE, ctx->Line.StippleFlag); + break; + case GL_POINT_SMOOTH: + if (rmesa->options.conformance_mode) + r300SwitchFallback(ctx, R300_FALLBACK_POINT_SMOOTH, ctx->Point.SmoothFlag); + break; + case GL_POLYGON_SMOOTH: + if (rmesa->options.conformance_mode) + r300SwitchFallback(ctx, R300_FALLBACK_POLYGON_SMOOTH, ctx->Polygon.SmoothFlag); + break; + case GL_POLYGON_STIPPLE: + if (rmesa->options.conformance_mode) + r300SwitchFallback(ctx, R300_FALLBACK_POLYGON_STIPPLE, ctx->Polygon.StippleFlag); break; case GL_POLYGON_OFFSET_POINT: case GL_POLYGON_OFFSET_LINE: @@ -1953,6 +1990,9 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) rmesa->radeon.state.scissor.enabled = state; radeonUpdateScissor( ctx ); break; + case GL_STENCIL_TEST: + r300SetStencilState(ctx, state); + break; default: break; } @@ -2180,9 +2220,11 @@ void r300UpdateShaders(r300ContextPtr rmesa) { GLcontext *ctx; struct r300_vertex_program *vp; + struct r300_fragment_program *fp; int i; ctx = rmesa->radeon.glCtx; + fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) { rmesa->radeon.NewGLState = 0; @@ -2202,20 +2244,17 @@ void r300UpdateShaders(r300ContextPtr rmesa) } r300SelectVertexShader(rmesa); - vp = (struct r300_vertex_program *) - CURRENT_VERTEX_SHADER(ctx); - /*if (vp->translated == GL_FALSE) - r300TranslateVertexShader(vp); */ - if (vp->translated == GL_FALSE) { - fprintf(stderr, "Failing back to sw-tcl\n"); - rmesa->options.hw_tcl_enabled = 0; - r300ResetHwState(rmesa); - - r300UpdateStateParameters(ctx, _NEW_PROGRAM | - _NEW_PROGRAM_CONSTANTS); - return; - } + vp = (struct r300_vertex_program *) CURRENT_VERTEX_SHADER(ctx); + r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, !vp->native); + } + + if (fp) { + if (!fp->translated) + r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + + r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error); } + r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); } @@ -2457,9 +2496,7 @@ void r300InitState(r300ContextPtr r300) static void r300RenderMode(GLcontext * ctx, GLenum mode) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); - (void)rmesa; - (void)mode; + r300SwitchFallback(ctx, R300_FALLBACK_RENDER_MODE, ctx->RenderMode != GL_RENDER); } /** diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index a40d0378db..78fa031479 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -324,7 +324,6 @@ static GLuint reduced_prim[] = { }; static void r300RasterPrimitive( GLcontext *ctx, GLuint prim ); -static void r300RenderPrimitive( GLcontext *ctx, GLenum prim ); /*********************************************************************** * Emit primitives as inline vertices * @@ -558,7 +557,7 @@ static void r300ChooseRenderState( GLcontext *ctx ) } -static void r300RenderStart(GLcontext *ctx) +void r300RenderStart(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); @@ -578,7 +577,7 @@ static void r300RenderStart(GLcontext *ctx) } } -static void r300RenderFinish(GLcontext *ctx) +void r300RenderFinish(GLcontext *ctx) { } @@ -592,7 +591,7 @@ static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim ) } } -static void r300RenderPrimitive(GLcontext *ctx, GLenum prim) +void r300RenderPrimitive(GLcontext *ctx, GLenum prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -604,7 +603,7 @@ static void r300RenderPrimitive(GLcontext *ctx, GLenum prim) r300RasterPrimitive( ctx, reduced_prim[prim] ); } -static void r300ResetLineStipple(GLcontext *ctx) +void r300ResetLineStipple(GLcontext *ctx) { } @@ -640,7 +639,6 @@ void r300InitSwtcl(GLcontext *ctx) _tnl_invalidate_vertices( ctx, ~0 ); _tnl_need_projected_coords( ctx, GL_FALSE ); - r300ChooseRenderState(ctx); } void r300DestroySwtcl(GLcontext *ctx) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index 75c419380d..14826f0817 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -60,5 +60,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r300InitSwtcl( GLcontext *ctx ); extern void r300DestroySwtcl( GLcontext *ctx ); +extern void r300RenderStart(GLcontext *ctx); +extern void r300RenderFinish(GLcontext *ctx); +extern void r300RenderPrimitive(GLcontext *ctx, GLenum prim); +extern void r300ResetLineStipple(GLcontext *ctx); + extern void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset); + #endif -- cgit v1.2.3 From 6f1a86ca1eb4a44a738d0ad99861d948c9749de6 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 23:09:39 +0200 Subject: r300: move forward declarations to where they belong --- src/mesa/drivers/dri/r300/r300_context.c | 5 +---- src/mesa/drivers/dri/r300/r300_render.h | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 5b22a11bca..be8d480c1c 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -64,6 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_ioctl.h" #include "r300_tex.h" #include "r300_emit.h" +#include "r300_render.h" #include "r300_swtcl.h" #include "radeon_bocs_wrapper.h" @@ -150,10 +151,6 @@ const struct dri_extension gl_20_extension[] = { {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, }; - -extern struct tnl_pipeline_stage _r300_render_stage; -extern const struct tnl_pipeline_stage _r300_tcl_stage; - static const struct tnl_pipeline_stage *r300_pipeline[] = { /* Try and go straight to t&l diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index fbc9581e06..940d2566e2 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -44,6 +44,10 @@ #define R300_FALLBACK_INVALID_BUFFERS (1 << 31) #define R300_RASTER_FALLBACK_MASK 0xffff0000 +extern const struct tnl_pipeline_stage _r300_render_stage; + +extern const struct tnl_pipeline_stage _r300_tcl_stage; + extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); #endif -- cgit v1.2.3 From 12ed56f1ddfbd40df16d4ab47b546ee25218118f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 23:49:04 +0200 Subject: r300: rename functions Be consistent with function naming: use Setup/Emit names for functions that modify hardware state --- src/mesa/drivers/dri/r300/r300_context.h | 2 +- src/mesa/drivers/dri/r300/r300_fragprog.h | 2 +- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 2 +- src/mesa/drivers/dri/r300/r300_fragprog_emit.c | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 4 ++-- src/mesa/drivers/dri/r300/r500_fragprog.h | 2 +- src/mesa/drivers/dri/r300/r500_fragprog_emit.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index d9e1944d71..cd25b1da01 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -616,7 +616,7 @@ struct r300_swtcl_info { struct r300_vtable { void (* SetupRSUnit)(GLcontext *ctx); void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); - GLboolean (* FragmentProgramEmit)(struct r300_fragment_program_compiler *compiler); + GLboolean (* BuildFragmentProgramHwCode)(struct r300_fragment_program_compiler *compiler); void (* FragmentProgramDump)(union rX00_fragment_program_code *code); GLboolean (* SetupPixelShader)(GLcontext *ctx); }; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.h b/src/mesa/drivers/dri/r300/r300_fragprog.h index affa022a5c..5ce6f33cee 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/r300_fragprog.h @@ -102,7 +102,7 @@ #endif -extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); +extern GLboolean r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler); extern void r300FragmentProgramDump(union rX00_fragment_program_code *c); diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 2a880e6d14..abc8757ba1 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -269,7 +269,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp) fflush(stdout); } - if (!r300->vtbl.FragmentProgramEmit(&compiler)) + if (!r300->vtbl.BuildFragmentProgramHwCode(&compiler)) r300_fp->error = GL_TRUE; /* Subtle: Rescue any parameters that have been added during transformations */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c index af8bb3887b..b75656e7ee 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c @@ -325,7 +325,7 @@ static const struct radeon_pair_handler pair_handler = { * Final compilation step: Turn the intermediate radeon_program into * machine-readable instructions. */ -GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler) +GLboolean r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler) { struct r300_fragment_program_code *code = &compiler->code->r300; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 397a26c3df..7b523e532f 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2551,13 +2551,13 @@ void r300InitShaderFunctions(r300ContextPtr r300) r300->vtbl.SetupRSUnit = r500SetupRSUnit; r300->vtbl.SetupPixelShader = r500SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r500SetupFragmentShaderTextures; - r300->vtbl.FragmentProgramEmit = r500FragmentProgramEmit; + r300->vtbl.BuildFragmentProgramHwCode = r500BuildFragmentProgramHwCode; r300->vtbl.FragmentProgramDump = r500FragmentProgramDump; } else { r300->vtbl.SetupRSUnit = r300SetupRSUnit; r300->vtbl.SetupPixelShader = r300SetupPixelShader; r300->vtbl.SetupFragmentShaderTextures = r300SetupFragmentShaderTextures; - r300->vtbl.FragmentProgramEmit = r300FragmentProgramEmit; + r300->vtbl.BuildFragmentProgramHwCode = r300BuildFragmentProgramHwCode; r300->vtbl.FragmentProgramDump = r300FragmentProgramDump; } } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.h b/src/mesa/drivers/dri/r300/r500_fragprog.h index 9ca2f9be51..1179bf6607 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/r500_fragprog.h @@ -39,7 +39,7 @@ #include "r300_context.h" #include "radeon_nqssadce.h" -extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler); +extern GLboolean r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler); extern void r500FragmentProgramDump(union rX00_fragment_program_code *c); diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c index 277f801c38..30f4514897 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c @@ -299,7 +299,7 @@ static const struct radeon_pair_handler pair_handler = { .MaxHwTemps = 128 }; -GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler) +GLboolean r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler) { struct r500_fragment_program_code *code = &compiler->code->r500; -- cgit v1.2.3 From 1961caeda849faeb9265d6df5724f2454f4c1055 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 13 May 2009 23:58:21 +0200 Subject: r300: move some code to common path --- src/mesa/drivers/dri/r300/r300_context.h | 2 +- src/mesa/drivers/dri/r300/r300_state.c | 31 +++++++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index cd25b1da01..4111fa2d81 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -618,7 +618,7 @@ struct r300_vtable { void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings); GLboolean (* BuildFragmentProgramHwCode)(struct r300_fragment_program_compiler *compiler); void (* FragmentProgramDump)(union rX00_fragment_program_code *code); - GLboolean (* SetupPixelShader)(GLcontext *ctx); + void (* SetupPixelShader)(GLcontext *ctx); }; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 7b523e532f..5821395f66 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2279,21 +2279,15 @@ static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, } -static GLboolean r300SetupPixelShader(GLcontext *ctx) +static void r300SetupPixelShader(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; struct r300_fragment_program_code *code; int i, k; - /* Program is not native, fallback to software */ - if (fp->error) - return GL_FALSE; - code = &fp->code.r300; - r300SetupTextures(ctx); - R300_STATECHANGE(rmesa, fpi[0]); R300_STATECHANGE(rmesa, fpi[1]); R300_STATECHANGE(rmesa, fpi[2]); @@ -2341,8 +2335,6 @@ static GLboolean r300SetupPixelShader(GLcontext *ctx) rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 2] = r300PackFloat24(constant[2]); rmesa->hw.fpp.cmd[R300_FPP_PARAM_0 + 4 * i + 3] = r300PackFloat24(constant[3]); } - - return GL_TRUE; } #define bump_r500fp_count(ptr, new_count) do{\ @@ -2359,7 +2351,7 @@ static GLboolean r300SetupPixelShader(GLcontext *ctx) if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\ } while(0) -static GLboolean r500SetupPixelShader(GLcontext *ctx) +static void r500SetupPixelShader(GLcontext *ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_fragment_program *fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; @@ -2369,14 +2361,8 @@ static GLboolean r500SetupPixelShader(GLcontext *ctx) ((drm_r300_cmd_header_t *) rmesa->hw.r500fp.cmd)->r500fp.count = 0; ((drm_r300_cmd_header_t *) rmesa->hw.r500fp_const.cmd)->r500fp.count = 0; - /* Program is not native, fallback to software */ - if (fp->error) - return GL_FALSE; - code = &fp->code.r500; - r300SetupTextures(ctx); - R300_STATECHANGE(rmesa, fp); rmesa->hw.fp.cmd[R500_FP_PIXSIZE] = code->max_temp_idx; @@ -2412,17 +2398,18 @@ static GLboolean r500SetupPixelShader(GLcontext *ctx) rmesa->hw.r500fp_const.cmd[R300_FPP_PARAM_0 + 4 * i + 3] = r300PackFloat32(constant[3]); } bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, code->const_nr * 4); - - return GL_TRUE; } void r300UpdateShaderStates(r300ContextPtr rmesa) { GLcontext *ctx; ctx = rmesa->radeon.glCtx; + struct r300_fragment_program *r300_fp; + + r300_fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; /* should only happenen once, just after context is created */ - if (!ctx->FragmentProgram._Current) + if (!r300_fp) return; r300SetEarlyZState(ctx); @@ -2450,9 +2437,13 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - if (!rmesa->vtbl.SetupPixelShader(ctx)) + if (r300_fp->error) return; + r300SetupTextures(ctx); + + rmesa->vtbl.SetupPixelShader(ctx); + rmesa->vtbl.SetupRSUnit(ctx); if (rmesa->options.hw_tcl_enabled) -- cgit v1.2.3 From f8c30793d161618fa1cdc788ad7984566b236d5e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 14 May 2009 00:10:52 +0200 Subject: r300: more cleanup - remove unnecessary r300TranslateFragmentShader call from r300UpdateShaderStates (it is already called in r300UpdateShaders) - remove unnecessary null ptr checks --- src/mesa/drivers/dri/r300/r300_state.c | 40 +++++++++++----------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 5821395f66..502bdd2f6d 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1395,9 +1395,6 @@ static void r300SetupTextures(GLcontext * ctx) r300->hw.tex.border_color.cmd[R300_TEX_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_TX_BORDER_COLOR_0, last_hw_tmu + 1); - if (!fp) /* should only happenen once, just after context is created */ - return; - if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { if (fp->Base.UsesKill && last_hw_tmu < 0) { // The KILL operation requires the first texture unit @@ -1442,12 +1439,7 @@ static void r300SetupRSUnit(GLcontext * ctx) else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); - if (ctx->FragmentProgram._Current) - InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; - else { - fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; /* This should only ever happen once.. */ - } + InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; R300_STATECHANGE(r300, ri); R300_STATECHANGE(r300, rc); @@ -1579,12 +1571,7 @@ static void r500SetupRSUnit(GLcontext * ctx) else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); - if (ctx->FragmentProgram._Current) - InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; - else { - fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; /* This should only ever happen once.. */ - } + InputsRead = ctx->FragmentProgram._Current->Base.InputsRead; R300_STATECHANGE(r300, ri); R300_STATECHANGE(r300, rc); @@ -2226,9 +2213,14 @@ void r300UpdateShaders(r300ContextPtr rmesa) ctx = rmesa->radeon.glCtx; fp = (struct r300_fragment_program *) ctx->FragmentProgram._Current; - if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) { - rmesa->radeon.NewGLState = 0; + /* should only happenen once, just after context is created */ + /* TODO: shouldn't we fallback to sw here? */ + if (!fp) { + _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); + return; + } + if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) { for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { rmesa->temp_attrib[i] = TNL_CONTEXT(ctx)->vb.AttribPtr[i]; @@ -2248,14 +2240,13 @@ void r300UpdateShaders(r300ContextPtr rmesa) r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, !vp->native); } - if (fp) { - if (!fp->translated) - r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); + if (!fp->translated || rmesa->radeon.NewGLState) + r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error); - } + r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error); r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + rmesa->radeon.NewGLState = 0; } static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, @@ -2435,11 +2426,6 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; } - r300TranslateFragmentShader(ctx, ctx->FragmentProgram._Current); - - if (r300_fp->error) - return; - r300SetupTextures(ctx); rmesa->vtbl.SetupPixelShader(ctx); -- cgit v1.2.3 From 1b49f1ca7f9ffda8b4a75ef2ad0be4c2c0eb820a Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 14 May 2009 00:22:21 +0200 Subject: r300: minor code movement --- src/mesa/drivers/dri/r300/r300_state.c | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 502bdd2f6d..af9e553eb5 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -460,6 +460,7 @@ static void r300SetEarlyZState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); GLuint topZ = R300_ZTOP_ENABLE; + GLuint w_fmt, fgdepthsrc; if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) topZ = R300_ZTOP_DISABLE; @@ -476,6 +477,26 @@ static void r300SetEarlyZState(GLcontext * ctx) R300_STATECHANGE(r300, zstencil_format); r300->hw.zstencil_format.cmd[2] = topZ; } + + /* w_fmt value is set to get best performance + * see p.130 R5xx 3D acceleration guide v1.3 */ + if (current_fragment_program_writes_depth(ctx)) { + fgdepthsrc = R300_FG_DEPTH_SRC_SHADER; + w_fmt = R300_W_FMT_W24 | R300_W_SRC_US; + } else { + fgdepthsrc = R300_FG_DEPTH_SRC_SCAN; + w_fmt = R300_W_FMT_W0 | R300_W_SRC_US; + } + + if (w_fmt != r300->hw.us_out_fmt.cmd[5]) { + R300_STATECHANGE(r300, us_out_fmt); + r300->hw.us_out_fmt.cmd[5] = w_fmt; + } + + if (fgdepthsrc != r300->hw.fg_depth_src.cmd[1]) { + R300_STATECHANGE(r300, fg_depth_src); + r300->hw.fg_depth_src.cmd[1] = fgdepthsrc; + } } static void r300SetAlphaState(GLcontext * ctx) @@ -2405,27 +2426,6 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) r300SetEarlyZState(ctx); - /* w_fmt value is set to get best performance - * see p.130 R5xx 3D acceleration guide v1.3 */ - GLuint w_fmt, fgdepthsrc; - if (current_fragment_program_writes_depth(ctx)) { - fgdepthsrc = R300_FG_DEPTH_SRC_SHADER; - w_fmt = R300_W_FMT_W24 | R300_W_SRC_US; - } else { - fgdepthsrc = R300_FG_DEPTH_SRC_SCAN; - w_fmt = R300_W_FMT_W0 | R300_W_SRC_US; - } - - if (w_fmt != rmesa->hw.us_out_fmt.cmd[5]) { - R300_STATECHANGE(rmesa, us_out_fmt); - rmesa->hw.us_out_fmt.cmd[5] = w_fmt; - } - - if (fgdepthsrc != rmesa->hw.fg_depth_src.cmd[1]) { - R300_STATECHANGE(rmesa, fg_depth_src); - rmesa->hw.fg_depth_src.cmd[1] = fgdepthsrc; - } - r300SetupTextures(ctx); rmesa->vtbl.SetupPixelShader(ctx); -- cgit v1.2.3 From 73d2a4a04750b18463b51750651d3925d63ae074 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 14 May 2009 02:21:09 +0200 Subject: r300: cleanup vertex program related functions - move vertex program related functions to r300_vertprog.c - use _mesa_bitcount instead of self-made bit_count function - remove duplicated field in r300_vertex_shader_fragment.body union - rename r300_vertex_shader_fragment to r300_vertex_shader_hw_code - rename r300_vertex_program field native to error - remove unnecessary r300_vertex_shader_state structure - remove unused r300_vertex_program and r300_vertex_program_cont fields - remove disabled code --- src/mesa/drivers/dri/r300/r300_context.h | 49 +++----- src/mesa/drivers/dri/r300/r300_emit.c | 3 +- src/mesa/drivers/dri/r300/r300_state.c | 179 +++--------------------------- src/mesa/drivers/dri/r300/r300_state.h | 1 + src/mesa/drivers/dri/r300/r300_vertprog.c | 145 +++++++++++++++++++++--- src/mesa/drivers/dri/r300/r300_vertprog.h | 3 + 6 files changed, 164 insertions(+), 216 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 4111fa2d81..2ea064ed45 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -399,56 +399,40 @@ struct r300_hw_state { #define STATE_R300_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0) #define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1) -struct r300_vertex_shader_fragment { - int length; - union { - GLuint d[VSF_MAX_FRAGMENT_LENGTH]; - float f[VSF_MAX_FRAGMENT_LENGTH]; - GLuint i[VSF_MAX_FRAGMENT_LENGTH]; - } body; -}; - -struct r300_vertex_shader_state { - struct r300_vertex_shader_fragment program; -}; - #define COLOR_IS_RGBA #define TAG(x) r300##x #include "tnl_dd/t_dd_vertex.h" #undef TAG -#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->selected_vp) - -/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday. - * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly. - */ - -struct r300_vertex_program_key { - GLuint InputsRead; - GLuint OutputsWritten; - GLuint OutputsAdded; -}; - struct r300_vertex_program { struct r300_vertex_program *next; - struct r300_vertex_program_key key; - int translated; - struct r300_vertex_shader_fragment program; + struct r300_vertex_program_key { + GLuint InputsRead; + GLuint OutputsWritten; + GLuint OutputsAdded; + } key; + + struct r300_vertex_shader_hw_code { + int length; + union { + GLuint d[VSF_MAX_FRAGMENT_LENGTH]; + float f[VSF_MAX_FRAGMENT_LENGTH]; + } body; + } hw_code; + + GLboolean translated; + GLboolean error; int pos_end; int num_temporaries; /* Number of temp vars used by program */ int wpos_idx; int inputs[VERT_ATTRIB_MAX]; int outputs[VERT_RESULT_MAX]; - int native; - int ref_count; - int use_ref_count; }; struct r300_vertex_program_cont { struct gl_vertex_program mesa_program; /* Must be first */ - struct r300_vertex_shader_fragment params; struct r300_vertex_program *progs; }; @@ -632,7 +616,6 @@ struct r300_context { struct r300_hw_state hw; - struct r300_vertex_shader_state vertex_shader; struct r300_vertex_program *selected_vp; /* Vertex buffers diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 45e7074002..1e79a76b47 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -210,8 +210,7 @@ void r300EmitArrays(GLcontext * ctx) int vir_inputs[VERT_ATTRIB_MAX]; GLint tab[VERT_ATTRIB_MAX]; int swizzle[VERT_ATTRIB_MAX][4]; - struct r300_vertex_program *prog = - (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); + struct r300_vertex_program *prog = rmesa->selected_vp; if (rmesa->options.hw_tcl_enabled) { inputs = prog->inputs; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index af9e553eb5..91f9acd5bf 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -65,6 +65,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_fragprog.h" #include "r500_fragprog.h" #include "r300_render.h" +#include "r300_vertprog.h" #include "drirenderbuffer.h" @@ -1455,8 +1456,9 @@ static void r300SetupRSUnit(GLcontext * ctx) int i, count, col_fmt, hw_tcl_on; hw_tcl_on = r300->options.hw_tcl_enabled; + if (hw_tcl_on) - OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; + OutputsWritten.vp_outputs = r300->selected_vp->key.OutputsWritten; else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); @@ -1587,8 +1589,9 @@ static void r500SetupRSUnit(GLcontext * ctx) int i, count, col_fmt, hw_tcl_on; hw_tcl_on = r300->options.hw_tcl_enabled; + if (hw_tcl_on) - OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten; + OutputsWritten.vp_outputs = r300->selected_vp->key.OutputsWritten; else RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->render_inputs_bitset); @@ -1717,58 +1720,9 @@ static void r500SetupRSUnit(GLcontext * ctx) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); } - - - -#define bump_vpu_count(ptr, new_count) do{\ - drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\ - int _nc=(new_count)/4; \ - assert(_nc < 256); \ - if(_nc>_p->vpu.count)_p->vpu.count=_nc;\ - }while(0) - -static INLINE void r300SetupVertexProgramFragment(r300ContextPtr r300, int dest, struct r300_vertex_shader_fragment *vsf) -{ - int i; - - if (vsf->length == 0) - return; - - if (vsf->length & 0x3) { - fprintf(stderr, "VERTEX_SHADER_FRAGMENT must have length divisible by 4\n"); - _mesa_exit(-1); - } - - switch ((dest >> 8) & 0xf) { - case 0: - R300_STATECHANGE(r300, vpi); - for (i = 0; i < vsf->length; i++) - r300->hw.vpi.cmd[R300_VPI_INSTR_0 + i + 4 * (dest & 0xff)] = (vsf->body.d[i]); - bump_vpu_count(r300->hw.vpi.cmd, vsf->length + 4 * (dest & 0xff)); - break; - - case 2: - R300_STATECHANGE(r300, vpp); - for (i = 0; i < vsf->length; i++) - r300->hw.vpp.cmd[R300_VPP_PARAM_0 + i + 4 * (dest & 0xff)] = (vsf->body.d[i]); - bump_vpu_count(r300->hw.vpp.cmd, vsf->length + 4 * (dest & 0xff)); - break; - case 4: - R300_STATECHANGE(r300, vps); - for (i = 0; i < vsf->length; i++) - r300->hw.vps.cmd[1 + i + 4 * (dest & 0xff)] = (vsf->body.d[i]); - bump_vpu_count(r300->hw.vps.cmd, vsf->length + 4 * (dest & 0xff)); - break; - default: - fprintf(stderr, "%s:%s don't know how to handle dest %04x\n", __FILE__, __FUNCTION__, dest); - _mesa_exit(-1); - } -} - #define MIN3(a, b, c) ((a) < (b) ? MIN2(a, c) : MIN2(b, c)) - -static void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, +void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count) { int vtx_mem_size; @@ -1822,115 +1776,6 @@ static void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, } -static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa) -{ - struct r300_vertex_shader_state *prog = &(rmesa->vertex_shader); - GLuint o_reg = 0; - GLuint i_reg = 0; - int i; - int inst_count = 0; - int param_count = 0; - int program_end = 0; - - for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { - if (rmesa->swtcl.sw_tcl_inputs[i] != -1) { - prog->program.body.i[program_end + 0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); - prog->program.body.i[program_end + 1] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 2] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - prog->program.body.i[program_end + 3] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - program_end += 4; - i_reg++; - } - } - - prog->program.length = program_end; - - r300SetupVertexProgramFragment(rmesa, R300_PVS_CODE_START, - &(prog->program)); - inst_count = (prog->program.length / 4) - 1; - - r300VapCntl(rmesa, i_reg, o_reg, 0); - - R300_STATECHANGE(rmesa, pvs); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_FIRST_INST_SHIFT) | - (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | - (inst_count << R300_PVS_LAST_INST_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = - (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | - (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = - (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); -} - -static int bit_count (int x) -{ - x = ((x & 0xaaaaaaaaU) >> 1) + (x & 0x55555555U); - x = ((x & 0xccccccccU) >> 2) + (x & 0x33333333U); - x = (x >> 16) + (x & 0xffff); - x = ((x & 0xf0f0) >> 4) + (x & 0x0f0f); - return (x >> 8) + (x & 0x00ff); -} - -static void r300SetupRealVertexProgram(r300ContextPtr rmesa) -{ - GLcontext *ctx = rmesa->radeon.glCtx; - struct r300_vertex_program *prog = (struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx); - int inst_count = 0; - int param_count = 0; - - /* FIXME: r300SetupVertexProgramFragment */ - R300_STATECHANGE(rmesa, vpp); - param_count = - r300VertexProgUpdateParams(ctx, - (struct r300_vertex_program_cont *) - ctx->VertexProgram._Current, - (float *)&rmesa->hw.vpp. - cmd[R300_VPP_PARAM_0]); - bump_vpu_count(rmesa->hw.vpp.cmd, param_count); - param_count /= 4; - - r300SetupVertexProgramFragment(rmesa, R300_PVS_CODE_START, &(prog->program)); - inst_count = (prog->program.length / 4) - 1; - - r300VapCntl(rmesa, bit_count(prog->key.InputsRead), - bit_count(prog->key.OutputsWritten), prog->num_temporaries); - - R300_STATECHANGE(rmesa, pvs); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_FIRST_INST_SHIFT) | - (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | - (inst_count << R300_PVS_LAST_INST_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = - (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | - (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = - (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); -} - - -static void r300SetupVertexProgram(r300ContextPtr rmesa) -{ - GLcontext *ctx = rmesa->radeon.glCtx; - - /* Reset state, in case we don't use something */ - ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; - - /* Not sure why this doesnt work... - 0x400 area might have something to do with pixel shaders as it appears right after pfs programming. - 0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */ - //setup_vertex_shader_fragment(rmesa, 0x406, &unk4); - if (rmesa->options.hw_tcl_enabled && ((struct r300_vertex_program *)CURRENT_VERTEX_SHADER(ctx))->translated) { - r300SetupRealVertexProgram(rmesa); - } else { - /* FIXME: This needs to be replaced by vertex shader generation code. */ - r300SetupDefaultVertexProgram(rmesa); - } - -} - /** * Enable/Disable states. * @@ -2227,7 +2072,6 @@ static void r300ResetHwState(r300ContextPtr r300) void r300UpdateShaders(r300ContextPtr rmesa) { GLcontext *ctx; - struct r300_vertex_program *vp; struct r300_fragment_program *fp; int i; @@ -2257,8 +2101,7 @@ void r300UpdateShaders(r300ContextPtr rmesa) } r300SelectVertexShader(rmesa); - vp = (struct r300_vertex_program *) CURRENT_VERTEX_SHADER(ctx); - r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, !vp->native); + r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, rmesa->selected_vp->error); } if (!fp->translated || rmesa->radeon.NewGLState) @@ -2432,8 +2275,12 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->vtbl.SetupRSUnit(ctx); - if (rmesa->options.hw_tcl_enabled) - r300SetupVertexProgram(rmesa); + if (rmesa->options.hw_tcl_enabled) { + if (rmesa->fallback & R300_FALLBACK_VERTEX_PROGRAM) + r300SetupSwtclVertexProgram(rmesa); + else + r300SetupVertexProgram(rmesa); + } } /** diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index 3921efa8e3..cac639d7c6 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -57,5 +57,6 @@ void r300UpdateShaders (r300ContextPtr rmesa); void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); void r300InitStateFuncs (struct dd_function_table *functions); +void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count); #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 146daa367c..949c0b499c 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/tnl.h" #include "r300_context.h" +#include "r300_state.h" /* TODO: Get rid of t_src_class call */ #define CMP_SRCS(a, b) ((a.RelAddr != b.RelAddr) || (a.Index != b.Index && \ @@ -64,7 +65,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. int u_temp_used = (VSF_MAX_FRAGMENT_TEMPS - 1) - u_temp_i; \ if((vp->num_temporaries + u_temp_used) > VSF_MAX_FRAGMENT_TEMPS) { \ WARN_ONCE("Ran out of temps, num temps %d, us %d\n", vp->num_temporaries, u_temp_used); \ - vp->native = GL_FALSE; \ + vp->error = GL_TRUE; \ } \ u_temp_i=VSF_MAX_FRAGMENT_TEMPS-1; \ } while (0) @@ -1007,14 +1008,13 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, struct prog_src_register src[3]; vp->pos_end = 0; /* Not supported yet */ - vp->program.length = 0; - /*vp->num_temporaries=mesa_vp->Base.NumTemporaries; */ + vp->hw_code.length = 0; vp->translated = GL_TRUE; - vp->native = GL_TRUE; + vp->error = GL_FALSE; t_inputs_outputs(vp); - for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END; + for (inst = vp->hw_code.body.d; vpi->Opcode != OPCODE_END; vpi++, inst += 4) { FREE_TEMPS(); @@ -1176,7 +1176,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, &u_temp_i); break; default: - assert(0); + vp->error = GL_TRUE; break; } } @@ -1198,16 +1198,10 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, } } - vp->program.length = (inst - vp->program.body.i); - if (vp->program.length >= VSF_MAX_FRAGMENT_LENGTH) { - vp->program.length = 0; - vp->native = GL_FALSE; + vp->hw_code.length = (inst - vp->hw_code.body.d); + if (vp->hw_code.length >= VSF_MAX_FRAGMENT_LENGTH) { + vp->error = GL_TRUE; } -#if 0 - fprintf(stderr, "hw program:\n"); - for (i = 0; i < vp->program.length; i++) - fprintf(stderr, "%08x\n", vp->program.body.d[i]); -#endif } /* DP4 version seems to trigger some hw peculiarity */ @@ -1466,3 +1460,124 @@ void r300SelectVertexShader(r300ContextPtr r300) vpc->progs = vp; r300->selected_vp = vp; } + +#define bump_vpu_count(ptr, new_count) do { \ + drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr)); \ + int _nc=(new_count)/4; \ + assert(_nc < 256); \ + if(_nc>_p->vpu.count)_p->vpu.count=_nc; \ + } while(0) + +static void r300EmitVertexProgram(r300ContextPtr r300, int dest, struct r300_vertex_shader_hw_code *code) +{ + int i; + + assert((code->length > 0) && (code->length % 4 == 0)); + + switch ((dest >> 8) & 0xf) { + case 0: + R300_STATECHANGE(r300, vpi); + for (i = 0; i < code->length; i++) + r300->hw.vpi.cmd[R300_VPI_INSTR_0 + i + 4 * (dest & 0xff)] = (code->body.d[i]); + bump_vpu_count(r300->hw.vpi.cmd, code->length + 4 * (dest & 0xff)); + break; + case 2: + R300_STATECHANGE(r300, vpp); + for (i = 0; i < code->length; i++) + r300->hw.vpp.cmd[R300_VPP_PARAM_0 + i + 4 * (dest & 0xff)] = (code->body.d[i]); + bump_vpu_count(r300->hw.vpp.cmd, code->length + 4 * (dest & 0xff)); + break; + case 4: + R300_STATECHANGE(r300, vps); + for (i = 0; i < code->length; i++) + r300->hw.vps.cmd[1 + i + 4 * (dest & 0xff)] = (code->body.d[i]); + bump_vpu_count(r300->hw.vps.cmd, code->length + 4 * (dest & 0xff)); + break; + default: + fprintf(stderr, "%s:%s don't know how to handle dest %04x\n", __FILE__, __FUNCTION__, dest); + _mesa_exit(-1); + } +} + +void r300SetupSwtclVertexProgram(r300ContextPtr rmesa) +{ + struct r300_vertex_shader_hw_code *hw_code; + GLuint o_reg = 0; + GLuint i_reg = 0; + int i; + int inst_count = 0; + int param_count = 0; + int program_end = 0; + + /* Reset state, in case we don't use something */ + ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; + + hw_code = _mesa_malloc(sizeof(struct r300_vertex_shader_hw_code)); + + for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { + if (rmesa->swtcl.sw_tcl_inputs[i] != -1) { + hw_code->body.d[program_end + 0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); + hw_code->body.d[program_end + 1] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_X, + PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + hw_code->body.d[program_end + 2] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + hw_code->body.d[program_end + 3] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, + PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); + program_end += 4; + i_reg++; + } + } + + hw_code->length = program_end; + + r300EmitVertexProgram(rmesa, R300_PVS_CODE_START, hw_code); + inst_count = (hw_code->length / 4) - 1; + + r300VapCntl(rmesa, i_reg, o_reg, 0); + + R300_STATECHANGE(rmesa, pvs); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = (0 << R300_PVS_FIRST_INST_SHIFT) | (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | + (inst_count << R300_PVS_LAST_INST_SHIFT); + + rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); + + _mesa_free(hw_code); +} + +void r300SetupVertexProgram(r300ContextPtr rmesa) +{ + GLcontext *ctx = rmesa->radeon.glCtx; + struct r300_vertex_program *prog = rmesa->selected_vp; + int inst_count = 0; + int param_count = 0; + + /* Reset state, in case we don't use something */ + ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; + ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; + + R300_STATECHANGE(rmesa, vpp); + param_count = r300VertexProgUpdateParams(ctx, + (struct r300_vertex_program_cont *) + ctx->VertexProgram._Current, + (float *)&rmesa->hw.vpp. + cmd[R300_VPP_PARAM_0]); + bump_vpu_count(rmesa->hw.vpp.cmd, param_count); + param_count /= 4; + + r300EmitVertexProgram(rmesa, R300_PVS_CODE_START, &(prog->hw_code)); + inst_count = (prog->hw_code.length / 4) - 1; + + r300VapCntl(rmesa, _mesa_bitcount(prog->key.InputsRead), + _mesa_bitcount(prog->key.OutputsWritten), prog->num_temporaries); + + R300_STATECHANGE(rmesa, pvs); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = (0 << R300_PVS_FIRST_INST_SHIFT) | (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | + (inst_count << R300_PVS_LAST_INST_SHIFT); + + rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); + rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); +} diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 2f35f02bc8..44b5f981a9 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -32,4 +32,7 @@ #endif +void r300SetupVertexProgram(r300ContextPtr rmesa); +void r300SetupSwtclVertexProgram(r300ContextPtr rmesa); + #endif -- cgit v1.2.3 From 57fd20237541c34ed06587bca9f5a58c8a63fbf4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 16 May 2009 17:25:26 +0100 Subject: gallium: remove occlusion_count flag from depth-stencil state Drivers can just keep track of whether they are within a query by monitoring the begin/end query callbacks. The flag adds no information beyond that. Only softpipe was examining this flag -- it has been fixed up and retested with demos/arbocclude. --- src/gallium/drivers/softpipe/sp_context.h | 1 + src/gallium/drivers/softpipe/sp_quad_pipe.c | 2 +- src/gallium/drivers/softpipe/sp_query.c | 5 +++++ src/gallium/drivers/trace/tr_dump_state.c | 1 - 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 59d6df8f2d..b89a7292e5 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -92,6 +92,7 @@ struct softpipe_context { * queries. */ uint64_t occlusion_count; + unsigned active_query_count; /** Mapped vertex buffers */ ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS]; diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index 892ef87ee9..b5f69b7426 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -80,7 +80,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp) sp_push_quad_first( sp, sp->quad[i].blend, i ); } - if (sp->depth_stencil->depth.occlusion_count) { + if (sp->active_query_count) { sp_push_quad_first( sp, sp->quad[i].occlusion, i ); } diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index 93dab236d6..379cf4ad06 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -34,6 +34,7 @@ #include "util/u_memory.h" #include "sp_context.h" #include "sp_query.h" +#include "sp_state.h" struct softpipe_query { uint64_t start; @@ -69,6 +70,8 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) struct softpipe_query *sq = softpipe_query(q); sq->start = softpipe->occlusion_count; + softpipe->active_query_count++; + softpipe->dirty |= SP_NEW_QUERY; } @@ -78,7 +81,9 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) struct softpipe_context *softpipe = softpipe_context( pipe ); struct softpipe_query *sq = softpipe_query(q); + softpipe->active_query_count--; sq->end = softpipe->occlusion_count; + softpipe->dirty |= SP_NEW_QUERY; } diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 1b2b3493a6..23a2473b57 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -271,7 +271,6 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_ trace_dump_member(bool, &state->depth, enabled); trace_dump_member(bool, &state->depth, writemask); trace_dump_member(uint, &state->depth, func); - trace_dump_member(bool, &state->depth, occlusion_count); trace_dump_struct_end(); trace_dump_member_end(); -- cgit v1.2.3 From 13131adbf1beb3e4222ce16c32ac7910a4a5331b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 08:47:36 -0700 Subject: r300-gallium: Various cleanups leftover from before. BEGIN/END_CS pair, a few asserts, and a slightly more correct VTE setup. --- src/gallium/drivers/r300/r300_emit.c | 6 ++++-- src/gallium/drivers/r300/r300_state.c | 2 +- src/gallium/drivers/r300/r300_surface.c | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index cd5c38a0c7..3beb1b8c3f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -163,6 +163,7 @@ void r300_emit_fb_state(struct r300_context* r300, BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { tex = (struct r300_texture*)fb->cbufs[i]->texture; + assert(tex && tex->buffer && "cbuf is marked, but NULL!"); pixpitch = tex->stride / tex->tex.block.size; OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); @@ -177,7 +178,8 @@ void r300_emit_fb_state(struct r300_context* r300, if (fb->zsbuf) { tex = (struct r300_texture*)fb->zsbuf->texture; - pixpitch = (tex->stride / tex->tex.block.size); + assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + pixpitch = tex->stride / tex->tex.block.size; OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); @@ -473,7 +475,7 @@ void r300_emit_dirty_state(struct r300_context* r300) /* ...textures... */ for (i = 0; i < r300->texture_count; i++) { tex = r300->textures[i]; - assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); + assert(tex && tex->buffer && "texture is marked, but NULL!"); r300->winsys->add_buffer(r300->winsys, tex->buffer, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 2118f7706f..49b93a420b 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -562,7 +562,7 @@ static void r300_set_viewport_state(struct pipe_context* pipe, if (r300_screen(r300->context.screen)->caps->has_tcl) { /* Do the transform in HW. */ - r300->viewport_state->vte_control = R300_VTX_W0_FMT; + r300->viewport_state->vte_control = R300_VTX_XY_FMT | R300_VTX_Z_FMT; if (state->scale[0] != 1.0f) { assert(state->scale[0] != 0.0f); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 00eb4ebe7c..17b42504d4 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -264,6 +264,7 @@ static void r300_surface_copy(struct pipe_context* pipe, r300_emit_rs_block_state(r300, &r300_rs_block_copy_state); } + BEGIN_CS(28); /* VAP stream control, mapping from input memory to PVS/RS memory */ if (caps->has_tcl) { OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, @@ -313,6 +314,8 @@ static void r300_surface_copy(struct pipe_context* pipe, OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); + END_CS; + r300->dirty_hw++; } -- cgit v1.2.3 From 5e39a8c4503596a019dc7c3ed4e24ee4117b1fca Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 09:58:54 -0700 Subject: Create common trace_drm code, add to radeon_winsys. --- src/gallium/auxiliary/trace/trace_drm.h | 165 ++++++++++++++++++++++++ src/gallium/winsys/drm/radeon/core/radeon_drm.c | 8 ++ src/gallium/winsys/drm/radeon/dri/Makefile | 1 + src/gallium/winsys/drm/radeon/egl/Makefile | 1 + 4 files changed, 175 insertions(+) create mode 100644 src/gallium/auxiliary/trace/trace_drm.h diff --git a/src/gallium/auxiliary/trace/trace_drm.h b/src/gallium/auxiliary/trace/trace_drm.h new file mode 100644 index 0000000000..892bd9860c --- /dev/null +++ b/src/gallium/auxiliary/trace/trace_drm.h @@ -0,0 +1,165 @@ +/* + * Copyright 2009 Jakob Bornecrantz + * Corbin Simpson + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef TRACE_DRM_H +#define TRACE_DRM_H + +#include "state_tracker/drm_api.h" + +#include "trace/tr_buffer.h" +#include "trace/tr_context.h" +#include "trace/tr_screen.h" +#include "trace/tr_texture.h" + +struct drm_api hooks; + +static struct pipe_screen * +trace_drm_create_screen(int fd, struct drm_create_screen_arg *arg) +{ + struct pipe_screen *screen; + + if (arg && arg->mode != DRM_CREATE_NORMAL) + return NULL; + + screen = hooks.create_screen(fd, arg); + + return trace_screen_create(screen); +}; + +static struct pipe_context * +trace_drm_create_context(struct pipe_screen *_screen) +{ + struct pipe_screen *screen; + struct pipe_context *pipe; + + if (trace_enabled()) + screen = trace_screen(_screen)->screen; + else + screen = _screen; + + pipe = hooks.create_context(screen); + + if (trace_enabled()) + pipe = trace_context_create(_screen, pipe); + + return pipe; +}; + +static boolean +trace_drm_buffer_from_texture(struct pipe_texture *_texture, + struct pipe_buffer **_buffer, + unsigned *stride) +{ + struct pipe_texture *texture; + struct pipe_buffer *buffer = NULL; + boolean result; + + if (trace_enabled()) + texture = trace_texture(_texture)->texture; + else + texture = _texture; + + result = hooks.buffer_from_texture(texture, &buffer, stride); + + if (result && _buffer) + buffer = trace_buffer_create(trace_screen(texture->screen), buffer); + + if (_buffer) + *_buffer = buffer; + else + pipe_buffer_reference(&buffer, NULL); + + return result; +} + +static struct pipe_buffer * +trace_drm_buffer_from_handle(struct pipe_screen *_screen, + const char *name, + unsigned handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *result; + + if (trace_enabled()) + screen = trace_screen(_screen)->screen; + else + screen = _screen; + + result = hooks.buffer_from_handle(screen, name, handle); + + if (trace_enabled()) + result = trace_buffer_create(trace_screen(_screen), result); + + return result; +} + +static boolean +trace_drm_handle_from_buffer(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *buffer; + + if (trace_enabled()) { + screen = trace_screen(_screen)->screen; + buffer = trace_buffer(_buffer)->buffer; + } else { + screen = _screen; + buffer = _buffer; + } + + return hooks.handle_from_buffer(screen, buffer, handle); +} + +static boolean +trace_drm_global_handle_from_buffer(struct pipe_screen *_screen, + struct pipe_buffer *_buffer, + unsigned *handle) +{ + struct pipe_screen *screen; + struct pipe_buffer *buffer; + + if (trace_enabled()) { + screen = trace_screen(_screen)->screen; + buffer = trace_buffer(_buffer)->buffer; + } else { + screen = _screen; + buffer = _buffer; + } + + return hooks.global_handle_from_buffer(screen, buffer, handle); +} + +struct drm_api drm_api_hooks = +{ + .create_screen = trace_drm_create_screen, + .create_context = trace_drm_create_context, + + .buffer_from_texture = trace_drm_buffer_from_texture, + .buffer_from_handle = trace_drm_buffer_from_handle, + .handle_from_buffer = trace_drm_handle_from_buffer, + .global_handle_from_buffer = trace_drm_global_handle_from_buffer, +}; + +#endif /* TRACE_DRM_H */ diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 428d3f65a1..5406d2bbea 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -30,6 +30,10 @@ #include "radeon_drm.h" +#ifdef DEBUG +#include "trace/trace_drm.h" +#endif + /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(int drmFB, struct drm_create_screen_arg *arg) @@ -112,7 +116,11 @@ boolean radeon_global_handle_from_buffer(struct pipe_screen* screen, return TRUE; } +#ifdef DEBUG +struct drm_api hooks = { +#else struct drm_api drm_api_hooks = { +#endif .create_screen = radeon_create_screen, .create_context = radeon_create_context, /* XXX fix this */ diff --git a/src/gallium/winsys/drm/radeon/dri/Makefile b/src/gallium/winsys/drm/radeon/dri/Makefile index c218ee9d01..a9889444de 100644 --- a/src/gallium/winsys/drm/radeon/dri/Makefile +++ b/src/gallium/winsys/drm/radeon/dri/Makefile @@ -10,6 +10,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/r300/libr300.a C_SOURCES = \ diff --git a/src/gallium/winsys/drm/radeon/egl/Makefile b/src/gallium/winsys/drm/radeon/egl/Makefile index d989b3aa93..6a1448d1b9 100644 --- a/src/gallium/winsys/drm/radeon/egl/Makefile +++ b/src/gallium/winsys/drm/radeon/egl/Makefile @@ -8,6 +8,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \ $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/r300/libr300.a DRIVER_SOURCES = -- cgit v1.2.3 From 0e8c6e56e467864249dfa311be1eef4dfc381f2a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 10:03:46 -0700 Subject: intel-gallium: Fix trace_drm integration. Compile-tested only, sorry. --- src/gallium/winsys/drm/intel/gem/intel_be_api.c | 149 +----------------------- 1 file changed, 5 insertions(+), 144 deletions(-) diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c index 5853afa756..a74be13bf7 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -2,10 +2,12 @@ #include "intel_be_api.h" #include "i915simple/i915_winsys.h" -#ifndef DEBUG -struct drm_api drm_api_hooks = +#ifdef DEBUG +#include "trace/trace_drm.h" + +struct drm_api hooks = #else -static struct drm_api hooks = +struct drm_api drm_api_hooks = #endif { /* intel_be_context.c */ @@ -17,144 +19,3 @@ static struct drm_api hooks = .handle_from_buffer = intel_be_handle_from_buffer, .global_handle_from_buffer = intel_be_global_handle_from_buffer, }; - - -/* - * Trace integration - */ - -#ifdef DEBUG -#include "trace/tr_screen.h" -#include "trace/tr_texture.h" -#include "trace/tr_buffer.h" -#include "trace/tr_context.h" - -static struct pipe_screen * -trace_drm_create_screen(int fd, struct drm_create_screen_arg *arg) -{ - struct pipe_screen *screen; - - if (arg && arg->mode != DRM_CREATE_NORMAL) - return NULL; - - screen = hooks.create_screen(fd, arg); - - return trace_screen_create(screen); -}; - -static struct pipe_context * -trace_drm_create_context(struct pipe_screen *_screen) -{ - struct pipe_screen *screen; - struct pipe_context *pipe; - - if (trace_enabled()) - screen = trace_screen(_screen)->screen; - else - screen = _screen; - - pipe = hooks.create_context(screen); - - if (trace_enabled()) - pipe = trace_context_create(_screen, pipe); - - return pipe; -}; - -static boolean -trace_drm_buffer_from_texture(struct pipe_texture *_texture, - struct pipe_buffer **_buffer, - unsigned *stride) -{ - struct pipe_texture *texture; - struct pipe_buffer *buffer = NULL; - boolean result; - - if (trace_enabled()) - texture = trace_texture(_texture)->texture; - else - texture = _texture; - - result = hooks.buffer_from_texture(texture, &buffer, stride); - - if (result && _buffer) - buffer = trace_buffer_create(trace_screen(texture->screen), buffer); - - if (_buffer) - *_buffer = buffer; - else - pipe_buffer_reference(&buffer, NULL); - - return result; -} - -static struct pipe_buffer * -trace_drm_buffer_from_handle(struct pipe_screen *_screen, - const char *name, - unsigned handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *result; - - if (trace_enabled()) - screen = trace_screen(_screen)->screen; - else - screen = _screen; - - result = hooks.buffer_from_handle(screen, name, handle); - - if (trace_enabled()) - result = trace_buffer_create(trace_screen(_screen), result); - - return result; -} - -static boolean -trace_drm_handle_from_buffer(struct pipe_screen *_screen, - struct pipe_buffer *_buffer, - unsigned *handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *buffer; - - if (trace_enabled()) { - screen = trace_screen(_screen)->screen; - buffer = trace_buffer(_buffer)->buffer; - } else { - screen = _screen; - buffer = _buffer; - } - - return hooks.handle_from_buffer(screen, buffer, handle); -} - -static boolean -trace_drm_global_handle_from_buffer(struct pipe_screen *_screen, - struct pipe_buffer *_buffer, - unsigned *handle) -{ - struct pipe_screen *screen; - struct pipe_buffer *buffer; - - if (trace_enabled()) { - screen = trace_screen(_screen)->screen; - buffer = trace_buffer(_buffer)->buffer; - } else { - screen = _screen; - buffer = _buffer; - } - - return hooks.global_handle_from_buffer(screen, buffer, handle); -} - -struct drm_api drm_api_hooks = -{ - .create_screen = trace_drm_create_screen, - .create_context = trace_drm_create_context, - - .buffer_from_texture = trace_drm_buffer_from_texture, - .buffer_from_handle = trace_drm_buffer_from_handle, - .handle_from_buffer = trace_drm_handle_from_buffer, - .global_handle_from_buffer = trace_drm_global_handle_from_buffer, -}; -#endif -- cgit v1.2.3 From 13f8e7bc9c5b4a7de0fe4f53af2eb6237b3e71fd Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 10:46:55 -0700 Subject: r300-gallium: Update screen caps. Anisotropic filtering should work, and OQ is broken. --- src/gallium/drivers/r300/r300_screen.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index d2c5998c26..78ed2ad922 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -87,7 +87,6 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) } else { return 0; } - return 0; case PIPE_CAP_GLSL: /* IN THEORY */ return 0; @@ -95,15 +94,15 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) /* IN THEORY */ return 0; case PIPE_CAP_ANISOTROPIC_FILTER: - /* IN THEORY */ - return 0; + return 1; case PIPE_CAP_POINT_SPRITE: /* IN THEORY */ return 0; case PIPE_CAP_MAX_RENDER_TARGETS: return 4; case PIPE_CAP_OCCLUSION_QUERY: - return 1; + /* IN THEORY */ + return 0; case PIPE_CAP_TEXTURE_SHADOW_MAP: /* IN THEORY */ return 0; -- cgit v1.2.3 From 17b395638b92139feef9beaea4039f76710bb23a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 10:56:17 -0700 Subject: r300-gallium: Update floating-point params too. Even though we *can* render 10,000-pixel-wide lines, let's not advertise it. --- src/gallium/drivers/r300/r300_screen.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 78ed2ad922..ab095028fb 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -151,17 +151,20 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) static float r300_get_paramf(struct pipe_screen* pscreen, int param) { + struct r300_screen* r300screen = r300_screen(pscreen); + switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: case PIPE_CAP_MAX_LINE_WIDTH_AA: - /* XXX this is the biggest thing that will fit in that register. - * Perhaps the actual rendering limits are less? */ - return 10922.0f; case PIPE_CAP_MAX_POINT_WIDTH: case PIPE_CAP_MAX_POINT_WIDTH_AA: - /* XXX this is the biggest thing that will fit in that register. - * Perhaps the actual rendering limits are less? */ - return 10922.0f; + /* The maximum dimensions of the colorbuffer are our practical + * rendering limits. 2048 pixels should be enough for anybody. */ + if (r300screen->caps->is_r500) { + return 4096.0f; + } else { + return 2048.0f; + } case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: return 16.0f; case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: -- cgit v1.2.3 From 08ec7e0d329a72433b427e8167b2c3442d1f53b4 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 16 May 2009 11:17:05 -0700 Subject: r300-gallium: Die on bad texture formats. Odds are good that we'll die later anyway, so we might as well do it before we start dancing on random memory. --- src/gallium/drivers/r300/r300_screen.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index ab095028fb..6fe724cc92 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -232,9 +232,16 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen, case PIPE_TEXTURE_2D: return check_tex_2d_format(format, r300_screen(pscreen)->caps->is_r500); + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_3D: + case PIPE_TEXTURE_CUBE: + debug_printf("r300: Implementation error: Unsupported format " + "target: %d\n", target); + break; default: - debug_printf("r300: Warning: Got unknown format target: %d\n", - format); + debug_printf("r300: Fatal: This is not a format target: %d\n", + target); + assert(0); break; } -- cgit v1.2.3 From 764bf9501adea0f3dbe8d7c718b22dfb067fbbfa Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 09:39:06 -0700 Subject: r300-gallium: vs: Dupe tokens, better debug, count spurious insts. --- src/gallium/drivers/r300/r300_debug.c | 10 ++++++---- src/gallium/drivers/r300/r300_state.c | 2 ++ src/gallium/drivers/r300/r300_state_tcl.c | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 1ff72172eb..ffc93eb591 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -152,10 +152,12 @@ void r500_fs_dump(struct r500_fragment_shader* fs) static void r300_vs_op_dump(uint32_t op) { - if (op & 0x81) { - debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n"); - } else if (op & 0x80) { - debug_printf(" PVS_MACRO_OP_2CLK_MADD\n"); + if (op & 0x80) { + if (op & 0x1) { + debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n"); + } else { + debug_printf(" PVS_MACRO_OP_2CLK_MADD\n"); + } } else if (op & 0x40) { debug_printf("%s\n", r300_vs_me_ops[op & 0x1f]); } else { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 49b93a420b..0ae118dbb9 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -634,6 +634,7 @@ static void* r300_create_vs_state(struct pipe_context* pipe, struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader); /* Copy state directly into shader. */ vs->state = *shader; + vs->state.tokens = tgsi_dup_tokens(shader->tokens); tgsi_scan_shader(shader->tokens, &vs->info); @@ -679,6 +680,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; draw_delete_vertex_shader(r300->draw, vs->draw); + FREE(vs->state.tokens); FREE(shader); } else { draw_delete_vertex_shader(r300->draw, diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index ed9164db49..8b7a2ec5e9 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -334,6 +334,8 @@ void r300_translate_vertex_shader(struct r300_context* r300, int i; struct r300_constant_buffer* consts = &r300->shader_constants[PIPE_SHADER_VERTEX]; + boolean end = FALSE; + int spurious = 0; struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm); if (assembler == NULL) { @@ -373,8 +375,16 @@ void r300_translate_vertex_shader(struct r300_context* r300, assembler->imm_count++; break; case TGSI_TOKEN_TYPE_INSTRUCTION: - r300_vs_instruction(vs, assembler, - &parser.FullToken.FullInstruction); + if (parser.FullToken.FullInstruction.Instruction.Opcode == + TGSI_OPCODE_END) { + end = TRUE; + } + if (end) { + spurious++; + } else { + r300_vs_instruction(vs, assembler, + &parser.FullToken.FullInstruction); + } break; } } @@ -391,6 +401,9 @@ void r300_translate_vertex_shader(struct r300_context* r300, debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0], assembler->tab[1], assembler->tab[2], assembler->tab[3]); + debug_printf("r300: vs: %d spurious instructions following END\n", + spurious - 1); + tgsi_dump(vs->state.tokens); /* XXX finish r300 vertex shader dumper */ r300_vs_dump(vs); -- cgit v1.2.3 From 7e97219ff8adce22d30abeda53144f7193589c30 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 09:44:14 -0700 Subject: r300-gallium: Comment out useless debugging code. Those parts are nearly solid compared to the shaders. --- src/gallium/drivers/r300/r300_emit.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 3beb1b8c3f..b7d1cf8a92 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -236,7 +236,7 @@ void r300_emit_rs_block_state(struct r300_context* r300, } for (i = 0; i < 8; i++) { OUT_CS(rs->ip[i]); - debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]); + /* debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]); */ } OUT_CS_REG_SEQ(R300_RS_COUNT, 2); @@ -250,11 +250,11 @@ void r300_emit_rs_block_state(struct r300_context* r300, } for (i = 0; i < 8; i++) { OUT_CS(rs->inst[i]); - debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]); + /* debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]); */ } - debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count, - rs->inst_count); + /* debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count, + * rs->inst_count); */ END_CS; } @@ -336,22 +336,22 @@ void r300_emit_vertex_format_state(struct r300_context* r300) OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); OUT_CS(r300->vertex_info.vinfo.hwfmt[2]); OUT_CS(r300->vertex_info.vinfo.hwfmt[3]); - for (i = 0; i < 4; i++) { - debug_printf("hwfmt%d: 0x%08x\n", i, - r300->vertex_info.vinfo.hwfmt[i]); - } + /* for (i = 0; i < 4; i++) { + * debug_printf("hwfmt%d: 0x%08x\n", i, + * r300->vertex_info.vinfo.hwfmt[i]); + * } */ OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8); for (i = 0; i < 8; i++) { OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]); - debug_printf("prog_stream_cntl%d: 0x%08x\n", i, - r300->vertex_info.vap_prog_stream_cntl[i]); + /* debug_printf("prog_stream_cntl%d: 0x%08x\n", i, + * r300->vertex_info.vap_prog_stream_cntl[i]); */ } OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8); for (i = 0; i < 8; i++) { OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]); - debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i, - r300->vertex_info.vap_prog_stream_cntl_ext[i]); + /* debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i, + * r300->vertex_info.vap_prog_stream_cntl_ext[i]); */ } END_CS; } -- cgit v1.2.3 From 8dae8f28e52ed20b087ecf0d09efe2d94bdd09cf Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 10:30:59 -0700 Subject: r300-gallium: r500-fs: Enable depth writes, kinda. Should work, but doesn't. Hm. --- src/gallium/drivers/r300/r300_state_shader.c | 29 ++++++++++++++++++++++++---- src/gallium/drivers/r300/r300_state_shader.h | 6 ++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 1b02239ee7..7257638dbe 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -59,6 +59,12 @@ static void r300_fs_declare(struct r300_fs_asm* assembler, } break; case TGSI_FILE_OUTPUT: + /* Depth write. Mark the position of the output so we can + * identify it later. */ + if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + assembler->depth_output = decl->DeclarationRange.First; + } + break; case TGSI_FILE_CONSTANT: break; case TGSI_FILE_TEMPORARY: @@ -120,6 +126,14 @@ static INLINE unsigned r300_fs_dst(struct r300_fs_asm* assembler, return 0; } +static INLINE boolean r300_fs_is_depr(struct r300_fs_asm* assembler, + struct tgsi_dst_register* dst) +{ + return (assembler->writes_depth && + (dst->File == TGSI_FILE_OUTPUT) && + (dst->Index == assembler->depth_output)); +} + static INLINE unsigned r500_fix_swiz(unsigned s) { /* For historical reasons, the swizzle values x, y, z, w, and 0 are @@ -302,16 +316,21 @@ static INLINE void r500_emit_alu(struct r500_fragment_shader* fs, int i = fs->instruction_count; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - fs->instructions[i].inst0 = R500_INST_TYPE_OUT | - R500_ALU_OMASK(dst->DstRegister.WriteMask); + fs->instructions[i].inst0 = R500_INST_TYPE_OUT; + if (r300_fs_is_depr(assembler, dst)) { + fs->instructions[i].inst4 = R500_W_OMASK; + } else { + fs->instructions[i].inst0 |= + R500_ALU_OMASK(dst->DstRegister.WriteMask); + } } else { fs->instructions[i].inst0 = R500_INST_TYPE_ALU | - R500_ALU_WMASK(dst->DstRegister.WriteMask); + R500_ALU_WMASK(dst->DstRegister.WriteMask); } fs->instructions[i].inst0 |= R500_INST_TEX_SEM_WAIT; - fs->instructions[i].inst4 = + fs->instructions[i].inst4 |= R500_ALPHA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister)); fs->instructions[i].inst5 = R500_ALU_RGBA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister)); @@ -581,6 +600,8 @@ void r300_translate_fragment_shader(struct r300_context* r300, } /* Setup starting offset for immediates. */ assembler->imm_offset = consts->user_count; + /* Enable depth writes, if needed. */ + assembler->writes_depth = fs->info.writes_z; /* Make sure we start at the beginning of the shader. */ if (is_r500) { diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 185fdd90f0..f4fb31d86c 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -57,6 +57,7 @@ #define R500_TEX_WMASK(x) ((x) << 11) #define R500_ALU_WMASK(x) ((x) << 11) #define R500_ALU_OMASK(x) ((x) << 15) +#define R500_W_OMASK (1 << 31) /* TGSI constants. TGSI is like XML: If it can't solve your problems, you're * not using enough of it. */ @@ -99,6 +100,11 @@ struct r300_fs_asm { unsigned imm_offset; /* Number of immediate constants. */ unsigned imm_count; + /* Are depth writes enabled? */ + boolean writes_depth; + /* Depth write offset. This is the TGSI output that corresponds to + * depth writes. */ + unsigned depth_output; }; void r300_translate_fragment_shader(struct r300_context* r300, -- cgit v1.2.3 From 45435abcb967931c79aba1714ae797a1c5dc075e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 10:33:56 -0700 Subject: r300-gallium: vs: Fix vert shader init. Makes the last three commits suck much less. :3 --- src/gallium/drivers/r300/r300_state_tcl.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 8b7a2ec5e9..fdbcbf3db8 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -325,6 +325,8 @@ static void r300_vs_init(struct r300_vertex_shader* vs, break; } } + + vs->instruction_count = 0; } void r300_translate_vertex_shader(struct r300_context* r300, @@ -334,8 +336,6 @@ void r300_translate_vertex_shader(struct r300_context* r300, int i; struct r300_constant_buffer* consts = &r300->shader_constants[PIPE_SHADER_VERTEX]; - boolean end = FALSE; - int spurious = 0; struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm); if (assembler == NULL) { @@ -375,16 +375,8 @@ void r300_translate_vertex_shader(struct r300_context* r300, assembler->imm_count++; break; case TGSI_TOKEN_TYPE_INSTRUCTION: - if (parser.FullToken.FullInstruction.Instruction.Opcode == - TGSI_OPCODE_END) { - end = TRUE; - } - if (end) { - spurious++; - } else { - r300_vs_instruction(vs, assembler, - &parser.FullToken.FullInstruction); - } + r300_vs_instruction(vs, assembler, + &parser.FullToken.FullInstruction); break; } } @@ -401,9 +393,6 @@ void r300_translate_vertex_shader(struct r300_context* r300, debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0], assembler->tab[1], assembler->tab[2], assembler->tab[3]); - debug_printf("r300: vs: %d spurious instructions following END\n", - spurious - 1); - tgsi_dump(vs->state.tokens); /* XXX finish r300 vertex shader dumper */ r300_vs_dump(vs); -- cgit v1.2.3 From fbcfcd9f5ce7523bde69103fcf1ebae30531a10c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 11:58:53 -0700 Subject: r300-gallium: Correct default MSPOS. Per agd5f. --- src/gallium/drivers/r300/r300_state_invariant.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 8bd9b41bd7..3e1580c595 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -40,8 +40,8 @@ void r300_emit_invariant_state(struct r300_context* r300) /* Various GB enables */ OUT_CS_REG(R300_GB_ENABLE, 0x0); /* Subpixel multisampling for AA */ - OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); - OUT_CS_REG(R300_GB_MSPOS1, 0x66666666); + OUT_CS_REG(R300_GB_MSPOS0, 0x6666666); + OUT_CS_REG(R300_GB_MSPOS1, 0x6666666); /* GB tile config and pipe setup */ OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE | r300_translate_gb_pipes(caps->num_frag_pipes)); -- cgit v1.2.3 From e5f5390f4bcb0fb04dff11cd1333b426cba6d0d1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 12:51:18 -0700 Subject: r300-gallium: Update XXX. Lops work fine as long as HW TCL is off. (I think I know why.) --- src/gallium/drivers/r300/r300_state.c | 7 +++---- src/gallium/drivers/r300/r300_state_shader.h | 16 ---------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0ae118dbb9..e818a77699 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -62,8 +62,6 @@ static void* r300_create_blend_state(struct pipe_context* pipe, } /* PIPE_LOGICOP_* don't need to be translated, fortunately. */ - /* XXX are logicops still allowed if blending's disabled? - * Does Gallium take care of it for us? */ if (state->logicop_enable) { blend->rop = R300_RB3D_ROPCNTL_ROP_ENABLE | (state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT; @@ -121,7 +119,7 @@ static void r300_set_clip_state(struct pipe_context* pipe, const struct pipe_clip_state* state) { struct r300_context* r300 = r300_context(pipe); - /* XXX Draw */ + /* XXX add HW TCL clipping setup */ draw_flush(r300->draw); draw_set_clip_state(r300->draw, state); } @@ -257,6 +255,7 @@ static void r300_set_edgeflags(struct pipe_context* pipe, const unsigned* bitfield) { /* XXX you know it's bad when i915 has this blank too */ + /* XXX and even worse, I have no idea WTF the bitfield is */ } static void @@ -326,7 +325,7 @@ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader) static void r300_set_polygon_stipple(struct pipe_context* pipe, const struct pipe_poly_stipple* state) { - /* XXX */ + /* XXX no idea how to set this up, but not terribly important */ } /* Create a new rasterizer state based on the CSO rasterizer state. diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index f4fb31d86c..06260e61fe 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -111,14 +111,6 @@ void r300_translate_fragment_shader(struct r300_context* r300, struct r3xx_fragment_shader* fs); static struct r300_fragment_shader r300_passthrough_fragment_shader = { - /* XXX This is the emission code. TODO: decode - OUT_CS_REG(R300_US_CONFIG, 0); - OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000); -*/ .alu_instruction_count = 1, .tex_instruction_count = 0, .indirections = 0, @@ -165,14 +157,6 @@ static struct r500_fragment_shader r500_passthrough_fragment_shader = { }; static struct r300_fragment_shader r300_texture_fragment_shader = { - /* XXX This is the emission code. TODO: decode - OUT_CS_REG(R300_US_CONFIG, 0); - OUT_CS_REG(R300_US_CODE_OFFSET, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0); - OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000); -*/ .alu_instruction_count = 1, .tex_instruction_count = 0, .indirections = 0, -- cgit v1.2.3 From 60665ae6277f15a1b5e48b65ba7d94cea2535c2c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 13:23:39 -0700 Subject: r300-gallium: Clean up more invariant state. GA_ENHANCE is now the kernel's problem. --- src/gallium/drivers/r300/r300_state_invariant.c | 27 +++++++------------------ src/gallium/drivers/r300/r300_surface.c | 10 +++++---- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 3e1580c595..0acbcbff7f 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -34,7 +34,7 @@ void r300_emit_invariant_state(struct r300_context* r300) struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); - BEGIN_CS(30 + (caps->has_tcl ? 2: 0)); + BEGIN_CS(28 + (caps->has_tcl ? 2: 0)); /*** Graphics Backend (GB) ***/ /* Various GB enables */ @@ -50,20 +50,6 @@ void r300_emit_invariant_state(struct r300_context* r300) /* AA enable */ OUT_CS_REG(R300_GB_AA_CONFIG, 0x0); - /*** Geometry Assembly (GA) ***/ - /* GA errata fixes. */ - if (caps->is_r500) { - OUT_CS_REG(R300_GA_ENHANCE, - R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL | - R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE | - R500_GA_ENHANCE_REG_READWRITE_ENABLE | - R500_GA_ENHANCE_REG_NOSTALL_ENABLE); - } else { - OUT_CS_REG(R300_GA_ENHANCE, - R300_GA_ENHANCE_DEADLOCK_CNTL_PREVENT_TCL | - R300_GA_ENHANCE_FASTSYNC_CNTL_ENABLE); - } - /*** Fog (FG) ***/ OUT_CS_REG(R300_FG_FOG_BLEND, 0x0); OUT_CS_REG(R300_FG_FOG_COLOR_R, 0x0); @@ -86,7 +72,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(79 + (caps->has_tcl ? 7 : 0)); + BEGIN_CS(77 + (caps->has_tcl ? 7 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -113,11 +99,14 @@ void r300_emit_invariant_state(struct r300_context* r300) OUT_CS_32F(0.0); OUT_CS_REG_SEQ(R300_GA_POINT_S1, 1); OUT_CS_32F(1.0); + /* XXX line tex stuffing */ + OUT_CS_REG_SEQ(R300_GA_LINE_S0, 1); + OUT_CS_32F(0.0); + OUT_CS_REG_SEQ(R300_GA_LINE_S1, 1); + OUT_CS_32F(1.0); OUT_CS_REG(R300_GA_TRIANGLE_STIPPLE, 0x5 | (0x5 << R300_GA_TRIANGLE_STIPPLE_Y_SHIFT_SHIFT)); /* XXX this big chunk should be refactored into rs_state */ - OUT_CS_REG(R300_GA_LINE_S0, 0x00000000); - OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000); OUT_CS_REG(R300_GA_SOLID_RG, 0x00000000); OUT_CS_REG(R300_GA_SOLID_BA, 0x00000000); OUT_CS_REG(R300_GA_POLY_MODE, 0x00000000); @@ -144,8 +133,6 @@ void r300_emit_invariant_state(struct r300_context* r300) OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1); OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405); OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F); - /* Vertex size. */ - OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); /* XXX */ OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa); diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 17b42504d4..ceaafe11d5 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -179,6 +179,9 @@ static void r300_surface_fill(struct pipe_context* pipe, ((h * 6) & R300_POINTSIZE_Y_MASK) | ((w * 6) << R300_POINTSIZE_X_SHIFT)); + /* Vertex size. */ + OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); + /* Packet3 with our point vertex */ OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8); OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | @@ -194,11 +197,7 @@ static void r300_surface_fill(struct pipe_context* pipe, OUT_CS_32F(b); OUT_CS_32F(a); - /* XXX figure out why this is 0xA and not 0x2 */ OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); - /* XXX OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, - R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | - R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); */ END_CS; @@ -287,6 +286,9 @@ static void r300_surface_copy(struct pipe_context* pipe, /* Two components of texture 0 */ OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2); + /* Vertex size. */ + OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); + /* Packet3 with our texcoords */ OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16); OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING | -- cgit v1.2.3 From d6e085bd76ad8e6cfb67c317dc1b32b04434a8b5 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 16:42:54 -0700 Subject: r300-gallium: Don't set GB_TILE_CONFIG (in userspace.) This accompanies kernel patches that make GB_TILE_CONFIG's various members completely controlled in DRM. GB_TILE_CONFIG has the following controls: - The number of GB (pixel) pipes enabled - The size and style of tiling - Subpixel precision (either 1/12 or 1/16) Per airlied and glisse, userspace and kernel will now agree (always) on a subpixel precision of 1/12, and tiling will always be kernel-controlled. --- src/gallium/drivers/r300/r300_state_invariant.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 0acbcbff7f..d74928ceca 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -34,7 +34,7 @@ void r300_emit_invariant_state(struct r300_context* r300) struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); - BEGIN_CS(28 + (caps->has_tcl ? 2: 0)); + BEGIN_CS(26 + (caps->has_tcl ? 2: 0)); /*** Graphics Backend (GB) ***/ /* Various GB enables */ @@ -42,9 +42,6 @@ void r300_emit_invariant_state(struct r300_context* r300) /* Subpixel multisampling for AA */ OUT_CS_REG(R300_GB_MSPOS0, 0x6666666); OUT_CS_REG(R300_GB_MSPOS1, 0x6666666); - /* GB tile config and pipe setup */ - OUT_CS_REG(R300_GB_TILE_CONFIG, R300_GB_TILE_DISABLE | - r300_translate_gb_pipes(caps->num_frag_pipes)); /* Source of fog depth */ OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); /* AA enable */ -- cgit v1.2.3 From 6a40d1e9d96f8e8c57bc3bbd6f567cacd4471f59 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 17:03:15 -0700 Subject: r300-gallium, radeon-gallium: Nuke gb_pipes from orbit. See the previous commit for an explanation. This is just all the support code for GB_TILE_CONFIG. --- src/gallium/drivers/r300/r300_chipset.c | 1 - src/gallium/drivers/r300/r300_chipset.h | 2 -- src/gallium/drivers/r300/r300_screen.c | 1 - src/gallium/drivers/r300/r300_state_inlines.h | 19 ------------------- src/gallium/drivers/r300/r300_winsys.h | 3 --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 22 ++-------------------- src/gallium/winsys/drm/radeon/core/radeon_r300.h | 3 --- 7 files changed, 2 insertions(+), 49 deletions(-) diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index db09f27bfa..758f706c51 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -34,7 +34,6 @@ void r300_parse_chipset(struct r300_capabilities* caps) caps->is_r500 = FALSE; caps->num_vert_fpus = 4; - /* Note: These are not ordered by PCI ID. I leave that task to GCC, * which will perform the ordering while collating jump tables. Instead, * I've tried to group them according to capabilities and age. */ diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index 21eebeae60..5b2e1f0568 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -34,8 +34,6 @@ struct r300_capabilities { int family; /* The number of vertex floating-point units */ int num_vert_fpus; - /* The number of fragment pipes */ - int num_frag_pipes; /* Whether or not TCL is physically present */ boolean has_tcl; /* Whether or not this is an RV515 or newer; R500s have many differences diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 6fe724cc92..04d6db81b0 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -346,7 +346,6 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys) return NULL; caps->pci_id = r300_winsys->pci_id; - caps->num_frag_pipes = r300_winsys->gb_pipes; r300_parse_chipset(caps); diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 91b93fc367..22c8e199ae 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -353,25 +353,6 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) /* Non-CSO state. (For now.) */ -static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) -{ - switch (pipe_count) { - case 1: - return R300_GB_TILE_PIPE_COUNT_RV300; - break; - case 2: - return R300_GB_TILE_PIPE_COUNT_R300; - break; - case 3: - return R300_GB_TILE_PIPE_COUNT_R420_3P; - break; - case 4: - return R300_GB_TILE_PIPE_COUNT_R420; - break; - } - return 0; -} - static INLINE uint32_t translate_vertex_data_type(int type) { switch (type) { case EMIT_1F: diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index a833bb0399..a5ced8041c 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -45,9 +45,6 @@ struct r300_winsys { /* PCI ID */ uint32_t pci_id; - /* GB pipe count */ - uint32_t gb_pipes; - /* GART size. */ uint32_t gart_size; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 56b0d00842..d257e01693 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -161,25 +161,7 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) info.value = ⌖ gp.value = ⌖ - /* First, get the number of pixel pipes */ - info.request = RADEON_INFO_NUM_GB_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); - if (retval) { - fprintf(stderr, "%s: New ioctl for GB pipe count failed " - "(error number %d), trying classic ioctl...\n", - __FUNCTION__, retval); - gp.param = RADEON_PARAM_NUM_GB_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, - sizeof(gp)); - if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, " - "error number %d\n", __FUNCTION__, retval); - exit(1); - } - } - winsys->gb_pipes = target; - - /* Then, get PCI ID */ + /* First, get PCI ID */ info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { @@ -197,7 +179,7 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) } winsys->pci_id = target; - /* Finally, retrieve MM info */ + /* Then, retrieve MM info */ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, &gem_info, sizeof(gem_info)); if (retval) { diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index 19c7ed2626..a2e0e58248 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -32,9 +32,6 @@ #include "radeon_buffer.h" /* protect us from bonghits */ -#ifndef RADEON_INFO_NUM_GB_PIPES -#define RADEON_INFO_NUM_GB_PIPES 0 -#endif #ifndef RADEON_INFO_DEVICE_ID #define RADEON_INFO_DEVICE_ID 0 #endif -- cgit v1.2.3 From 572d7d1358b60c93ec4f1f28151bb0e708a9df17 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 20:49:39 -0700 Subject: r300-gallium: Size mismatch. --- src/gallium/drivers/r300/r300_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index ceaafe11d5..acb6192492 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -147,7 +147,7 @@ static void r300_surface_fill(struct pipe_context* pipe, r300_emit_rs_block_state(r300, &r300_rs_block_clear_state); } - BEGIN_CS(24); + BEGIN_CS(26); /* VAP stream control, mapping from input memory to PVS/RS memory */ if (caps->has_tcl) { -- cgit v1.2.3 From 06a7b798f2261a7faaede71946e4489979840713 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 21:10:07 -0700 Subject: r300-gallium: Add half-right COS and SIN. HW trig does a premultiply by 2pi, where Mesa does another premultiply by pi. This is a problem. --- src/gallium/drivers/r300/r300_state_shader.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 7257638dbe..0871aed2b4 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -208,10 +208,12 @@ static INLINE uint32_t r300_alpha_op(unsigned op) static INLINE uint32_t r500_rgba_op(unsigned op) { switch (op) { + case TGSI_OPCODE_COS: case TGSI_OPCODE_EX2: case TGSI_OPCODE_LG2: case TGSI_OPCODE_RCP: case TGSI_OPCODE_RSQ: + case TGSI_OPCODE_SIN: return R500_ALU_RGBA_OP_SOP; case TGSI_OPCODE_FRC: return R500_ALU_RGBA_OP_FRC; @@ -238,6 +240,8 @@ static INLINE uint32_t r500_rgba_op(unsigned op) static INLINE uint32_t r500_alpha_op(unsigned op) { switch (op) { + case TGSI_OPCODE_COS: + return R500_ALPHA_OP_COS; case TGSI_OPCODE_EX2: return R500_ALPHA_OP_EX2; case TGSI_OPCODE_LG2: @@ -248,6 +252,8 @@ static INLINE uint32_t r500_alpha_op(unsigned op) return R500_ALPHA_OP_RSQ; case TGSI_OPCODE_FRC: return R500_ALPHA_OP_FRC; + case TGSI_OPCODE_SIN: + return R500_ALPHA_OP_SIN; case TGSI_OPCODE_DP3: case TGSI_OPCODE_DP4: case TGSI_OPCODE_DPH: @@ -460,6 +466,9 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, * AMD/ATI names for opcodes, please, as it facilitates using the * documentation. */ switch (inst->Instruction.Opcode) { + /* XXX trig needs extra prep */ + case TGSI_OPCODE_COS: + case TGSI_OPCODE_SIN: /* The simple scalar ops. */ case TGSI_OPCODE_EX2: case TGSI_OPCODE_LG2: -- cgit v1.2.3 From 0036f2ccba6720e06a578333f04086d100d188b1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 21:39:11 -0700 Subject: dri-gallium: Add GLSL support. Oh, look, it's more features. :3 --- src/gallium/state_trackers/dri/dri_extensions.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 0c59d42d5c..2f48162526 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -36,9 +36,11 @@ #define need_GL_ARB_multisample #define need_GL_ARB_occlusion_query #define need_GL_ARB_point_parameters +#define need_GL_ARB_shader_objects #define need_GL_ARB_texture_compression #define need_GL_ARB_vertex_buffer_object #define need_GL_ARB_vertex_program +#define need_GL_ARB_vertex_shader #define need_GL_ARB_window_pos #define need_GL_EXT_blend_color #define need_GL_EXT_blend_equation_separate @@ -50,16 +52,23 @@ #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #define need_GL_NV_vertex_program +#define need_GL_VERSION_2_0 +#define need_GL_VERSION_2_1 #include "extension_helper.h" /** * Extension strings exported by the driver. */ const struct dri_extension card_extensions[] = { + {"GL_ARB_fragment_shader", NULL}, {"GL_ARB_multisample", GL_ARB_multisample_functions}, {"GL_ARB_multitexture", NULL}, {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, + {"GL_ARB_pixel_buffer_object", NULL}, {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, + {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, + {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, + {"GL_ARB_shader_objects", GL_ARB_shader_objects_functions}, {"GL_ARB_texture_border_clamp", NULL}, {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions}, {"GL_ARB_texture_cube_map", NULL}, @@ -69,7 +78,7 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_texture_mirrored_repeat", NULL}, {"GL_ARB_texture_rectangle", NULL}, {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, - {"GL_ARB_pixel_buffer_object", NULL}, + {"GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions}, {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, -- cgit v1.2.3 From 9569221563fd0e9fba564126d61bf3786cf74715 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 21:40:16 -0700 Subject: r300-gallium: r500-fs: DDX and DDY support. Oh, look, GLSL instructions. I wonder what I'll do next. --- src/gallium/drivers/r300/r300_state_shader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 0871aed2b4..ed99c76c15 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -215,6 +215,10 @@ static INLINE uint32_t r500_rgba_op(unsigned op) case TGSI_OPCODE_RSQ: case TGSI_OPCODE_SIN: return R500_ALU_RGBA_OP_SOP; + case TGSI_OPCODE_DDX: + return R500_ALU_RGBA_OP_MDH; + case TGSI_OPCODE_DDY: + return R500_ALU_RGBA_OP_MDV; case TGSI_OPCODE_FRC: return R500_ALU_RGBA_OP_FRC; case TGSI_OPCODE_DP3: @@ -254,6 +258,10 @@ static INLINE uint32_t r500_alpha_op(unsigned op) return R500_ALPHA_OP_FRC; case TGSI_OPCODE_SIN: return R500_ALPHA_OP_SIN; + case TGSI_OPCODE_DDX: + return R500_ALPHA_OP_MDH; + case TGSI_OPCODE_DDY: + return R500_ALPHA_OP_MDV; case TGSI_OPCODE_DP3: case TGSI_OPCODE_DP4: case TGSI_OPCODE_DPH: @@ -480,6 +488,8 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, inst->FullSrcRegisters[0].SrcRegister.SwizzleW = inst->FullSrcRegisters[0].SrcRegister.SwizzleX; /* Fall through */ + case TGSI_OPCODE_DDX: + case TGSI_OPCODE_DDY: case TGSI_OPCODE_FRC: r500_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 1); -- cgit v1.2.3 From 27206add2738f9813d1e9f42fe3b1bdfbd9b8aa4 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 17 May 2009 21:41:25 -0700 Subject: r300-gallium: Enable GLSL for r500. Before you get all excited, this is *not* to be construed as actual support for GLSL shaders. The GL version is still 1.3, and stuff still sucks. Just flicking it on so that it can be tested and developed a bit easier. --- src/gallium/drivers/r300/r300_screen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 04d6db81b0..a6f1efe356 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -88,8 +88,11 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) return 0; } case PIPE_CAP_GLSL: - /* IN THEORY */ - return 0; + if (r300screen->caps->is_r500) { + return 1; + } else { + return 0; + } case PIPE_CAP_S3TC: /* IN THEORY */ return 0; -- cgit v1.2.3 From d039cf4574893e480d33f286e3526c6805d919fd Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 18 May 2009 10:13:05 +0200 Subject: radeon: fix DRI1 cmd stream --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 26 ++++++++++++++++---------- src/mesa/drivers/dri/r300/r300_state.c | 9 ++------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 253378767b..60ad8ea14b 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -312,7 +312,6 @@ static void emit_gb_misc(GLcontext *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); - if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) { BEGIN_BATCH_NO_AUTOSTATE(4); OUT_BATCH(atom->cmd[0]); @@ -323,6 +322,19 @@ static void emit_gb_misc(GLcontext *ctx, struct radeon_state_atom * atom) } } +static void emit_threshold_misc(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + BATCH_LOCALS(&r300->radeon); + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + BEGIN_BATCH_NO_AUTOSTATE(3); + OUT_BATCH(atom->cmd[0]); + OUT_BATCH(atom->cmd[1]); + OUT_BATCH(atom->cmd[2]); + END_BATCH(); + } +} + static void emit_shade_misc(GLcontext *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -620,15 +632,9 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.rb3d_dither_ctl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_DITHER_CTL, 9); ALLOC_STATE(rb3d_aaresolve_ctl, always, 2, 0); r300->hw.rb3d_aaresolve_ctl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_AARESOLVE_CTL, 1); - if (is_r500) { - ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); - } else { - ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = (2 << 30); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = (2 << 30); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = (2 << 30); - } + ALLOC_STATE(rb3d_discard_src_pixel_lte_threshold, always, 3, 0); + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 2); + r300->hw.rb3d_discard_src_pixel_lte_threshold.emit = emit_threshold_misc; ALLOC_STATE(zs, always, R300_ZS_CMDSIZE, 0); r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_ZB_CNTL, 3); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 91f9acd5bf..efbe5cacab 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2036,13 +2036,8 @@ static void r300ResetHwState(r300ContextPtr r300) r300->hw.rb3d_aaresolve_ctl.cmd[1] = 0; - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = 0x00000000; - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = 0xffffffff; - } else { - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = (2 << 30); - r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = (2 << 30); - } + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[1] = 0x00000000; + r300->hw.rb3d_discard_src_pixel_lte_threshold.cmd[2] = 0xffffffff; r300->hw.zb_depthclearvalue.cmd[1] = 0; -- cgit v1.2.3 From f2445dfd85b42aafe0634e17b2929b4122ff3f03 Mon Sep 17 00:00:00 2001 From: Aidan Thornton Date: Mon, 18 May 2009 12:47:00 +0200 Subject: Initialize psp->waitX/waitGL for swrast_dri.so. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21053 . --- src/glx/x11/drisw_glx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index 5e3d763cff..b843ce484f 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -405,6 +405,8 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, psp->createContext = driCreateContext; psp->createDrawable = driCreateDrawable; psp->swapBuffers = driSwapBuffers; + psp->waitX = NULL; + psp->waitGL = NULL; return psp; -- cgit v1.2.3 From da0d4e1db67d7641a535218de2db5f7bb00a6bb8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 07:17:36 -0600 Subject: docs: emphasize the incomplete status of the nouveau/R300 gallium drivers --- docs/relnotes-7.5.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index 3de243d1b2..d47b21d827 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -46,7 +46,7 @@ tbd

          New features

            -
          • Gallium - this is the new architecture for OS-independent and +
          • Gallium3D - this is the new architecture for OS-independent and API-independent 3D drivers. Gallium3D is intended for GPUs that fully support vertex/fragment shaders. The Gallium3D drivers currently included are: @@ -54,8 +54,10 @@ tbd
          • softpipe - a software/reference driver
          • i915 - Intel 915/945 driver
          • Cell - IBM/Sony/Toshiba Cell processor driver -
          • nouveau - preliminary driver for NVIDIA GPUs (still under development) -
          • r300 - preliminary driver for R300 (still under development) +
          • nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300). + PLEASE NOTE: these drivers are incomplete and still under development. + It's probably NOT worthwhile to report any bugs unless you have patches. +
        • GL_ARB_framebuffer_object extension (software drivers, i965 driver)
        • Reworked two-sided stencil support. -- cgit v1.2.3 From 6e61700541f229b55d78102a534c022caee1319c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 07:17:46 -0600 Subject: docs: link to 7.5 relnotes --- docs/relnotes.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes.html b/docs/relnotes.html index ca808af64c..45746268af 100644 --- a/docs/relnotes.html +++ b/docs/relnotes.html @@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.

            +
          • 7.5 release notes
          • 7.4.2 release notes
          • 7.4.1 release notes
          • 7.4 release notes -- cgit v1.2.3 From df37cde3090cabded561f4f5ef29ff5ddf980170 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 08:46:17 -0600 Subject: mesa: added linux-osmesa-static config Contributed by Nicolas Noble. See SF bug #2792536 --- Makefile | 1 + configs/linux-osmesa-static | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 configs/linux-osmesa-static diff --git a/Makefile b/Makefile index acf83e6280..d134c4c330 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,7 @@ linux-icc \ linux-icc-static \ linux-llvm \ linux-osmesa \ +linux-osmesa-static \ linux-osmesa16 \ linux-osmesa16-static \ linux-osmesa32 \ diff --git a/configs/linux-osmesa-static b/configs/linux-osmesa-static new file mode 100644 index 0000000000..a03e63eb75 --- /dev/null +++ b/configs/linux-osmesa-static @@ -0,0 +1,37 @@ +# Configuration for building static libOSMesa.a on Linux, no Xlib driver +# This doesn't really have any Linux dependencies, so it should be usable +# on other (gcc-based) systems. + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa + +# Compiler and flags +CC = gcc -m32 +CXX = g++ -m32 +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +MKLIB_OPTIONS = -static + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Directories +SRC_DIRS = mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ + $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm -- cgit v1.2.3 From 14e5bff97b20565637d468d97dba434ac4cd2ba1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 10:12:36 -0600 Subject: st: fix incorrect target parameter to screen->is_format_supported() We were passing a GL texture target instead of a pipe_texture_target enum. --- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index e159b4c9db..3a88908022 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -87,7 +87,7 @@ st_render_mipmap(struct st_context *st, assert(target != GL_TEXTURE_3D); /* not done yet */ /* check if we can render in the texture's format */ - if (!screen->is_format_supported(screen, pt->format, target, + if (!screen->is_format_supported(screen, pt->format, pt->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { return FALSE; } -- cgit v1.2.3 From 30320f0afb3ae4409adab662d65475cf9665bc19 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 10:13:44 -0600 Subject: softpipe: add texture target sanity check assertion --- src/gallium/drivers/softpipe/sp_screen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 7380a6ae2b..a32fd3a1ba 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -127,6 +127,11 @@ softpipe_is_format_supported( struct pipe_screen *screen, unsigned tex_usage, unsigned geom_flags ) { + assert(target == PIPE_TEXTURE_1D || + target == PIPE_TEXTURE_2D || + target == PIPE_TEXTURE_3D || + target == PIPE_TEXTURE_CUBE); + switch(format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: -- cgit v1.2.3 From adabd0e81e287cd5dac60fa63841d8b096d10d5f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 10:27:31 -0600 Subject: mesa: comments for _mesa_generate_mipmap_level() --- src/mesa/main/mipmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index bc8658beff..7a719745fc 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1370,6 +1370,9 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, /** * Down-sample a texture image to produce the next lower mipmap level. + * \param comps components per texel (1, 2, 3 or 4) + * \param srcRowStride stride between source rows, in texels + * \param dstRowStride stride between destination rows, in texels */ void _mesa_generate_mipmap_level(GLenum target, -- cgit v1.2.3 From 7ce105d2e6885eeac73c59dc14c4cd59a89c1425 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 May 2009 10:28:04 -0600 Subject: st/mesa: fix incorrect src/dst stride params to _mesa_generate_mipmap_level() The stride needs to be in texels, not bytes. --- src/mesa/state_tracker/st_gen_mipmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 3a88908022..dc6d77825f 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -123,6 +123,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, struct pipe_transfer *srcTrans, *dstTrans; const ubyte *srcData; ubyte *dstData; + int srcStride, dstStride; srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, srcLevel, zslice, @@ -139,14 +140,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); + srcStride = srcTrans->stride / srcTrans->block.size; + dstStride = dstTrans->stride / dstTrans->block.size; + _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], srcData, - srcTrans->stride, /* stride in bytes */ + srcStride, /* stride in texels */ pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], dstData, - dstTrans->stride); /* stride in bytes */ + dstStride); /* stride in texels */ screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); -- cgit v1.2.3 From 301d238c1adf3d451b412333a77c81af14feed6f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 18 May 2009 09:40:13 -0700 Subject: r300-gallium: Always do VTE, never software viewport. This makes glxgears draw properly with SW TCL. --- src/gallium/drivers/r300/r300_context.c | 7 +++++++ src/gallium/drivers/r300/r300_context.h | 10 ++++++++++ src/gallium/drivers/r300/r300_emit.c | 6 +++++- src/gallium/drivers/r300/r300_state.c | 8 +++++--- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index a1cdea30de..21c0fe2b80 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -145,8 +145,15 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.is_texture_referenced = r300_is_texture_referenced; r300->context.is_buffer_referenced = r300_is_buffer_referenced; + /* Create a Draw. This is used for vert collation and SW TCL. */ r300->draw = draw_create(); + /* Enable our renderer. */ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); + /* Tell Draw that we can always do non-UCP clipping. */ + draw_set_driver_clipping(r300->draw, TRUE); + /* Force Draw to never do viewport transform, since (again) we can do + * transform in hardware, always. */ + draw_set_viewport_state(r300->draw, &r300_viewport_identity); r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); r300->rs_block = CALLOC_STRUCT(r300_rs_block); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 96f1f11246..58f1fa0e2e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -63,6 +63,11 @@ struct r300_rs_state { /* Draw-specific rasterizer state */ struct pipe_rasterizer_state rs; + /* Whether or not to enable the VTE. This is referenced at the very + * last moment during emission of VTE state, to decide whether or not + * the VTE should be used for transformation. */ + boolean enable_vte; + uint32_t vap_control_status; /* R300_VAP_CNTL_STATUS: 0x2140 */ uint32_t point_size; /* R300_GA_POINT_SIZE: 0x421c */ uint32_t point_minmax; /* R300_GA_POINT_MINMAX: 0x4230 */ @@ -255,6 +260,11 @@ struct r300_vertex_shader { } instructions[128]; /*< XXX magic number */ }; +static struct pipe_viewport_state r300_viewport_identity = { + .scale = {1.0, 1.0, 1.0, 1.0}, + .translate = {0.0, 0.0, 0.0, 0.0}, +}; + struct r300_context { /* Parent class */ struct pipe_context context; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b7d1cf8a92..0cb0507fc8 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -429,7 +429,11 @@ void r300_emit_viewport_state(struct r300_context* r300, OUT_CS_32F(viewport->zscale); OUT_CS_32F(viewport->zoffset); - OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control); + if (r300->rs_state->enable_vte) { + OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control); + } else { + OUT_CS_REG(R300_VAP_VTE_CNTL, 0); + } END_CS; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index e818a77699..d7825e0e5f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -343,6 +343,8 @@ static void* r300_create_rs_state(struct pipe_context* pipe, /* Copy rasterizer state for Draw. */ rs->rs = *state; + rs->enable_vte = !state->bypass_vs_clip_and_viewport; + /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL. * Else, enable HW TCL and force Draw's TCL off. */ if (state->bypass_vs_clip_and_viewport || @@ -557,11 +559,11 @@ static void r300_set_viewport_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - draw_flush(r300->draw); + //draw_flush(r300->draw); - if (r300_screen(r300->context.screen)->caps->has_tcl) { + if (TRUE || r300_screen(r300->context.screen)->caps->has_tcl) { /* Do the transform in HW. */ - r300->viewport_state->vte_control = R300_VTX_XY_FMT | R300_VTX_Z_FMT; + r300->viewport_state->vte_control = R300_VTX_W0_FMT; if (state->scale[0] != 1.0f) { assert(state->scale[0] != 0.0f); -- cgit v1.2.3 From 5236ea39006fd0b475ff1658a1418abc71ec998c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 18 May 2009 09:41:21 -0700 Subject: r300-gallium: Cleanup viewport state setup. --- src/gallium/drivers/r300/r300_state.c | 64 +++++++++++++++-------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d7825e0e5f..4e65fbbabe 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -559,43 +559,35 @@ static void r300_set_viewport_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - //draw_flush(r300->draw); + /* Do the transform in HW. */ + r300->viewport_state->vte_control = R300_VTX_W0_FMT; - if (TRUE || r300_screen(r300->context.screen)->caps->has_tcl) { - /* Do the transform in HW. */ - r300->viewport_state->vte_control = R300_VTX_W0_FMT; - - if (state->scale[0] != 1.0f) { - assert(state->scale[0] != 0.0f); - r300->viewport_state->xscale = state->scale[0]; - r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA; - } - if (state->scale[1] != 1.0f) { - assert(state->scale[1] != 0.0f); - r300->viewport_state->yscale = state->scale[1]; - r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA; - } - if (state->scale[2] != 1.0f) { - assert(state->scale[2] != 0.0f); - r300->viewport_state->zscale = state->scale[2]; - r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA; - } - if (state->translate[0] != 0.0f) { - r300->viewport_state->xoffset = state->translate[0]; - r300->viewport_state->vte_control |= R300_VPORT_X_OFFSET_ENA; - } - if (state->translate[1] != 0.0f) { - r300->viewport_state->yoffset = state->translate[1]; - r300->viewport_state->vte_control |= R300_VPORT_Y_OFFSET_ENA; - } - if (state->translate[2] != 0.0f) { - r300->viewport_state->zoffset = state->translate[2]; - r300->viewport_state->vte_control |= R300_VPORT_Z_OFFSET_ENA; - } - } else { - r300->viewport_state->vte_control = 0; - /* Have Draw do the actual transform. */ - draw_set_viewport_state(r300->draw, state); + if (state->scale[0] != 1.0f) { + assert(state->scale[0] != 0.0f); + r300->viewport_state->xscale = state->scale[0]; + r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA; + } + if (state->scale[1] != 1.0f) { + assert(state->scale[1] != 0.0f); + r300->viewport_state->yscale = state->scale[1]; + r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA; + } + if (state->scale[2] != 1.0f) { + assert(state->scale[2] != 0.0f); + r300->viewport_state->zscale = state->scale[2]; + r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA; + } + if (state->translate[0] != 0.0f) { + r300->viewport_state->xoffset = state->translate[0]; + r300->viewport_state->vte_control |= R300_VPORT_X_OFFSET_ENA; + } + if (state->translate[1] != 0.0f) { + r300->viewport_state->yoffset = state->translate[1]; + r300->viewport_state->vte_control |= R300_VPORT_Y_OFFSET_ENA; + } + if (state->translate[2] != 0.0f) { + r300->viewport_state->zoffset = state->translate[2]; + r300->viewport_state->vte_control |= R300_VPORT_Z_OFFSET_ENA; } r300->dirty_state |= R300_NEW_VIEWPORT; -- cgit v1.2.3 From 026f4c97dc4cf29c93461857afa76b07086ede42 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 18 May 2009 09:47:37 -0700 Subject: radeon-gallium: Remove BO validation debug. It appears that that area of code "just works" much like classic Mesa's version, so might as well not waste scrollback on it. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index d257e01693..65366e242c 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -57,10 +57,6 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) (struct radeon_winsys_priv*)winsys->radeon_winsys; struct radeon_cs_space_check* sc = priv->sc; - debug_printf("Validation count: %d\n", priv->bo_count); - for (i = 0; i < priv->bo_count; i++) { - debug_printf("BO %d: %p rd: %d wd: %d\n", i, sc[i].bo, sc[i].read_domains, sc[i].write_domain); - } retval = radeon_cs_space_check(priv->cs, sc, priv->bo_count); if (retval == RADEON_CS_SPACE_OP_TO_BIG) { -- cgit v1.2.3 From d0639d067e9b95875b1d395eaa66388884996296 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 18 May 2009 09:50:30 -0700 Subject: r300-gallium: Fix (another) wrong value in MSPOS. Again, thanks to agd5f. --- src/gallium/drivers/r300/r300_state_invariant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index d74928ceca..9dde662802 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -40,7 +40,7 @@ void r300_emit_invariant_state(struct r300_context* r300) /* Various GB enables */ OUT_CS_REG(R300_GB_ENABLE, 0x0); /* Subpixel multisampling for AA */ - OUT_CS_REG(R300_GB_MSPOS0, 0x6666666); + OUT_CS_REG(R300_GB_MSPOS0, 0x66666666); OUT_CS_REG(R300_GB_MSPOS1, 0x6666666); /* Source of fog depth */ OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W); -- cgit v1.2.3 From 7d11a392d780ef7f0374f8da87e3ba416d880cf2 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 18 May 2009 02:50:15 +0100 Subject: st/dri: Only create new textures if drawable has changed --- src/gallium/state_trackers/dri/dri_drawable.c | 12 ++++++++++++ src/gallium/state_trackers/dri/dri_drawable.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 15a2088df5..865cc8d0b6 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -138,6 +138,18 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) dri_drawable->pBackClipRects[0].x2 = dri_drawable->w; dri_drawable->pBackClipRects[0].y2 = dri_drawable->h; + if (drawable->old_num == count && + drawable->old_w == dri_drawable->w && + drawable->old_h == dri_drawable->h && + memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) { + return; + } else { + drawable->old_num = count; + drawable->old_w = dri_drawable->w; + drawable->old_h = dri_drawable->h; + memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count); + } + for (i = 0; i < count; i++) { enum pipe_format format = 0; int index = 0; diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index 78a66624aa..0f654d804a 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -46,6 +46,11 @@ struct dri_drawable unsigned attachments[8]; unsigned num_attachments; + __DRIbuffer old[8]; + unsigned old_num; + unsigned old_w; + unsigned old_h; + /* gallium */ struct st_framebuffer *stfb; struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; -- cgit v1.2.3 From bd59dd69ba0f11f96e627c663c67cc15d1083776 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 16 May 2009 03:13:15 +0100 Subject: trace: Improve shader wrapping --- src/gallium/drivers/trace/tr_context.c | 4 ++-- src/gallium/drivers/trace/tr_state.c | 18 +++++++++++++++++- src/gallium/drivers/trace/tr_state.h | 11 ++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index a416628562..2ad5ca4998 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -582,7 +582,7 @@ trace_context_create_fs_state(struct pipe_context *_pipe, trace_dump_call_end(); - result = trace_shader_create(tr_ctx, state, result); + result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_FRAGMENT); return result; } @@ -654,7 +654,7 @@ trace_context_create_vs_state(struct pipe_context *_pipe, trace_dump_call_end(); - result = trace_shader_create(tr_ctx, state, result); + result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_VERTEX); return result; } diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c index c9ce63a0ed..d8c11640bf 100644 --- a/src/gallium/drivers/trace/tr_state.c +++ b/src/gallium/drivers/trace/tr_state.c @@ -27,13 +27,18 @@ #include "util/u_memory.h" #include "util/u_simple_list.h" +#include "tgsi/tgsi_parse.h" + struct trace_shader * trace_shader_create(struct trace_context *tr_ctx, const struct pipe_shader_state *state, - void *result) + void *result, + enum trace_shader_type type) { struct trace_shader *tr_shdr = CALLOC_STRUCT(trace_shader); tr_shdr->state = result; + tr_shdr->type = type; + tr_shdr->tokens = tgsi_dup_tokens(state->tokens); /* works on context as well */ trace_screen_add_to_list(tr_ctx, shaders, tr_shdr); @@ -46,5 +51,16 @@ void trace_shader_destroy(struct trace_context *tr_ctx, { trace_screen_remove_from_list(tr_ctx, shaders, tr_shdr); + if (tr_shdr->replaced) { + if (tr_shdr->type == TRACE_SHADER_FRAGMENT) + tr_ctx->pipe->delete_fs_state(tr_ctx->pipe, tr_shdr->replaced); + else if (tr_shdr->type == TRACE_SHADER_VERTEX) + tr_ctx->pipe->delete_vs_state(tr_ctx->pipe, tr_shdr->replaced); + else + assert(0); + } + + FREE(tr_shdr->replaced_tokens); + FREE(tr_shdr->tokens); FREE(tr_shdr); } diff --git a/src/gallium/drivers/trace/tr_state.h b/src/gallium/drivers/trace/tr_state.h index bca615c50e..1c16042ee5 100644 --- a/src/gallium/drivers/trace/tr_state.h +++ b/src/gallium/drivers/trace/tr_state.h @@ -29,10 +29,18 @@ struct tgsi_token; +enum trace_shader_type { + TRACE_SHADER_FRAGMENT = 0, + TRACE_SHADER_VERTEX = 1, + TRACE_SHADER_GEOMETRY = 2, +}; + struct trace_shader { struct tr_list list; + enum trace_shader_type type; + void *state; void *replaced; @@ -51,7 +59,8 @@ trace_shader(void *state) struct trace_shader * trace_shader_create(struct trace_context *tr_ctx, const struct pipe_shader_state *state, - void *result); + void *result, + enum trace_shader_type type); void trace_shader_destroy(struct trace_context *tr_ctx, struct trace_shader *tr_shdr); -- cgit v1.2.3 From 43d8ace88da80848035827c7bb4bbf5530b59a7c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 19 May 2009 09:21:27 -0600 Subject: mesa: print more info when valid_texture_object() fails --- src/mesa/main/texobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 0024efc0e6..d51e7b76ec 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -281,7 +281,8 @@ valid_texture_object(const struct gl_texture_object *tex) _mesa_problem(NULL, "invalid reference to a deleted texture object"); return GL_FALSE; default: - _mesa_problem(NULL, "invalid texture object Target value"); + _mesa_problem(NULL, "invalid texture object Target 0x%x, Id = %u", + tex->Target, tex->Name); return GL_FALSE; } } -- cgit v1.2.3 From c99a60c40d4ece363d37a5af895124f08a645c6b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 19 May 2009 09:57:01 -0600 Subject: mesa: assign trb->Base.StencilBits in update_wrapper(). When we render to a depth/stencil texture there are stencil bits. --- src/mesa/main/texrender.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 49de6f5b8a..cc74d58fbd 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -507,6 +507,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits; trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits; trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits; + trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits; } -- cgit v1.2.3 From 042d9a513213b1fa356c0d80abc62b9327e0bcc2 Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Tue, 19 May 2009 09:59:01 -0600 Subject: mesa: allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT See sourceforge bug #2793846. --- src/mesa/main/fbobject.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9c5a5908a2..e8e8c2bf30 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -374,6 +374,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && + ctx->Extensions.ARB_depth_texture && texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } @@ -384,10 +385,19 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } } else { - /* no such thing as stencil textures */ - att_incomplete("illegal stencil texture"); - att->Complete = GL_FALSE; - return; + ASSERT(format == GL_STENCIL); + ASSERT(att->Renderbuffer->StencilBits); + if (ctx->Extensions.EXT_packed_depth_stencil && + ctx->Extensions.ARB_depth_texture && + att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { + /* OK */ + } + else { + /* no such thing as stencil-only textures */ + att_incomplete("illegal stencil texture"); + att->Complete = GL_FALSE; + return; + } } } else if (att->Type == GL_RENDERBUFFER_EXT) { -- cgit v1.2.3 From 0c75cb5afe81b0de9d006f9f9b75fdc9a15038d0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 May 2009 19:51:44 -0600 Subject: st: reformatting, comments, var renaming --- src/mesa/state_tracker/st_atom_constbuf.c | 48 +++++++++++++++++++------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 3ba7b26928..5d4d8eee02 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -24,11 +24,12 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ - /* - * Authors: - * Keith Whitwell - * Brian Paul - */ + +/* + * Authors: + * Keith Whitwell + * Brian Paul + */ #include "main/imports.h" #include "shader/prog_parameter.h" @@ -44,19 +45,21 @@ #include "st_program.h" #include "st_inlines.h" + /** * Pass the given program parameters to the graphics pipe as a * constant buffer. - * \param id either PIPE_SHADER_VERTEX or PIPE_SHADER_FRAGMENT + * \param shader_type either PIPE_SHADER_VERTEX or PIPE_SHADER_FRAGMENT */ void st_upload_constants( struct st_context *st, struct gl_program_parameter_list *params, - unsigned id) + unsigned shader_type) { struct pipe_context *pipe = st->pipe; - struct pipe_constant_buffer *cbuf = &st->state.constants[id]; + struct pipe_constant_buffer *cbuf = &st->state.constants[shader_type]; - assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT); + assert(shader_type == PIPE_SHADER_VERTEX || + shader_type == PIPE_SHADER_FRAGMENT); /* update constants */ if (params && params->NumParameters) { @@ -68,13 +71,14 @@ void st_upload_constants( struct st_context *st, * avoid gratuitous rendering synchronization. */ pipe_buffer_reference(&cbuf->buffer, NULL ); - cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT, + cbuf->buffer = pipe_buffer_create(pipe->screen, 16, + PIPE_BUFFER_USAGE_CONSTANT, paramBytes ); - if (0) - { - printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", - __FUNCTION__, id, params->NumParameters, params->StateFlags); + if (0) { + debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", + __FUNCTION__, shader_type, params->NumParameters, + params->StateFlags); _mesa_print_parameter_list(params); } @@ -84,15 +88,16 @@ void st_upload_constants( struct st_context *st, 0, paramBytes, params->ParameterValues); - st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf); + st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf); } else { - st->constants.tracked_state[id].dirty.mesa = 0; - // st->pipe->set_constant_buffer(st->pipe, id, 0, NULL); + st->constants.tracked_state[shader_type].dirty.mesa = 0x0; } } -/* Vertex shader: + +/** + * Vertex shader: */ static void update_vs_constants(struct st_context *st ) { @@ -102,6 +107,7 @@ static void update_vs_constants(struct st_context *st ) st_upload_constants( st, params, PIPE_SHADER_VERTEX ); } + const struct st_tracked_state st_update_vs_constants = { "st_update_vs_constants", /* name */ { /* dirty */ @@ -111,7 +117,10 @@ const struct st_tracked_state st_update_vs_constants = { update_vs_constants /* update */ }; -/* Fragment shader: + + +/** + * Fragment shader: */ static void update_fs_constants(struct st_context *st ) { @@ -121,6 +130,7 @@ static void update_fs_constants(struct st_context *st ) st_upload_constants( st, params, PIPE_SHADER_FRAGMENT ); } + const struct st_tracked_state st_update_fs_constants = { "st_update_fs_constants", /* name */ { /* dirty */ -- cgit v1.2.3 From 8308bf9ee155b405ad42e6621daf33a108330418 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 20 May 2009 13:21:24 +0200 Subject: r200: fix indexed draw color order and cs missmatch --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 3 ++- src/mesa/drivers/dri/r200/r200_state_init.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index e34ea9655e..0487c3fcf5 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -137,6 +137,7 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) BEGIN_BATCH(8+2); OUT_BATCH_PACKET3(R200_CP_CMD_3D_DRAW_INDX_2, 0); OUT_BATCH(R200_VF_PRIM_WALK_IND | + R200_VF_COLOR_ORDER_RGBA | ((vertex_count + 0) << 16) | type); @@ -243,7 +244,7 @@ void r200EmitVertexAOS( r200ContextPtr rmesa, __FUNCTION__, vertex_size, offset); - BEGIN_BATCH(5); + BEGIN_BATCH(7); OUT_BATCH_PACKET3(R200_CP_CMD_3D_LOAD_VBPNTR, 2); OUT_BATCH(1); OUT_BATCH(vertex_size | (vertex_size << 8)); diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index be57ac3163..a716779096 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -295,12 +295,16 @@ VP_CHECK( tcl_vpp_size, ctx->VertexProgram.Current->Base.NumNativeParameters > 9 h.i = hdr; \ _start = h.veclinear.addr_lo | (h.veclinear.addr_hi << 8); \ _sz = h.veclinear.count * 4; \ + if (r200->radeon.radeonScreen->kernel_mm && _sz) { \ + BEGIN_BATCH_NO_AUTOSTATE(dwords); \ OUT_BATCH(CP_PACKET0(RADEON_SE_TCL_STATE_FLUSH, 0)); \ OUT_BATCH(0); \ OUT_BATCH(CP_PACKET0(R200_SE_TCL_VECTOR_INDX_REG, 0)); \ OUT_BATCH(_start | (1 << RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT)); \ OUT_BATCH(CP_PACKET0_ONE(R200_SE_TCL_VECTOR_DATA_REG, _sz - 1)); \ OUT_BATCH_TABLE((data), _sz); \ + END_BATCH(); \ + } \ } while(0) #define OUT_SCL(hdr, data) do { \ @@ -367,9 +371,7 @@ static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom) uint32_t dwords = atom->cmd_size; dwords += 4; - BEGIN_BATCH_NO_AUTOSTATE(dwords); OUT_VECLINEAR(atom->cmd[0], atom->cmd+1); - END_BATCH(); } static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom) -- cgit v1.2.3 From 4550423211063010a2fa482037d8233bb80e3773 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 07:18:08 -0700 Subject: radeon-gallium: Don't permit reading and writing a BO in one CS. This fixes some silent problems in current libdrm_radeon. surface_copy still locks up hard. --- src/gallium/drivers/r300/r300_cs.h | 5 +++-- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 82a3942248..2abf04d27e 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -93,8 +93,9 @@ } while (0) #define OUT_CS_RELOC(bo, offset, rd, wd, flags) do { \ - debug_printf("r300: writing relocation for buffer %p, offset %d\n", \ - bo, offset); \ + debug_printf("r300: writing relocation for buffer %p, offset %d, " \ + "domains (%d, %d, %d)\n", \ + bo, offset, rd, wd, flags); \ assert(bo); \ OUT_CS(offset); \ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 65366e242c..995bf6aa22 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -69,6 +69,16 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) return TRUE; } + /* XXX should probably be its own function */ + for (i = 0; i < priv->bo_count; i++) { + if (sc[i].read_domains && sc[i].write_domain) { + /* Cute, cute. We need to flush first. */ + debug_printf("radeon: BO %p can't be read and written; " + "requesting flush.\n", sc[i].bo); + return TRUE; + } + } + /* Things are fine, we can proceed as normal. */ return FALSE; } @@ -109,9 +119,15 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, { struct radeon_winsys_priv* priv = (struct radeon_winsys_priv*)winsys->radeon_winsys; + int retval = 0; - radeon_cs_write_reloc(priv->cs, + retval = radeon_cs_write_reloc(priv->cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); + + if (retval) { + debug_printf("radeon: Relocation of %p (%d, %d, %d) failed!\n", + pbuffer, rd, wd, flags); + } } static void radeon_r300_end_cs(struct r300_winsys* winsys, -- cgit v1.2.3 From c696dd0f62c195d71cf7ecbdd04d9b156dd0da0b Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 20 May 2009 16:34:06 +0200 Subject: radeon: set max texture size This still need some work to actually report somethings reasonable if no memory manager is available. --- src/mesa/drivers/dri/r200/r200_context.c | 4 ++++ src/mesa/drivers/dri/r300/r300_context.c | 4 ++++ src/mesa/drivers/dri/radeon/radeon_context.c | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index f80f0d8ac7..8924849d08 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -354,6 +354,10 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures"); + /* FIXME: When no memory manager is available we should set this + * to some reasonable value based on texture memory pool size */ + ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureMaxAnisotropy = 16.0; /* No wide AA points. diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index be8d480c1c..dbd5ce589e 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -268,6 +268,10 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units"); ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits); + /* FIXME: When no memory manager is available we should set this + * to some reasonable value based on texture memory pool size */ + /* FIXME: r5xx limit is 4096 */ + ctx->Const.MaxTextureLevels = 12; ctx->Const.MaxTextureMaxAnisotropy = 16.0; ctx->Const.MaxTextureLodBias = 16.0; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 2600c78df3..8f780c443c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -283,6 +283,11 @@ r100CreateContext( const __GLcontextModes *glVisual, i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures"); + /* FIXME: When no memory manager is available we should set this + * to some reasonable value based on texture memory pool size */ + /* FIXME: does r100 support 2048x2048 texture ? */ + ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureMaxAnisotropy = 16.0; /* No wide points. -- cgit v1.2.3 From 01daeadf8cd8c56820585c3da88cc626dcdc33d0 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 20 May 2009 16:39:33 +0200 Subject: radeon: Increase reference count of current renderbuffers. Fixes glxinfo: main/renderbuffer.c:2159: _mesa_reference_renderbuffer: Assertion `oldRb->Magic == 0xaabbccdd' failed. --- src/mesa/drivers/dri/radeon/radeon_common.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_common.h | 4 ++-- src/mesa/drivers/dri/radeon/radeon_common_context.c | 9 +++++---- src/mesa/drivers/dri/radeon/radeon_common_context.h | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 2f55dadcb9..76e884d705 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -752,8 +752,8 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) ctx->NewState |= (_NEW_DEPTH | _NEW_STENCIL); } - radeon->state.depth.rrb = rrbDepth; - radeon->state.color.rrb = rrbColor; + _mesa_reference_renderbuffer(&radeon->state.depth.rb, &rrbDepth->base); + _mesa_reference_renderbuffer(&radeon->state.color.rb, &rrbColor->base); radeon->state.color.draw_offset = offset; #if 0 diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index c2fbb0950d..b60792df0b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -77,7 +77,7 @@ static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_fram static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa) { struct radeon_renderbuffer *rrb; - rrb = rmesa->state.depth.rrb; + rrb = radeon_renderbuffer(rmesa->state.depth.rb); if (!rrb) return NULL; @@ -88,7 +88,7 @@ static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPt { struct radeon_renderbuffer *rrb; - rrb = rmesa->state.color.rrb; + rrb = radeon_renderbuffer(rmesa->state.color.rb); if (!rrb) return NULL; return rrb; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 6fb6f92cb9..622bb98f3e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "drirenderbuffer.h" #include "main/context.h" #include "main/framebuffer.h" +#include "main/renderbuffer.h" #include "main/state.h" #include "main/simple_list.h" #include "swrast/swrast.h" @@ -651,10 +652,10 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, radeon_update_renderbuffers(driContextPriv, driDrawPriv); if (driDrawPriv != driReadPriv) radeon_update_renderbuffers(driContextPriv, driReadPriv); - radeon->state.color.rrb = - radeon_get_renderbuffer(&drfb->base, BUFFER_BACK_LEFT); - radeon->state.depth.rrb = - radeon_get_renderbuffer(&drfb->base, BUFFER_DEPTH); + _mesa_reference_renderbuffer(&radeon->state.color.rb, + &(radeon_get_renderbuffer(&drfb->base, BUFFER_BACK_LEFT)->base)); + _mesa_reference_renderbuffer(&radeon->state.depth.rb, + &(radeon_get_renderbuffer(&drfb->base, BUFFER_DEPTH)->base)); } else { radeon_make_renderbuffer_current(radeon, drfb); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 446c2f6269..af05f4ae32 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -121,13 +121,13 @@ struct radeon_framebuffer struct radeon_colorbuffer_state { GLuint clear; int roundEnable; - struct radeon_renderbuffer *rrb; + struct gl_renderbuffer *rb; uint32_t draw_offset; /* offset into color renderbuffer - FBOs */ }; struct radeon_depthbuffer_state { GLuint clear; - struct radeon_renderbuffer *rrb; + struct gl_renderbuffer *rb; }; struct radeon_scissor_state { -- cgit v1.2.3 From 65946ef0813e00944763ae959698e281871ee642 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 11:46:26 -0700 Subject: r300-gallium: Make surface_copy work, and refactor buffer validation. --- src/gallium/drivers/r300/r300_emit.c | 13 ++++++--- src/gallium/drivers/r300/r300_surface.c | 50 +++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 0cb0507fc8..5e4b179505 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -452,8 +452,8 @@ void r300_emit_dirty_state(struct r300_context* r300) { struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_texture* tex; - int i; - int dirty_tex = 0; + int i, dirty_tex = 0; + boolean invalid = FALSE; if (!(r300->dirty_state)) { return; @@ -462,6 +462,7 @@ void r300_emit_dirty_state(struct r300_context* r300) r300_update_derived_state(r300); /* XXX check size */ +validate: /* Color buffers... */ for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture; @@ -490,10 +491,14 @@ void r300_emit_dirty_state(struct r300_context* r300) } else { debug_printf("No VBO while emitting dirty state!\n"); } - if (r300->winsys->validate(r300->winsys)) { - /* XXX */ r300->context.flush(&r300->context, 0, NULL); + if (invalid) { + /* Well, hell. */ + exit(1); + } + invalid = TRUE; + goto validate; } if (r300->dirty_state & R300_NEW_BLEND) { diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index acb6192492..7711e8f569 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -32,13 +32,6 @@ static void r300_surface_setup(struct r300_context* r300, unsigned pixpitch = dest->stride / dest->tex.block.size; CS_LOCALS(r300); - /* Make sure our target BO is okay. */ - r300->winsys->add_buffer(r300->winsys, dest->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); - if (r300->winsys->validate(r300->winsys)) { - r300->context.flush(&r300->context, 0, NULL); - } - r300_emit_blend_state(r300, &blend_clear_state); r300_emit_blend_color_state(r300, &blend_color_clear_state); r300_emit_dsa_state(r300, &dsa_clear_state); @@ -106,6 +99,7 @@ static void r300_surface_fill(struct pipe_context* pipe, struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* tex = (struct r300_texture*)dest->texture; unsigned pixpitch = tex->stride / tex->tex.block.size; + boolean invalid = FALSE; CS_LOCALS(r300); a = (float)((color >> 24) & 0xff) / 255.0f; @@ -118,11 +112,25 @@ static void r300_surface_fill(struct pipe_context* pipe, /* Fallback? */ if (FALSE) { +fallback: debug_printf("r300: Falling back on surface clear..."); util_surface_fill(pipe, dest, x, y, w, h, color); return; } + /* Make sure our target BO is okay. */ +validate: + r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + if (r300->winsys->validate(r300->winsys)) { + r300->context.flush(&r300->context, 0, NULL); + if (invalid) { + goto fallback; + } + invalid = TRUE; + goto validate; + } + r300_surface_setup(r300, tex, x, y, w, h); /* Vertex shader setup */ @@ -216,6 +224,7 @@ static void r300_surface_copy(struct pipe_context* pipe, struct r300_texture* srctex = (struct r300_texture*)src->texture; struct r300_texture* desttex = (struct r300_texture*)dest->texture; unsigned pixpitch = srctex->stride / srctex->tex.block.size; + boolean invalid = FALSE; CS_LOCALS(r300); debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d)," @@ -225,21 +234,38 @@ static void r300_surface_copy(struct pipe_context* pipe, if ((srctex == desttex) && ((destx < srcx + w) || (srcx < destx + w)) && ((desty < srcy + h) || (srcy < desty + h))) { +fallback: debug_printf("r300: Falling back on surface_copy\n"); util_surface_copy(pipe, FALSE, dest, destx, desty, src, srcx, srcy, w, h); } - /* Add our source texture to the BO list before emitting anything. - * r300_surface_setup will flush if needed for us. */ + /* Add our target BOs to the list. */ +validate: r300->winsys->add_buffer(r300->winsys, srctex->buffer, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + r300->winsys->add_buffer(r300->winsys, desttex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM); + if (r300->winsys->validate(r300->winsys)) { + r300->context.flush(&r300->context, 0, NULL); + if (invalid) { + goto fallback; + } + invalid = TRUE; + goto validate; + } r300_surface_setup(r300, desttex, destx, desty, w, h); + /* Setup the texture. */ r300_emit_sampler(r300, &r300_sampler_copy_state, 0); r300_emit_texture(r300, srctex, 0); - r300_flush_textures(r300); + + /* Flush and enable. */ + BEGIN_CS(4); + OUT_CS_REG(R300_TX_INVALTAGS, 0); + OUT_CS_REG(R300_TX_ENABLE, 0x1); + END_CS; /* Vertex shader setup */ if (caps->has_tcl) { @@ -263,7 +289,7 @@ static void r300_surface_copy(struct pipe_context* pipe, r300_emit_rs_block_state(r300, &r300_rs_block_copy_state); } - BEGIN_CS(28); + BEGIN_CS(30); /* VAP stream control, mapping from input memory to PVS/RS memory */ if (caps->has_tcl) { OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, @@ -287,7 +313,7 @@ static void r300_surface_copy(struct pipe_context* pipe, OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2); /* Vertex size. */ - OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); + OUT_CS_REG(R300_VAP_VTX_SIZE, 0x4); /* Packet3 with our texcoords */ OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16); -- cgit v1.2.3 From b22b6f074381f3a0cfb9b6c3f45eaa533c1a0426 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 12:08:00 -0700 Subject: r300-gallium: Add missing R481 PCI ID. Per 74cb2aba on xf86-video-ati. --- src/gallium/drivers/r300/r300_chipset.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 758f706c51..00fae8d26f 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -149,6 +149,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) caps->num_vert_fpus = 6; break; + case 0x4B48: case 0x4B49: case 0x4B4A: case 0x4B4B: -- cgit v1.2.3 From 9e8de1b91136d056ee29e1a448196b5648ac2b3f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 12:22:24 -0700 Subject: r300-gallium: Make surface_copy actually load the texture in shader. --- src/gallium/drivers/r300/r300_reg.h | 1 + src/gallium/drivers/r300/r300_state_shader.h | 2 +- src/gallium/drivers/r300/r300_surface.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 660816e1da..920584a59e 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -3040,6 +3040,7 @@ enum { # define R500_INST_RGB_WMASK_R (1 << 11) # define R500_INST_RGB_WMASK_G (1 << 12) # define R500_INST_RGB_WMASK_B (1 << 13) +# define R500_INST_RGB_WMASK_RGB (7 << 11) # define R500_INST_ALPHA_WMASK (1 << 14) # define R500_INST_RGB_OMASK_R (1 << 15) # define R500_INST_RGB_OMASK_G (1 << 16) diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index 06260e61fe..b6087404ce 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -181,7 +181,7 @@ static struct r500_fragment_shader r500_texture_fragment_shader = { .instruction_count = 2, .instructions[0].inst0 = R500_INST_TYPE_TEX | R500_INST_TEX_SEM_WAIT | - R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK | + R500_INST_RGB_WMASK_RGB | R500_INST_ALPHA_WMASK | R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP, .instructions[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED, diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index 894def07aa..9a4c39f58b 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -101,7 +101,7 @@ static struct r300_rs_block r300_rs_block_copy_state = { R500_RS_SEL_Q(R300_RS_SEL_K1), .inst[0] = R300_RS_INST_COL_CN_WRITE, .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN, - .inst_count = R300_RS_TX_OFFSET(6), + .inst_count = R300_RS_TX_OFFSET(0), }; static struct r300_rs_block r500_rs_block_copy_state = { @@ -111,7 +111,7 @@ static struct r300_rs_block r500_rs_block_copy_state = { R500_RS_SEL_Q(R500_RS_IP_PTR_K1), .inst[0] = R500_RS_INST_TEX_CN_WRITE, .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN, - .inst_count = R300_RS_TX_OFFSET(6), + .inst_count = R300_RS_TX_OFFSET(0), }; static struct r300_sampler_state r300_sampler_copy_state = { -- cgit v1.2.3 From a13e96359baaa0331561f86ef6487feba6540464 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 20 May 2009 22:18:31 +0200 Subject: r200: fix vbo array rendering --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 6 ++---- src/mesa/drivers/dri/radeon/radeon_dma.c | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 0487c3fcf5..55ea81a57c 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -148,12 +148,12 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) rmesa->radeon.tcl.elt_dma_bo, rmesa->radeon.tcl.elt_dma_offset, RADEON_GEM_DOMAIN_GTT, 0, 0); - OUT_BATCH(vertex_count/2); + OUT_BATCH((vertex_count + 1)/2); } else { OUT_BATCH_PACKET3(R200_CP_CMD_INDX_BUFFER, 2); OUT_BATCH((0x80 << 24) | (0 << 16) | 0x810); OUT_BATCH(rmesa->radeon.tcl.elt_dma_offset); - OUT_BATCH(vertex_count/2); + OUT_BATCH((vertex_count + 1)/2); radeon_cs_write_reloc(rmesa->radeon.cmdbuf.cs, rmesa->radeon.tcl.elt_dma_bo, RADEON_GEM_DOMAIN_GTT, 0, 0); @@ -173,8 +173,6 @@ void r200FlushElts(GLcontext *ctx) assert( rmesa->radeon.dma.flush == r200FlushElts ); rmesa->radeon.dma.flush = NULL; - elt_used = (elt_used + 2) & ~2; - nr = elt_used / 2; radeon_bo_unmap(rmesa->radeon.tcl.elt_dma_bo); diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 5ffee86e5a..574e47ed30 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -319,6 +319,9 @@ void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs ) radeonContextPtr radeon = RADEON_CONTEXT( ctx ); int i; + if (radeon->dma.flush) { + radeon->dma.flush(radeon->glCtx); + } if (radeon->tcl.elt_dma_bo) { radeon_bo_unref(radeon->tcl.elt_dma_bo); radeon->tcl.elt_dma_bo = NULL; -- cgit v1.2.3 From 0ba7f762339cbc8be31fe98421b0c9b44c7402fa Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 13:21:17 -0700 Subject: radeon-gallium: Add surface_buffer_create callback. --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index a15487352b..0d0fdc5bd8 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -93,6 +93,29 @@ static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws, return &radeon_buffer->base; } +static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws, + unsigned width, + unsigned height, + enum pipe_format format, + unsigned usage, + unsigned *stride) +{ + struct pipe_format_block block; + unsigned nblocksx, nblocksy, size; + + pf_get_block(format, &block); + + nblocksx = pf_get_nblocksx(&block, width); + nblocksy = pf_get_nblocksy(&block, height); + + /* Radeons enjoy things in multiples of 32. */ + /* XXX this can be 32 when POT */ + *stride = (nblocksx * block.size + 63) & ~63; + size = *stride * nblocksy; + + return radeon_buffer_create(ws, 64, usage, size); +} + static void radeon_buffer_del(struct pipe_buffer *buffer) { struct radeon_pipe_buffer *radeon_buffer = @@ -180,10 +203,11 @@ struct radeon_winsys* radeon_pipe_winsys(int fd) radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer; radeon_ws->base.buffer_create = radeon_buffer_create; - radeon_ws->base.buffer_destroy = radeon_buffer_del; radeon_ws->base.user_buffer_create = radeon_buffer_user_create; + radeon_ws->base.surface_buffer_create = radeon_surface_buffer_create; radeon_ws->base.buffer_map = radeon_buffer_map; radeon_ws->base.buffer_unmap = radeon_buffer_unmap; + radeon_ws->base.buffer_destroy = radeon_buffer_del; radeon_ws->base.fence_reference = radeon_fence_reference; radeon_ws->base.fence_signalled = radeon_fence_signalled; -- cgit v1.2.3 From 364a4a829341b3691b4d1e559d5cc3c178147b97 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 14:17:27 -0700 Subject: r300-gallium: fs: Remove cruft from way back when. --- src/gallium/drivers/r300/r300_state_shader.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index ed99c76c15..a56b507eef 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -22,24 +22,6 @@ #include "r300_state_shader.h" -static void r300_copy_passthrough_shader(struct r300_fragment_shader* fs) -{ - struct r300_fragment_shader* pt = &r300_passthrough_fragment_shader; - fs->shader.stack_size = pt->shader.stack_size; - fs->alu_instruction_count = pt->alu_instruction_count; - fs->tex_instruction_count = pt->tex_instruction_count; - fs->indirections = pt->indirections; - fs->instructions[0] = pt->instructions[0]; -} - -static void r500_copy_passthrough_shader(struct r500_fragment_shader* fs) -{ - struct r500_fragment_shader* pt = &r500_passthrough_fragment_shader; - fs->shader.stack_size = pt->shader.stack_size; - fs->instruction_count = pt->instruction_count; - fs->instructions[0] = pt->instructions[0]; -} - static void r300_fs_declare(struct r300_fs_asm* assembler, struct tgsi_full_declaration* decl) { -- cgit v1.2.3 From 4151c0ea91212ac5ec73fa6d1936df9254978672 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 14:38:22 -0700 Subject: r300-gallium: Raise constantbuf limits. Still not correct, but really I don't care. --- src/gallium/drivers/r300/r300_context.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 58f1fa0e2e..d1cf75032c 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -141,11 +141,11 @@ struct r300_viewport_state { struct r300_constant_buffer { /* Buffer of constants */ /* XXX first number should be raised */ - float constants[8][4]; + float constants[32][4]; /* Number of user-defined constants */ - int user_count; + unsigned user_count; /* Total number of constants */ - int count; + unsigned count; }; struct r3xx_fragment_shader { -- cgit v1.2.3 From d04c85d01bf37d480df8b9a21d9a79194d2e67f3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 14:55:03 -0700 Subject: r300-gallium: Another constantbuf shader recompile test. Less briefly... Shaders need to be recompiled if their constantbuf offsets have changed. However, since we only change them from shaders if immediates need to be emitted, we shouldn't bother if the shader doesn't use immediates. --- src/gallium/drivers/r300/r300_context.h | 8 ++++++++ src/gallium/drivers/r300/r300_state.c | 6 ++++-- src/gallium/drivers/r300/r300_state_shader.c | 1 + src/gallium/drivers/r300/r300_state_tcl.c | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index d1cf75032c..a9dd041e08 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -158,6 +158,10 @@ struct r3xx_fragment_shader { /* Pixel stack size */ int stack_size; + + /* Are there immediates in this shader? + * If not, we can heavily optimize recompilation. */ + boolean uses_imms; }; struct r300_fragment_shader { @@ -248,6 +252,10 @@ struct r300_vertex_shader { /* Has this shader been translated yet? */ boolean translated; + /* Are there immediates in this shader? + * If not, we can heavily optimize recompilation. */ + boolean uses_imms; + /* Number of used instructions */ int instruction_count; diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 4e65fbbabe..0461ffd681 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -151,10 +151,12 @@ static void /* If the number of constants have changed, invalidate the shader. */ if (r300->shader_constants[shader].user_count != i) { - if (shader == PIPE_SHADER_FRAGMENT && r300->fs) { + if (shader == PIPE_SHADER_FRAGMENT && r300->fs && + r300->fs->uses_imms) { r300->fs->translated = FALSE; r300_translate_fragment_shader(r300, r300->fs); - } else if (shader == PIPE_SHADER_VERTEX && r300->vs) { + } else if (shader == PIPE_SHADER_VERTEX && r300->vs && + r300->vs->uses_imms) { r300->vs->translated = FALSE; r300_translate_vertex_shader(r300, r300->vs); } diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index a56b507eef..f27d7233d8 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -652,6 +652,7 @@ void r300_translate_fragment_shader(struct r300_context* r300, assembler->tex_count + assembler->color_count); consts->count = consts->user_count + assembler->imm_count; + fs->uses_imms = assembler->imm_count; debug_printf("r300: fs: %d total constants, " "%d from user and %d from immediates\n", consts->count, consts->user_count, assembler->imm_count); diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index fdbcbf3db8..32e61bc1d7 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -386,6 +386,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, assembler->tex_count + assembler->color_count); consts->count = consts->user_count + assembler->imm_count; + vs->uses_imms = assembler->imm_count; debug_printf("r300: vs: %d total constants, " "%d from user and %d from immediates\n", consts->count, consts->user_count, assembler->imm_count); -- cgit v1.2.3 From d67fb5ea1d93db3f64720994017c312a04867eea Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 15:02:45 -0700 Subject: r300-gallium: Prevent assert when fogcoords are present. Seems like this file is the source of all bad logic. (Pun intended.) --- src/gallium/drivers/r300/r300_state_derived.c | 18 +++++++++++++----- src/gallium/drivers/r300/r300_state_shader.c | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index caa5f3b543..7ae339cf97 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -64,6 +64,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, break; case TGSI_SEMANTIC_FOG: fog = TRUE; + /* Fall through */ case TGSI_SEMANTIC_GENERIC: texs++; break; @@ -103,6 +104,9 @@ static void r300_vs_tab_routes(struct r300_context* r300, } } + /* XXX magic */ + assert(texs <= 8); + /* Do the actual vertex_info setup. * * vertex_info has four uints of hardware-specific data in it. @@ -140,17 +144,21 @@ static void r300_vs_tab_routes(struct r300_context* r300, vinfo->hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } - for (i = 0; i < texs; i++) { + /* Init i right here, increment it if fog is enabled. + * This gets around a double-increment problem. */ + i = 0; + + if (fog) { + i++; draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo->hwfmt[3] |= (4 << (3 * i)); } - if (fog) { - i++; + for (i; i < texs; i++) { draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo->hwfmt[3] |= (4 << (3 * i)); } diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index f27d7233d8..d087771c3e 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -31,6 +31,7 @@ static void r300_fs_declare(struct r300_fs_asm* assembler, case TGSI_SEMANTIC_COLOR: assembler->color_count++; break; + case TGSI_SEMANTIC_FOG: case TGSI_SEMANTIC_GENERIC: assembler->tex_count++; break; -- cgit v1.2.3 From f1f0893eba6a3785d309f60ce4027980237fb8a6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 16:53:45 -0700 Subject: r300-gallium: r500-fs: Combine function. --- src/gallium/drivers/r300/r300_state_shader.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index d087771c3e..8a3e380eec 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -306,9 +306,12 @@ static INLINE void r300_emit_maths(struct r300_fragment_shader* fs, } /* Setup an ALU operation. */ -static INLINE void r500_emit_alu(struct r500_fragment_shader* fs, - struct r300_fs_asm* assembler, - struct tgsi_full_dst_register* dst) +static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, + struct r300_fs_asm* assembler, + struct tgsi_full_src_register* src, + struct tgsi_full_dst_register* dst, + unsigned op, + unsigned count) { int i = fs->instruction_count; @@ -331,18 +334,6 @@ static INLINE void r500_emit_alu(struct r500_fragment_shader* fs, R500_ALPHA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister)); fs->instructions[i].inst5 = R500_ALU_RGBA_ADDRD(r300_fs_dst(assembler, &dst->DstRegister)); -} - -static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, - struct r300_fs_asm* assembler, - struct tgsi_full_src_register* src, - struct tgsi_full_dst_register* dst, - unsigned op, - unsigned count) -{ - int i = fs->instruction_count; - - r500_emit_alu(fs, assembler, dst); switch (count) { case 3: -- cgit v1.2.3 From cfd241e8a68bc04f0f82960eae9ff1ec01384b67 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 21:52:11 -0700 Subject: r300-gallium: r500-fs: LRP. Goddammit. This cannot be the "easy way." :C --- src/gallium/drivers/r300/r300_state_shader.c | 36 ++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 8a3e380eec..cf9eeb4201 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -355,8 +355,8 @@ static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, R500_ALU_RGB_SEL_B_SRC1 | R500_SWIZ_RGB_B(r500_rgb_swiz(&src[1])); fs->instructions[i].inst4 |= - R500_SWIZ_ALPHA_B(r500_alpha_swiz(&src[1])) | - R500_ALPHA_SEL_B_SRC1; + R500_ALPHA_SEL_B_SRC1 | + R500_SWIZ_ALPHA_B(r500_alpha_swiz(&src[1])); case 1: case 0: default: @@ -368,8 +368,8 @@ static INLINE void r500_emit_maths(struct r500_fragment_shader* fs, R500_ALU_RGB_SEL_A_SRC0 | R500_SWIZ_RGB_A(r500_rgb_swiz(&src[0])); fs->instructions[i].inst4 |= - R500_SWIZ_ALPHA_A(r500_alpha_swiz(&src[0])) | - R500_ALPHA_SEL_A_SRC0; + R500_ALPHA_SEL_A_SRC0 | + R500_SWIZ_ALPHA_A(r500_alpha_swiz(&src[0])); break; } @@ -539,6 +539,34 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3); break; + /* The compound and hybrid insts. */ + case TGSI_OPCODE_LRP: + /* LRP DST A, B, C -> MAD TMP -A, C, C; MAD DST A, B, TMP */ + inst->FullSrcRegisters[3] = inst->FullSrcRegisters[1]; + inst->FullSrcRegisters[1] = inst->FullSrcRegisters[2]; + inst->FullSrcRegisters[0].SrcRegister.Negate = + !(inst->FullSrcRegisters[0].SrcRegister.Negate); + inst->FullDstRegisters[1] = inst->FullDstRegisters[0]; + inst->FullDstRegisters[0].DstRegister.Index = + assembler->temp_count; + inst->FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; + r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], TGSI_OPCODE_MAD, 3); + inst->FullSrcRegisters[2].SrcRegister.Index = + assembler->temp_count; + inst->FullSrcRegisters[2].SrcRegister.File = TGSI_FILE_TEMPORARY; + inst->FullSrcRegisters[2].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst->FullSrcRegisters[2].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; + inst->FullSrcRegisters[2].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; + inst->FullSrcRegisters[2].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; + inst->FullSrcRegisters[1] = inst->FullSrcRegisters[3]; + inst->FullSrcRegisters[0].SrcRegister.Negate = + !(inst->FullSrcRegisters[0].SrcRegister.Negate); + inst->FullDstRegisters[0] = inst->FullDstRegisters[1]; + r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], TGSI_OPCODE_MAD, 3); + break; + /* The texture instruction set. */ case TGSI_OPCODE_KIL: case TGSI_OPCODE_TEX: -- cgit v1.2.3 From 3af0952bc9bade8d5a5c60349c045b28762f8815 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 20 May 2009 23:22:16 -0700 Subject: r300-gallium: r500-fs: POW. I feel so unclean. --- src/gallium/drivers/r300/r300_state_shader.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index cf9eeb4201..cc7f6a7c4b 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -566,6 +566,32 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, r500_emit_maths(fs, assembler, inst->FullSrcRegisters, &inst->FullDstRegisters[0], TGSI_OPCODE_MAD, 3); break; + case TGSI_OPCODE_POW: + /* POW DST A, B -> LG2 TMP A; MUL TMP TMP, B; EX2 DST TMP */ + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleW = + inst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtSwizzleX; + inst->FullSrcRegisters[0].SrcRegister.SwizzleW = + inst->FullSrcRegisters[0].SrcRegister.SwizzleX; + inst->FullDstRegisters[1] = inst->FullDstRegisters[0]; + inst->FullDstRegisters[0].DstRegister.Index = + assembler->temp_count; + inst->FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; + r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], TGSI_OPCODE_LG2, 1); + inst->FullSrcRegisters[0].SrcRegister.Index = + assembler->temp_count; + inst->FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + inst->FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst->FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; + inst->FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; + inst->FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; + inst->FullSrcRegisters[2] = r500_constant_zero; + r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], TGSI_OPCODE_MUL, 3); + inst->FullDstRegisters[0] = inst->FullDstRegisters[1]; + r500_emit_maths(fs, assembler, inst->FullSrcRegisters, + &inst->FullDstRegisters[0], TGSI_OPCODE_EX2, 1); + break; /* The texture instruction set. */ case TGSI_OPCODE_KIL: @@ -595,7 +621,7 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs, static void r300_fs_finalize(struct r3xx_fragment_shader* fs, struct r300_fs_asm* assembler) { - fs->stack_size = assembler->temp_count + assembler->temp_offset; + fs->stack_size = assembler->temp_count + assembler->temp_offset + 1; } static void r500_fs_finalize(struct r500_fragment_shader* fs, -- cgit v1.2.3 From d7cc0eb47930d6c8ebfd18fefbe48fe8eec696a0 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 21 May 2009 13:49:15 +0200 Subject: radeon: maxbuffer size is in bytes --- src/mesa/drivers/dri/radeon/radeon_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 574e47ed30..a357afe679 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -164,7 +164,7 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size) { - size = MAX2(size, MAX_DMA_BUF_SZ * 16); + size = MAX2(size, MAX_DMA_BUF_SZ); if (RADEON_DEBUG & (DEBUG_IOCTL | DEBUG_DMA)) fprintf(stderr, "%s\n", __FUNCTION__); @@ -202,7 +202,7 @@ again_alloc: if (radeon_revalidate_bos(rmesa->glCtx) == GL_FALSE) fprintf(stderr,"failure to revalidate BOs - badness\n"); - + radeon_bo_map(rmesa->dma.current, 1); } -- cgit v1.2.3 From d2f4c2b6327832ce59dde5d7741a656b5ff5c46d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 21 May 2009 07:52:13 -0600 Subject: minstall: Don't copy over an identical file The rationale here is to avoid updating a timestamp for a file that hasn't changed. Needless updates of the timestamp can ripple into other projects, (xserver, etc.), useless recompiling due to a 'make install' in mesa that didn't actually change anything. --- bin/minstall | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/minstall b/bin/minstall index 8ee96089fa..130025829b 100755 --- a/bin/minstall +++ b/bin/minstall @@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then elif [ -f "$FILE" ] ; then #echo "$FILE" is a regular file - $RM "$DEST/`basename $FILE`" - cp "$FILE" "$DEST" + # Only copy if the files differ + if ! cmp -s $FILE $DEST/`basename $FILE`; then + $RM "$DEST/`basename $FILE`" + cp "$FILE" "$DEST" + fi if [ $MODE ] ; then FILE=`basename "$FILE"` chmod $MODE "$DEST/$FILE" -- cgit v1.2.3 From 5b27b4ad37bd992d2d3a6fd9d407277113544f30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 08:15:22 -0600 Subject: st: add support for GL_EXT_vertex_array_bgra --- src/mesa/state_tracker/st_draw.c | 13 ++++++++++++- src/mesa/state_tracker/st_draw.h | 3 ++- src/mesa/state_tracker/st_draw_feedback.c | 1 + src/mesa/state_tracker/st_extensions.c | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 225541a30b..8e036223c6 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -159,12 +159,21 @@ static GLuint fixed_types[4] = { * Return a PIPE_FORMAT_x for the given GL datatype and size. */ GLuint -st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized) +st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, + GLboolean normalized) { assert((type >= GL_BYTE && type <= GL_DOUBLE) || type == GL_FIXED); assert(size >= 1); assert(size <= 4); + assert(format == GL_RGBA || format == GL_BGRA); + + if (format == GL_BGRA) { + /* this is an odd-ball case */ + assert(type == GL_UNSIGNED_BYTE); + assert(normalized); + return PIPE_FORMAT_B8G8R8A8_UNORM; + } if (normalized) { switch (type) { @@ -392,6 +401,7 @@ setup_interleaved_attribs(GLcontext *ctx, velements[attr].src_format = st_pipe_vertex_format(arrays[mesaAttr]->Type, arrays[mesaAttr]->Size, + arrays[mesaAttr]->Format, arrays[mesaAttr]->Normalized); assert(velements[attr].src_format); } @@ -479,6 +489,7 @@ setup_non_interleaved_attribs(GLcontext *ctx, velements[attr].src_format = st_pipe_vertex_format(arrays[mesaAttr]->Type, arrays[mesaAttr]->Size, + arrays[mesaAttr]->Format, arrays[mesaAttr]->Normalized); assert(velements[attr].src_format); } diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h index da04fce8e2..dcfe7e1536 100644 --- a/src/mesa/state_tracker/st_draw.h +++ b/src/mesa/state_tracker/st_draw.h @@ -62,7 +62,8 @@ st_feedback_draw_vbo(GLcontext *ctx, /* Internal function: */ extern GLuint -st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized); +st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, + GLboolean normalized); /** diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 32502a9cda..2712c131c0 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -178,6 +178,7 @@ st_feedback_draw_vbo(GLcontext *ctx, velements[attr].src_format = st_pipe_vertex_format(arrays[mesaAttr]->Type, arrays[mesaAttr]->Size, + arrays[mesaAttr]->Format, arrays[mesaAttr]->Normalized); assert(velements[attr].src_format); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index d526dfcf52..efa88c2481 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -167,6 +167,7 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_texture_env_combine = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; + ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; ctx->Extensions.APPLE_vertex_array_object = GL_TRUE; -- cgit v1.2.3 From b4824520ecf453cd8de90e57e839cb11a698d9c0 Mon Sep 17 00:00:00 2001 From: Jonathan Adamczewski Date: Thu, 21 May 2009 08:18:03 -0600 Subject: cell: unroll inner loop of spu_render.c:cmd_render() It was taking approximately 50 cycles to extract the vertex indices, calculate the vertex_header pointers and call tri_draw() for each three vertices - . Unrolled, it takes less than 100 cycles to extract, unpack, calculate pointers and call tri_draw() eight times. It does have a nasty jump-tabled switch. I'm sure that there's a better way... Code size of spu_render.o gets larger due to the extra constants and work in the inner loop, there are extra stack saves and loads because there are more registers in use, and an assert. spu_tri.o gets a little smaller. --- src/gallium/drivers/cell/spu/spu_render.c | 79 +++++++++++++++++++++++++++---- src/gallium/drivers/cell/spu/spu_tri.c | 40 +++++++--------- src/gallium/drivers/cell/spu/spu_tri.h | 2 +- 3 files changed, 89 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c index 7c225e2f27..5ffb7073ab 100644 --- a/src/gallium/drivers/cell/spu/spu_render.c +++ b/src/gallium/drivers/cell/spu/spu_render.c @@ -32,6 +32,7 @@ #include "spu_main.h" #include "spu_render.h" +#include "spu_shuffle.h" #include "spu_tri.h" #include "spu_tile.h" #include "cell/common.h" @@ -267,15 +268,75 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr) uint drawn = 0; - /* loop over tris */ - for (j = 0; j < render->num_indexes; j += 3) { - const float *v0, *v1, *v2; - - v0 = (const float *) (vertices + indexes[j+0] * vertex_size); - v1 = (const float *) (vertices + indexes[j+1] * vertex_size); - v2 = (const float *) (vertices + indexes[j+2] * vertex_size); - - drawn += tri_draw(v0, v1, v2, tx, ty); + const qword vertex_sizes = (qword)spu_splats(vertex_size); + const qword verticess = (qword)spu_splats((uint)vertices); + + ASSERT_ALIGN16(&indexes[0]); + + const uint num_indexes = render->num_indexes; + + /* loop over tris + * &indexes[0] will be 16 byte aligned. This loop is heavily unrolled + * avoiding variable rotates when extracting vertex indices. + */ + for (j = 0; j < num_indexes; j += 24) { + /* Load three vectors, containing 24 ushort indices */ + const qword* lower_qword = (qword*)&indexes[j]; + const qword indices0 = lower_qword[0]; + const qword indices1 = lower_qword[1]; + const qword indices2 = lower_qword[2]; + + /* stores three indices for each tri n in slots 0, 1 and 2 of vsn */ + /* Straightforward rotates for these */ + qword vs0 = indices0; + qword vs1 = si_shlqbyi(indices0, 6); + qword vs3 = si_shlqbyi(indices1, 2); + qword vs4 = si_shlqbyi(indices1, 8); + qword vs6 = si_shlqbyi(indices2, 4); + qword vs7 = si_shlqbyi(indices2, 10); + + /* For tri 2 and 5, the three indices are split across two machine + * words - rotate and combine */ + const qword tmp2a = si_shlqbyi(indices0, 12); + const qword tmp2b = si_rotqmbyi(indices1, 12|16); + qword vs2 = si_selb(tmp2a, tmp2b, si_fsmh(si_from_uint(0x20))); + + const qword tmp5a = si_shlqbyi(indices1, 14); + const qword tmp5b = si_rotqmbyi(indices2, 14|16); + qword vs5 = si_selb(tmp5a, tmp5b, si_fsmh(si_from_uint(0x60))); + + /* unpack indices from halfword slots to word slots */ + vs0 = si_shufb(vs0, vs0, SHUFB8(0,A,0,B,0,C,0,0)); + vs1 = si_shufb(vs1, vs1, SHUFB8(0,A,0,B,0,C,0,0)); + vs2 = si_shufb(vs2, vs2, SHUFB8(0,A,0,B,0,C,0,0)); + vs3 = si_shufb(vs3, vs3, SHUFB8(0,A,0,B,0,C,0,0)); + vs4 = si_shufb(vs4, vs4, SHUFB8(0,A,0,B,0,C,0,0)); + vs5 = si_shufb(vs5, vs5, SHUFB8(0,A,0,B,0,C,0,0)); + vs6 = si_shufb(vs6, vs6, SHUFB8(0,A,0,B,0,C,0,0)); + vs7 = si_shufb(vs7, vs7, SHUFB8(0,A,0,B,0,C,0,0)); + + /* Calculate address of vertex in vertices[] */ + vs0 = si_mpya(vs0, vertex_sizes, verticess); + vs1 = si_mpya(vs1, vertex_sizes, verticess); + vs2 = si_mpya(vs2, vertex_sizes, verticess); + vs3 = si_mpya(vs3, vertex_sizes, verticess); + vs4 = si_mpya(vs4, vertex_sizes, verticess); + vs5 = si_mpya(vs5, vertex_sizes, verticess); + vs6 = si_mpya(vs6, vertex_sizes, verticess); + vs7 = si_mpya(vs7, vertex_sizes, verticess); + + /* Select the appropriate call based on the number of vertices + * remaining */ + switch(num_indexes - j) { + default: drawn += tri_draw(vs7, tx, ty); + case 21: drawn += tri_draw(vs6, tx, ty); + case 18: drawn += tri_draw(vs5, tx, ty); + case 15: drawn += tri_draw(vs4, tx, ty); + case 12: drawn += tri_draw(vs3, tx, ty); + case 9: drawn += tri_draw(vs2, tx, ty); + case 6: drawn += tri_draw(vs1, tx, ty); + case 3: drawn += tri_draw(vs0, tx, ty); + } } //printf("SPU %u: drew %u of %u\n", spu.init.id, drawn, render->num_indexes/3); diff --git a/src/gallium/drivers/cell/spu/spu_tri.c b/src/gallium/drivers/cell/spu/spu_tri.c index d727268475..d9f5a46672 100644 --- a/src/gallium/drivers/cell/spu/spu_tri.c +++ b/src/gallium/drivers/cell/spu/spu_tri.c @@ -440,9 +440,7 @@ print_vertex(const struct vertex_header *v) * \return FALSE if tri is totally outside tile, TRUE otherwise */ static boolean -setup_sort_vertices(const struct vertex_header *v0, - const struct vertex_header *v1, - const struct vertex_header *v2) +setup_sort_vertices(const qword vs) { float area, sign; @@ -459,23 +457,23 @@ setup_sort_vertices(const struct vertex_header *v0, { /* A table of shuffle patterns for putting vertex_header pointers into correct order. Quite magical. */ - const vec_uchar16 sort_order_patterns[] = { - SHUFFLE4(A,B,C,C), - SHUFFLE4(C,A,B,C), - SHUFFLE4(A,C,B,C), - SHUFFLE4(B,C,A,C), - SHUFFLE4(B,A,C,C), - SHUFFLE4(C,B,A,C) }; - - /* The vertex_header pointers, packed for easy shuffling later */ - const vec_uint4 vs = {(unsigned)v0, (unsigned)v1, (unsigned)v2}; + const qword sort_order_patterns[] = { + SHUFB4(A,B,C,C), + SHUFB4(C,A,B,C), + SHUFB4(A,C,B,C), + SHUFB4(B,C,A,C), + SHUFB4(B,A,C,C), + SHUFB4(C,B,A,C) }; /* Collate y values into two vectors for comparison. Using only one shuffle constant! ;) */ - const vec_float4 y_02_ = spu_shuffle(v0->data[0], v2->data[0], SHUFFLE4(0,B,b,C)); - const vec_float4 y_10_ = spu_shuffle(v1->data[0], v0->data[0], SHUFFLE4(0,B,b,C)); - const vec_float4 y_012 = spu_shuffle(y_02_, v1->data[0], SHUFFLE4(0,B,b,C)); - const vec_float4 y_120 = spu_shuffle(y_10_, v2->data[0], SHUFFLE4(0,B,b,C)); + const vector float f0 = ((const struct vertex_header*)si_to_ptr(vs))->data[0]; + const vector float f1 = ((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 4)))->data[0]; + const vector float f2 = ((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 8)))->data[0]; + const vec_float4 y_02_ = spu_shuffle(f0, f2, SHUFFLE4(0,B,b,C)); + const vec_float4 y_10_ = spu_shuffle(f1, f0, SHUFFLE4(0,B,b,C)); + const vec_float4 y_012 = spu_shuffle(y_02_, f1, SHUFFLE4(0,B,b,C)); + const vec_float4 y_120 = spu_shuffle(y_10_, f2, SHUFFLE4(0,B,b,C)); /* Perform comparison: {y0,y1,y2} > {y1,y2,y0} */ const vec_uint4 compare = spu_cmpgt(y_012, y_120); @@ -485,7 +483,7 @@ setup_sort_vertices(const struct vertex_header *v0, const unsigned int index = spu_extract(gather, 0) - 1; /* Load the appropriate pattern and construct the desired vector. */ - setup.vertex_headers = (qword)spu_shuffle(vs, vs, sort_order_patterns[index]); + setup.vertex_headers = si_shufb(vs, vs, sort_order_patterns[index]); /* Using the result of the comparison, set sign. Very magical. */ @@ -761,7 +759,7 @@ subtriangle(struct edge *eleft, struct edge *eright, unsigned lines) * The tile data should have already been fetched. */ boolean -tri_draw(const float *v0, const float *v1, const float *v2, +tri_draw(const qword vs, uint tx, uint ty) { setup.tx = tx; @@ -773,9 +771,7 @@ tri_draw(const float *v0, const float *v1, const float *v2, setup.cliprect_maxx = (tx + 1) * TILE_SIZE; setup.cliprect_maxy = (ty + 1) * TILE_SIZE; - if (!setup_sort_vertices((struct vertex_header *) v0, - (struct vertex_header *) v1, - (struct vertex_header *) v2)) { + if(!setup_sort_vertices(vs)) { return FALSE; /* totally clipped */ } diff --git a/src/gallium/drivers/cell/spu/spu_tri.h b/src/gallium/drivers/cell/spu/spu_tri.h index aa694dd7c9..82e3b19ad7 100644 --- a/src/gallium/drivers/cell/spu/spu_tri.h +++ b/src/gallium/drivers/cell/spu/spu_tri.h @@ -31,7 +31,7 @@ extern boolean -tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty); +tri_draw(const qword vs, uint tx, uint ty); #endif /* SPU_TRI_H */ -- cgit v1.2.3 From 2c007517b541ab470ad251365bd95c83002dfb16 Mon Sep 17 00:00:00 2001 From: Jonathan Adamczewski Date: Thu, 21 May 2009 08:19:00 -0600 Subject: cell: perform triangle cull a little earlier In spu_tri.c:setup_sort_vertices() triangles are culled after the vertices are sorted. This patch moves the check a little earlier and performs the actual check a little faster through intrinsics and a little trickery. Reduced code size and less work is done before a triangle is deemed OK to skip. --- src/gallium/drivers/cell/spu/spu_tri.c | 105 +++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/cell/spu/spu_tri.c b/src/gallium/drivers/cell/spu/spu_tri.c index d9f5a46672..58be001be4 100644 --- a/src/gallium/drivers/cell/spu/spu_tri.c +++ b/src/gallium/drivers/cell/spu/spu_tri.c @@ -133,7 +133,15 @@ struct setup_stage { uint tx, ty; /**< position of current tile (x, y) */ - int cliprect_minx, cliprect_maxx, cliprect_miny, cliprect_maxy; + union { + struct { + int cliprect_minx; + int cliprect_miny; + int cliprect_maxx; + int cliprect_maxy; + }; + qword cliprect; + }; struct interp_coef coef[PIPE_MAX_SHADER_INPUTS]; @@ -432,6 +440,41 @@ print_vertex(const struct vertex_header *v) } #endif +/* Returns the minimum of each slot of two vec_float4s as qwords. + * i.e. return[n] = min(q0[n],q1[n]); + */ +static qword +minfq(qword q0, qword q1) +{ + const qword q0q1m = si_fcgt(q0, q1); + return si_selb(q0, q1, q0q1m); +} + +/* Returns the minimum of each slot of three vec_float4s as qwords. + * i.e. return[n] = min(q0[n],q1[n],q2[n]); + */ +static qword +min3fq(qword q0, qword q1, qword q2) +{ + return minfq(minfq(q0, q1), q2); +} + +/* Returns the maximum of each slot of two vec_float4s as qwords. + * i.e. return[n] = min(q0[n],q1[n],q2[n]); + */ +static qword +maxfq(qword q0, qword q1) { + const qword q0q1m = si_fcgt(q0, q1); + return si_selb(q1, q0, q0q1m); +} + +/* Returns the maximum of each slot of three vec_float4s as qwords. + * i.e. return[n] = min(q0[n],q1[n],q2[n]); + */ +static qword +max3fq(qword q0, qword q1, qword q2) { + return maxfq(maxfq(q0, q1), q2); +} /** * Sort vertices from top to bottom. @@ -453,8 +496,25 @@ setup_sort_vertices(const qword vs) } #endif - /* determine bottom to top order of vertices */ { + /* Load the float values for various processing... */ + const qword f0 = (qword)(((const struct vertex_header*)si_to_ptr(vs))->data[0]); + const qword f1 = (qword)(((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 4)))->data[0]); + const qword f2 = (qword)(((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 8)))->data[0]); + + /* Check if triangle is completely outside the tile bounds + * Find the min and max x and y positions of the three poits */ + const qword minf = min3fq(f0, f1, f2); + const qword maxf = max3fq(f0, f1, f2); + + /* Compare min and max against cliprect vals */ + const qword maxsmins = si_shufb(maxf, minf, SHUFB4(A,B,a,b)); + const qword outside = si_fcgt(maxsmins, si_csflt(setup.cliprect, 0)); + + /* Use a little magic to work out of the tri is visible or not */ + if(si_to_uint(si_xori(si_gb(outside), 0xc))) return FALSE; + + /* determine bottom to top order of vertices */ /* A table of shuffle patterns for putting vertex_header pointers into correct order. Quite magical. */ const qword sort_order_patterns[] = { @@ -467,43 +527,26 @@ setup_sort_vertices(const qword vs) /* Collate y values into two vectors for comparison. Using only one shuffle constant! ;) */ - const vector float f0 = ((const struct vertex_header*)si_to_ptr(vs))->data[0]; - const vector float f1 = ((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 4)))->data[0]; - const vector float f2 = ((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 8)))->data[0]; - const vec_float4 y_02_ = spu_shuffle(f0, f2, SHUFFLE4(0,B,b,C)); - const vec_float4 y_10_ = spu_shuffle(f1, f0, SHUFFLE4(0,B,b,C)); - const vec_float4 y_012 = spu_shuffle(y_02_, f1, SHUFFLE4(0,B,b,C)); - const vec_float4 y_120 = spu_shuffle(y_10_, f2, SHUFFLE4(0,B,b,C)); + const qword y_02_ = si_shufb(f0, f2, SHUFB4(0,B,b,C)); + const qword y_10_ = si_shufb(f1, f0, SHUFB4(0,B,b,C)); + const qword y_012 = si_shufb(y_02_, f1, SHUFB4(0,B,b,C)); + const qword y_120 = si_shufb(y_10_, f2, SHUFB4(0,B,b,C)); /* Perform comparison: {y0,y1,y2} > {y1,y2,y0} */ - const vec_uint4 compare = spu_cmpgt(y_012, y_120); + const qword compare = si_fcgt(y_012, y_120); /* Compress the result of the comparison into 4 bits */ - const vec_uint4 gather = spu_gather(compare); + const qword gather = si_gb(compare); /* Subtract one to attain the index into the LUT. Magical. */ - const unsigned int index = spu_extract(gather, 0) - 1; + const unsigned int index = si_to_uint(gather) - 1; /* Load the appropriate pattern and construct the desired vector. */ setup.vertex_headers = si_shufb(vs, vs, sort_order_patterns[index]); /* Using the result of the comparison, set sign. Very magical. */ - sign = ((si_to_uint(si_cntb((qword)gather)) == 2) ? 1.0f : -1.0f); + sign = ((si_to_uint(si_cntb(gather)) == 2) ? 1.0f : -1.0f); } - /* Check if triangle is completely outside the tile bounds */ - if (spu_extract(setup.vmin->data[0], 1) > setup.cliprect_maxy) - return FALSE; - if (spu_extract(setup.vmax->data[0], 1) < setup.cliprect_miny) - return FALSE; - if (spu_extract(setup.vmin->data[0], 0) < setup.cliprect_minx && - spu_extract(setup.vmid->data[0], 0) < setup.cliprect_minx && - spu_extract(setup.vmax->data[0], 0) < setup.cliprect_minx) - return FALSE; - if (spu_extract(setup.vmin->data[0], 0) > setup.cliprect_maxx && - spu_extract(setup.vmid->data[0], 0) > setup.cliprect_maxx && - spu_extract(setup.vmax->data[0], 0) > setup.cliprect_maxx) - return FALSE; - setup.ebot.ds = spu_sub(setup.vmid->data[0], setup.vmin->data[0]); setup.emaj.ds = spu_sub(setup.vmax->data[0], setup.vmin->data[0]); setup.etop.ds = spu_sub(setup.vmax->data[0], setup.vmid->data[0]); @@ -766,10 +809,10 @@ tri_draw(const qword vs, setup.ty = ty; /* set clipping bounds to tile bounds */ - setup.cliprect_minx = tx * TILE_SIZE; - setup.cliprect_miny = ty * TILE_SIZE; - setup.cliprect_maxx = (tx + 1) * TILE_SIZE; - setup.cliprect_maxy = (ty + 1) * TILE_SIZE; + const qword clipbase = (qword)((vec_uint4){tx, ty}); + const qword clipmin = si_mpyui(clipbase, TILE_SIZE); + const qword clipmax = si_ai(clipmin, TILE_SIZE); + setup.cliprect = si_shufb(clipmin, clipmax, SHUFB4(A,B,a,b)); if(!setup_sort_vertices(vs)) { return FALSE; /* totally clipped */ -- cgit v1.2.3 From 899c524a49fe5dc7413656380ebd65bbd061c042 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 08:22:29 -0600 Subject: vbo: s/8/MAX_TEXTURE_COORD_UNITS/ --- src/mesa/vbo/vbo_exec_array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index f4ad394f51..fdb501815d 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -115,7 +115,7 @@ static void bind_array_obj( GLcontext *ctx ) } exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i]; for (i = 0; i < VERT_ATTRIB_MAX; i++) -- cgit v1.2.3 From a185bcbdec856cc98c26098e4e447a683eed14d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 13:24:24 -0600 Subject: mesa: move gl_array_attrib::_MaxElement to gl_array_object::_MaxElement This value is per array object. --- src/mesa/main/api_validate.c | 8 ++++---- src/mesa/main/mtypes.h | 7 ++++++- src/mesa/main/state.c | 2 +- src/mesa/vbo/vbo_exec_array.c | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index d5c604c56a..1507671250 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -182,10 +182,10 @@ _mesa_validate_DrawElements(GLcontext *ctx, /* find max array index */ GLuint max = max_buffer_index(ctx, count, type, indices, ctx->Array.ElementArrayBufferObj); - if (max >= ctx->Array._MaxElement) { + if (max >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDrawElements() index=%u is " - "out of bounds (max=%u)", max, ctx->Array._MaxElement); + "out of bounds (max=%u)", max, ctx->Array.ArrayObj->_MaxElement); return GL_FALSE; } } @@ -254,7 +254,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (ctx->Const.CheckArrayBounds) { GLuint max = max_buffer_index(ctx, count, type, indices, ctx->Array.ElementArrayBufferObj); - if (max >= ctx->Array._MaxElement) { + if (max >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ return GL_FALSE; } @@ -293,7 +293,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, return GL_FALSE; if (ctx->Const.CheckArrayBounds) { - if (start + count > (GLint) ctx->Array._MaxElement) + if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement) return GL_FALSE; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d11df535f2..0df425c913 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1578,6 +1578,12 @@ struct gl_array_object /** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */ GLbitfield _Enabled; + + /** + * Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs + * we can determine the max legal (in bounds) glDrawElements array index. + */ + GLuint _MaxElement; }; @@ -1602,7 +1608,6 @@ struct gl_array_attrib struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; #endif - GLuint _MaxElement; /* Min of all enabled array's maxes */ }; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index a6411f7b62..bfbefa55d4 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -206,7 +206,7 @@ update_arrays( GLcontext *ctx ) } /* _MaxElement is one past the last legal array element */ - ctx->Array._MaxElement = min; + arrayObj->_MaxElement = min; } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index fdb501815d..a4c67c1de1 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -352,10 +352,11 @@ vbo_exec_DrawRangeElements(GLenum mode, if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) return; - if (end >= ctx->Array._MaxElement) { + if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements() index=%u is " - "out of bounds (max=%u)", end, ctx->Array._MaxElement); + "out of bounds (max=%u)", end, + ctx->Array.ArrayObj->_MaxElement); return; } -- cgit v1.2.3 From 15f21bf357980284d4aea6270f68bb9b83d26fbd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 16:23:34 -0600 Subject: mesa: updated comment for _MaxElement field It's the largest array index, plus one. --- src/mesa/main/mtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0df425c913..2708678e64 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1544,7 +1544,7 @@ struct gl_client_array GLuint _ElementSize; /**< size of each element in bytes */ struct gl_buffer_object *BufferObj;/**< GL_ARB_vertex_buffer_object */ - GLuint _MaxElement; /**< max element index into array buffer */ + GLuint _MaxElement; /**< max element index into array buffer + 1 */ }; -- cgit v1.2.3 From 39d7524f7b176d4375e230ac60963d197be539f2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 16:25:32 -0600 Subject: mesa: added _mesa_print_arrays() for debugging --- src/mesa/main/varray.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/varray.h | 17 +++++------------ 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a9c9162be1..8e6ef9caa5 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1032,6 +1033,50 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, } +/** + * Print vertex array's fields. + */ +static void +print_array(const char *name, GLint index, const struct gl_client_array *array) +{ + if (index >= 0) + _mesa_printf(" %s[%d]: ", name, index); + else + _mesa_printf(" %s: ", name); + _mesa_printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %u), MaxElem=%u\n", + array->Ptr, array->Type, array->Size, + array->_ElementSize, array->StrideB, + array->BufferObj->Name, array->BufferObj->Size, + array->_MaxElement); +} + + +/** + * Print current vertex object/array info. For debug. + */ +void +_mesa_print_arrays(GLcontext *ctx) +{ + const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + GLuint i; + + _mesa_printf("Array Object %u\n", arrayObj->Name); + if (arrayObj->Vertex.Enabled) + print_array("Vertex", -1, &arrayObj->Vertex); + if (arrayObj->Normal.Enabled) + print_array("Normal", -1, &arrayObj->Normal); + if (arrayObj->Color.Enabled) + print_array("Color", -1, &arrayObj->Color); + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + if (arrayObj->TexCoord[i].Enabled) + print_array("TexCoord", i, &arrayObj->TexCoord[i]); + for (i = 0; i < VERT_ATTRIB_MAX; i++) + if (arrayObj->VertexAttrib[i].Enabled) + print_array("Attrib", i, &arrayObj->VertexAttrib[i]); + _mesa_printf(" _MaxElement = %u\n", arrayObj->_MaxElement); +} + + /** * Initialize vertex array state for given context. */ diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 97d5c8219d..46cc3ee342 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -1,18 +1,9 @@ -/** - * \file varray.h - * Vertex arrays. - * - * \if subset - * (No-op) - * - * \endif - */ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 7.6 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -169,6 +160,8 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +extern void +_mesa_print_arrays(GLcontext *ctx); extern void _mesa_init_varray( GLcontext * ctx ); -- cgit v1.2.3 From f7ca97f85e73c0b0a0e056ae86e4aa5a68ec39f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 14 May 2009 16:51:10 -0600 Subject: mesa: remove pointless null ptr check, improved some error messages --- src/mesa/main/bufferobj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 1f2070ef47..a806766386 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -490,7 +490,7 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) _mesa_reference_buffer_object(ctx, bindTarget, newBufObj); /* Pass BindBuffer call to device driver */ - if (ctx->Driver.BindBuffer && newBufObj) + if (ctx->Driver.BindBuffer) ctx->Driver.BindBuffer( ctx, target, newBufObj ); } @@ -937,7 +937,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, return; } if (bufObj->Name == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB" ); + _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer 0)" ); return; } @@ -1025,7 +1025,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access) return NULL; } if (bufObj->Name == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB" ); + _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(buffer 0)" ); return NULL; } if (bufObj->Pointer) { -- cgit v1.2.3 From 840c09fc71542fdfc71edd2a2802925d467567bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 May 2009 09:14:24 -0600 Subject: i965: rename var: s/tmp/vs_inputs/ --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index b91b20bec6..1b8bcc14ec 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -343,7 +343,7 @@ static void brw_prepare_vertices(struct brw_context *brw) { GLcontext *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); - GLuint tmp = brw->vs.prog_data->inputs_read; + GLbitfield vs_inputs = brw->vs.prog_data->inputs_read; GLuint i; const unsigned char *ptr = NULL; GLuint interleave = 0; @@ -362,11 +362,11 @@ static void brw_prepare_vertices(struct brw_context *brw) _mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index); /* Accumulate the list of enabled arrays. */ - while (tmp) { - GLuint i = _mesa_ffsll(tmp)-1; + while (vs_inputs) { + GLuint i = _mesa_ffsll(vs_inputs) - 1; struct brw_vertex_element *input = &brw->vb.inputs[i]; - tmp &= ~(1<intel.ctx; struct intel_context *intel = intel_context(ctx); - GLuint tmp = brw->vs.prog_data->inputs_read; + GLbitfield vs_inputs = brw->vs.prog_data->inputs_read; struct brw_vertex_element *enabled[VERT_ATTRIB_MAX]; GLuint i; GLuint nr_enabled = 0; /* Accumulate the list of enabled arrays. */ - while (tmp) { - i = _mesa_ffsll(tmp)-1; + while (vs_inputs) { + i = _mesa_ffsll(vs_inputs) - 1; struct brw_vertex_element *input = &brw->vb.inputs[i]; - tmp &= ~(1< Date: Thu, 21 May 2009 09:12:35 -0600 Subject: mesa: added debug functions for dumping color/depth/stencil buffers --- src/mesa/main/debug.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/debug.h | 9 +++++ 2 files changed, 110 insertions(+) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 2eabcdaf49..80bc6afc4c 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -341,3 +341,104 @@ _mesa_dump_textures(GLboolean dumpImages) DumpImages = dumpImages; _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx); } + + +void +_mesa_dump_color_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLubyte *buf; + + buf = (GLubyte *) _mesa_malloc(w * h * 4); + + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); + + _mesa_printf("ReadBuffer %p 0x%x DrawBuffer %p 0x%x\n", + ctx->ReadBuffer->_ColorReadBuffer, + ctx->ReadBuffer->ColorReadBuffer, + ctx->DrawBuffer->_ColorDrawBuffers[0], + ctx->DrawBuffer->ColorDrawBuffer[0]); + _mesa_printf("Writing %d x %d color buffer to %s\n", w, h, filename); + write_ppm(filename, buf, w, h, 4, 0, 1, 2); + + glPopClientAttrib(); + + _mesa_free(buf); +} + + +void +_mesa_dump_depth_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLuint *buf; + GLubyte *buf2; + GLuint i; + + buf = (GLuint *) _mesa_malloc(w * h * 4); /* 4 bpp */ + buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ + + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + glReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buf); + + /* spread 24 bits of Z across R, G, B */ + for (i = 0; i < w * h; i++) { + buf2[i*3+0] = (buf[i] >> 24) & 0xff; + buf2[i*3+1] = (buf[i] >> 16) & 0xff; + buf2[i*3+2] = (buf[i] >> 8) & 0xff; + } + + _mesa_printf("Writing %d x %d depth buffer to %s\n", w, h, filename); + write_ppm(filename, buf2, w, h, 3, 0, 1, 2); + + glPopClientAttrib(); + + _mesa_free(buf); + _mesa_free(buf2); +} + + +void +_mesa_dump_stencil_buffer(const char *filename) +{ + GET_CURRENT_CONTEXT(ctx); + const GLuint w = ctx->DrawBuffer->Width; + const GLuint h = ctx->DrawBuffer->Height; + GLubyte *buf; + GLubyte *buf2; + GLuint i; + + buf = (GLubyte *) _mesa_malloc(w * h); /* 1 bpp */ + buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ + + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + + glReadPixels(0, 0, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); + + for (i = 0; i < w * h; i++) { + buf2[i*3+0] = buf[i]; + buf2[i*3+1] = (buf[i] & 127) * 2; + buf2[i*3+2] = (buf[i] - 128) * 2; + } + + _mesa_printf("Writing %d x %d stencil buffer to %s\n", w, h, filename); + write_ppm(filename, buf2, w, h, 3, 0, 1, 2); + + glPopClientAttrib(); + + _mesa_free(buf); + _mesa_free(buf2); +} diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index 1862ec75b7..bb384c4324 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -60,4 +60,13 @@ extern void _mesa_init_debug( GLcontext *ctx ); extern void _mesa_dump_textures(GLboolean dumpImages); +extern void +_mesa_dump_color_buffer(const char *filename); + +extern void +_mesa_dump_depth_buffer(const char *filename); + +extern void +_mesa_dump_stencil_buffer(const char *filename); + #endif -- cgit v1.2.3 From 4da58bbab034fb2ef955495445fe377dbce1f411 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 13:09:04 -0700 Subject: intel: Use _mesa_CheckFramebufferStatusEXT insteaad of glCheck... Fixes a segfault in our oglconform fbo test. --- src/mesa/drivers/dri/intel/intel_generatemipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c index 02804b51fa..1060fbd9e5 100644 --- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c +++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c @@ -84,7 +84,7 @@ intel_generate_mipmap_level(GLcontext *ctx, GLuint tex_name, /* Choose to render to the color attachment. */ _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) return GL_FALSE; -- cgit v1.2.3 From 467f18f7a5375af9a31031063536c927df3ea70c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 14:00:32 -0700 Subject: intel: Don't segfault on glGenerateMipmaps of a cube map with one face defined. This presumably applies to SGIS_generate_mipmaps as well. --- src/mesa/drivers/dri/intel/intel_tex_validate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 05a375e1f3..b5cb7597d1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -241,7 +241,7 @@ intel_tex_map_level_images(struct intel_context *intel, struct intel_texture_image *intelImage = intel_texture_image(intelObj->base.Image[face][level]); - if (intelImage->mt) { + if (intelImage && intelImage->mt) { intelImage->base.Data = intel_miptree_image_map(intel, intelImage->mt, @@ -268,7 +268,7 @@ intel_tex_unmap_level_images(struct intel_context *intel, struct intel_texture_image *intelImage = intel_texture_image(intelObj->base.Image[face][level]); - if (intelImage->mt) { + if (intelImage && intelImage->mt) { intel_miptree_image_unmap(intel, intelImage->mt); intelImage->base.Data = NULL; } -- cgit v1.2.3 From 8bba183b9eeb162661a287bf2e118c6dd419dd24 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 14:05:03 -0700 Subject: intel: Mark the FBO as incomplete if there's no intel_renderbuffer for it. This happens to rendering with textures with a border, which had resulted in a segfault on dereferencing the irb. --- src/mesa/drivers/dri/intel/intel_fbo.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 52647ddf8b..0b0f0f980b 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -679,6 +679,11 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) if (rb == NULL) continue; + if (irb == NULL) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; + continue; + } + switch (irb->texformat->MesaFormat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_RGB565: -- cgit v1.2.3 From e78a6aa2b94683faa8d43a39aa68d806b14f8833 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 14:16:34 -0700 Subject: intel: Fall back on any rendering to texture with no miptree. Fixes segfault on an fbo.c negative test for FBO with texture width/height of 0. Previously we just tested for border != 0 to work around this segfault. --- src/mesa/drivers/dri/intel/intel_fbo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 0b0f0f980b..04723a2f91 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -574,9 +574,10 @@ intel_render_texture(GLcontext * ctx, ASSERT(newImage); - if (newImage->Border != 0) { - /* Fallback on drawing to a texture with a border, which won't have a - * miptree. + intel_image = intel_texture_image(newImage); + if (!intel_image->mt) { + /* Fallback on drawing to a texture that doesn't have a miptree + * (has a border, width/height 0, etc.) */ _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); _mesa_render_texture(ctx, fb, att); @@ -607,7 +608,6 @@ intel_render_texture(GLcontext * ctx, irb->Base.RefCount); /* point the renderbufer's region to the texture image region */ - intel_image = intel_texture_image(newImage); if (irb->region != intel_image->mt->region) { if (irb->region) intel_region_release(&irb->region); -- cgit v1.2.3 From 3a521d84ecc646fcc65fa3fe7c5f1fdbdebe8bc2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 15:59:07 -0700 Subject: i956: Make state dependency of SF on drawbuffer bounds match Mesa's. Noticed while debugging a weird 1D FBO testcase that left its existing viewport and projection matrix in place when switching drawbuffers. Didn't fix the testcase, though. --- src/mesa/drivers/dri/i965/brw_sf_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 68fa9820b6..c99918724b 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -66,7 +66,9 @@ static void upload_sf_vp(struct brw_context *brw) sfv.viewport.m31 = v[MAT_TY] * y_scale + y_bias; sfv.viewport.m32 = v[MAT_TZ] * depth_scale; - /* _NEW_SCISSOR */ + /* _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT + * for DrawBuffer->_[XY]{min,max} + */ /* The scissor only needs to handle the intersection of drawable and * scissor rect. Clipping to the boundaries of static shared buffers @@ -97,7 +99,8 @@ static void upload_sf_vp(struct brw_context *brw) const struct brw_tracked_state brw_sf_vp = { .dirty = { .mesa = (_NEW_VIEWPORT | - _NEW_SCISSOR), + _NEW_SCISSOR | + _NEW_BUFFERS), .brw = 0, .cache = 0 }, -- cgit v1.2.3 From bd0861e2742c22e4bce83bce40dfdbfd713835df Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 21:15:46 -0700 Subject: i965: fix whitespace in brw_tex_layout.c The broken indentation was driving me crazy, so fix other stuff while I'm here. --- src/mesa/drivers/dri/i965/brw_tex_layout.c | 63 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 51a617fcb4..be8ce546a9 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -28,7 +28,6 @@ * Authors: * Keith Whitwell */ - /* Code to layout images in a mipmap tree for i965. */ @@ -40,14 +39,14 @@ #define FILE_DEBUG_FLAG DEBUG_MIPTREE -GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_tree *mt ) +GLboolean brw_miptree_layout(struct intel_context *intel, + struct intel_mipmap_tree *mt) { - /* XXX: these vary depending on image format: - */ -/* GLint align_w = 4; */ + /* XXX: these vary depending on image format: */ + /* GLint align_w = 4; */ switch (mt->target) { - case GL_TEXTURE_CUBE_MAP: + case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_3D: { GLuint width = mt->width0; GLuint height = mt->height0; @@ -59,7 +58,7 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t GLuint align_w = 4; mt->total_height = 0; - + if (mt->compressed) { align_w = intel_compressed_alignment(mt->internal_format); mt->pitch = ALIGN(width, align_w); @@ -72,12 +71,12 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t pack_x_pitch = mt->pitch; pack_x_nr = 1; - for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { + for (level = mt->first_level ; level <= mt->last_level ; level++) { GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6; GLint x = 0; GLint y = 0; GLint q, j; - + intel_miptree_set_level_info(mt, level, nr_images, 0, mt->total_height, width, height, depth); @@ -89,7 +88,7 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t } x = 0; - y += pack_y_pitch; + y += pack_y_pitch; } @@ -98,25 +97,25 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t height = minify(height); depth = minify(depth); - if (mt->compressed) { - pack_y_pitch = (height + 3) / 4; - - if (pack_x_pitch > ALIGN(width, align_w)) { - pack_x_pitch = ALIGN(width, align_w); - pack_x_nr <<= 1; - } - } else { - if (pack_x_pitch > 4) { - pack_x_pitch >>= 1; - pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr <= mt->pitch); - } - - if (pack_y_pitch > 2) { - pack_y_pitch >>= 1; - pack_y_pitch = ALIGN(pack_y_pitch, align_h); - } - } + if (mt->compressed) { + pack_y_pitch = (height + 3) / 4; + + if (pack_x_pitch > ALIGN(width, align_w)) { + pack_x_pitch = ALIGN(width, align_w); + pack_x_nr <<= 1; + } + } else { + if (pack_x_pitch > 4) { + pack_x_pitch >>= 1; + pack_x_nr <<= 1; + assert(pack_x_pitch * pack_x_nr <= mt->pitch); + } + + if (pack_y_pitch > 2) { + pack_y_pitch >>= 1; + pack_y_pitch = ALIGN(pack_y_pitch, align_h); + } + } } break; @@ -126,12 +125,12 @@ GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_t i945_miptree_layout_2d(intel, mt); break; } - DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, - mt->pitch, + DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, + mt->pitch, mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp ); - + return GL_TRUE; } -- cgit v1.2.3 From a1f6f82e829d14a9b730f1761ebfc11b4409cb51 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 09:50:55 -0600 Subject: vbo: move vp_mode enum to vbo_exec.h, use enum instead of GLuint --- src/mesa/vbo/vbo_context.h | 12 ++++++------ src/mesa/vbo/vbo_exec.h | 10 ++++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index bf405eb693..1d5e929e84 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -92,13 +92,13 @@ static INLINE struct vbo_context *vbo_context(GLcontext *ctx) return (struct vbo_context *)(ctx->swtnl_im); } -enum { - VP_NONE = 1, - VP_NV, - VP_ARB -}; -static INLINE GLuint get_program_mode( GLcontext *ctx ) +/** + * Return VP_x token to indicate whether we're running fixed-function + * vertex transformation, an NV vertex program or ARB vertex program/shader. + */ +static INLINE enum vp_mode +get_program_mode( GLcontext *ctx ) { if (!ctx->VertexProgram._Current) return VP_NONE; diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 100bb8a5de..e0f44892cf 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -48,6 +48,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define ERROR_ATTRIB 16 +/** Current vertex program mode */ +enum vp_mode { + VP_NONE, /**< fixed function */ + VP_NV, /**< NV vertex program */ + VP_ARB /**< ARB vertex program or GLSL vertex shader */ +}; struct vbo_exec_eval1_map { @@ -103,7 +109,7 @@ struct vbo_exec_context * values are squashed down to the 32 attributes passed to the * vertex program below: */ - GLuint program_mode; + enum vp_mode program_mode; GLuint enabled_flags; const struct gl_client_array *inputs[VERT_ATTRIB_MAX]; } vtx; @@ -116,7 +122,7 @@ struct vbo_exec_context } eval; struct { - GLuint program_mode; + enum vp_mode program_mode; GLuint enabled_flags; GLuint array_obj; -- cgit v1.2.3 From dda82137d28aba846dda73da230871c115e30aaf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 09:52:33 -0600 Subject: vbo: return VP_NONE from get_program_mode() if running fixed-func vertex program If we're running a vertex program to emulated fixed-function, we still need to treat vertex arrays/attributes as if we're in fixed-function mode. This should probably be back-ported to Mesa 7.5 after a bit more testing. --- src/mesa/vbo/vbo_context.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 1d5e929e84..7e366d474d 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -102,6 +102,8 @@ get_program_mode( GLcontext *ctx ) { if (!ctx->VertexProgram._Current) return VP_NONE; + else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) + return VP_NONE; else if (ctx->VertexProgram._Current->IsNVProgram) return VP_NV; else -- cgit v1.2.3 From de1cfc5e8a8e9d0b0b397671575ae448a554a002 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 09:56:41 -0600 Subject: mesa: new _mesa_update_array_object_max_element() function This will replace the code in state.c --- src/mesa/main/arrayobj.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/arrayobj.h | 7 ++++- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 8ec73b9526..eab6fac94e 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -1,9 +1,10 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2006 + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -46,6 +47,7 @@ #include "bufferobj.h" #endif #include "arrayobj.h" +#include "macros.h" #include "glapi/dispatch.h" @@ -267,6 +269,80 @@ remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) } + +/** + * Compute the index of the last array element that can be safely accessed + * in a vertex array. We can really only do this when the array lives in + * a VBO. + * The array->_MaxElement field will be updated. + * Later in glDrawArrays/Elements/etc we can do some bounds checking. + */ +static void +compute_max_element(struct gl_client_array *array) +{ + if (array->BufferObj->Name) { + /* Compute the max element we can access in the VBO without going + * out of bounds. + */ + array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size + - (GLsizeiptrARB) array->Ptr + array->StrideB + - array->_ElementSize) / array->StrideB; + if (0) + _mesa_printf("%s Object %u Size %u MaxElement %u\n", + __FUNCTION__, + array->BufferObj->Name, + (GLuint) array->BufferObj->Size, + array->_MaxElement); + } + else { + /* user-space array, no idea how big it is */ + array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ + } +} + + +/** + * Helper for update_arrays(). + * \return min(current min, array->_MaxElement). + */ +static GLuint +update_min(GLuint min, struct gl_client_array *array) +{ + compute_max_element(array); + if (array->Enabled) + return MIN2(min, array->_MaxElement); + else + return min; +} + + +/** + * Examine vertex arrays to update the gl_array_object::_MaxElement field. + */ +void +_mesa_update_array_object_max_element(GLcontext *ctx, + struct gl_array_object *arrayObj) +{ + GLuint i, min = ~0; + + min = update_min(min, &arrayObj->Vertex); + min = update_min(min, &arrayObj->Normal); + min = update_min(min, &arrayObj->Color); + min = update_min(min, &arrayObj->SecondaryColor); + min = update_min(min, &arrayObj->FogCoord); + min = update_min(min, &arrayObj->Index); + min = update_min(min, &arrayObj->EdgeFlag); + min = update_min(min, &arrayObj->PointSize); + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) + min = update_min(min, &arrayObj->TexCoord[i]); + for (i = 0; i < VERT_ATTRIB_MAX; i++) + min = update_min(min, &arrayObj->VertexAttrib[i]); + + /* _MaxElement is one past the last legal array element */ + arrayObj->_MaxElement = min; +} + + /**********************************************************************/ /* API Functions */ /**********************************************************************/ diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 90c2aea155..abca5ab9b4 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -1,9 +1,10 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.6 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2006 + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -57,6 +58,10 @@ _mesa_initialize_array_object( GLcontext *ctx, struct gl_array_object *obj, GLuint name ); +extern void +_mesa_update_array_object_max_element(GLcontext *ctx, + struct gl_array_object *arrayObj); + /* * API functions -- cgit v1.2.3 From aac19609bfd7c950b2577489b06886c8a8097bb2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 10:05:04 -0600 Subject: mesa: fix some potential state-restore issues in pop_texture_group() Call the _mesa_set_enable() functions instead of driver functions, etc. Also, add missing code for 1D/2D texture arrays. --- src/mesa/main/attrib.c | 90 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index e43fa96dd3..a609199504 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.3 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -541,6 +541,7 @@ end: static void pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) { + const GLuint curTexUnitSave = ctx->Texture.CurrentUnit; GLuint i; #define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \ @@ -685,59 +686,51 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) /* texture unit enables */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) { - ctx->Texture.Unit[i].Enabled = enable->Texture[i]; - if (ctx->Driver.Enable) { - if (ctx->Driver.ActiveTexture) { - (*ctx->Driver.ActiveTexture)(ctx, i); - } - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, - (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) ); - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, - (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) ); - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, - (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) ); - if (ctx->Extensions.ARB_texture_cube_map) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, - (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) ); - if (ctx->Extensions.NV_texture_rectangle) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, - (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) ); + const GLbitfield enabled = enable->Texture[i]; + const GLbitfield genEnabled = enable->TexGen[i]; + + if (ctx->Texture.Unit[i].Enabled != enabled) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + i); + + _mesa_set_enable(ctx, GL_TEXTURE_1D, + (enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_2D, + (enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_3D, + (enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE); + if (ctx->Extensions.NV_texture_rectangle) { + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_ARB, + (enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE); + } + if (ctx->Extensions.ARB_texture_cube_map) { + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, + (enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE); + } + if (ctx->Extensions.MESA_texture_array) { + _mesa_set_enable(ctx, GL_TEXTURE_1D_ARRAY_EXT, + (enabled & TEXTURE_1D_ARRAY_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_2D_ARRAY_EXT, + (enabled & TEXTURE_2D_ARRAY_BIT) ? GL_TRUE : GL_FALSE); } } - if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) { - ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i]; - if (ctx->Driver.Enable) { - if (ctx->Driver.ActiveTexture) { - (*ctx->Driver.ActiveTexture)(ctx, i); - } - if (enable->TexGen[i] & S_BIT) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE); - else - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE); - if (enable->TexGen[i] & T_BIT) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE); - else - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE); - if (enable->TexGen[i] & R_BIT) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE); - else - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE); - if (enable->TexGen[i] & Q_BIT) - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE); - else - (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE); - } + if (ctx->Texture.Unit[i].TexGenEnabled != genEnabled) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + i); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, + (genEnabled & S_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, + (genEnabled & T_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, + (genEnabled & R_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, + (genEnabled & Q_BIT) ? GL_TRUE : GL_FALSE); } /* GL_SGI_texture_color_table */ ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i]; } - if (ctx->Driver.ActiveTexture) { - (*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit); - } + _mesa_ActiveTextureARB(GL_TEXTURE0 + curTexUnitSave); } @@ -770,6 +763,13 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate) _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, (unit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE); } + if (ctx->Extensions.MESA_texture_array) { + _mesa_set_enable(ctx, GL_TEXTURE_1D_ARRAY_EXT, + (unit->Enabled & TEXTURE_1D_ARRAY_BIT) ? GL_TRUE : GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_2D_ARRAY_EXT, + (unit->Enabled & TEXTURE_2D_ARRAY_BIT) ? GL_TRUE : GL_FALSE); + } + if (ctx->Extensions.SGI_texture_color_table) { _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI, unit->ColorTableEnabled); -- cgit v1.2.3 From 1889890c88c3c10287ca4f84369190cc7029884f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 10:11:13 -0600 Subject: mesa: check FEATURE_point_size_array for PointSize array --- src/mesa/main/arrayobj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index eab6fac94e..8973c3cb37 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -332,7 +332,9 @@ _mesa_update_array_object_max_element(GLcontext *ctx, min = update_min(min, &arrayObj->FogCoord); min = update_min(min, &arrayObj->Index); min = update_min(min, &arrayObj->EdgeFlag); +#if FEATURE_point_size_array min = update_min(min, &arrayObj->PointSize); +#endif for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) min = update_min(min, &arrayObj->TexCoord[i]); for (i = 0; i < VERT_ATTRIB_MAX; i++) -- cgit v1.2.3 From 8fa0cb2b422abaeee1b69f82ca7e9f02dc8393b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 10:15:18 -0600 Subject: mesa: added gl_array_object::Weight array field We don't really implement vertex weights but in the VBO code this fixes and odd case for the legacy_array[] setup. Before, the vbo->draw_prims() call was always indicating that the vertex weight array was present/enabled when it really wasn't. --- src/mesa/main/arrayobj.c | 3 +++ src/mesa/main/mtypes.h | 1 + src/mesa/vbo/vbo_exec_array.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 8973c3cb37..f9b11ee244 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -81,6 +81,7 @@ unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) GLuint i; _mesa_reference_buffer_object(ctx, &obj->Vertex.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Weight.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->Normal.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->Color.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->SecondaryColor.BufferObj, NULL); @@ -223,6 +224,7 @@ _mesa_initialize_array_object( GLcontext *ctx, /* Init the individual arrays */ init_array(ctx, &obj->Vertex, 4, GL_FLOAT); + init_array(ctx, &obj->Weight, 1, GL_FLOAT); init_array(ctx, &obj->Normal, 3, GL_FLOAT); init_array(ctx, &obj->Color, 4, GL_FLOAT); init_array(ctx, &obj->SecondaryColor, 4, GL_FLOAT); @@ -326,6 +328,7 @@ _mesa_update_array_object_max_element(GLcontext *ctx, GLuint i, min = ~0; min = update_min(min, &arrayObj->Vertex); + min = update_min(min, &arrayObj->Weight); min = update_min(min, &arrayObj->Normal); min = update_min(min, &arrayObj->Color); min = update_min(min, &arrayObj->SecondaryColor); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2708678e64..55bfa2bf41 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1563,6 +1563,7 @@ struct gl_array_object /** Conventional vertex arrays */ /*@{*/ struct gl_client_array Vertex; + struct gl_client_array Weight; struct gl_client_array Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index a4c67c1de1..c33d557e92 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -103,7 +103,7 @@ static void bind_array_obj( GLcontext *ctx ) * go away. */ exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex; - exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &vbo->legacy_currval[VERT_ATTRIB_WEIGHT]; + exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight; exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal; exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color; exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor; -- cgit v1.2.3 From 8fe3134622eed34159ff6f72a33558a659e8d299 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:36:25 -0600 Subject: mesa: call _mesa_update_array_object_max_element() before printing array info --- src/mesa/main/varray.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 8e6ef9caa5..ac30538925 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1060,6 +1060,8 @@ _mesa_print_arrays(GLcontext *ctx) const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; + _mesa_update_array_object_max_element(ctx, arrayObj); + _mesa_printf("Array Object %u\n", arrayObj->Name); if (arrayObj->Vertex.Enabled) print_array("Vertex", -1, &arrayObj->Vertex); -- cgit v1.2.3 From a554d7c4d87902833382cb67bd8a282d5c500c6d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:55:33 -0600 Subject: mesa: VertexAttribPointer comments --- src/mesa/main/varray.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index ac30538925..7879e0079b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -518,6 +518,12 @@ _mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr) #if FEATURE_NV_vertex_program +/** + * Set a vertex attribute array. + * Note that these arrays DO alias the conventional GL vertex arrays + * (position, normal, color, fog, texcoord, etc). + * The generic attribute slots at #16 and above are not touched. + */ void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) @@ -578,6 +584,11 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, #if FEATURE_ARB_vertex_program +/** + * Set a generic vertex attribute array. + * Note that these arrays DO NOT alias the conventional GL vertex arrays + * (position, normal, color, fog, texcoord, etc). + */ void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, -- cgit v1.2.3 From 6a2211f00077f49af42e6f087e3120abfb1be5ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:55:50 -0600 Subject: mesa: remove const qualifier --- src/mesa/main/varray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 7879e0079b..ea11857a98 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1068,7 +1068,7 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) void _mesa_print_arrays(GLcontext *ctx) { - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint i; _mesa_update_array_object_max_element(ctx, arrayObj); -- cgit v1.2.3 From 254845fad064eabd92c7a72322e647137ec719e9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 15:57:29 -0600 Subject: mesa: minor code simplification in _mesa_GetVertexAttribfvARB() --- src/mesa/shader/arbprogram.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 317d623a22..98c2e3019a 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -302,6 +302,7 @@ _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) { + const struct gl_client_array *array; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -310,21 +311,23 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) return; } + array = &ctx->Array.ArrayObj->VertexAttrib[index]; + switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Enabled; + params[0] = (GLfloat) array->Enabled; break; case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Size; + params[0] = (GLfloat) array->Size; break; case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Stride; + params[0] = (GLfloat) array->Stride; break; case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Type; + params[0] = (GLfloat) array->Type; break; case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Normalized; + params[0] = array->Normalized; break; case GL_CURRENT_VERTEX_ATTRIB_ARB: if (index == 0) { @@ -336,7 +339,7 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]); break; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].BufferObj->Name; + params[0] = (GLfloat) array->BufferObj->Name; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); -- cgit v1.2.3 From 024de60348c5f463b9611f2d28270ce514da55c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:02:50 -0600 Subject: mesa: comment for _mesa_GetVertexAttribfvARB() --- src/mesa/shader/arbprogram.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 98c2e3019a..6f5a954c16 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -299,6 +299,10 @@ _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) } +/** + * Return info for a generic vertex attribute array (no alias with + * legacy vertex attributes (pos, normal, color, etc)). + */ void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) { -- cgit v1.2.3 From 667a4037fac4fd154ebfa7513b3bbba935077241 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:03:18 -0600 Subject: mesa: minor code simplification in _mesa_GetVertexAttrib*NV() --- src/mesa/shader/nvprogram.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 8ba521182b..d6469b17be 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -354,6 +354,7 @@ _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, void GLAPIENTRY _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) { + const struct gl_client_array *array; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -362,15 +363,17 @@ _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) return; } + array = &ctx->Array.ArrayObj->VertexAttrib[index]; + switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Size; + params[0] = array->Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Stride; + params[0] = array->Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Type; + params[0] = array->Type; break; case GL_CURRENT_ATTRIB_NV: if (index == 0) { @@ -395,6 +398,7 @@ _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) void GLAPIENTRY _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) { + const struct gl_client_array *array; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -403,15 +407,17 @@ _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) return; } + array = &ctx->Array.ArrayObj->VertexAttrib[index]; + switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Size; + params[0] = (GLfloat) array->Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Stride; + params[0] = (GLfloat) array->Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: - params[0] = (GLfloat) ctx->Array.ArrayObj->VertexAttrib[index].Type; + params[0] = (GLfloat) array->Type; break; case GL_CURRENT_ATTRIB_NV: if (index == 0) { @@ -436,6 +442,7 @@ _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) void GLAPIENTRY _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) { + const struct gl_client_array *array; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -444,15 +451,17 @@ _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) return; } + array = &ctx->Array.ArrayObj->VertexAttrib[index]; + switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Size; + params[0] = array->Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Stride; + params[0] = array->Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Type; + params[0] = array->Type; break; case GL_CURRENT_ATTRIB_NV: if (index == 0) { @@ -467,7 +476,7 @@ _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) params[3] = (GLint) ctx->Current.Attrib[index][3]; break; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->VertexAttrib[index].BufferObj->Name; + params[0] = array->BufferObj->Name; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); -- cgit v1.2.3 From 54a5ffbfa1f935c46642a9835f08983cc1fdfeed Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:05:11 -0600 Subject: mesa: freshen comments for update_array() --- src/mesa/main/varray.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index ea11857a98..6bf3c485c7 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -37,15 +37,14 @@ /** - * Update the fields of a vertex array object. - * We need to do a few special things for arrays that live in - * vertex buffer objects. + * Set the fields of a vertex array. * * \param array the array to update * \param dirtyBit which bit to set in ctx->Array.NewState for this array * \param elementSize size of each array element, in bytes * \param size components per element (1, 2, 3 or 4) * \param type datatype of each component (GL_FLOAT, GL_INT, etc) + * \param format either GL_RGBA or GL_BGRA * \param stride stride between elements, in elements * \param normalized are integer types converted to floats in [-1, 1]? * \param ptr the address (or offset inside VBO) of the array data -- cgit v1.2.3 From d4fb7615b5a9c514d48fc78a01c52cb721b889c6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:52:45 -0600 Subject: mesa: use MAX_ values instead of literals --- src/mesa/vbo/vbo_exec_array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0d4cbe9a1e..0e611840c2 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -115,7 +115,7 @@ static void bind_array_obj( GLcontext *ctx ) } exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i]; for (i = 0; i < VERT_ATTRIB_MAX; i++) @@ -216,7 +216,7 @@ static void recalculate_input_bindings( GLcontext *ctx ) } } - for (i = 0; i < 16; i++) { + for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { if (exec->array.generic_array[i]->Enabled) inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i]; else { -- cgit v1.2.3 From 8da09e6924ca22ba7951d5a7673dfab2a711a997 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 16:54:35 -0600 Subject: vbo: fix incorrect loop limit in bind_array_obj() The generic_array[] is 16 elements in size, but the loop was doing 32 iterations. The out of bounds array write was clobbering the following inputs[] array but as luck would have it, that didn't matter. --- src/mesa/vbo/vbo_exec_array.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0e611840c2..65fe197a4d 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -118,8 +118,11 @@ static void bind_array_obj( GLcontext *ctx ) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i]; - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + assert(i < Elements(arrayObj->VertexAttrib)); + assert(i < Elements(exec->array.generic_array)); exec->array.generic_array[i] = &arrayObj->VertexAttrib[i]; + } exec->array.array_obj = arrayObj->Name; } -- cgit v1.2.3 From d2a74d76c96957cf0294dcf40d29526621ada95e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 17:03:21 -0600 Subject: mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS --- src/mesa/main/varray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 6bf3c485c7..0982dc7977 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -532,7 +532,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) { + if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); return; } -- cgit v1.2.3 From 3bfe312d0136c95b2a8518d65fa32c89ed474987 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 17:03:52 -0600 Subject: vbo: comments, whitespace clean-ups --- src/mesa/vbo/vbo_exec_array.c | 45 +++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 66a4ed7a40..564f7f71ab 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -36,7 +36,8 @@ #include "vbo_context.h" -/* Compute min and max elements for drawelements calls. +/** + * Compute min and max elements for glDraw[Range]Elements() calls. */ static void get_minmax_index( GLuint count, GLuint type, const GLvoid *indices, @@ -89,7 +90,8 @@ static void get_minmax_index( GLuint count, GLuint type, } -/* Just translate the arrayobj into a sane layout. +/** + * Just translate the arrayobj into a sane layout. */ static void bind_array_obj( GLcontext *ctx ) { @@ -127,6 +129,7 @@ static void bind_array_obj( GLcontext *ctx ) exec->array.array_obj = arrayObj->Name; } + static void recalculate_input_bindings( GLcontext *ctx ) { struct vbo_context *vbo = vbo_context(ctx); @@ -140,9 +143,10 @@ static void recalculate_input_bindings( GLcontext *ctx ) switch (exec->array.program_mode) { case VP_NONE: - /* When no vertex program is active, we put the material values - * into the generic slots. This is the only situation where - * material values are available as per-vertex attributes. + /* When no vertex program is active (or the vertex program is generated + * from fixed-function state). We put the material values into the + * generic slots. This is the only situation where material values + * are available as per-vertex attributes. */ for (i = 0; i <= VERT_ATTRIB_TEX7; i++) { if (exec->array.legacy_array[i]->Enabled) @@ -165,8 +169,8 @@ static void recalculate_input_bindings( GLcontext *ctx ) inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i]; const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i); } - break; + case VP_NV: /* NV_vertex_program - attribute arrays alias and override * conventional, legacy arrays. No materials, and the generic @@ -190,11 +194,11 @@ static void recalculate_input_bindings( GLcontext *ctx ) inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0]; const_inputs |= 1 << i; } - break; + case VP_ARB: - /* ARB_vertex_program - Only the attribute zero (position) array - * aliases and overrides the legacy position array. + /* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0] + * attribute array aliases and overrides the legacy position array. * * Otherwise, legacy attributes available in the legacy slots, * generic attributes in the generic slots and materials are not @@ -209,7 +213,6 @@ static void recalculate_input_bindings( GLcontext *ctx ) const_inputs |= 1 << 0; } - for (i = 1; i <= VERT_ATTRIB_TEX7; i++) { if (exec->array.legacy_array[i]->Enabled) inputs[i] = exec->array.legacy_array[i]; @@ -234,6 +237,7 @@ static void recalculate_input_bindings( GLcontext *ctx ) _mesa_set_varying_vp_inputs( ctx, ~const_inputs ); } + static void bind_arrays( GLcontext *ctx ) { #if 0 @@ -281,7 +285,10 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) bind_arrays( ctx ); - /* Again... + /* Again... because we may have changed the bitmask of per-vertex varying + * attributes. If we regenerate the fixed-function vertex program now + * we may be able to prune down the number of vertex attributes which we + * need in the shader. */ if (ctx->NewState) _mesa_update_state( ctx ); @@ -295,7 +302,8 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) prim[0].count = count; prim[0].indexed = 0; - vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, start, start + count - 1 ); + vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, + start, start + count - 1 ); #if 0 { @@ -340,7 +348,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) } - static void GLAPIENTRY vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, @@ -357,9 +364,11 @@ vbo_exec_DrawRangeElements(GLenum mode, if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ - _mesa_warning(ctx, "glDraw[Range]Elements() index=%u is " - "out of bounds (max=%u)", end, - ctx->Array.ArrayObj->_MaxElement); + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " + "type 0x%x) index=%u is out of bounds (max=%u)", + start, end, count, type, end, + if (0) + _mesa_print_arrays(ctx); return; } @@ -426,6 +435,7 @@ vbo_exec_DrawRangeElements(GLenum mode, vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib, start, end ); } + static void GLAPIENTRY vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { @@ -465,9 +475,6 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *ind * Initialization */ - - - void vbo_exec_array_init( struct vbo_exec_context *exec ) { #if 1 -- cgit v1.2.3 From 8b91778f46bf7f48efacf5f14d3cc9023a1986ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 17:07:33 -0600 Subject: vbo: fix build breakage...oops --- src/mesa/vbo/vbo_exec_array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 564f7f71ab..df444932bc 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -366,7 +366,7 @@ vbo_exec_DrawRangeElements(GLenum mode, /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " "type 0x%x) index=%u is out of bounds (max=%u)", - start, end, count, type, end, + start, end, count, type, end); if (0) _mesa_print_arrays(ctx); return; -- cgit v1.2.3 From 70c4b81e88e18e354e8dfaf47e5455e463b207d8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 21:49:57 -0600 Subject: mesa: add missing glGet*() case for GL_VERTEX_ARRAY_BINDING_APPLE --- src/mesa/main/get.c | 12 ++++++++++++ src/mesa/main/get_gen.py | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 0937fd053c..1ed6fc3383 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1867,6 +1867,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(ARB_framebuffer_object, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxSamples); break; + case GL_VERTEX_ARRAY_BINDING_APPLE: + CHECK_EXT1(APPLE_vertex_array_object, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } @@ -3677,6 +3681,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(ARB_framebuffer_object, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.MaxSamples); break; + case GL_VERTEX_ARRAY_BINDING_APPLE: + CHECK_EXT1(APPLE_vertex_array_object, "GetFloatv"); + params[0] = (GLfloat)(ctx->Array.ArrayObj->Name); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); } @@ -5487,6 +5495,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(ARB_framebuffer_object, "GetIntegerv"); params[0] = ctx->Const.MaxSamples; break; + case GL_VERTEX_ARRAY_BINDING_APPLE: + CHECK_EXT1(APPLE_vertex_array_object, "GetIntegerv"); + params[0] = ctx->Array.ArrayObj->Name; + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index fa695c48f1..00dcb19335 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1003,7 +1003,10 @@ StateVars = [ # GL_ARB_framebuffer_object ( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "", - ["ARB_framebuffer_object"] ) + ["ARB_framebuffer_object"] ), + + ( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "", + ["APPLE_vertex_array_object"] ), ] -- cgit v1.2.3 From 42b747e57d4487ee4f0049ab6835b56f22890e97 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:14:16 -0600 Subject: mesa: added comment --- src/mesa/main/get_gen.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 00dcb19335..43ee5fff10 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1005,6 +1005,7 @@ StateVars = [ ( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "", ["ARB_framebuffer_object"] ), + # GL_APPLE_vertex_array_object ( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "", ["APPLE_vertex_array_object"] ), ] -- cgit v1.2.3 From 4dc426c01627a240bd5b148c1804c45b0d5ecd6c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:19:27 -0600 Subject: mesa: s/MAX_VERTEX_PROGRAM_ATTRIBS/MAX_NV_VERTEX_PROGRAM_INPUTS/ in NV funcs --- src/mesa/main/dlist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 537ff5881f..478fedd523 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5506,7 +5506,7 @@ index_error(void) static void GLAPIENTRY save_VertexAttrib1fNV(GLuint index, GLfloat x) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr1fNV(index, x); else index_error(); @@ -5515,7 +5515,7 @@ save_VertexAttrib1fNV(GLuint index, GLfloat x) static void GLAPIENTRY save_VertexAttrib1fvNV(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr1fNV(index, v[0]); else index_error(); @@ -5524,7 +5524,7 @@ save_VertexAttrib1fvNV(GLuint index, const GLfloat * v) static void GLAPIENTRY save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr2fNV(index, x, y); else index_error(); @@ -5533,7 +5533,7 @@ save_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) static void GLAPIENTRY save_VertexAttrib2fvNV(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr2fNV(index, v[0], v[1]); else index_error(); @@ -5542,7 +5542,7 @@ save_VertexAttrib2fvNV(GLuint index, const GLfloat * v) static void GLAPIENTRY save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr3fNV(index, x, y, z); else index_error(); @@ -5551,7 +5551,7 @@ save_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) static void GLAPIENTRY save_VertexAttrib3fvNV(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr3fNV(index, v[0], v[1], v[2]); else index_error(); @@ -5561,7 +5561,7 @@ static void GLAPIENTRY save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr4fNV(index, x, y, z, w); else index_error(); @@ -5570,7 +5570,7 @@ save_VertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, static void GLAPIENTRY save_VertexAttrib4fvNV(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_PROGRAM_ATTRIBS) + if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) save_Attr4fNV(index, v[0], v[1], v[2], v[3]); else index_error(); -- cgit v1.2.3 From 4a95185c9f30c2de7a03bb1a0653f51b53b1111d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:26:08 -0600 Subject: mesa: rename MAX_VERTEX_ATTRIBS to MAX_VERTEX_GENERIC_ATTRIBS Be clearer that this is the number of generic vertex program/shader attributes, not counting the legacy attributes (pos, normal, color, etc). --- src/mesa/main/api_noop.c | 16 ++++++++-------- src/mesa/main/config.h | 2 +- src/mesa/main/dlist.c | 24 ++++++++++++------------ src/mesa/main/enums.c | 10 +++++----- src/mesa/shader/slang/slang_link.c | 8 ++++---- src/mesa/vbo/vbo_attrib_tmp.h | 16 ++++++++-------- src/mesa/vbo/vbo_exec_array.c | 4 ++-- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index a1cc3a2a4b..66f9c4e6bd 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -477,7 +477,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1); } else @@ -487,7 +487,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1); } else @@ -497,7 +497,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloa static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1); } else @@ -507,7 +507,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GL static void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1); } else @@ -518,7 +518,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1); } else @@ -528,7 +528,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, static void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1); } else @@ -539,7 +539,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w); } else @@ -549,7 +549,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, static void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]); } else diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 888e08ff93..100caff7bf 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -215,7 +215,7 @@ /** For GL_ARB_vertex_shader */ /*@{*/ -#define MAX_VERTEX_ATTRIBS 16 +#define MAX_VERTEX_GENERIC_ATTRIBS 16 #define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS #define MAX_COMBINED_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS /*@}*/ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 478fedd523..782f847904 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -4974,7 +4974,7 @@ save_Attr1fARB(GLenum attr, GLfloat x) n[2].f = x; } - ASSERT(attr < MAX_VERTEX_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); @@ -4996,7 +4996,7 @@ save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) n[3].f = y; } - ASSERT(attr < MAX_VERTEX_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); @@ -5019,7 +5019,7 @@ save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) n[4].f = z; } - ASSERT(attr < MAX_VERTEX_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); @@ -5043,7 +5043,7 @@ save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) n[5].f = w; } - ASSERT(attr < MAX_VERTEX_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); @@ -5582,7 +5582,7 @@ save_VertexAttrib4fvNV(GLuint index, const GLfloat * v) static void GLAPIENTRY save_VertexAttrib1fARB(GLuint index, GLfloat x) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr1fARB(index, x); else index_error(); @@ -5591,7 +5591,7 @@ save_VertexAttrib1fARB(GLuint index, GLfloat x) static void GLAPIENTRY save_VertexAttrib1fvARB(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr1fARB(index, v[0]); else index_error(); @@ -5600,7 +5600,7 @@ save_VertexAttrib1fvARB(GLuint index, const GLfloat * v) static void GLAPIENTRY save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr2fARB(index, x, y); else index_error(); @@ -5609,7 +5609,7 @@ save_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) static void GLAPIENTRY save_VertexAttrib2fvARB(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr2fARB(index, v[0], v[1]); else index_error(); @@ -5618,7 +5618,7 @@ save_VertexAttrib2fvARB(GLuint index, const GLfloat * v) static void GLAPIENTRY save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr3fARB(index, x, y, z); else index_error(); @@ -5627,7 +5627,7 @@ save_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) static void GLAPIENTRY save_VertexAttrib3fvARB(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr3fARB(index, v[0], v[1], v[2]); else index_error(); @@ -5637,7 +5637,7 @@ static void GLAPIENTRY save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr4fARB(index, x, y, z, w); else index_error(); @@ -5646,7 +5646,7 @@ save_VertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, static void GLAPIENTRY save_VertexAttrib4fvARB(GLuint index, const GLfloat * v) { - if (index < MAX_VERTEX_ATTRIBS) + if (index < MAX_VERTEX_GENERIC_ATTRIBS) save_Attr4fARB(index, v[0], v[1], v[2], v[3]); else index_error(); diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index c077bc0a89..cf893fdac5 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -948,8 +948,8 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" "GL_MAX_VARYING_FLOATS\0" "GL_MAX_VARYING_FLOATS_ARB\0" - "GL_MAX_VERTEX_ATTRIBS\0" - "GL_MAX_VERTEX_ATTRIBS_ARB\0" + "GL_MAX_VERTEX_GENERIC_ATTRIBS\0" + "GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" @@ -2772,8 +2772,8 @@ static const enum_elt all_enums[1820] = { 19417, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ { 19452, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ { 19474, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19500, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 19522, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 19500, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */ + { 19522, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB */ { 19548, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ { 19582, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ { 19620, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ @@ -4733,7 +4733,7 @@ static const unsigned reduced_enums[1319] = 317, /* GL_CURRENT_QUERY */ 1259, /* GL_QUERY_RESULT */ 1261, /* GL_QUERY_RESULT_AVAILABLE */ - 912, /* GL_MAX_VERTEX_ATTRIBS */ + 912, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */ 1778, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ 368, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 367, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 2bc8809661..5ea89d2ff3 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -324,7 +324,7 @@ _slang_resolve_attributes(struct gl_shader_program *shProg, const struct gl_program *origProg, struct gl_program *linkedProg) { - GLint attribMap[MAX_VERTEX_ATTRIBS]; + GLint attribMap[MAX_VERTEX_GENERIC_ATTRIBS]; GLuint i, j; GLbitfield usedAttributes; /* generics only, not legacy attributes */ @@ -360,7 +360,7 @@ _slang_resolve_attributes(struct gl_shader_program *shProg, } /* initialize the generic attribute map entries to -1 */ - for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { attribMap[i] = -1; } @@ -401,11 +401,11 @@ _slang_resolve_attributes(struct gl_shader_program *shProg, * Start at 1 since generic attribute 0 always aliases * glVertex/position. */ - for (attr = 0; attr < MAX_VERTEX_ATTRIBS; attr++) { + for (attr = 0; attr < MAX_VERTEX_GENERIC_ATTRIBS; attr++) { if (((1 << attr) & usedAttributes) == 0) break; } - if (attr == MAX_VERTEX_ATTRIBS) { + if (attr == MAX_VERTEX_GENERIC_ATTRIBS) { link_error(shProg, "Too many vertex attributes"); return GL_FALSE; } diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index ff11c7d59a..7a889b8e2f 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -265,7 +265,7 @@ static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x ) GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR1F(0, x); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1F(VBO_ATTRIB_GENERIC0 + index, x); else ERROR(); @@ -277,7 +277,7 @@ static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR1FV(0, v); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v); else ERROR(); @@ -289,7 +289,7 @@ static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR2F(0, x, y); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y); else ERROR(); @@ -301,7 +301,7 @@ static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR2FV(0, v); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v); else ERROR(); @@ -313,7 +313,7 @@ static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR3F(0, x, y, z); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z); else ERROR(); @@ -325,7 +325,7 @@ static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR3FV(0, v); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v); else ERROR(); @@ -338,7 +338,7 @@ static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR4F(0, x, y, z, w); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w); else ERROR(); @@ -350,7 +350,7 @@ static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, GET_CURRENT_CONTEXT( ctx ); if (index == 0) ATTR4FV(0, v); - else if (index < MAX_VERTEX_ATTRIBS) + else if (index < MAX_VERTEX_GENERIC_ATTRIBS) ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v); else ERROR(); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index df444932bc..1e1c0781c2 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -120,7 +120,7 @@ static void bind_array_obj( GLcontext *ctx ) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i]; - for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { assert(i < Elements(arrayObj->VertexAttrib)); assert(i < Elements(exec->array.generic_array)); exec->array.generic_array[i] = &arrayObj->VertexAttrib[i]; @@ -222,7 +222,7 @@ static void recalculate_input_bindings( GLcontext *ctx ) } } - for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { if (exec->array.generic_array[i]->Enabled) inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i]; else { -- cgit v1.2.3 From 882cd6c839e56a3eceb8edf62f83893f6b531d35 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:30:05 -0600 Subject: mesa: remove MAX_VERTEX_PROGRAM_ATTRIBS Use MAX_VERTEX_GENERIC_ATTRIBS instead. No need for two #defines for the same quantity. --- src/mesa/main/config.h | 1 - src/mesa/main/dlist.c | 8 ++++---- src/mesa/shader/arbprogparse.c | 14 +++++++------- src/mesa/shader/arbprogram.c | 2 +- src/mesa/tnl/t_vb_program.c | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 100caff7bf..5a05a65396 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -168,7 +168,6 @@ /** For GL_ARB_vertex_program */ /*@{*/ #define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1 -#define MAX_VERTEX_PROGRAM_ATTRIBS 16 /*@}*/ /** For GL_ARB_fragment_program */ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 782f847904..5120e516e0 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -4883,7 +4883,7 @@ save_Attr1fNV(GLenum attr, GLfloat x) n[2].f = x; } - ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); @@ -4905,7 +4905,7 @@ save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) n[3].f = y; } - ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); @@ -4928,7 +4928,7 @@ save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) n[4].f = z; } - ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, 1); @@ -4952,7 +4952,7 @@ save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) n[5].f = w; } - ASSERT(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + ASSERT(attr < MAX_VERTEX_GENERIC_ATTRIBS); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V(ctx->ListState.CurrentAttrib[attr], x, y, z, w); diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 36267c336f..a90ce95a63 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -953,7 +953,7 @@ parse_generic_attrib_num(GLcontext *ctx, const GLubyte ** inst, { GLint i = parse_integer(inst, Program); - if ((i < 0) || (i >= MAX_VERTEX_PROGRAM_ATTRIBS)) + if ((i < 0) || (i >= MAX_VERTEX_GENERIC_ATTRIBS)) { program_error(ctx, Program->Position, "Invalid generic vertex attribute index"); @@ -1510,10 +1510,10 @@ generic_attrib_check(struct var_cache *vc_head) { int a; struct var_cache *curr; - GLboolean explicitAttrib[MAX_VERTEX_PROGRAM_ATTRIBS], - genericAttrib[MAX_VERTEX_PROGRAM_ATTRIBS]; + GLboolean explicitAttrib[MAX_VERTEX_GENERIC_ATTRIBS], + genericAttrib[MAX_VERTEX_GENERIC_ATTRIBS]; - for (a=0; aattrib_is_generic) { GLuint attr = (curr->attrib_binding == 0) ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0); - assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); genericAttrib[attr] = GL_TRUE; } else { - assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS); + assert(curr->attrib_binding < MAX_VERTEX_GENERIC_ATTRIBS); explicitAttrib[ curr->attrib_binding ] = GL_TRUE; } } @@ -1536,7 +1536,7 @@ generic_attrib_check(struct var_cache *vc_head) curr = curr->next; } - for (a=0; a= MAX_VERTEX_PROGRAM_ATTRIBS) { + if (index >= MAX_VERTEX_GENERIC_ATTRIBS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)"); return; } diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 1795f62c32..c35eaf1538 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -207,7 +207,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine) { /* Input registers get initialized from the current vertex attribs */ MEMCPY(machine->VertAttribs, ctx->Current.Attrib, - MAX_VERTEX_PROGRAM_ATTRIBS * 4 * sizeof(GLfloat)); + MAX_VERTEX_GENERIC_ATTRIBS * 4 * sizeof(GLfloat)); if (ctx->VertexProgram._Current->IsNVProgram) { GLuint i; -- cgit v1.2.3 From 42ae2a8648923b6fa11e29ad0f6ff7555534e390 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:51:13 -0600 Subject: mesa: use Elements() macro to limit loops instead of constants --- src/mesa/main/arrayobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index f9b11ee244..c03353b78f 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -89,10 +89,10 @@ unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) _mesa_reference_buffer_object(ctx, &obj->Index.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->EdgeFlag.BufferObj, NULL); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(obj->TexCoord); i++) _mesa_reference_buffer_object(ctx, &obj->TexCoord[i].BufferObj, NULL); - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(obj->VertexAttrib); i++) _mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj,NULL); } @@ -230,11 +230,11 @@ _mesa_initialize_array_object( GLcontext *ctx, init_array(ctx, &obj->SecondaryColor, 4, GL_FLOAT); init_array(ctx, &obj->FogCoord, 1, GL_FLOAT); init_array(ctx, &obj->Index, 1, GL_FLOAT); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { + for (i = 0; i < Elements(obj->TexCoord); i++) { init_array(ctx, &obj->TexCoord[i], 4, GL_FLOAT); } init_array(ctx, &obj->EdgeFlag, 1, GL_BOOL); - for (i = 0; i < VERT_ATTRIB_MAX; i++) { + for (i = 0; i < Elements(obj->VertexAttrib); i++) { init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT); } @@ -340,7 +340,7 @@ _mesa_update_array_object_max_element(GLcontext *ctx, #endif for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) min = update_min(min, &arrayObj->TexCoord[i]); - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) min = update_min(min, &arrayObj->VertexAttrib[i]); /* _MaxElement is one past the last legal array element */ -- cgit v1.2.3 From a545f1ab6d50e044c6e0b2d952af28e6d9059f80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 07:51:35 -0600 Subject: mesa: added some assertions --- src/mesa/main/enable.c | 2 ++ src/mesa/shader/arbprogram.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 2e7baa48ff..48268fcd27 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -119,6 +119,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) CHECK_EXTENSION(NV_vertex_program, cap); { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib)); var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled; flag = _NEW_ARRAY_ATTRIB(n); } @@ -1316,6 +1317,7 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(NV_vertex_program); { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib)); return (ctx->Array.ArrayObj->VertexAttrib[n].Enabled != 0); } case GL_MAP1_VERTEX_ATTRIB0_4_NV: diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 21c5cfbf99..39136efada 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -254,6 +254,8 @@ _mesa_EnableVertexAttribArrayARB(GLuint index) return; } + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE; ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index); @@ -273,6 +275,8 @@ _mesa_DisableVertexAttribArrayARB(GLuint index) return; } + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE; ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index); @@ -315,6 +319,8 @@ _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) return; } + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + array = &ctx->Array.ArrayObj->VertexAttrib[index]; switch (pname) { @@ -387,6 +393,8 @@ _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) return; } + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; } -- cgit v1.2.3 From 995456f9305593005f8466520314ee087f3d422a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 09:35:02 -0600 Subject: mesa: allow GL_BITMAP type in _mesa_image_image_stride() It's possible to hand a GL_COLOR_INDEX/GL_BITMAP image to glTexImage3D() which gets converted to RGBA via the glPixelMap tables. This fixes a failure with piglit/fdo10370 with Gallium. --- src/mesa/main/image.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ddae456fa1..332febf91f 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -755,12 +756,20 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLint height, GLenum format, GLenum type ) { + GLint bytesPerRow, bytesPerImage, remainder; + ASSERT(packing); - ASSERT(type != GL_BITMAP); - { + if (type == GL_BITMAP) { + if (packing->RowLength == 0) { + bytesPerRow = (width + 7) / 8; + } + else { + bytesPerRow = (packing->RowLength + 7) / 8; + } + } + else { const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); - GLint bytesPerRow, bytesPerImage, remainder; if (bytesPerPixel <= 0) return -1; /* error */ @@ -770,17 +779,18 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, else { bytesPerRow = bytesPerPixel * packing->RowLength; } - remainder = bytesPerRow % packing->Alignment; - if (remainder > 0) - bytesPerRow += (packing->Alignment - remainder); + } - if (packing->ImageHeight == 0) - bytesPerImage = bytesPerRow * height; - else - bytesPerImage = bytesPerRow * packing->ImageHeight; + remainder = bytesPerRow % packing->Alignment; + if (remainder > 0) + bytesPerRow += (packing->Alignment - remainder); - return bytesPerImage; - } + if (packing->ImageHeight == 0) + bytesPerImage = bytesPerRow * height; + else + bytesPerImage = bytesPerRow * packing->ImageHeight; + + return bytesPerImage; } -- cgit v1.2.3 From 58fadc624281b3f0bbe084e3e8af28a61036ca94 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:00:49 -0600 Subject: demos: fix multitex.c VertCoord attribute mapping If the multitex.vert shader uses the VertCoord generic vertex attribute instead of the pre-defined gl_Vertex attribute, we need to make sure that VertCoord gets bound to generic vertex attribute zero. That's because we need to call glVertexAttrib2fv(0, xy) after all the other vertex attributes have been set since setting generic attribute 0 triggers vertex submission. Before, we wound up issuing the vertex attributes in the order 0, 1, 2 which caused the first vertex to be submitted before all the attributes were set. Now, the attributes are set in 1, 2, 0 order. --- progs/glsl/multitex.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index b4be463787..bbf58af055 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -271,9 +271,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile, InitUniforms(program, uniforms); + VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + if (VertCoord_attr > 0) { + /* We want the VertCoord attrib to have position zero so that + * the call to glVertexAttrib(0, xyz) triggers vertex processing. + * Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have + * to set that attribute last (which is a PITA to manage). + */ + glBindAttribLocation_func(program, 0, "VertCoord"); + /* re-link */ + glLinkProgram_func(program); + /* VertCoord_attr should be zero now */ + VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + assert(VertCoord_attr == 0); + } + TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0"); TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1"); - VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + printf("TexCoord0_attr = %d\n", TexCoord0_attr); printf("TexCoord1_attr = %d\n", TexCoord1_attr); printf("VertCoord_attr = %d\n", VertCoord_attr); -- cgit v1.2.3 From 96370113f1a3580ed2a8ef2fb427f37afd7432f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:12:01 -0600 Subject: demos/util: add funcs for GL_ARB_buffer_object --- progs/util/extfuncs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/progs/util/extfuncs.h b/progs/util/extfuncs.h index 070414e294..238794d55a 100644 --- a/progs/util/extfuncs.h +++ b/progs/util/extfuncs.h @@ -86,6 +86,15 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL; /* GL_EXT_stencil_two_side */ static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL; +/* GL_ARB_buffer_object */ +static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL; +static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL; +static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL; +static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL; +static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL; +static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL; +static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL; + static void GetExtensionFuncs(void) @@ -173,5 +182,15 @@ GetExtensionFuncs(void) /* GL_EXT_stencil_two_side */ glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT"); + + /* GL_ARB_vertex_buffer_object */ + glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB"); + glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB"); + glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB"); + glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB"); + glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB"); + glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB"); + glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB"); + } -- cgit v1.2.3 From 891a2bdd7d11086712500cf916efbc1b733f094b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:12:28 -0600 Subject: demos: extend glsl/multitex.c to use a vertex buffer object --- progs/glsl/multitex.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 6 deletions(-) diff --git a/progs/glsl/multitex.c b/progs/glsl/multitex.c index b4be463787..1a1c63aaf4 100644 --- a/progs/glsl/multitex.c +++ b/progs/glsl/multitex.c @@ -51,6 +51,8 @@ static GLfloat Xrot = 0.0, Yrot = .0, Zrot = 0.0; static GLfloat EyeDist = 10; static GLboolean Anim = GL_TRUE; static GLboolean UseArrays = GL_TRUE; +static GLboolean UseVBO = GL_TRUE; +static GLuint VBO = 0; static GLint VertCoord_attr = -1, TexCoord0_attr = -1, TexCoord1_attr = -1; @@ -76,28 +78,81 @@ static const GLfloat VertCoords[4][2] = { }; + +static void +SetupVertexBuffer(void) +{ + glGenBuffersARB_func(1, &VBO); + glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO); + + glBufferDataARB_func(GL_ARRAY_BUFFER_ARB, + sizeof(VertCoords) + + sizeof(Tex0Coords) + + sizeof(Tex1Coords), + NULL, + GL_STATIC_DRAW_ARB); + + /* non-interleaved vertex arrays */ + + glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB, + 0, /* offset */ + sizeof(VertCoords), /* size */ + VertCoords); /* data */ + + glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB, + sizeof(VertCoords), /* offset */ + sizeof(Tex0Coords), /* size */ + Tex0Coords); /* data */ + + glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB, + sizeof(VertCoords) + + sizeof(Tex0Coords), /* offset */ + sizeof(Tex1Coords), /* size */ + Tex1Coords); /* data */ + + glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0); +} + + static void DrawPolygonArray(void) { + void *vertPtr, *tex0Ptr, *tex1Ptr; + + if (UseVBO) { + glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO); + vertPtr = (void *) 0; + tex0Ptr = (void *) sizeof(VertCoords); + tex1Ptr = (void *) (sizeof(VertCoords) + sizeof(Tex0Coords)); + } + else { + glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0); + vertPtr = VertCoords; + tex0Ptr = Tex0Coords; + tex1Ptr = Tex1Coords; + } + if (VertCoord_attr >= 0) { glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE, - 0, VertCoords); + 0, vertPtr); glEnableVertexAttribArray_func(VertCoord_attr); } else { - glVertexPointer(2, GL_FLOAT, 0, VertCoords); + glVertexPointer(2, GL_FLOAT, 0, vertPtr); glEnable(GL_VERTEX_ARRAY); } glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE, - 0, Tex0Coords); + 0, tex0Ptr); glEnableVertexAttribArray_func(TexCoord0_attr); glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE, - 0, Tex1Coords); + 0, tex1Ptr); glEnableVertexAttribArray_func(TexCoord1_attr); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0); } @@ -163,6 +218,10 @@ key(unsigned char k, int x, int y) UseArrays = !UseArrays; printf("Arrays: %d\n", UseArrays); break; + case 'v': + UseVBO = !UseVBO; + printf("Use VBO: %d\n", UseVBO); + break; case ' ': Anim = !Anim; if (Anim) @@ -271,9 +330,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile, InitUniforms(program, uniforms); + VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + if (VertCoord_attr > 0) { + /* We want the VertCoord attrib to have position zero so that + * the call to glVertexAttrib(0, xyz) triggers vertex processing. + * Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have + * to set that attribute last (which is a PITA to manage). + */ + glBindAttribLocation_func(program, 0, "VertCoord"); + /* re-link */ + glLinkProgram_func(program); + /* VertCoord_attr should be zero now */ + VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + assert(VertCoord_attr == 0); + } + TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0"); TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1"); - VertCoord_attr = glGetAttribLocation_func(program, "VertCoord"); + printf("TexCoord0_attr = %d\n", TexCoord0_attr); printf("TexCoord1_attr = %d\n", TexCoord1_attr); printf("VertCoord_attr = %d\n", VertCoord_attr); @@ -299,12 +373,19 @@ InitGL(void) /*exit(1);*/ } printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - + printf("Usage:\n"); + printf(" a - toggle arrays vs. immediate mode rendering\n"); + printf(" v - toggle VBO usage for array rendering\n"); + printf(" z/Z - change viewing distance\n"); + printf(" SPACE - toggle animation\n"); + printf(" Esc - exit\n"); GetExtensionFuncs(); InitTextures(); InitPrograms(); + SetupVertexBuffer(); + glEnable(GL_DEPTH_TEST); glClearColor(.6, .6, .9, 0); -- cgit v1.2.3 From c3538969e1ae3e626a618934aa8f35a7a22ddb39 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:15:41 -0600 Subject: vbo: fix crash in vbo_exec_bind_arrays() When a vertex shader uses generic vertex attribute 0, but not gl_Vertex, we need to set attribute[16] to point to attribute[0]. We were setting the attribute size, but not the pointer. Fixes crash in glsl/multitex.c when using the VertCoord attribute instead of gl_Vertex. --- src/mesa/vbo/vbo_exec_draw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 5381cc4d92..da2d849ded 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -185,6 +185,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) { exec->vtx.inputs[16] = exec->vtx.inputs[0]; exec->vtx.attrsz[16] = exec->vtx.attrsz[0]; + exec->vtx.attrptr[16] = exec->vtx.attrptr[0]; exec->vtx.attrsz[0] = 0; } break; -- cgit v1.2.3 From 4b55e3695279daef221669ff063631cf3675da0c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:44:59 -0600 Subject: vbo: asst. reformatting, clean-ups --- src/mesa/vbo/vbo_exec_draw.c | 80 +++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index da2d849ded..c939b7b633 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -35,7 +35,8 @@ #include "vbo_context.h" -static void vbo_exec_debug_verts( struct vbo_exec_context *exec ) +static void +vbo_exec_debug_verts( struct vbo_exec_context *exec ) { GLuint count = exec->vtx.vert_count; GLuint i; @@ -64,19 +65,19 @@ static void vbo_exec_debug_verts( struct vbo_exec_context *exec ) * NOTE: Need to have calculated primitives by this point -- do it on the fly. * NOTE: Old 'parity' issue is gone. */ -static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) +static GLuint +vbo_copy_vertices( struct vbo_exec_context *exec ) { GLuint nr = exec->vtx.prim[exec->vtx.prim_count-1].count; GLuint ovf, i; GLuint sz = exec->vtx.vertex_size; GLfloat *dst = exec->vtx.copied.buffer; - GLfloat *src = (exec->vtx.buffer_map + - exec->vtx.prim[exec->vtx.prim_count-1].start * - exec->vtx.vertex_size); + const GLfloat *src = (exec->vtx.buffer_map + + exec->vtx.prim[exec->vtx.prim_count-1].start * + exec->vtx.vertex_size); - switch( exec->ctx->Driver.CurrentExecPrimitive ) - { + switch (exec->ctx->Driver.CurrentExecPrimitive) { case GL_POINTS: return 0; case GL_LINES: @@ -95,8 +96,9 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); return i; case GL_LINE_STRIP: - if (nr == 0) + if (nr == 0) { return 0; + } else { _mesa_memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) ); return 1; @@ -104,12 +106,14 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) case GL_LINE_LOOP: case GL_TRIANGLE_FAN: case GL_POLYGON: - if (nr == 0) + if (nr == 0) { return 0; + } else if (nr == 1) { _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); return 1; - } else { + } + else { _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) ); return 2; @@ -122,9 +126,15 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) /* fallthrough */ 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++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); @@ -141,13 +151,14 @@ static GLuint vbo_copy_vertices( struct vbo_exec_context *exec ) /* TODO: populate these as the vertex is defined: */ -static void vbo_exec_bind_arrays( GLcontext *ctx ) +static void +vbo_exec_bind_arrays( GLcontext *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; struct gl_client_array *arrays = exec->vtx.arrays; - GLuint count = exec->vtx.vert_count; - GLubyte *data = (GLubyte *)exec->vtx.buffer_map; + const GLuint count = exec->vtx.vert_count; + const GLubyte *data = (GLubyte *) exec->vtx.buffer_map; const GLuint *map; GLuint attr; GLbitfield varying_inputs = 0x0; @@ -227,7 +238,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) arrays[attr]._MaxElement = count; /* ??? */ data += exec->vtx.attrsz[src] * sizeof(GLfloat); - varying_inputs |= 1<vtx.bufferobj->Name) { GLcontext *ctx = exec->ctx; - if(ctx->Driver.FlushMappedBufferRange) { + if (ctx->Driver.FlushMappedBufferRange) { GLintptr offset = exec->vtx.buffer_used - exec->vtx.bufferobj->Offset; GLsizeiptr length = (exec->vtx.buffer_ptr - exec->vtx.buffer_map) * sizeof(float); - if(length) + if (length) ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, exec->vtx.bufferobj); @@ -265,7 +277,9 @@ static void vbo_exec_vtx_unmap( struct vbo_exec_context *exec ) } } -void vbo_exec_vtx_map( struct vbo_exec_context *exec ) + +void +vbo_exec_vtx_map( struct vbo_exec_context *exec ) { GLcontext *ctx = exec->ctx; GLenum target = GL_ARRAY_BUFFER_ARB; @@ -282,8 +296,7 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) } if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024 && - ctx->Driver.MapBufferRange) - { + ctx->Driver.MapBufferRange) { exec->vtx.buffer_map = (GLfloat *)ctx->Driver.MapBufferRange(ctx, target, @@ -305,12 +318,13 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) VBO_VERT_BUFFER_SIZE, NULL, usage, exec->vtx.bufferobj); - exec->vtx.buffer_map = - (GLfloat *)ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + exec->vtx.buffer_map = (GLfloat *) + ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); exec->vtx.buffer_ptr = exec->vtx.buffer_map; } - if (0) _mesa_printf("map %d..\n", exec->vtx.buffer_used); + if (0) + _mesa_printf("map %d..\n", exec->vtx.buffer_used); } @@ -318,13 +332,12 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec ) /** * Execute the buffer and save copied verts. */ -void vbo_exec_vtx_flush( struct vbo_exec_context *exec, - GLboolean unmap ) +void +vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) { if (0) vbo_exec_debug_verts( exec ); - if (exec->vtx.prim_count && exec->vtx.vert_count) { @@ -345,8 +358,9 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec, vbo_exec_vtx_unmap( exec ); } - if (0) _mesa_printf("%s %d %d\n", __FUNCTION__, exec->vtx.prim_count, - exec->vtx.vert_count); + if (0) + _mesa_printf("%s %d %d\n", __FUNCTION__, exec->vtx.prim_count, + exec->vtx.vert_count); vbo_context(ctx)->draw_prims( ctx, exec->vtx.inputs, @@ -360,7 +374,7 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec, */ if (exec->vtx.bufferobj->Name && !unmap) { vbo_exec_vtx_map( exec ); - } + } } } @@ -372,14 +386,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec, vbo_exec_vtx_unmap( exec ); } - if (unmap) exec->vtx.max_vert = 0; else exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) / (exec->vtx.vertex_size * sizeof(GLfloat))); - exec->vtx.buffer_ptr = exec->vtx.buffer_map; exec->vtx.prim_count = 0; exec->vtx.vert_count = 0; -- cgit v1.2.3 From 1045481dd96dec6e37f4b623b1dbae8af381de75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 13:50:31 -0600 Subject: mesa: fix loop over generic attribs in update_arrays() --- src/mesa/main/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index f18fc8f683..94e37e3dab 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -159,7 +159,7 @@ update_arrays( GLcontext *ctx ) /* 16..31 */ if (ctx->VertexProgram._Current) { - for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) { + for (i = 0; i < Elements(ctx->Array.ArrayObj->VertexAttrib); i++) { if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) { min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement); } -- cgit v1.2.3 From a65f385b8deec6ac1f2ed7a52f7d76ec89e167b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:14:53 -0600 Subject: mesa: minor code simplification --- src/mesa/main/bufferobj.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index a806766386..eefc1b04fa 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -779,6 +779,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]); if (bufObj) { + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint j; ASSERT(bufObj->Name == ids[i]); @@ -791,18 +792,19 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) } /* unbind any vertex pointers bound to this buffer */ - unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->SecondaryColor.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->FogCoord.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->Index.BufferObj, bufObj); - unbind(ctx, &ctx->Array.ArrayObj->EdgeFlag.BufferObj, bufObj); + unbind(ctx, &arrayObj->Vertex.BufferObj, bufObj); + unbind(ctx, &arrayObj->Weight.BufferObj, bufObj); + unbind(ctx, &arrayObj->Normal.BufferObj, bufObj); + unbind(ctx, &arrayObj->Color.BufferObj, bufObj); + unbind(ctx, &arrayObj->SecondaryColor.BufferObj, bufObj); + unbind(ctx, &arrayObj->FogCoord.BufferObj, bufObj); + unbind(ctx, &arrayObj->Index.BufferObj, bufObj); + unbind(ctx, &arrayObj->EdgeFlag.BufferObj, bufObj); for (j = 0; j < MAX_TEXTURE_COORD_UNITS; j++) { - unbind(ctx, &ctx->Array.ArrayObj->TexCoord[j].BufferObj, bufObj); + unbind(ctx, &arrayObj->TexCoord[j].BufferObj, bufObj); } for (j = 0; j < VERT_ATTRIB_MAX; j++) { - unbind(ctx, &ctx->Array.ArrayObj->VertexAttrib[j].BufferObj, bufObj); + unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj); } if (ctx->Array.ArrayBufferObj == bufObj) { -- cgit v1.2.3 From ebb991ca0d7de103dc068397ed91744bf40ee58f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:16:00 -0600 Subject: mesa: use Elements() for loop bound --- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index eefc1b04fa..90daa2e5b8 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -800,10 +800,10 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) unbind(ctx, &arrayObj->FogCoord.BufferObj, bufObj); unbind(ctx, &arrayObj->Index.BufferObj, bufObj); unbind(ctx, &arrayObj->EdgeFlag.BufferObj, bufObj); - for (j = 0; j < MAX_TEXTURE_COORD_UNITS; j++) { + for (j = 0; j < Elements(arrayObj->TexCoord); j++) { unbind(ctx, &arrayObj->TexCoord[j].BufferObj, bufObj); } - for (j = 0; j < VERT_ATTRIB_MAX; j++) { + for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) { unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj); } -- cgit v1.2.3 From b625fbaef2564236357f94eca803a15187e2636d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:22:40 -0600 Subject: vbo: s/32/VERT_ATTRIB_MAX/ --- src/mesa/vbo/vbo_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 7e366d474d..8b726dc8ac 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -68,8 +68,8 @@ struct vbo_context { struct gl_client_array *generic_currval; struct gl_client_array *mat_currval; - GLuint map_vp_none[32]; - GLuint map_vp_arb[32]; + GLuint map_vp_none[VERT_ATTRIB_MAX]; + GLuint map_vp_arb[VERT_ATTRIB_MAX]; GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */ GLfloat CurrentFloatEdgeFlag; -- cgit v1.2.3 From d30163ad4201dcd5a594694ab87be9e59db47edd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:23:02 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/main/dlist.c | 4 ++-- src/mesa/main/varray.c | 4 ++-- src/mesa/vbo/vbo_context.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5120e516e0..dd73a1906b 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6806,10 +6806,10 @@ _mesa_NewList(GLuint name, GLenum mode) /* Reset acumulated list state: */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(ctx->ListState.ActiveAttribSize); i++) ctx->ListState.ActiveAttribSize[i] = 0; - for (i = 0; i < MAT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(ctx->ListState.ActiveMaterialSize); i++) ctx->ListState.ActiveMaterialSize[i] = 0; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 0982dc7977..ff3128b8be 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1079,10 +1079,10 @@ _mesa_print_arrays(GLcontext *ctx) print_array("Normal", -1, &arrayObj->Normal); if (arrayObj->Color.Enabled) print_array("Color", -1, &arrayObj->Color); - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(arrayObj->TexCoord); i++) if (arrayObj->TexCoord[i].Enabled) print_array("TexCoord", i, &arrayObj->TexCoord[i]); - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) if (arrayObj->VertexAttrib[i].Enabled) print_array("Attrib", i, &arrayObj->VertexAttrib[i]); _mesa_printf(" _MaxElement = %u\n", arrayObj->_MaxElement); diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index f193a4bf1e..90025f62fc 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -214,7 +214,7 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) for (i = 0; i < 4; i++) vbo->map_vp_none[28+i] = i; - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(vbo->map_vp_arb); i++) vbo->map_vp_arb[i] = i; } -- cgit v1.2.3 From bf4dfd6563e1ce5cabea415d1e3600ab4abefe81 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:24:21 -0600 Subject: mesa: minor code clean-up --- src/mesa/main/api_arrayelt.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index d124c724c9..703eeebfc3 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1094,48 +1094,49 @@ static void _ae_update_state( GLcontext *ctx ) AEarray *aa = actx->arrays; AEattrib *at = actx->attribs; GLuint i; + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; actx->nr_vbos = 0; /* conventional vertex arrays */ - if (ctx->Array.ArrayObj->Index.Enabled) { - aa->array = &ctx->Array.ArrayObj->Index; + if (arrayObj->Index.Enabled) { + aa->array = &arrayObj->Index; aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (ctx->Array.ArrayObj->EdgeFlag.Enabled) { - aa->array = &ctx->Array.ArrayObj->EdgeFlag; + if (arrayObj->EdgeFlag.Enabled) { + aa->array = &arrayObj->EdgeFlag; aa->offset = _gloffset_EdgeFlagv; check_vbo(actx, aa->array->BufferObj); aa++; } - if (ctx->Array.ArrayObj->Normal.Enabled) { - aa->array = &ctx->Array.ArrayObj->Normal; + if (arrayObj->Normal.Enabled) { + aa->array = &arrayObj->Normal; aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (ctx->Array.ArrayObj->Color.Enabled) { - aa->array = &ctx->Array.ArrayObj->Color; + if (arrayObj->Color.Enabled) { + aa->array = &arrayObj->Color; aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (ctx->Array.ArrayObj->SecondaryColor.Enabled) { - aa->array = &ctx->Array.ArrayObj->SecondaryColor; + if (arrayObj->SecondaryColor.Enabled) { + aa->array = &arrayObj->SecondaryColor; aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (ctx->Array.ArrayObj->FogCoord.Enabled) { - aa->array = &ctx->Array.ArrayObj->FogCoord; + if (arrayObj->FogCoord.Enabled) { + aa->array = &arrayObj->FogCoord; aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - struct gl_client_array *attribArray = &ctx->Array.ArrayObj->TexCoord[i]; + struct gl_client_array *attribArray = &arrayObj->TexCoord[i]; if (attribArray->Enabled) { /* NOTE: we use generic glVertexAttribNV functions here. * If we ever remove GL_NV_vertex_program this will have to change. @@ -1153,7 +1154,7 @@ static void _ae_update_state( GLcontext *ctx ) /* generic vertex attribute arrays */ for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ - struct gl_client_array *attribArray = &ctx->Array.ArrayObj->VertexAttrib[i]; + struct gl_client_array *attribArray = &arrayObj->VertexAttrib[i]; if (attribArray->Enabled) { at->array = attribArray; /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV @@ -1179,18 +1180,18 @@ static void _ae_update_state( GLcontext *ctx ) } /* finally, vertex position */ - if (ctx->Array.ArrayObj->VertexAttrib[0].Enabled) { + if (arrayObj->VertexAttrib[0].Enabled) { /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's * issued as the last (provoking) attribute). */ - aa->array = &ctx->Array.ArrayObj->VertexAttrib[0]; + aa->array = &arrayObj->VertexAttrib[0]; assert(aa->array->Size >= 2); /* XXX fix someday? */ aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - else if (ctx->Array.ArrayObj->Vertex.Enabled) { - aa->array = &ctx->Array.ArrayObj->Vertex; + else if (arrayObj->Vertex.Enabled) { + aa->array = &arrayObj->Vertex; aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; -- cgit v1.2.3 From 180df4d328166a21fa9bb847b52ec1ba8f95dfcc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:27:26 -0600 Subject: mesa: simplify adjust_buffer_object_ref_counts() --- src/mesa/main/attrib.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index a609199504..51b653fb74 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1330,20 +1330,22 @@ _mesa_PopAttrib(void) * counts when pushing/popping the GL_CLIENT_VERTEX_ARRAY_BIT attribute group. */ static void -adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step) +adjust_buffer_object_ref_counts(struct gl_array_object *arrayObj, GLint step) { GLuint i; - array->ArrayObj->Vertex.BufferObj->RefCount += step; - array->ArrayObj->Normal.BufferObj->RefCount += step; - array->ArrayObj->Color.BufferObj->RefCount += step; - array->ArrayObj->SecondaryColor.BufferObj->RefCount += step; - array->ArrayObj->FogCoord.BufferObj->RefCount += step; - array->ArrayObj->Index.BufferObj->RefCount += step; - array->ArrayObj->EdgeFlag.BufferObj->RefCount += step; + + arrayObj->Vertex.BufferObj->RefCount += step; + arrayObj->Weight.BufferObj->RefCount += step; + arrayObj->Normal.BufferObj->RefCount += step; + arrayObj->Color.BufferObj->RefCount += step; + arrayObj->SecondaryColor.BufferObj->RefCount += step; + arrayObj->FogCoord.BufferObj->RefCount += step; + arrayObj->Index.BufferObj->RefCount += step; + arrayObj->EdgeFlag.BufferObj->RefCount += step; for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) - array->ArrayObj->TexCoord[i].BufferObj->RefCount += step; + arrayObj->TexCoord[i].BufferObj->RefCount += step; for (i = 0; i < VERT_ATTRIB_MAX; i++) - array->ArrayObj->VertexAttrib[i].BufferObj->RefCount += step; + arrayObj->VertexAttrib[i].BufferObj->RefCount += step; } @@ -1434,7 +1436,7 @@ _mesa_PushClientAttrib(GLbitfield mask) newnode->next = head; head = newnode; /* bump reference counts on buffer objects */ - adjust_buffer_object_ref_counts(&ctx->Array, 1); + adjust_buffer_object_ref_counts(ctx->Array.ArrayObj, 1); } ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head; @@ -1484,7 +1486,7 @@ _mesa_PopClientAttrib(void) struct gl_array_attrib * data = (struct gl_array_attrib *) node->data; - adjust_buffer_object_ref_counts(&ctx->Array, -1); + adjust_buffer_object_ref_counts(ctx->Array.ArrayObj, -1); ctx->Array.ActiveTexture = data->ActiveTexture; if (data->LockCount != 0) -- cgit v1.2.3 From 2a3d118a8e4c048e5d850a29301c02f886ba09d4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:27:42 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/main/api_arrayelt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 703eeebfc3..f5b7d1e138 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1153,7 +1153,7 @@ static void _ae_update_state( GLcontext *ctx ) } /* generic vertex attribute arrays */ - for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ + for (i = 1; i < Elements(arrayObj->VertexAttrib); i++) { /* skip zero! */ struct gl_client_array *attribArray = &arrayObj->VertexAttrib[i]; if (attribArray->Enabled) { at->array = attribArray; -- cgit v1.2.3 From 8091aa86337b5541e70f0a83bc9b13c55faec559 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:28:24 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/main/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 51b653fb74..476a24434c 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1342,9 +1342,9 @@ adjust_buffer_object_ref_counts(struct gl_array_object *arrayObj, GLint step) arrayObj->FogCoord.BufferObj->RefCount += step; arrayObj->Index.BufferObj->RefCount += step; arrayObj->EdgeFlag.BufferObj->RefCount += step; - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(arrayObj->TexCoord); i++) arrayObj->TexCoord[i].BufferObj->RefCount += step; - for (i = 0; i < VERT_ATTRIB_MAX; i++) + for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) arrayObj->VertexAttrib[i].BufferObj->RefCount += step; } -- cgit v1.2.3 From ce7a049191c14be1d3dd456cdc72463b01ccf34c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:32:37 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/main/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5e0f2d7b1b..ff9dd488c7 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -455,7 +455,7 @@ _mesa_init_current(GLcontext *ctx) GLuint i; /* Init all to (0,0,0,1) */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) { + for (i = 0; i < Elements(ctx->Current.Attrib); i++) { ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); } -- cgit v1.2.3 From 842b4cd3cdb313751647e229a9aa3f0001e03d15 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:32:45 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/state_tracker/st_cb_rasterpos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 7dd2352739..7a9c50b3fc 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -194,7 +194,7 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) rs->stage.destroy = rastpos_destroy; rs->ctx = ctx; - for (i = 0; i < VERT_ATTRIB_MAX; i++) { + for (i = 0; i < Elements(rs->array); i++) { rs->array[i].Size = 4; rs->array[i].Type = GL_FLOAT; rs->array[i].Stride = 0; -- cgit v1.2.3 From 8e3f6c0f96eb22198ec436990acc85d44aca7d8e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:42:26 -0600 Subject: mesa: use Elements() for loop limit --- src/mesa/vbo/vbo_exec_array.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 1e1c0781c2..cbb9b23968 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -117,11 +117,10 @@ static void bind_array_obj( GLcontext *ctx ) } exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &arrayObj->EdgeFlag; - for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) + for (i = 0; i < Elements(arrayObj->TexCoord); i++) exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &arrayObj->TexCoord[i]; - for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { - assert(i < Elements(arrayObj->VertexAttrib)); + for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) { assert(i < Elements(exec->array.generic_array)); exec->array.generic_array[i] = &arrayObj->VertexAttrib[i]; } -- cgit v1.2.3 From 2ead49f98bcc18ab0ebc7942de78e280ec56d77a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 14:57:51 -0600 Subject: mesa: reduce gl_array_object::VertexAttrib[] array from 32 to 16 elements This array was mistakenly dimensioned with VERT_ATTRIB_MAX (32) but it should really be MAX_VERTEX_GENERIC_ATTRIBS (16). The generic vertex attributes are in addition to the conventional arrays (except in NV vertex program mode- they alias/overlay in that case) so the total of all conventional attributes plus generic attributes should total 32 (not 48). --- src/mesa/main/mtypes.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 55bfa2bf41..e3471123c6 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1574,8 +1574,13 @@ struct gl_array_object struct gl_client_array PointSize; /*@}*/ - /** Generic arrays for vertex programs/shaders */ - struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; + /** + * Generic arrays for vertex programs/shaders. + * For NV vertex programs, these attributes alias and take priority + * over the conventional attribs above. For ARB vertex programs and + * GLSL vertex shaders, these attributes are separate. + */ + struct gl_client_array VertexAttrib[MAX_VERTEX_GENERIC_ATTRIBS]; /** Mask of _NEW_ARRAY_* values indicating which arrays are enabled */ GLbitfield _Enabled; -- cgit v1.2.3 From 68d412f31cbf028b1faa1c7fd95b849a95bb762c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 15:35:49 -0600 Subject: mesa: add missing update_min() call in update_arrays() --- src/mesa/main/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index d5bdb63a97..7b41b8f4da 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -196,7 +196,7 @@ update_arrays( GLcontext *ctx ) if (ctx->VertexProgram._Current) { for (i = 0; i < Elements(arrayObj->VertexAttrib); i++) { if (arrayObj->VertexAttrib[i].Enabled) { - min = MIN2(min, arrayObj->VertexAttrib[i]._MaxElement); + min = update_min(min, &arrayObj->VertexAttrib[i]); } } } -- cgit v1.2.3 From 434f9200422a9e937277ca592ef14a63781dec16 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 22 May 2009 23:44:44 +0200 Subject: radeon: reading back to scratch reg through status map doesn't work For some unknown reasons the scratch reg value doesn't endup in the status map at the scratch reg offset, this is a temporary work around until we figure out why it doesn't work. --- src/mesa/drivers/dri/radeon/radeon_bo_legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index 03a6299ed8..6a8da402b1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c @@ -48,6 +48,7 @@ #include "radeon_drm.h" #include "radeon_common.h" #include "radeon_bocs_wrapper.h" +#include "radeon_macros.h" /* no seriously texmem.c is this screwed up */ struct bo_legacy_texture_object { @@ -164,6 +165,7 @@ static int legacy_free_handle(struct bo_manager_legacy *bom, uint32_t handle) static void legacy_get_current_age(struct bo_manager_legacy *boml) { drm_radeon_getparam_t gp; + unsigned char *RADEONMMIO = NULL; int r; if (IS_R300_CLASS(boml->screen)) { @@ -175,8 +177,11 @@ static void legacy_get_current_age(struct bo_manager_legacy *boml) fprintf(stderr, "%s: drmRadeonGetParam: %d\n", __FUNCTION__, r); exit(1); } - } else - boml->current_age = boml->screen->scratch[3]; + } else { + RADEONMMIO = boml->screen->mmio.map; + boml->current_age = boml->screen->scratch[3]; + boml->current_age = INREG(RADEON_GUI_SCRATCH_REG3); + } } static int legacy_is_pending(struct radeon_bo *bo) -- cgit v1.2.3 From 2d30dafaddc2e50697bd1b55235fd45fd08d09fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 22 May 2009 15:49:38 -0600 Subject: mesa: fix warning message in vbo_exec_DrawRangeElements() --- src/mesa/vbo/vbo_exec_array.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index cbb9b23968..2815ba3cc9 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -365,7 +365,8 @@ vbo_exec_DrawRangeElements(GLenum mode, /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " "type 0x%x) index=%u is out of bounds (max=%u)", - start, end, count, type, end); + start, end, count, type, end, + ctx->Array.ArrayObj->_MaxElement); if (0) _mesa_print_arrays(ctx); return; -- cgit v1.2.3 From 7dd184dc4da37233471875df6f40cce0560cb7bc Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Sun, 24 May 2009 14:55:51 +0200 Subject: radeon: Remove drawable & readable from radeon_dri_mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The duplication of state data caused a crash due to double-free on destruction of context, because a variable wasn't correctly null'ed out. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r200/r200_ioctl.c | 30 ++-- src/mesa/drivers/dri/r200/r200_pixel.c | 30 ++-- src/mesa/drivers/dri/r200/r200_state.c | 152 ++++++++++----------- src/mesa/drivers/dri/r200/r200_swtcl.c | 36 ++--- src/mesa/drivers/dri/r300/r300_ioctl.c | 16 +-- src/mesa/drivers/dri/r300/r300_state.c | 18 +-- src/mesa/drivers/dri/radeon/radeon_common.c | 63 +++++---- .../drivers/dri/radeon/radeon_common_context.c | 66 ++++----- .../drivers/dri/radeon/radeon_common_context.h | 27 ++-- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 54 ++++---- src/mesa/drivers/dri/radeon/radeon_lock.c | 8 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 1 + src/mesa/drivers/dri/radeon/radeon_state.c | 128 ++++++++--------- 13 files changed, 310 insertions(+), 319 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 0262aea880..0b3398a730 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Keith Whitwell */ - + #include #include @@ -66,7 +66,7 @@ static void r200UserClear(GLcontext *ctx, GLuint mask) static void r200KernelClear(GLcontext *ctx, GLuint flags) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLint cx, cy, cw, ch, ret; GLuint i; @@ -94,7 +94,7 @@ static void r200KernelClear(GLcontext *ctx, GLuint flags) if ( rmesa->radeon.sarea->last_clear - clear <= 25 ) { break; } - + if (rmesa->radeon.do_usleeps) { UNLOCK_HARDWARE( &rmesa->radeon ); DO_USLEEP( 1 ); @@ -190,7 +190,7 @@ static void r200KernelClear(GLcontext *ctx, GLuint flags) static void r200Clear( GLcontext *ctx, GLbitfield mask ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLuint flags = 0; GLuint color_mask = 0; GLuint orig_mask = mask; @@ -202,7 +202,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask ) { LOCK_HARDWARE( &rmesa->radeon ); UNLOCK_HARDWARE( &rmesa->radeon ); - if ( dPriv->numClipRects == 0 ) + if ( dPriv->numClipRects == 0 ) return; } @@ -236,7 +236,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask ) _swrast_Clear( ctx, mask ); } - if ( !flags ) + if ( !flags ) return; if (rmesa->using_hyperz) { @@ -267,7 +267,7 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask ) * device fd. */ void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size, - GLfloat readfreq, GLfloat writefreq, + GLfloat readfreq, GLfloat writefreq, GLfloat priority) { GET_CURRENT_CONTEXT(ctx); @@ -277,7 +277,7 @@ void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size, int ret; if (R200_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq, + fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq, writefreq, priority); if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->radeon.radeonScreen->gartTextures.map) @@ -294,12 +294,12 @@ void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size, ret = drmCommandWriteRead( rmesa->radeon.radeonScreen->driScreen->fd, DRM_RADEON_ALLOC, &alloc, sizeof(alloc)); - + if (ret) { fprintf(stderr, "%s: DRM_RADEON_ALLOC ret %d\n", __FUNCTION__, ret); return NULL; } - + { char *region_start = (char *)rmesa->radeon.radeonScreen->gartTextures.map; return (void *)(region_start + region_offset); @@ -326,7 +326,7 @@ void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer) region_offset = (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map; - if (region_offset < 0 || + if (region_offset < 0 || region_offset > rmesa->radeon.radeonScreen->gartTextures.size) { fprintf(stderr, "offset %d outside range 0..%d\n", region_offset, rmesa->radeon.radeonScreen->gartTextures.size); @@ -335,12 +335,12 @@ void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer) memfree.region = RADEON_MEM_REGION_GART; memfree.region_offset = region_offset; - + ret = drmCommandWrite( rmesa->radeon.radeonScreen->driScreen->fd, DRM_RADEON_FREE, &memfree, sizeof(memfree)); - - if (ret) + + if (ret) fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret); } @@ -374,7 +374,7 @@ GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, if (R200_DEBUG & DEBUG_IOCTL) fprintf(stderr, "r200IsGartMemory( %p ) : %d\n", pointer, valid ); - + return valid; } diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 354daef07f..654f2c6ae9 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -65,8 +65,8 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format, return GL_FALSE; } - if ( type == GL_UNSIGNED_INT_8_8_8_8_REV && - cpp == 4 && + if ( type == GL_UNSIGNED_INT_8_8_8_8_REV && + cpp == 4 && format == GL_BGRA ) { if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s: passed 2\n", __FUNCTION__); @@ -83,7 +83,7 @@ static GLboolean check_color_per_fragment_ops( const GLcontext *ctx ) { int result; - result = (!( ctx->Color.AlphaEnabled || + result = (!( ctx->Color.AlphaEnabled || ctx->Depth.Test || ctx->Fog.Enabled || ctx->Scissor.Enabled || @@ -96,7 +96,7 @@ check_color_per_fragment_ops( const GLcontext *ctx ) ctx->Texture._EnabledUnits ) && ctx->Current.RasterPosValid); - + return result; } @@ -163,7 +163,7 @@ r200TryReadPixels( GLcontext *ctx, /* Only accelerate reading to GART buffers. */ - if ( !r200IsGartMemory(rmesa, pixels, + if ( !r200IsGartMemory(rmesa, pixels, pitch * height * rmesa->radeon.radeonScreen->cpp ) ) { if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s: dest not GART\n", __FUNCTION__); @@ -224,7 +224,7 @@ r200TryReadPixels( GLcontext *ctx, drm_clip_rect_t *box = dPriv->pClipRects; int i; - r200EmitWait( rmesa, RADEON_WAIT_3D ); + r200EmitWait( rmesa, RADEON_WAIT_3D ); y = dPriv->h - y - height; x += dPriv->x; @@ -241,7 +241,7 @@ r200TryReadPixels( GLcontext *ctx, GLint by = box[i].y1; GLint bw = box[i].x2 - bx; GLint bh = box[i].y2 - by; - + if (bx < x) bw -= x - bx, bx = x; if (by < y) bh -= y - by, by = y; if (bx + bw > x + width) bw = x + width - bx; @@ -277,9 +277,9 @@ r200ReadPixels( GLcontext *ctx, if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); - if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack, + if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack, pixels)) - _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, + _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, pixels); } @@ -293,7 +293,7 @@ static void do_draw_pix( GLcontext *ctx, GLuint planemask) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); drm_clip_rect_t *box = dPriv->pClipRects; struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0]; driRenderbuffer *drb = (driRenderbuffer *) rb; @@ -325,7 +325,7 @@ static void do_draw_pix( GLcontext *ctx, rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ ); y -= height; /* cope with pixel zoom */ - + if (!clip_pixelrect(ctx, ctx->DrawBuffer, &x, &y, &width, &height, &size)) { @@ -409,7 +409,7 @@ r200TryDrawPixels( GLcontext *ctx, if (planemask != ~0) return GL_FALSE; /* fix me -- should be possible */ - /* Can't do conversions on GART reads/draws. + /* Can't do conversions on GART reads/draws. */ if ( !r200IsGartMemory( rmesa, pixels, size ) ) { if (R200_DEBUG & DEBUG_PIXEL) @@ -484,9 +484,9 @@ r200Bitmap( GLcontext *ctx, GLint px, GLint py, void r200InitPixelFuncs( GLcontext *ctx ) { if (!getenv("R200_NO_BLITS")) { - ctx->Driver.ReadPixels = r200ReadPixels; - ctx->Driver.DrawPixels = r200DrawPixels; - if (getenv("R200_HW_BITMAP")) + ctx->Driver.ReadPixels = r200ReadPixels; + ctx->Driver.DrawPixels = r200DrawPixels; + if (getenv("R200_HW_BITMAP")) ctx->Driver.Bitmap = r200Bitmap; } } diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 6802e190a7..f8ebe0df57 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -79,7 +79,7 @@ static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) switch ( func ) { case GL_NEVER: - pp_misc |= R200_ALPHA_TEST_FAIL; + pp_misc |= R200_ALPHA_TEST_FAIL; break; case GL_LESS: pp_misc |= R200_ALPHA_TEST_LESS; @@ -479,7 +479,7 @@ static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) } } break; - case GL_FOG_COLOR: + case GL_FOG_COLOR: R200_STATECHANGE( rmesa, ctx ); UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color ); i = radeonPackColor( 4, col[0], col[1], col[2], 0 ); @@ -507,7 +507,7 @@ static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) if (out_0 != rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0]) { R200_STATECHANGE( rmesa, vtx ); - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] = out_0; + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] = out_0; } break; @@ -696,7 +696,7 @@ static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) r200ContextPtr rmesa = R200_CONTEXT(ctx); R200_STATECHANGE( rmesa, lin ); - rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = + rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern)); } @@ -720,10 +720,10 @@ static void r200ColorMask( GLcontext *ctx, if (!(r && g && b && a)) flag |= R200_PLANE_MASK_ENABLE; - if ( rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] != flag ) { - R200_STATECHANGE( rmesa, ctx ); - rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = flag; - } + if ( rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] != flag ) { + R200_STATECHANGE( rmesa, ctx ); + rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = flag; + } if ( rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK] != mask ) { R200_STATECHANGE( rmesa, msk ); @@ -774,7 +774,7 @@ static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask ) /* FIXME: Use window x,y offsets into stipple RAM. */ stipple.mask = rmesa->state.stipple.mask; - drmCommandWrite( rmesa->radeon.dri.fd, DRM_RADEON_STIPPLE, + drmCommandWrite( rmesa->radeon.dri.fd, DRM_RADEON_STIPPLE, &stipple, sizeof(stipple) ); UNLOCK_HARDWARE( &rmesa->radeon ); } @@ -785,7 +785,7 @@ static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; /* Can't generally do unfilled via tcl, but some good special - * cases work. + * cases work. */ TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag); if (rmesa->radeon.TclFallback) { @@ -827,34 +827,34 @@ static void r200UpdateSpecular( GLcontext *ctx ) if (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) | - (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); + (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0; rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1; rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE; p |= R200_SPECULAR_ENABLE; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= + rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_DIFFUSE_SPECULAR_COMBINE; } else if (ctx->Light.Enabled) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= + ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_0; rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHTING_ENABLE; } else if (ctx->Fog.ColorSumEnabled ) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT) | - (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); + (R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); p |= R200_SPECULAR_ENABLE; } else { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= + ((R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT)); } if (ctx->Fog.Enabled) { - rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= - ((R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); + rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_VTXFMT_0] |= + ((R200_VTX_FP_RGBA << R200_VTX_COLOR_1_SHIFT)); rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL] |= R200_OUTPUT_COLOR_1; } @@ -865,7 +865,7 @@ static void r200UpdateSpecular( GLcontext *ctx ) /* Update vertex/render formats */ - if (rmesa->radeon.TclFallback) { + if (rmesa->radeon.TclFallback) { r200ChooseRenderState( ctx ); r200ChooseVertexState( ctx ); } @@ -877,7 +877,7 @@ static void r200UpdateSpecular( GLcontext *ctx ) */ -/* Update on colormaterial, material emmissive/ambient, +/* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ static void update_global_ambient( GLcontext *ctx ) @@ -891,23 +891,23 @@ static void update_global_ambient( GLcontext *ctx ) */ if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] & ((3 << R200_FRONT_EMISSIVE_SOURCE_SHIFT) | - (3 << R200_FRONT_AMBIENT_SOURCE_SHIFT))) == 0) + (3 << R200_FRONT_AMBIENT_SOURCE_SHIFT))) == 0) { - COPY_3V( &fcmd[GLT_RED], + COPY_3V( &fcmd[GLT_RED], ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]); ACC_SCALE_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]); - } + } else { COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient ); } - + R200_DB_STATECHANGE(rmesa, &rmesa->hw.glt); } -/* Update on change to +/* Update on change to * - light[p].colors * - light[p].enabled */ @@ -921,10 +921,10 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) r200ContextPtr rmesa = R200_CONTEXT(ctx); float *fcmd = (float *)R200_DB_STATE( lit[p] ); - COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient ); + COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient ); COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse ); COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular ); - + R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] ); } } @@ -944,7 +944,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) if (ctx->Light.ColorMaterialEnabled) { GLuint mask = ctx->Light.ColorMaterialBitmask; - + if (mask & MAT_BIT_FRONT_EMISSION) { light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << R200_FRONT_EMISSIVE_SOURCE_SHIFT); @@ -960,7 +960,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) else light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_AMBIENT_SOURCE_SHIFT); - + if (mask & MAT_BIT_FRONT_DIFFUSE) { light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << R200_FRONT_DIFFUSE_SOURCE_SHIFT); @@ -968,7 +968,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) else light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_DIFFUSE_SOURCE_SHIFT); - + if (mask & MAT_BIT_FRONT_SPECULAR) { light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << R200_FRONT_SPECULAR_SOURCE_SHIFT); @@ -977,7 +977,7 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) light_model_ctl1 |= (R200_LM1_SOURCE_MATERIAL_0 << R200_FRONT_SPECULAR_SOURCE_SHIFT); } - + if (mask & MAT_BIT_BACK_EMISSION) { light_model_ctl1 |= (R200_LM1_SOURCE_VERTEX_COLOR_0 << R200_BACK_EMISSIVE_SOURCE_SHIFT); @@ -1027,8 +1027,8 @@ static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) R200_STATECHANGE( rmesa, tcl ); rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1] = light_model_ctl1; } - - + + } void r200UpdateMaterial( GLcontext *ctx ) @@ -1038,7 +1038,7 @@ void r200UpdateMaterial( GLcontext *ctx ) GLfloat *fcmd = (GLfloat *)R200_DB_STATE( mtl[0] ); GLfloat *fcmd2 = (GLfloat *)R200_DB_STATE( mtl[1] ); GLuint mask = ~0; - + /* Might be possible and faster to update everything unconditionally? */ if (ctx->Light.ColorMaterialEnabled) mask &= ~ctx->Light.ColorMaterialBitmask; @@ -1124,7 +1124,7 @@ void r200UpdateMaterial( GLcontext *ctx ) * * which are calculated in light.c and are correct for the current * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW - * and _MESA_NEW_NEED_EYE_COORDS. + * and _MESA_NEW_NEED_EYE_COORDS. */ static void update_light( GLcontext *ctx ) { @@ -1141,8 +1141,8 @@ static void update_light( GLcontext *ctx ) tmp &= ~R200_LIGHT_IN_MODELSPACE; else tmp |= R200_LIGHT_IN_MODELSPACE; - - if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]) + + if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]) { R200_STATECHANGE( rmesa, tcl ); rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] = tmp; @@ -1166,10 +1166,10 @@ static void update_light( GLcontext *ctx ) if (ctx->Light.Light[p].Enabled) { struct gl_light *l = &ctx->Light.Light[p]; GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] ); - + if (l->EyePosition[3] == 0.0) { - COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm ); - COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm ); + COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm ); + COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm ); fcmd[LIT_POSITION_W] = 0; fcmd[LIT_DIRECTION_W] = 0; } else { @@ -1193,21 +1193,21 @@ static void r200Lightfv( GLcontext *ctx, GLenum light, GLint p = light - GL_LIGHT0; struct gl_light *l = &ctx->Light.Light[p]; GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd; - + switch (pname) { - case GL_AMBIENT: + case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: update_light_colors( ctx, p ); break; - case GL_SPOT_DIRECTION: - /* picked up in update_light */ + case GL_SPOT_DIRECTION: + /* picked up in update_light */ break; case GL_POSITION: { - /* positions picked up in update_light, but can do flag here */ + /* positions picked up in update_light, but can do flag here */ GLuint flag = (p&1)? R200_LIGHT_1_IS_LOCAL : R200_LIGHT_0_IS_LOCAL; GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2; @@ -1323,7 +1323,7 @@ static void r200LightModelfv( GLcontext *ctx, GLenum pname, r200ContextPtr rmesa = R200_CONTEXT(ctx); switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: + case GL_LIGHT_MODEL_AMBIENT: update_global_ambient( ctx ); break; @@ -1582,7 +1582,7 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - rmesa->radeon.state.stencil.clear = + rmesa->radeon.state.stencil.clear = ((GLuint) (ctx->Stencil.Clear & 0xff) | (0xff << R200_STENCIL_MASK_SHIFT) | ((ctx->Stencil.WriteMask[0] & 0xff) << R200_STENCIL_WRITEMASK_SHIFT)); @@ -1607,7 +1607,7 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) void r200UpdateWindow( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1663,7 +1663,7 @@ static void r200DepthRange( GLcontext *ctx, GLclampd nearval, void r200UpdateViewportOffset( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = (GLfloat)dPriv->x; GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1693,8 +1693,8 @@ void r200UpdateViewportOffset( GLcontext *ctx ) R200_STIPPLE_Y_OFFSET_MASK); /* add magic offsets, then invert */ - stx = 31 - ((rmesa->radeon.dri.drawable->x - 1) & R200_STIPPLE_COORD_MASK); - sty = 31 - ((rmesa->radeon.dri.drawable->y + rmesa->radeon.dri.drawable->h - 1) + stx = 31 - ((dPriv->x - 1) & R200_STIPPLE_COORD_MASK); + sty = 31 - ((dPriv->y + dPriv->h - 1) & R200_STIPPLE_COORD_MASK); m |= ((stx << R200_STIPPLE_X_OFFSET_SHIFT) | @@ -1808,7 +1808,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: + case GL_CLIP_PLANE5: p = cap-GL_CLIP_PLANE0; R200_STATECHANGE( rmesa, tcl ); if (state) { @@ -1860,7 +1860,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_TCL_FOG_MASK; } r200UpdateSpecular( ctx ); /* for PK_SPEC */ - if (rmesa->radeon.TclFallback) + if (rmesa->radeon.TclFallback) r200ChooseVertexState( ctx ); _mesa_allow_light_in_model( ctx, !state ); break; @@ -1875,13 +1875,13 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_LIGHT7: R200_STATECHANGE(rmesa, tcl); p = cap - GL_LIGHT0; - if (p&1) + if (p&1) flag = (R200_LIGHT_1_ENABLE | - R200_LIGHT_1_ENABLE_AMBIENT | + R200_LIGHT_1_ENABLE_AMBIENT | R200_LIGHT_1_ENABLE_SPECULAR); else flag = (R200_LIGHT_0_ENABLE | - R200_LIGHT_0_ENABLE_AMBIENT | + R200_LIGHT_0_ENABLE_AMBIENT | R200_LIGHT_0_ENABLE_SPECULAR); if (state) @@ -1889,7 +1889,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) else rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag; - /* + /* */ update_light_colors( ctx, p ); break; @@ -2043,7 +2043,7 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_TEXTURE_GEN_T: /* Picked up in r200UpdateTextureState. */ - rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE; + rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE; break; case GL_COLOR_SUM_EXT: @@ -2160,7 +2160,7 @@ void r200LightingSpaceChange( GLcontext *ctx ) r200ContextPtr rmesa = R200_CONTEXT(ctx); GLboolean tmp; - if (R200_DEBUG & DEBUG_STATE) + if (R200_DEBUG & DEBUG_STATE) fprintf(stderr, "%s %d BEFORE %x\n", __FUNCTION__, ctx->_NeedEyeCoords, rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]); @@ -2176,7 +2176,7 @@ void r200LightingSpaceChange( GLcontext *ctx ) rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_RESCALE_NORMALS; } - if (R200_DEBUG & DEBUG_STATE) + if (R200_DEBUG & DEBUG_STATE) fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords, rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0]); } @@ -2219,7 +2219,7 @@ static void update_texturematrix( GLcontext *ctx ) GLuint compsel = rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]; int unit; - if (R200_DEBUG & DEBUG_STATE) + if (R200_DEBUG & DEBUG_STATE) fprintf(stderr, "%s before COMPSEL: %x\n", __FUNCTION__, rmesa->hw.vtx.cmd[VTX_TCL_OUTPUT_COMPSEL]); @@ -2227,7 +2227,7 @@ static void update_texturematrix( GLcontext *ctx ) rmesa->TexMatCompSel = 0; for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) { - if (!ctx->Texture.Unit[unit]._ReallyEnabled) + if (!ctx->Texture.Unit[unit]._ReallyEnabled) continue; if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) { @@ -2237,21 +2237,21 @@ static void update_texturematrix( GLcontext *ctx ) rmesa->TexMatCompSel |= R200_OUTPUT_TEX_0 << unit; if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) { - /* Need to preconcatenate any active texgen + /* Need to preconcatenate any active texgen * obj/eyeplane matrices: */ _math_matrix_mul_matrix( &rmesa->tmpmat, - ctx->TextureMatrixStack[unit].Top, + ctx->TextureMatrixStack[unit].Top, &rmesa->TexGenMatrix[unit] ); upload_matrix( rmesa, rmesa->tmpmat.m, R200_MTX_TEX0+unit ); - } + } else { - upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m, + upload_matrix( rmesa, ctx->TextureMatrixStack[unit].Top->m, R200_MTX_TEX0+unit ); } } else if (rmesa->TexGenEnabled & (R200_TEXMAT_0_ENABLE << unit)) { - upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m, + upload_matrix( rmesa, rmesa->TexGenMatrix[unit].m, R200_MTX_TEX0+unit ); } } @@ -2277,7 +2277,7 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) int i; radeon_validate_reset_bos(&rmesa->radeon); - + rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { @@ -2295,7 +2295,7 @@ static GLboolean r200ValidateBuffers(GLcontext *ctx) for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { radeonTexObj *t; - + if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; @@ -2323,7 +2323,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) _mesa_update_framebuffer(ctx); /* this updates the DrawBuffer's Width/Height if it's a FBO */ _mesa_update_draw_buffer_bounds(ctx); - + R200_STATECHANGE(rmesa, ctx); } @@ -2341,7 +2341,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) /* Need an event driven matrix update? */ - if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) + if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, R200_MTX_MVP ); /* Need these for lighting (shouldn't upload otherwise) @@ -2365,7 +2365,7 @@ GLboolean r200ValidateState( GLcontext *ctx ) /* emit all active clip planes if projection matrix changes. */ if (new_state & (_NEW_PROJECTION)) { - if (ctx->Transform.ClipPlanesEnabled) + if (ctx->Transform.ClipPlanesEnabled) r200UpdateClipPlanes( ctx ); } @@ -2437,7 +2437,7 @@ static void r200WrapRunPipeline( GLcontext *ctx ) } /* Run the pipeline. - */ + */ _tnl_run_pipeline( ctx ); if (has_material) { diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 712da98077..83e70b586d 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -56,7 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /*********************************************************************** - * Initialization + * Initialization ***********************************************************************/ #define EMIT_ATTR( ATTR, STYLE, F0 ) \ @@ -118,7 +118,7 @@ static void r200SetVertexFormat( GLcontext *ctx ) } rmesa->swtcl.coloroffset = offset; -#if MESA_LITTLE_ENDIAN +#if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) ); #else EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR, (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) ); @@ -129,7 +129,7 @@ static void r200SetVertexFormat( GLcontext *ctx ) if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 ) || RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_FOG )) { -#if MESA_LITTLE_ENDIAN +#if MESA_LITTLE_ENDIAN if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_COLOR1 )) { rmesa->swtcl.specoffset = offset; EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB, (R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT) ); @@ -192,7 +192,7 @@ static void r200SetVertexFormat( GLcontext *ctx ) rmesa->radeon.swtcl.vertex_size = _tnl_install_attrs( ctx, - rmesa->radeon.swtcl.vertex_attrs, + rmesa->radeon.swtcl.vertex_attrs, rmesa->radeon.swtcl.vertex_attr_count, NULL, 0 ); rmesa->radeon.swtcl.vertex_size /= 4; @@ -278,7 +278,7 @@ void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) rmesa->radeon.dma.current, current_offset); - + r200EmitVbufPrim( rmesa, rmesa->radeon.swtcl.hw_primitive, rmesa->radeon.swtcl.numverts); @@ -338,7 +338,7 @@ static void r200ResetLineStipple( GLcontext *ctx ); r200ContextPtr rmesa = R200_CONTEXT(ctx); \ const char *r200verts = (char *)rmesa->radeon.swtcl.verts; #define VERT(x) (radeonVertex *)(r200verts + ((x) * vertsize * sizeof(int))) -#define VERTEX radeonVertex +#define VERTEX radeonVertex #define DO_DEBUG_VERTS (1 && (R200_DEBUG & DEBUG_VERTS)) #undef TAG @@ -539,7 +539,7 @@ void r200ChooseRenderState( GLcontext *ctx ) GLuint index = 0; GLuint flags = ctx->_TriangleCaps; - if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback) + if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback) return; if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT; @@ -597,7 +597,7 @@ static void r200RenderPrimitive( GLcontext *ctx, GLenum prim ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); rmesa->radeon.swtcl.render_primitive = prim; - if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED)) + if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED)) r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) ); } @@ -695,7 +695,7 @@ void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode ) /** * Cope with depth operations by drawing individual pixels as points. - * + * * \todo * The way the vertex state is set in this routine is hokey. It seems to * work, but it's very hackish. This whole routine is pretty hackish. If @@ -710,14 +710,14 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, const GLubyte *bitmap ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - const GLfloat *rc = ctx->Current.RasterColor; + const GLfloat *rc = ctx->Current.RasterColor; GLint row, col; radeonVertex vert; GLuint orig_vte; GLuint h; - /* Turn off tcl. + /* Turn off tcl. */ TCL_FALLBACK( ctx, R200_TCL_FALLBACK_BITMAP, 1 ); @@ -768,7 +768,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, R200_VPORT_Z_SCALE_ENA | R200_VPORT_X_OFFSET_ENA | R200_VPORT_Y_OFFSET_ENA | - R200_VPORT_Z_OFFSET_ENA); + R200_VPORT_Z_OFFSET_ENA); /* Turn off other stuff: Stipple?, texture?, blending?, etc. */ @@ -813,14 +813,14 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, */ LOCK_HARDWARE( &rmesa->radeon ); UNLOCK_HARDWARE( &rmesa->radeon ); - h = rmesa->radeon.dri.drawable->h + rmesa->radeon.dri.drawable->y; - px += rmesa->radeon.dri.drawable->x; + h = radeon_get_drawable(&rmesa->radeon)->h + radeon_get_drawable(&rmesa->radeon)->y; + px += radeon_get_drawable(&rmesa->radeon)->x; /* Clipping handled by existing mechansims in r200_ioctl.c? */ for (row=0; rowLsbFirst) { @@ -899,9 +899,9 @@ void r200InitSwtcl( GLcontext *ctx ) tnl->Driver.Render.Interp = _tnl_interp; /* FIXME: what are these numbers? */ - _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12, + _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12, 36 * sizeof(GLfloat) ); - + rmesa->radeon.swtcl.verts = (GLubyte *)tnl->clipspace.vertex_buf; rmesa->radeon.swtcl.RenderIndex = ~0; rmesa->radeon.swtcl.render_primitive = GL_TRIANGLES; diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 6766eb3eae..104079b4db 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -79,7 +79,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, { BATCH_LOCALS(&r300->radeon); GLcontext *ctx = r300->radeon.glCtx; - __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); GLuint cbpitch = 0; r300ContextPtr rmesa = r300; @@ -200,7 +200,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, OUT_BATCH_FLOAT32(ctx->Color.ClearColor[2]); OUT_BATCH_FLOAT32(ctx->Color.ClearColor[3]); } - + r300EmitCacheFlush(rmesa); cp_wait(&r300->radeon, R300_WAIT_3D | R300_WAIT_3D_CLEAN); @@ -213,7 +213,7 @@ static void r300EmitClearState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); BATCH_LOCALS(&r300->radeon); - __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); int i; int has_tcl; int is_r500 = 0; @@ -447,7 +447,7 @@ static void r300EmitClearState(GLcontext * ctx) R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 | R500_ALU_RGBA_A_SWIZ_0; - + r500fp.cmd[7] = 0; emit_r500fp(ctx, &r500fp); } @@ -541,9 +541,9 @@ static void r300EmitClearState(GLcontext * ctx) } static void r300KernelClear(GLcontext *ctx, GLuint flags) -{ +{ r300ContextPtr r300 = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); struct radeon_framebuffer *rfb = dPriv->driverPrivate; struct radeon_renderbuffer *rrb; struct radeon_renderbuffer *rrbd; @@ -565,7 +565,7 @@ static void r300KernelClear(GLcontext *ctx, GLuint flags) r300ClearBuffer(r300, CLEARBUFFER_COLOR, rrb, NULL); bits = 0; } - + if (flags & BUFFER_BIT_FRONT_LEFT) { rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_FRONT_LEFT); r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, rrb, rrbd); @@ -590,7 +590,7 @@ static void r300KernelClear(GLcontext *ctx, GLuint flags) static void r300Clear(GLcontext * ctx, GLbitfield mask) { r300ContextPtr r300 = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); GLbitfield swrast_mask = 0, tri_mask = 0; int i; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index efbe5cacab..582e8c27e3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -967,7 +967,7 @@ static void r300StencilOpSeparate(GLcontext * ctx, GLenum face, static void r300UpdateWindow(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1020,7 +1020,7 @@ static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) void r300UpdateViewportOffset(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = ((radeonContextPtr) rmesa)->dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = (GLfloat) dPriv->x; GLfloat yoffset = (GLfloat) dPriv->y + dPriv->h; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1052,12 +1052,14 @@ r300FetchStateParameter(GLcontext * ctx, switch (state[0]) { case STATE_INTERNAL: switch (state[1]) { - case STATE_R300_WINDOW_DIMENSION: - value[0] = r300->radeon.dri.drawable->w * 0.5f; /* width*0.5 */ - value[1] = r300->radeon.dri.drawable->h * 0.5f; /* height*0.5 */ - value[2] = 0.5F; /* for moving range [-1 1] -> [0 1] */ - value[3] = 1.0F; /* not used */ - break; + case STATE_R300_WINDOW_DIMENSION: { + __DRIdrawablePrivate * drawable = radeon_get_drawable(&r300->radeon); + value[0] = drawable->w * 0.5f; /* width*0.5 */ + value[1] = drawable->h * 0.5f; /* height*0.5 */ + value[2] = 0.5F; /* for moving range [-1 1] -> [0 1] */ + value[3] = 1.0F; /* not used */ + break; + } case STATE_R300_TEXRECT_FACTOR:{ struct gl_texture_object *t = diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 76e884d705..e2e0ba07a3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -153,7 +153,7 @@ void radeon_get_cliprects(radeonContextPtr radeon, unsigned int *num_cliprects, int *x_off, int *y_off) { - __DRIdrawablePrivate *dPriv = radeon->dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(radeon); struct radeon_framebuffer *rfb = dPriv->driverPrivate; if (radeon->constant_cliprect) { @@ -185,15 +185,15 @@ void radeon_get_cliprects(radeonContextPtr radeon, */ void radeonSetCliprects(radeonContextPtr radeon) { - __DRIdrawablePrivate *const drawable = radeon->dri.drawable; - __DRIdrawablePrivate *const readable = radeon->dri.readable; + __DRIdrawablePrivate *const drawable = radeon_get_drawable(radeon); + __DRIdrawablePrivate *const readable = radeon_get_readable(radeon); struct radeon_framebuffer *const draw_rfb = drawable->driverPrivate; struct radeon_framebuffer *const read_rfb = readable->driverPrivate; int x_off, y_off; radeon_get_cliprects(radeon, &radeon->pClipRects, &radeon->numClipRects, &x_off, &y_off); - + if ((draw_rfb->base.Width != drawable->w) || (draw_rfb->base.Height != drawable->h)) { _mesa_resize_framebuffer(radeon->glCtx, &draw_rfb->base, @@ -221,9 +221,9 @@ void radeonUpdateScissor( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - if ( rmesa->dri.drawable ) { - __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - + if ( radeon_get_drawable(rmesa) ) { + __DRIdrawablePrivate *dPriv = radeon_get_drawable(rmesa); + int x = ctx->Scissor.X; int y = dPriv->h - ctx->Scissor.Y - ctx->Scissor.Height; int w = ctx->Scissor.X + ctx->Scissor.Width - 1; @@ -425,11 +425,11 @@ void radeonCopyBuffer( __DRIdrawablePrivate *dPriv, radeonContextPtr rmesa; struct radeon_framebuffer *rfb; GLint nbox, i, ret; - + assert(dPriv); assert(dPriv->driContextPriv); assert(dPriv->driContextPriv->driverPrivate); - + rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; LOCK_HARDWARE(rmesa); @@ -506,7 +506,7 @@ static int radeonScheduleSwap(__DRIdrawablePrivate *dPriv, GLboolean *missed_tar UNLOCK_HARDWARE(rmesa); driWaitForVBlank(dPriv, missed_target); - + return 0; } @@ -540,7 +540,7 @@ static GLboolean radeonPageFlip( __DRIdrawablePrivate *dPriv ) radeon->sarea->nbox = 1; ret = drmCommandNone( radeon->dri.fd, DRM_RADEON_FLIP ); - + UNLOCK_HARDWARE(radeon); if ( ret ) { @@ -638,7 +638,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) struct radeon_renderbuffer *rrbDepth = NULL, *rrbStencil = NULL, *rrbColor = NULL; uint32_t offset = 0; - + if (!fb) { /* this can happen during the initial context initialization */ @@ -650,7 +650,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) radeon->vtbl.fallback(ctx, RADEON_FALLBACK_DRAW_BUFFER, GL_TRUE); return; } - + /* Do this here, note core Mesa, since this function is called from * many places within the driver. */ @@ -737,7 +737,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); else ctx->NewState |= _NEW_POLYGON; - + /* * Update depth test state */ @@ -751,7 +751,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) } else { ctx->NewState |= (_NEW_DEPTH | _NEW_STENCIL); } - + _mesa_reference_renderbuffer(&radeon->state.depth.rb, &rrbDepth->base); _mesa_reference_renderbuffer(&radeon->state.color.rb, &rrbColor->base); radeon->state.color.draw_offset = offset; @@ -762,7 +762,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) ctx->Driver.Viewport(ctx, ctx->Viewport.X, ctx->Viewport.Y, ctx->Viewport.Width, ctx->Viewport.Height); } else { - + } #endif ctx->NewState |= _NEW_VIEWPORT; @@ -814,7 +814,7 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) radeon->dri.context->driDrawablePriv); } } - + radeon_draw_buffer(ctx, ctx->DrawBuffer); } @@ -836,7 +836,7 @@ void radeonReadBuffer( GLcontext *ctx, GLenum mode ) */ void radeonUpdatePageFlipping(radeonContextPtr radeon) { - struct radeon_framebuffer *rfb = radeon->dri.drawable->driverPrivate; + struct radeon_framebuffer *rfb = radeon_get_drawable(radeon)->driverPrivate; rfb->pf_active = radeon->sarea->pfState; rfb->pf_current_page = radeon->sarea->pfCurrentPage; @@ -869,7 +869,6 @@ void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei he old_viewport = ctx->Driver.Viewport; ctx->Driver.Viewport = NULL; - radeon->dri.drawable = driContext->driDrawablePriv; radeon_window_moved(radeon); radeon_draw_buffer(ctx, radeon->glCtx->DrawBuffer); ctx->Driver.Viewport = old_viewport; @@ -962,7 +961,7 @@ static INLINE void radeonEmitAtoms(radeonContextPtr radeon, GLboolean dirty) } } } - + COMMIT_BATCH(); } @@ -1032,7 +1031,7 @@ void radeonEmitState(radeonContextPtr radeon) if (!radeon->cmdbuf.cs->cdw) { if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "Begin reemit state\n"); - + radeonEmitAtoms(radeon, GL_FALSE); } @@ -1064,7 +1063,7 @@ void radeonFlush(GLcontext *ctx) radeon->dma.flush( ctx ); radeonEmitState(radeon); - + if (radeon->cmdbuf.cs->cdw) rcommonFlushCmdBuf(radeon, __FUNCTION__); @@ -1073,8 +1072,8 @@ void radeonFlush(GLcontext *ctx) if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) && (screen->dri2.loader->flushFrontBuffer != NULL)) { - (*screen->dri2.loader->flushFrontBuffer)(radeon->dri.drawable, - radeon->dri.drawable->loaderPrivate); + __DRIdrawablePrivate * drawable = radeon_get_drawable(radeon); + (*screen->dri2.loader->flushFrontBuffer)(drawable, drawable->loaderPrivate); /* Only clear the dirty bit if front-buffer rendering is no longer * enabled. This is done so that the dirty bit can only be set in @@ -1161,7 +1160,7 @@ int rcommonFlushCmdBuf(radeonContextPtr rmesa, const char *caller) int ret; radeonReleaseDmaRegion(rmesa); - + LOCK_HARDWARE(rmesa); ret = rcommonFlushCmdBufLocked(rmesa, caller); UNLOCK_HARDWARE(rmesa); @@ -1223,7 +1222,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) rmesa->cmdbuf.cs = radeon_cs_create(rmesa->cmdbuf.csm, size); assert(rmesa->cmdbuf.cs != NULL); rmesa->cmdbuf.size = size; - + if (!rmesa->radeonScreen->kernel_mm) { radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, rmesa->radeonScreen->texSize[0]); radeon_cs_set_limit(rmesa->cmdbuf.cs, RADEON_GEM_DOMAIN_GTT, rmesa->radeonScreen->gartTextures.size); @@ -1334,7 +1333,7 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) unsigned int saved_active_texture; assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | - BUFFER_BIT_STENCIL)) == 0); + BUFFER_BIT_STENCIL)) == 0); _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | @@ -1346,7 +1345,7 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) GL_CURRENT_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); saved_active_texture = ctx->Texture.CurrentUnit; - + /* Disable existing GL state we don't want to apply to a clear. */ _mesa_Disable(GL_ALPHA_TEST); _mesa_Disable(GL_BLEND); @@ -1375,10 +1374,10 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) saved_shader_program = ctx->Shader.CurrentProgram->Name; _mesa_UseProgramObjectARB(0); } - + if (ctx->Texture._EnabledUnits != 0) { int i; - + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { _mesa_ActiveTextureARB(GL_TEXTURE0 + i); _mesa_Disable(GL_TEXTURE_1D); @@ -1394,14 +1393,14 @@ void radeon_clear_tris(GLcontext *ctx, GLbitfield mask) } } } - + #if FEATURE_ARB_vertex_buffer_object _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); #endif radeon_meta_set_passthrough_transform(rmesa); - + for (i = 0; i < 4; i++) { color[i][0] = ctx->Color.ClearColor[0]; color[i][1] = ctx->Color.ClearColor[1]; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 622bb98f3e..e9967986a3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -147,8 +147,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, /* DRI fields */ radeon->dri.context = driContextPriv; radeon->dri.screen = sPriv; - radeon->dri.drawable = NULL; - radeon->dri.readable = NULL; radeon->dri.hwContext = driContextPriv->hHWContext; radeon->dri.hwLock = &sPriv->pSAREA->lock; radeon->dri.fd = sPriv->fd; @@ -171,7 +169,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, "IRQ's not enabled, falling back to %s: %d %d\n", radeon->do_usleeps ? "usleeps" : "busy waits", fthrottle_mode, radeon->radeonScreen->irq); - + radeon->texture_depth = driQueryOptioni (&radeon->optionCache, "texture_depth"); if (radeon->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB) @@ -217,7 +215,7 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) radeon_firevertices(radeon); _mesa_make_current(NULL, NULL, NULL); } - + assert(radeon); if (radeon) { @@ -233,14 +231,11 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) _tnl_DestroyContext( radeon->glCtx ); _vbo_DestroyContext( radeon->glCtx ); _swrast_DestroyContext( radeon->glCtx ); - - radeonDestroyBuffer(radeon->dri.drawable); - radeonDestroyBuffer(radeon->dri.readable); /* free atom list */ /* free the Mesa context */ _mesa_destroy_context(radeon->glCtx); - + /* _mesa_destroy_context() might result in calls to functions that * depend on the DriverCtx, so don't set it to NULL before. * @@ -248,7 +243,7 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) */ /* free the option cache */ driDestroyOptionCache(&radeon->optionCache); - + rcommonDestroyCmdBuf(radeon); radeon_destroy_atom_list(radeon); @@ -346,12 +341,12 @@ radeon_make_renderbuffer_current(radeonContextPtr radeon, int size = 4096*4096*4; /* if radeon->fake */ struct radeon_renderbuffer *rb; - + if (radeon->radeonScreen->kernel_mm) { radeon_make_kernel_renderbuffer_current(radeon, draw); return; } - + if ((rb = (void *)draw->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer)) { if (!rb->bo) { @@ -440,7 +435,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (RADEON_DEBUG & DEBUG_DRI) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); - + draw = drawable->driverPrivate; screen = context->driScreenPriv; radeon = (radeonContextPtr) context->driverPrivate; @@ -493,7 +488,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) attachments[i++] = __DRI_BUFFER_DEPTH; if (radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL)) attachments[i++] = __DRI_BUFFER_STENCIL; - + buffers = (*screen->dri2.loader->getBuffers)(drawable, &drawable->w, &drawable->h, @@ -591,7 +586,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) fprintf(stderr, "failed to attach %s %d\n", regname, buffers[i].name); - + } } @@ -648,7 +643,7 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, drfb = driDrawPriv->driverPrivate; readfb = driReadPriv->driverPrivate; - if (driContextPriv->driScreenPriv->dri2.enabled) { + if (driContextPriv->driScreenPriv->dri2.enabled) { radeon_update_renderbuffers(driContextPriv, driDrawPriv); if (driDrawPriv != driReadPriv) radeon_update_renderbuffers(driContextPriv, driReadPriv); @@ -664,9 +659,6 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, if (RADEON_DEBUG & DEBUG_DRI) fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __FUNCTION__, radeon->glCtx, drfb, readfb); - if (radeon->dri.readable != driReadPriv) - radeon->dri.readable = driReadPriv; - driUpdateFramebufferSize(radeon->glCtx, driDrawPriv); if (driReadPriv != driDrawPriv) driUpdateFramebufferSize(radeon->glCtx, driReadPriv); @@ -676,29 +668,25 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, _mesa_update_state(radeon->glCtx); if (radeon->glCtx->DrawBuffer == &drfb->base) { - - if (radeon->dri.drawable != driDrawPriv) { - if (driDrawPriv->swap_interval == (unsigned)-1) { - int i; - driDrawPriv->vblFlags = - (radeon->radeonScreen->irq != 0) - ? driGetDefaultVBlankFlags(&radeon-> - optionCache) - : VBLANK_FLAG_NO_IRQ; - - driDrawableInitVBlank(driDrawPriv); - drfb->vbl_waited = driDrawPriv->vblSeq; - - for (i = 0; i < 2; i++) { - if (drfb->color_rb[i]) - drfb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq; - } - + if (driDrawPriv->swap_interval == (unsigned)-1) { + int i; + driDrawPriv->vblFlags = + (radeon->radeonScreen->irq != 0) + ? driGetDefaultVBlankFlags(&radeon-> + optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank(driDrawPriv); + drfb->vbl_waited = driDrawPriv->vblSeq; + + for (i = 0; i < 2; i++) { + if (drfb->color_rb[i]) + drfb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq; } - radeon->dri.drawable = driDrawPriv; - - radeon_window_moved(radeon); + } + + radeon_window_moved(radeon); radeon_draw_buffer(radeon->glCtx, &drfb->base); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index af05f4ae32..e995062657 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -117,7 +117,7 @@ struct radeon_framebuffer }; - + struct radeon_colorbuffer_state { GLuint clear; int roundEnable; @@ -346,16 +346,6 @@ struct radeon_dri_mirror { __DRIcontextPrivate *context; /* DRI context */ __DRIscreenPrivate *screen; /* DRI screen */ - /** - * DRI drawable bound to this context for drawing. - */ - __DRIdrawablePrivate *drawable; - - /** - * DRI drawable bound to this context for reading. - */ - __DRIdrawablePrivate *readable; - drm_context_t hwContext; drm_hw_lock_t *hwLock; int fd; @@ -416,7 +406,7 @@ struct radeon_cmdbuf { struct radeon_context { GLcontext *glCtx; radeonScreenPtr radeonScreen; /* Screen private DRI data */ - + /* Texture object bookkeeping */ int texture_depth; @@ -458,7 +448,7 @@ struct radeon_context { driOptionCache optionCache; struct radeon_cmdbuf cmdbuf; - + drm_clip_rect_t fboRect; GLboolean constant_cliprect; /* use for FBO or DRI2 rendering */ GLboolean front_cliprects; @@ -507,6 +497,17 @@ struct radeon_context { #define RADEON_CONTEXT(glctx) ((radeonContextPtr)(ctx->DriverCtx)) +static inline __DRIdrawablePrivate* radeon_get_drawable(radeonContextPtr radeon) +{ + return radeon->dri.context->driDrawablePriv; +} + +static inline __DRIdrawablePrivate* radeon_get_readable(radeonContextPtr radeon) +{ + return radeon->dri.context->driReadablePriv; +} + + /** * This function takes a float and packs it into a uint32_t */ diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index b5fde6d3de..caa0c4a896 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -35,7 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#include +#include #include "main/attrib.h" #include "main/enable.h" @@ -114,7 +114,7 @@ void radeonSetUpAtomList( r100ContextPtr rmesa ) } /* Fire a section of the retained (indexed_verts) buffer as a regular - * primtive. + * primtive. */ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, GLuint vertex_format, @@ -124,7 +124,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, BATCH_LOCALS(&rmesa->radeon); assert(!(primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); - + radeonEmitState(&rmesa->radeon); #if RADEON_OLD_PACKETS @@ -135,7 +135,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, } else { OUT_BATCH(rmesa->ioctl.vertex_offset); } - + OUT_BATCH(vertex_nr); OUT_BATCH(vertex_format); OUT_BATCH(primitive | RADEON_CP_VC_CNTL_PRIM_WALK_LIST | @@ -149,10 +149,10 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, RADEON_GEM_DOMAIN_GTT, 0, 0); } - + END_BATCH(); - -#else + +#else BEGIN_BATCH(4); OUT_BATCH_PACKET3_CLIP(RADEON_CP_PACKET3_3D_DRAW_VBUF, 1); OUT_BATCH(vertex_format); @@ -173,7 +173,7 @@ void radeonFlushElts( GLcontext *ctx ) int nr; uint32_t *cmd = (uint32_t *)(rmesa->radeon.cmdbuf.cs->packets + rmesa->tcl.elt_cmd_start); int dwords = (rmesa->radeon.cmdbuf.cs->section_ndw - rmesa->radeon.cmdbuf.cs->section_cdw); - + if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s\n", __FUNCTION__); @@ -230,9 +230,9 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, fprintf(stderr, "%s %d prim %x\n", __FUNCTION__, min_nr, primitive); assert((primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); - + radeonEmitState(&rmesa->radeon); - + rmesa->tcl.elt_cmd_start = rmesa->radeon.cmdbuf.cs->cdw; /* round up min_nr to align the state */ @@ -248,7 +248,7 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, } OUT_BATCH(0xffff); OUT_BATCH(vertex_format); - OUT_BATCH(primitive | + OUT_BATCH(primitive | RADEON_CP_VC_CNTL_PRIM_WALK_IND | RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA | RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE); @@ -257,7 +257,7 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, BEGIN_BATCH_NO_AUTOSTATE(ELTS_BUFSZ(align_min_nr)/4); OUT_BATCH_PACKET3_CLIP(RADEON_CP_PACKET3_DRAW_INDX, 0); OUT_BATCH(vertex_format); - OUT_BATCH(primitive | + OUT_BATCH(primitive | RADEON_CP_VC_CNTL_PRIM_WALK_IND | RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA | RADEON_CP_VC_CNTL_MAOS_ENABLE | @@ -269,7 +269,7 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, rmesa->tcl.elt_used = min_nr; retval = (GLushort *)(rmesa->radeon.cmdbuf.cs->packets + rmesa->tcl.elt_cmd_offset); - + if (RADEON_DEBUG & DEBUG_PRIMS) fprintf(stderr, "%s: header prim %x \n", __FUNCTION__, primitive); @@ -305,7 +305,7 @@ void radeonEmitVertexAOS( r100ContextPtr rmesa, #endif } - + void radeonEmitAOS( r100ContextPtr rmesa, GLuint nr, @@ -314,7 +314,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, #if RADEON_OLD_PACKETS assert( nr == 1 ); rmesa->ioctl.bo = rmesa->radeon.tcl.aos[0].bo; - rmesa->ioctl.vertex_offset = + rmesa->ioctl.vertex_offset = (rmesa->radeon.tcl.aos[0].offset + offset * rmesa->radeon.tcl.aos[0].stride * 4); #else BATCH_LOCALS(&rmesa->radeon); @@ -336,7 +336,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, (rmesa->radeon.tcl.aos[i].stride << 8) | (rmesa->radeon.tcl.aos[i + 1].components << 16) | (rmesa->radeon.tcl.aos[i + 1].stride << 24)); - + voffset = rmesa->radeon.tcl.aos[i + 0].offset + offset * 4 * rmesa->radeon.tcl.aos[i + 0].stride; OUT_BATCH_RELOC(voffset, @@ -352,7 +352,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, RADEON_GEM_DOMAIN_GTT, 0, 0); } - + if (nr & 1) { OUT_BATCH((rmesa->radeon.tcl.aos[nr - 1].components << 0) | (rmesa->radeon.tcl.aos[nr - 1].stride << 8)); @@ -370,7 +370,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, (rmesa->radeon.tcl.aos[i].stride << 8) | (rmesa->radeon.tcl.aos[i + 1].components << 16) | (rmesa->radeon.tcl.aos[i + 1].stride << 24)); - + voffset = rmesa->radeon.tcl.aos[i + 0].offset + offset * 4 * rmesa->radeon.tcl.aos[i + 0].stride; OUT_BATCH(voffset); @@ -378,7 +378,7 @@ void radeonEmitAOS( r100ContextPtr rmesa, offset * 4 * rmesa->radeon.tcl.aos[i + 1].stride; OUT_BATCH(voffset); } - + if (nr & 1) { OUT_BATCH((rmesa->radeon.tcl.aos[nr - 1].components << 0) | (rmesa->radeon.tcl.aos[nr - 1].stride << 8)); @@ -427,7 +427,7 @@ static void radeonUserClear(GLcontext *ctx, GLuint mask) static void radeonKernelClear(GLcontext *ctx, GLuint flags) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); drm_radeon_sarea_t *sarea = rmesa->radeon.sarea; uint32_t clear; GLint ret, i; @@ -529,7 +529,7 @@ static void radeonKernelClear(GLcontext *ctx, GLuint flags) depth_boxes[n].f[CLEAR_Y1] = (float)b[n].y1; depth_boxes[n].f[CLEAR_X2] = (float)b[n].x2; depth_boxes[n].f[CLEAR_Y2] = (float)b[n].y2; - depth_boxes[n].f[CLEAR_DEPTH] = + depth_boxes[n].f[CLEAR_DEPTH] = (float)rmesa->radeon.state.depth.clear; } @@ -548,7 +548,7 @@ static void radeonKernelClear(GLcontext *ctx, GLuint flags) static void radeonClear( GLcontext *ctx, GLbitfield mask ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLuint flags = 0; GLuint color_mask = 0; GLuint orig_mask = mask; @@ -560,11 +560,11 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask ) { LOCK_HARDWARE( &rmesa->radeon ); UNLOCK_HARDWARE( &rmesa->radeon ); - if ( dPriv->numClipRects == 0 ) + if ( dPriv->numClipRects == 0 ) return; } - - radeon_firevertices(&rmesa->radeon); + + radeon_firevertices(&rmesa->radeon); if ( mask & BUFFER_BIT_FRONT_LEFT ) { flags |= RADEON_FRONT; @@ -594,12 +594,12 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask ) _swrast_Clear( ctx, mask ); } - if ( !flags ) + if ( !flags ) return; if (rmesa->using_hyperz) { flags |= RADEON_USE_COMP_ZBUF; -/* if (rmesa->radeon.radeonScreen->chipset & RADEON_CHIPSET_TCL) +/* if (rmesa->radeon.radeonScreen->chipset & RADEON_CHIPSET_TCL) flags |= RADEON_USE_HIERZ; */ if (((flags & RADEON_DEPTH) && (flags & RADEON_STENCIL) && ((rmesa->radeon.state.stencil.clear & RADEON_STENCIL_WRITE_MASK) == RADEON_STENCIL_WRITE_MASK))) { diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index fe19218d7a..5774f7ebcf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -58,8 +58,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ void radeonGetLock(radeonContextPtr rmesa, GLuint flags) { - __DRIdrawablePrivate *const drawable = rmesa->dri.drawable; - __DRIdrawablePrivate *const readable = rmesa->dri.readable; + __DRIdrawablePrivate *const drawable = radeon_get_drawable(rmesa); + __DRIdrawablePrivate *const readable = radeon_get_readable(rmesa); __DRIscreenPrivate *sPriv = rmesa->dri.screen; assert(drawable != NULL); @@ -95,8 +95,8 @@ void radeon_lock_hardware(radeonContextPtr radeon) struct radeon_framebuffer *rfb = NULL; struct radeon_renderbuffer *rrb = NULL; - if (radeon->dri.drawable) { - rfb = radeon->dri.drawable->driverPrivate; + if (radeon_get_drawable(radeon)) { + rfb = radeon_get_drawable(radeon)->driverPrivate; if (rfb) rrb = radeon_get_renderbuffer(&rfb->base, diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 5aeb968d41..3ba11e848e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1374,6 +1374,7 @@ static GLboolean radeonCreateContext(const __GLcontextModes * glVisual, #endif #if !RADEON_COMMON + (void)screen; return r100CreateContext(glVisual, driContextPriv, sharedContextPriv); #endif return GL_FALSE; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 34c8cb42fa..06b8c29936 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -149,7 +149,7 @@ static void radeonBlendFuncSeparate( GLcontext *ctx, GLenum sfactorA, GLenum dfactorA ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & + GLuint b = rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] & ~(RADEON_SRC_BLEND_MASK | RADEON_DST_BLEND_MASK); GLboolean fallback = GL_FALSE; @@ -392,7 +392,7 @@ static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) rmesa->hw.fog.cmd[FOG_D] = d.i; } break; - case GL_FOG_COLOR: + case GL_FOG_COLOR: RADEON_STATECHANGE( rmesa, ctx ); UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color ); rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] &= ~RADEON_FOG_COLOR_MASK; @@ -495,7 +495,7 @@ static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern ) r100ContextPtr rmesa = R100_CONTEXT(ctx); RADEON_STATECHANGE( rmesa, lin ); - rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = + rmesa->hw.lin.cmd[LIN_RE_LINE_PATTERN] = ((((GLuint)factor & 0xff) << 16) | ((GLuint)pattern)); } @@ -558,7 +558,7 @@ static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask ) /* FIXME: Use window x,y offsets into stipple RAM. */ stipple.mask = rmesa->state.stipple.mask; - drmCommandWrite( rmesa->radeon.dri.fd, DRM_RADEON_STIPPLE, + drmCommandWrite( rmesa->radeon.dri.fd, DRM_RADEON_STIPPLE, &stipple, sizeof(drm_radeon_stipple_t) ); UNLOCK_HARDWARE( &rmesa->radeon ); } @@ -569,7 +569,7 @@ static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0; /* Can't generally do unfilled via tcl, but some good special - * cases work. + * cases work. */ TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_UNFILLED, flag); if (rmesa->radeon.TclFallback) { @@ -617,7 +617,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE; rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE; p |= RADEON_SPECULAR_ENABLE; - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= + rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_DIFFUSE_SPECULAR_COMBINE; } else if (ctx->Light.Enabled) { @@ -647,7 +647,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) RADEON_TCL_COMPUTE_SPECULAR) != 0; } } - + TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_FOGCOORDSPEC, flag); if (NEED_SECONDARY_COLOR(ctx)) { @@ -663,7 +663,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) /* Update vertex/render formats */ - if (rmesa->radeon.TclFallback) { + if (rmesa->radeon.TclFallback) { radeonChooseRenderState( ctx ); radeonChooseVertexState( ctx ); } @@ -675,7 +675,7 @@ static void radeonUpdateSpecular( GLcontext *ctx ) */ -/* Update on colormaterial, material emmissive/ambient, +/* Update on colormaterial, material emmissive/ambient, * lightmodel.globalambient */ static void update_global_ambient( GLcontext *ctx ) @@ -688,23 +688,23 @@ static void update_global_ambient( GLcontext *ctx ) */ if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] & ((3 << RADEON_EMISSIVE_SOURCE_SHIFT) | - (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0) + (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0) { - COPY_3V( &fcmd[GLT_RED], + COPY_3V( &fcmd[GLT_RED], ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]); ACC_SCALE_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]); - } + } else { COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient ); } - + RADEON_DB_STATECHANGE(rmesa, &rmesa->hw.glt); } -/* Update on change to +/* Update on change to * - light[p].colors * - light[p].enabled */ @@ -718,10 +718,10 @@ static void update_light_colors( GLcontext *ctx, GLuint p ) r100ContextPtr rmesa = R100_CONTEXT(ctx); float *fcmd = (float *)RADEON_DB_STATE( lit[p] ); - COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient ); + COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient ); COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse ); COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular ); - + RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] ); } } @@ -735,7 +735,7 @@ static void check_twoside_fallback( GLcontext *ctx ) if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { if (ctx->Light.ColorMaterialEnabled && - (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) != + (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) != ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1)) fallback = GL_TRUE; else { @@ -743,7 +743,7 @@ static void check_twoside_fallback( GLcontext *ctx ) if (memcmp( ctx->Light.Material.Attrib[i], ctx->Light.Material.Attrib[i+1], sizeof(GLfloat)*4) != 0) { - fallback = GL_TRUE; + fallback = GL_TRUE; break; } } @@ -761,8 +761,8 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) light_model_ctl1 &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) | (3 << RADEON_AMBIENT_SOURCE_SHIFT) | (3 << RADEON_DIFFUSE_SOURCE_SHIFT) | - (3 << RADEON_SPECULAR_SOURCE_SHIFT)); - + (3 << RADEON_SPECULAR_SOURCE_SHIFT)); + if (ctx->Light.ColorMaterialEnabled) { GLuint mask = ctx->Light.ColorMaterialBitmask; @@ -783,7 +783,7 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT << RADEON_AMBIENT_SOURCE_SHIFT); } - + if (mask & MAT_BIT_FRONT_DIFFUSE) { light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE << RADEON_DIFFUSE_SOURCE_SHIFT); @@ -792,7 +792,7 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) light_model_ctl1 |= (RADEON_LM_SOURCE_STATE_MULT << RADEON_DIFFUSE_SOURCE_SHIFT); } - + if (mask & MAT_BIT_FRONT_SPECULAR) { light_model_ctl1 |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE << RADEON_SPECULAR_SOURCE_SHIFT); @@ -810,10 +810,10 @@ static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode ) (RADEON_LM_SOURCE_STATE_MULT << RADEON_DIFFUSE_SOURCE_SHIFT) | (RADEON_LM_SOURCE_STATE_MULT << RADEON_SPECULAR_SOURCE_SHIFT); } - + if (light_model_ctl1 != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) { RADEON_STATECHANGE( rmesa, tcl ); - rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl1; + rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl1; } } @@ -823,14 +823,14 @@ void radeonUpdateMaterial( GLcontext *ctx ) GLfloat (*mat)[4] = ctx->Light.Material.Attrib; GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( mtl ); GLuint mask = ~0; - + if (ctx->Light.ColorMaterialEnabled) mask &= ~ctx->Light.ColorMaterialBitmask; if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s\n", __FUNCTION__); - + if (mask & MAT_BIT_FRONT_EMISSION) { fcmd[MTL_EMMISSIVE_RED] = mat[MAT_ATTRIB_FRONT_EMISSION][0]; fcmd[MTL_EMMISSIVE_GREEN] = mat[MAT_ATTRIB_FRONT_EMISSION][1]; @@ -880,7 +880,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * * which are calculated in light.c and are correct for the current * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW - * and _MESA_NEW_NEED_EYE_COORDS. + * and _MESA_NEW_NEED_EYE_COORDS. */ static void update_light( GLcontext *ctx ) { @@ -897,12 +897,12 @@ static void update_light( GLcontext *ctx ) tmp &= ~RADEON_LIGHT_IN_MODELSPACE; else tmp |= RADEON_LIGHT_IN_MODELSPACE; - + /* Leave this test disabled: (unexplained q3 lockup) (even with new packets) */ - if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) + if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) { RADEON_STATECHANGE( rmesa, tcl ); rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = tmp; @@ -926,10 +926,10 @@ static void update_light( GLcontext *ctx ) if (ctx->Light.Light[p].Enabled) { struct gl_light *l = &ctx->Light.Light[p]; GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] ); - + if (l->EyePosition[3] == 0.0) { - COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm ); - COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm ); + COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm ); + COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm ); fcmd[LIT_POSITION_W] = 0; fcmd[LIT_DIRECTION_W] = 0; } else { @@ -953,26 +953,26 @@ static void radeonLightfv( GLcontext *ctx, GLenum light, GLint p = light - GL_LIGHT0; struct gl_light *l = &ctx->Light.Light[p]; GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd; - + switch (pname) { - case GL_AMBIENT: + case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: update_light_colors( ctx, p ); break; - case GL_SPOT_DIRECTION: - /* picked up in update_light */ + case GL_SPOT_DIRECTION: + /* picked up in update_light */ break; case GL_POSITION: { - /* positions picked up in update_light, but can do flag here */ + /* positions picked up in update_light, but can do flag here */ GLuint flag; GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2; /* FIXME: Set RANGE_ATTEN only when needed */ - if (p&1) + if (p&1) flag = RADEON_LIGHT_1_IS_LOCAL; else flag = RADEON_LIGHT_0_IS_LOCAL; @@ -1064,7 +1064,7 @@ static void radeonLightfv( GLcontext *ctx, GLenum light, } } - + static void radeonLightModelfv( GLcontext *ctx, GLenum pname, @@ -1073,7 +1073,7 @@ static void radeonLightModelfv( GLcontext *ctx, GLenum pname, r100ContextPtr rmesa = R100_CONTEXT(ctx); switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: + case GL_LIGHT_MODEL_AMBIENT: update_global_ambient( ctx ); break; @@ -1247,14 +1247,14 @@ static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, /* radeon 7200 have stencil bug, DEC and INC_WRAP will actually both do DEC_WRAP, and DEC_WRAP (and INVERT) will do INVERT. No way to get correct INC_WRAP and DEC, but DEC_WRAP can be fixed by using DEC and INC_WRAP at least use INC. */ - + GLuint tempRADEON_STENCIL_FAIL_DEC_WRAP; GLuint tempRADEON_STENCIL_FAIL_INC_WRAP; GLuint tempRADEON_STENCIL_ZFAIL_DEC_WRAP; GLuint tempRADEON_STENCIL_ZFAIL_INC_WRAP; GLuint tempRADEON_STENCIL_ZPASS_DEC_WRAP; GLuint tempRADEON_STENCIL_ZPASS_INC_WRAP; - + if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_BROKEN_STENCIL) { tempRADEON_STENCIL_FAIL_DEC_WRAP = RADEON_STENCIL_FAIL_DEC; tempRADEON_STENCIL_FAIL_INC_WRAP = RADEON_STENCIL_FAIL_INC; @@ -1271,7 +1271,7 @@ static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail, tempRADEON_STENCIL_ZPASS_DEC_WRAP = RADEON_STENCIL_ZPASS_DEC_WRAP; tempRADEON_STENCIL_ZPASS_INC_WRAP = RADEON_STENCIL_ZPASS_INC_WRAP; } - + RADEON_STATECHANGE( rmesa, ctx ); rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &= ~(RADEON_STENCIL_FAIL_MASK | RADEON_STENCIL_ZFAIL_MASK | @@ -1363,7 +1363,7 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - rmesa->radeon.state.stencil.clear = + rmesa->radeon.state.stencil.clear = ((GLuint) (ctx->Stencil.Clear & 0xff) | (0xff << RADEON_STENCIL_MASK_SHIFT) | ((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT)); @@ -1388,7 +1388,7 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) void radeonUpdateWindow( GLcontext *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = dPriv ? (GLfloat) dPriv->x : 0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->y + dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1443,7 +1443,7 @@ static void radeonDepthRange( GLcontext *ctx, GLclampd nearval, void radeonUpdateViewportOffset( GLcontext *ctx ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable; + __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon); GLfloat xoffset = (GLfloat)dPriv->x; GLfloat yoffset = (GLfloat)dPriv->y + dPriv->h; const GLfloat *v = ctx->Viewport._WindowMap.m; @@ -1473,8 +1473,8 @@ void radeonUpdateViewportOffset( GLcontext *ctx ) RADEON_STIPPLE_Y_OFFSET_MASK); /* add magic offsets, then invert */ - stx = 31 - ((rmesa->radeon.dri.drawable->x - 1) & RADEON_STIPPLE_COORD_MASK); - sty = 31 - ((rmesa->radeon.dri.drawable->y + rmesa->radeon.dri.drawable->h - 1) + stx = 31 - ((dPriv->x - 1) & RADEON_STIPPLE_COORD_MASK); + sty = 31 - ((dPriv->y + dPriv->h - 1) & RADEON_STIPPLE_COORD_MASK); m |= ((stx << RADEON_STIPPLE_X_OFFSET_SHIFT) | @@ -1613,7 +1613,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: + case GL_CLIP_PLANE5: p = cap-GL_CLIP_PLANE0; RADEON_STATECHANGE( rmesa, tcl ); if (state) { @@ -1678,13 +1678,13 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_LIGHT7: RADEON_STATECHANGE(rmesa, tcl); p = cap - GL_LIGHT0; - if (p&1) + if (p&1) flag = (RADEON_LIGHT_1_ENABLE | - RADEON_LIGHT_1_ENABLE_AMBIENT | + RADEON_LIGHT_1_ENABLE_AMBIENT | RADEON_LIGHT_1_ENABLE_SPECULAR); else flag = (RADEON_LIGHT_0_ENABLE | - RADEON_LIGHT_0_ENABLE_AMBIENT | + RADEON_LIGHT_0_ENABLE_AMBIENT | RADEON_LIGHT_0_ENABLE_SPECULAR); if (state) @@ -1692,7 +1692,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) else rmesa->hw.tcl.cmd[p/2 + TCL_PER_LIGHT_CTL_0] &= ~flag; - /* + /* */ update_light_colors( ctx, p ); break; @@ -1730,7 +1730,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; } break; - + case GL_NORMALIZE: RADEON_STATECHANGE( rmesa, tcl ); if ( state ) { @@ -1830,7 +1830,7 @@ static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_TEXTURE_GEN_T: /* Picked up in radeonUpdateTextureState. */ - rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE; + rmesa->recheck_texgen[ctx->Texture.CurrentUnit] = GL_TRUE; break; case GL_COLOR_SUM_EXT: @@ -1864,7 +1864,7 @@ static void radeonLightingSpaceChange( GLcontext *ctx ) rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS; } - if (RADEON_DEBUG & DEBUG_STATE) + if (RADEON_DEBUG & DEBUG_STATE) fprintf(stderr, "%s %d AFTER %x\n", __FUNCTION__, ctx->_NeedEyeCoords, rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]); } @@ -2051,7 +2051,7 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) int i; radeon_validate_reset_bos(&rmesa->radeon); - + rrb = radeon_get_colorbuffer(&rmesa->radeon); /* color buffer */ if (rrb && rrb->bo) { @@ -2069,7 +2069,7 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) for (i = 0; i < ctx->Const.MaxTextureImageUnits; ++i) { radeonTexObj *t; - + if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; @@ -2112,7 +2112,7 @@ GLboolean radeonValidateState( GLcontext *ctx ) /* Need an event driven matrix update? */ - if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) + if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) upload_matrix( rmesa, ctx->_ModelProjectMatrix.m, MODEL_PROJ ); /* Need these for lighting (shouldn't upload otherwise) @@ -2136,7 +2136,7 @@ GLboolean radeonValidateState( GLcontext *ctx ) /* emit all active clip planes if projection matrix changes. */ if (new_state & (_NEW_PROJECTION)) { - if (ctx->Transform.ClipPlanesEnabled) + if (ctx->Transform.ClipPlanesEnabled) radeonUpdateClipPlanes( ctx ); } @@ -2165,8 +2165,8 @@ static GLboolean check_material( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; - for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; - i < _TNL_ATTRIB_MAT_BACK_INDEXES; + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; + i < _TNL_ATTRIB_MAT_BACK_INDEXES; i++) if (tnl->vb.AttribPtr[i] && tnl->vb.AttribPtr[i]->stride) @@ -2174,7 +2174,7 @@ static GLboolean check_material( GLcontext *ctx ) return GL_FALSE; } - + static void radeonWrapRunPipeline( GLcontext *ctx ) { @@ -2197,7 +2197,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) } /* Run the pipeline. - */ + */ _tnl_run_pipeline( ctx ); if (has_material) { -- cgit v1.2.3 From 9b1efcb87c794ded9306f01336d48a80aaad3261 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sat, 23 May 2009 21:57:25 +0200 Subject: radeon: realloc dma if needed after revalidate Revalidate can trigger flushing and dma buffer deallocation, so retry allocation on such case. --- src/mesa/drivers/dri/radeon/radeon_dma.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index a357afe679..48b0d63818 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -203,6 +203,12 @@ again_alloc: if (radeon_revalidate_bos(rmesa->glCtx) == GL_FALSE) fprintf(stderr,"failure to revalidate BOs - badness\n"); + if (!rmesa->dma.current) { + /* Cmd buff have been flushed in radeon_revalidate_bos */ + rmesa->dma.nr_released_bufs = 0; + goto again_alloc; + } + radeon_bo_map(rmesa->dma.current, 1); } -- cgit v1.2.3 From 80f1ac87f2cb42ae8370174a75d1271950e59657 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 25 May 2009 11:29:32 +0200 Subject: r200: emit cliprect with indexed primitive --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 55ea81a57c..8b2335d149 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -135,7 +135,7 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) if (vertex_count > 0) { BEGIN_BATCH(8+2); - OUT_BATCH_PACKET3(R200_CP_CMD_3D_DRAW_INDX_2, 0); + OUT_BATCH_PACKET3_CLIP(R200_CP_CMD_3D_DRAW_INDX_2, 0); OUT_BATCH(R200_VF_PRIM_WALK_IND | R200_VF_COLOR_ORDER_RGBA | ((vertex_count + 0) << 16) | -- cgit v1.2.3 From 39ef33708c1a048863a1956cd99782013791ca92 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 25 May 2009 13:17:22 +0200 Subject: r200: fix multitexturing in dri2 path --- src/mesa/drivers/dri/r200/r200_state_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index a716779096..8392009337 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -598,7 +598,7 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) dwords -= 2; BEGIN_BATCH_NO_AUTOSTATE(dwords); - OUT_BATCH(CP_PACKET0(R200_PP_TXFILTER_0 + (24 * i), 7)); + OUT_BATCH(CP_PACKET0(R200_PP_TXFILTER_0 + (32 * i), 7)); OUT_BATCH_TABLE((atom->cmd + 1), 8); if (hastexture) { -- cgit v1.2.3 From 714f5e689fb1a69142995260e3c8908c12407b47 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 25 May 2009 15:47:39 +0200 Subject: r200: emit scissor when dri2 is enabled In DRI1 kernel emit scissor but in dri2 cs path we have to explicitly program them. --- src/mesa/drivers/dri/r200/r200_cmdbuf.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 8b2335d149..df9dd83344 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -105,6 +105,35 @@ void r200SetUpAtomList( r200ContextPtr rmesa ) insert_at_tail( &rmesa->radeon.hw.atomlist, &rmesa->hw.vpi[1] ); } +void r200EmitScissor(r200ContextPtr rmesa) +{ + BATCH_LOCALS(&rmesa->radeon); + if (!rmesa->radeon.radeonScreen->kernel_mm) { + return; + } + if (rmesa->radeon.state.scissor.enabled) { + BEGIN_BATCH(8); + OUT_BATCH(CP_PACKET0(R200_RE_CNTL, 0)); + OUT_BATCH(R200_SCISSOR_ENABLE | rmesa->hw.set.cmd[SET_RE_CNTL]); + OUT_BATCH(CP_PACKET0(R200_RE_AUX_SCISSOR_CNTL, 0)); + OUT_BATCH(R200_SCISSOR_ENABLE_0); + OUT_BATCH(CP_PACKET0(R200_RE_SCISSOR_TL_0, 0)); + OUT_BATCH((rmesa->radeon.state.scissor.rect.y1 << 16) | + rmesa->radeon.state.scissor.rect.x1); + OUT_BATCH(CP_PACKET0(R200_RE_SCISSOR_BR_0, 0)); + OUT_BATCH(((rmesa->radeon.state.scissor.rect.y2 - 1) << 16) | + (rmesa->radeon.state.scissor.rect.x2 - 1)); + END_BATCH(); + } else { + BEGIN_BATCH(4); + OUT_BATCH(CP_PACKET0(R200_RE_CNTL, 0)); + OUT_BATCH(rmesa->hw.set.cmd[SET_RE_CNTL] & ~R200_SCISSOR_ENABLE); + OUT_BATCH(CP_PACKET0(R200_RE_AUX_SCISSOR_CNTL, 0)); + OUT_BATCH(0); + END_BATCH(); + } +} + /* Fire a section of the retained (indexed_verts) buffer as a regular * primtive. */ @@ -121,6 +150,7 @@ void r200EmitVbufPrim( r200ContextPtr rmesa, if (R200_DEBUG & (DEBUG_IOCTL|DEBUG_PRIMS)) fprintf(stderr, "%s cmd_used/4: %d prim %x nr %d\n", __FUNCTION__, rmesa->store.cmd_used/4, primitive, vertex_nr); + r200EmitScissor(rmesa); BEGIN_BATCH(3); OUT_BATCH_PACKET3_CLIP(R200_CP_CMD_3D_DRAW_VBUF_2, 0); @@ -134,6 +164,7 @@ static void r200FireEB(r200ContextPtr rmesa, int vertex_count, int type) BATCH_LOCALS(&rmesa->radeon); if (vertex_count > 0) { + r200EmitScissor(rmesa); BEGIN_BATCH(8+2); OUT_BATCH_PACKET3_CLIP(R200_CP_CMD_3D_DRAW_INDX_2, 0); OUT_BATCH(R200_VF_PRIM_WALK_IND | -- cgit v1.2.3 From 9dee2f20a204f375eb4321092cf5dea6476c1c24 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 25 May 2009 16:05:45 +0200 Subject: radeon: on update drawable don't firevertices as it might be call from GetLock To avoid locking bug we shouldn't not call firevertices from this path as it's call from radeon get lock. --- src/mesa/drivers/dri/radeon/radeon_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index e2e0ba07a3..466eda784e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -769,9 +769,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb) /* Set state we know depends on drawable parameters: */ - if (ctx->Driver.Scissor) - ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, - ctx->Scissor.Width, ctx->Scissor.Height); + radeonUpdateScissor(ctx); radeon->NewGLState |= _NEW_SCISSOR; if (ctx->Driver.DepthRange) -- cgit v1.2.3 From 9178b31546e9817a0c9712f702b21f8c54efbd84 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 22 May 2009 21:53:26 +0100 Subject: intel: Override MaxRenderbufferSize with hardware constraints Limit the maximum renderbuffer size to 8192 on i965 and to 2048 on earlier hardware. --- src/mesa/drivers/dri/intel/intel_context.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 49eadc7532..ea43009f4c 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -650,6 +650,13 @@ intelInitContext(struct intel_context *intel, _mesa_init_point(ctx); ctx->Const.MaxColorAttachments = 4; /* XXX FBO: review this */ + if (IS_965(intelScreen->deviceID)) { + if (MAX_WIDTH > 8192) + ctx->Const.MaxRenderbufferSize = 8192; + } else { + if (MAX_WIDTH > 2048) + ctx->Const.MaxRenderbufferSize = 2048; + } /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); -- cgit v1.2.3 From 0e83e8f51af07a3066519f169f07d9afbf23252e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 26 May 2009 19:48:08 -0700 Subject: i915: Restore the Viewport and DepthRange functions on 8xx. Fixes failed viewport updates on glxgears (and other apps) resize since e41780fedc2c1f22b43118da30a0103fa68b769f. Bug #20473. --- src/mesa/drivers/dri/i915/i830_state.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index d9cad0c4bf..8ef6c9144f 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -39,6 +39,7 @@ #include "intel_screen.h" #include "intel_batchbuffer.h" #include "intel_fbo.h" +#include "intel_buffers.h" #include "i830_context.h" #include "i830_reg.h" @@ -446,6 +447,24 @@ i830DepthMask(GLcontext * ctx, GLboolean flag) i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE; } +/** Called from ctx->Driver.Viewport() */ +static void +i830Viewport(GLcontext * ctx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + intelCalcViewport(ctx); + + intel_viewport(ctx, x, y, width, height); +} + + +/** Called from ctx->Driver.DepthRange() */ +static void +i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) +{ + intelCalcViewport(ctx); +} + /* ============================================================= * Polygon stipple * @@ -1064,6 +1083,8 @@ i830InitStateFuncs(struct dd_function_table *functions) functions->StencilFuncSeparate = i830StencilFuncSeparate; functions->StencilMaskSeparate = i830StencilMaskSeparate; functions->StencilOpSeparate = i830StencilOpSeparate; + functions->DepthRange = i830DepthRange; + functions->Viewport = i830Viewport; } void -- cgit v1.2.3 From 8ec6e036792decf5149a209e51cb5e93ccc5c754 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 26 May 2009 20:45:29 -0700 Subject: i915: Fall back on NPOT textured metaops on 830-class. --- src/mesa/drivers/dri/intel/intel_context.h | 6 ++++++ src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 8 ++++++++ src/mesa/drivers/dri/intel/intel_pixel_draw.c | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index e931e401e9..8b68cc3f04 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -569,4 +569,10 @@ intel_context(GLcontext * ctx) return (struct intel_context *) ctx; } +static INLINE GLboolean +is_power_of_two(uint32_t value) +{ + return (value & (value - 1)) == 0; +} + #endif diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index b20840b9a0..80d3239189 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -400,6 +400,14 @@ intel_texture_bitmap(GLcontext * ctx, return GL_FALSE; } + if (!ctx->Extensions.ARB_texture_non_power_of_two && + (!is_power_of_two(width) || !is_power_of_two(height))) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, + "glBitmap() fallback: NPOT texture\n"); + return GL_FALSE; + } + /* Check that we can load in a texture this big. */ if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) || height > (1 << (ctx->Const.MaxTextureLevels - 1))) { diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index abcdcd5724..7cda6adb32 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -119,6 +119,14 @@ intel_texture_drawpixels(GLcontext * ctx, return GL_FALSE; } + if (!ctx->Extensions.ARB_texture_non_power_of_two && + (!is_power_of_two(width) || !is_power_of_two(height))) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, + "glDrawPixels() fallback: NPOT texture\n"); + return GL_FALSE; + } + _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_CURRENT_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); @@ -262,6 +270,14 @@ intel_stencil_drawpixels(GLcontext * ctx, return GL_FALSE; } + if (!ctx->Extensions.ARB_texture_non_power_of_two && + (!is_power_of_two(width) || !is_power_of_two(height))) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, + "glDrawPixels(GL_STENCIL_INDEX) fallback: NPOT texture\n"); + return GL_FALSE; + } + _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); -- cgit v1.2.3 From 6141c9ba71df68c44fb4f8c9409f23b557009ca0 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 27 May 2009 09:36:07 +0200 Subject: radeon: emit scissor when using cs submission style. --- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index caa0c4a896..8f8878ee10 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -113,6 +113,31 @@ void radeonSetUpAtomList( r100ContextPtr rmesa ) insert_at_tail(&rmesa->radeon.hw.atomlist, &rmesa->hw.glt); } +void radeonEmitScissor(r100ContextPtr rmesa) +{ + BATCH_LOCALS(&rmesa->radeon); + if (!rmesa->radeon.radeonScreen->kernel_mm) { + return; + } + if (rmesa->radeon.state.scissor.enabled) { + BEGIN_BATCH(6); + OUT_BATCH(CP_PACKET0(RADEON_PP_CNTL, 0)); + OUT_BATCH(rmesa->hw.ctx.cmd[CTX_PP_CNTL] | RADEON_SCISSOR_ENABLE); + OUT_BATCH(CP_PACKET0(RADEON_RE_TOP_LEFT, 0)); + OUT_BATCH((rmesa->radeon.state.scissor.rect.y1 << 16) | + rmesa->radeon.state.scissor.rect.x1); + OUT_BATCH(CP_PACKET0(RADEON_RE_WIDTH_HEIGHT, 0)); + OUT_BATCH(((rmesa->radeon.state.scissor.rect.y2 - 1) << 16) | + (rmesa->radeon.state.scissor.rect.x2 - 1)); + END_BATCH(); + } else { + BEGIN_BATCH(2); + OUT_BATCH(CP_PACKET0(RADEON_PP_CNTL, 0)); + OUT_BATCH(rmesa->hw.ctx.cmd[CTX_PP_CNTL] & ~RADEON_SCISSOR_ENABLE); + END_BATCH(); + } +} + /* Fire a section of the retained (indexed_verts) buffer as a regular * primtive. */ @@ -126,6 +151,7 @@ extern void radeonEmitVbufPrim( r100ContextPtr rmesa, assert(!(primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); radeonEmitState(&rmesa->radeon); + radeonEmitScissor(rmesa); #if RADEON_OLD_PACKETS BEGIN_BATCH(8); @@ -180,6 +206,8 @@ void radeonFlushElts( GLcontext *ctx ) assert( rmesa->radeon.dma.flush == radeonFlushElts ); rmesa->radeon.dma.flush = NULL; + radeonEmitScissor(rmesa); + nr = rmesa->tcl.elt_used; #if RADEON_OLD_PACKETS -- cgit v1.2.3 From 3a6dd3ebb33a35779b0d5be2c8cab581a56f245a Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 27 May 2009 21:50:03 +0200 Subject: radeon: emit scissor before emiting vertices --- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 8f8878ee10..01c45df2df 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -206,8 +206,6 @@ void radeonFlushElts( GLcontext *ctx ) assert( rmesa->radeon.dma.flush == radeonFlushElts ); rmesa->radeon.dma.flush = NULL; - radeonEmitScissor(rmesa); - nr = rmesa->tcl.elt_used; #if RADEON_OLD_PACKETS @@ -260,6 +258,7 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, assert((primitive & RADEON_CP_VC_CNTL_PRIM_WALK_IND)); radeonEmitState(&rmesa->radeon); + radeonEmitScissor(rmesa); rmesa->tcl.elt_cmd_start = rmesa->radeon.cmdbuf.cs->cdw; @@ -280,7 +279,6 @@ GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa, RADEON_CP_VC_CNTL_PRIM_WALK_IND | RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA | RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE); - #else BEGIN_BATCH_NO_AUTOSTATE(ELTS_BUFSZ(align_min_nr)/4); OUT_BATCH_PACKET3_CLIP(RADEON_CP_PACKET3_DRAW_INDX, 0); -- cgit v1.2.3 From c13bd7488593263f2c45c136b63114ce8b4602fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 27 May 2009 19:24:09 -0600 Subject: st/mesa: init Format field of vertex arrays for feedback mode Fixes segfault in glRasterPos() --- src/mesa/state_tracker/st_cb_rasterpos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 7a9c50b3fc..3bcccd0df4 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -197,6 +197,7 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) for (i = 0; i < Elements(rs->array); i++) { rs->array[i].Size = 4; rs->array[i].Type = GL_FLOAT; + rs->array[i].Format = GL_RGBA; rs->array[i].Stride = 0; rs->array[i].StrideB = 0; rs->array[i].Ptr = (GLubyte *) ctx->Current.Attrib[i]; -- cgit v1.2.3 From 5d75124db480b37977c353511b4e228905b7cc95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 27 May 2009 19:27:31 -0600 Subject: softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON Use the first vertex, not the last. --- src/gallium/drivers/softpipe/sp_context.h | 1 + src/gallium/drivers/softpipe/sp_draw_arrays.c | 1 + src/gallium/drivers/softpipe/sp_setup.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index b89a7292e5..2f90d538a5 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -107,6 +107,7 @@ struct softpipe_context { /** Which vertex shader output slot contains point size */ int psize_slot; + unsigned api_prim; /**< current prim type being drawn: PIPE_PRIM_x */ unsigned reduced_api_prim; /**< PIPE_PRIM_POINTS, _LINES or _TRIANGLES */ /** Derived from scissor and surface bounds: */ diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index f117096bf7..1460bc4b4b 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -129,6 +129,7 @@ softpipe_draw_range_elements(struct pipe_context *pipe, struct draw_context *draw = sp->draw; unsigned i; + sp->api_prim = mode; sp->reduced_api_prim = reduced_prim[mode]; if (sp->dirty) diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index accc692b66..c4dd61e41e 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -512,7 +512,10 @@ static boolean setup_sort_vertices( struct setup_context *setup, const float (*v1)[4], const float (*v2)[4] ) { - setup->vprovoke = v2; + if (setup->softpipe->api_prim == PIPE_PRIM_POLYGON) + setup->vprovoke = v0; + else + setup->vprovoke = v2; /* determine bottom to top order of vertices */ { -- cgit v1.2.3 From 31deacb8d38e2090dc4ba3ee4f6587792860e8c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 27 May 2009 19:30:07 -0600 Subject: softpipe: include sp_winsys.h to silence warning (unprototyped function) --- src/gallium/drivers/softpipe/sp_texture.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 9e19745889..7a533dad9f 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -42,6 +42,7 @@ #include "sp_texture.h" #include "sp_tile_cache.h" #include "sp_screen.h" +#include "sp_winsys.h" /* Simple, maximally packed layout. -- cgit v1.2.3 From b86067c61072ef0e6804e7cf0f19a7ea43fc6aec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 27 May 2009 19:36:59 -0600 Subject: softpipe: comments --- src/gallium/drivers/softpipe/sp_setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index c4dd61e41e..4f0baa3fd4 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -504,6 +504,8 @@ static void print_vertex(const struct setup_context *setup, #endif /** + * Sort the vertices from top to bottom order, setting up the triangle + * edge fields (ebot, emaj, etop). * \return FALSE if coords are inf/nan (cull the tri), TRUE otherwise */ static boolean setup_sort_vertices( struct setup_context *setup, -- cgit v1.2.3 From 5be48307d55120311b13433eaa9af09d07e233e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 27 May 2009 19:37:32 -0600 Subject: demos: remove some old debug/test code --- progs/samples/prim.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/progs/samples/prim.c b/progs/samples/prim.c index f47c60faef..c04750725f 100644 --- a/progs/samples/prim.c +++ b/progs/samples/prim.c @@ -466,25 +466,22 @@ static void Draw(void) } else { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } -#if 01 + Viewport(0, 0); Point(); Viewport(0, 1); Lines(); Viewport(0, 2); LineStrip(); Viewport(0, 3); LineLoop(); Viewport(1, 0); Bitmap(); - Viewport(1, 1); TriangleFan(); Viewport(1, 2); Triangles(); Viewport(1, 3); TriangleStrip(); Viewport(2, 0); Rect(); -#endif Viewport(2, 1); PolygonFunc(); -#if 01 Viewport(2, 2); Quads(); Viewport(2, 3); QuadStrip(); -#endif + glFlush(); if (doubleBuffer) { -- cgit v1.2.3 From 713b636a0e0356266b714548886b66864b830fff Mon Sep 17 00:00:00 2001 From: Mike Kaplinksiy Date: Thu, 28 May 2009 01:20:37 -0400 Subject: draw: Fix assertion failure at fetch_emit_prepare --- src/gallium/auxiliary/draw/draw_pt_fetch_emit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c index 6b7d02a19b..e7fe6b3b76 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c @@ -130,6 +130,10 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle, unsigned output_format; switch (vinfo->attrib[i].emit) { + case EMIT_4UB: + output_format = PIPE_FORMAT_R8G8B8A8_UNORM; + emit_sz = 4 * sizeof(unsigned char); + break; case EMIT_4F: output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; emit_sz = 4 * sizeof(float); @@ -153,6 +157,8 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle, output_format = PIPE_FORMAT_R32_FLOAT; emit_sz = 1 * sizeof(float); break; + case EMIT_OMIT: + continue; default: assert(0); output_format = PIPE_FORMAT_NONE; -- cgit v1.2.3 From 65e3fb7b46cc9fc02ad12fe41e0c023c65ffe1e8 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 28 May 2009 10:25:44 +1000 Subject: nouveau: explicitly request mappable buffers for the moment --- src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c index 9e03a9f5db..2dca8cd3a9 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c @@ -74,6 +74,7 @@ nouveau_pipe_bo_create(struct pipe_winsys *ws, unsigned alignment, nvbuf->base.size = size; flags = nouveau_flags_from_usage(ws, usage); + flags |= NOUVEAU_BO_MAP; if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) { FREE(nvbuf); return NULL; -- cgit v1.2.3 From 9417582f39788476e1039df3f1bdf681686fb7b4 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 12:21:27 +0200 Subject: nv50: fix some memory leaks in shader assembler --- src/gallium/drivers/nv50/nv50_program.c | 88 +++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 2d15868ae8..a33ec5997a 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -823,6 +823,11 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, emit_mov(pc, dst[2], zero); set_pred(pc, 3, 0, pc->p->exec_tail); } + + FREE(pos128); + FREE(neg128); + FREE(zero); + FREE(one); } static void @@ -885,7 +890,9 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) { struct nv50_reg *r = NULL; struct nv50_reg *temp; - unsigned c; + unsigned sgn, c; + + sgn = tgsi_util_get_full_src_register_sign_mode(src, chan); c = tgsi_util_get_full_src_register_extswizzle(src, chan); switch (c) { @@ -915,16 +922,17 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) break; case TGSI_EXTSWIZZLE_ZERO: r = alloc_immd(pc, 0.0); - break; + return r; case TGSI_EXTSWIZZLE_ONE: - r = alloc_immd(pc, 1.0); - break; + if (sgn == TGSI_UTIL_SIGN_TOGGLE || sgn == TGSI_UTIL_SIGN_SET) + return alloc_immd(pc, -1.0); + return alloc_immd(pc, 1.0); default: assert(0); break; } - switch (tgsi_util_get_full_src_register_sign_mode(src, chan)) { + switch (sgn) { case TGSI_UTIL_SIGN_KEEP: break; case TGSI_UTIL_SIGN_CLEAR: @@ -967,6 +975,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) dst[c] = tgsi_dst(pc, c, &inst->FullDstRegisters[0]); else dst[c] = NULL; + rdst[c] = NULL; + src[0][c] = NULL; + src[1][c] = NULL; + src[2][c] = NULL; } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { @@ -1002,7 +1014,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_COS: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_precossin(pc, temp, src[0][0]); emit_flop(pc, 5, temp, temp); for (c = 0; c < 4; c++) { @@ -1012,7 +1024,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_DP3: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_mul(pc, temp, src[0][0], src[1][0]); emit_mad(pc, temp, src[0][1], src[1][1], temp); emit_mad(pc, temp, src[0][2], src[1][2], temp); @@ -1021,10 +1033,9 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) continue; emit_mov(pc, dst[c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_DP4: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_mul(pc, temp, src[0][0], src[1][0]); emit_mad(pc, temp, src[0][1], src[1][1], temp); emit_mad(pc, temp, src[0][2], src[1][2], temp); @@ -1034,10 +1045,9 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) continue; emit_mov(pc, dst[c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_DPH: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_mul(pc, temp, src[0][0], src[1][0]); emit_mad(pc, temp, src[0][1], src[1][1], temp); emit_mad(pc, temp, src[0][2], src[1][2], temp); @@ -1047,7 +1057,6 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) continue; emit_mov(pc, dst[c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_DST: { @@ -1064,7 +1073,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_EX2: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_preex2(pc, temp, src[0][0]); emit_flop(pc, 6, temp, temp); for (c = 0; c < 4; c++) { @@ -1072,7 +1081,6 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) continue; emit_mov(pc, dst[c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_FLR: for (c = 0; c < 4; c++) { @@ -1082,14 +1090,13 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_FRC: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; emit_flr(pc, temp, src[0][c]); emit_sub(pc, dst[c], src[0][c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_KIL: emit_kil(pc, src[0][0]); @@ -1101,7 +1108,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) emit_lit(pc, &dst[0], mask, &src[0][0]); break; case TGSI_OPCODE_LG2: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_flop(pc, 3, temp, src[0][0]); for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) @@ -1157,14 +1164,13 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_POW: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_pow(pc, temp, src[0][0], src[1][0]); for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; emit_mov(pc, dst[c], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_RCP: for (c = 0; c < 4; c++) { @@ -1181,7 +1187,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_SCS: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_precossin(pc, temp, src[0][0]); if (mask & (1 << 0)) emit_flop(pc, 5, dst[0], temp); @@ -1196,7 +1202,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_SIN: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); emit_precossin(pc, temp, src[0][0]); emit_flop(pc, 4, temp, temp); for (c = 0; c < 4; c++) { @@ -1246,7 +1252,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_XPD: - temp = alloc_temp(pc, NULL); + temp = temp_temp(pc); if (mask & (1 << 0)) { emit_mul(pc, temp, src[0][2], src[1][1]); emit_msb(pc, dst[0], src[0][1], src[1][2], temp); @@ -1259,7 +1265,6 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) emit_mul(pc, temp, src[0][1], src[1][0]); emit_msb(pc, dst[2], src[0][0], src[1][1], temp); } - free_temp(pc, temp); break; case TGSI_OPCODE_END: break; @@ -1288,6 +1293,15 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } } + for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { + for (c = 0; c < 4; c++) { + if (!src[i][c]) + continue; + if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD) + FREE(src[i][c]); + } + } + kill_temp_temp(pc); return TRUE; } @@ -1477,6 +1491,31 @@ out_err: return ret; } +static void +free_nv50_pc(struct nv50_pc *pc) +{ + unsigned i; + + if (pc->immd) + FREE(pc->immd); + if (pc->param) + FREE(pc->param); + if (pc->result) + FREE(pc->result); + if (pc->attr) + FREE(pc->attr); + if (pc->temp) + FREE(pc->temp); + + for (i = 0; i < NV50_SU_MAX_TEMP; i++) { + /* deallocate fragment program attributes */ + if (pc->r_temp[i] && pc->r_temp[i]->index == -1) + FREE(pc->r_temp[i]); + } + + FREE(pc); +} + static boolean nv50_program_tx(struct nv50_program *p) { @@ -1530,6 +1569,7 @@ out_err: tgsi_parse_free(&parse); out_cleanup: + free_nv50_pc(pc); return ret; } @@ -1637,13 +1677,11 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) #ifdef NV50_PROGRAM_DUMP NOUVEAU_ERR("-------\n"); - up = ptr = MALLOC(p->exec_size * 4); for (e = p->exec_head; e; e = e->next) { NOUVEAU_ERR("0x%08x\n", e->inst[0]); if (is_long(e)) NOUVEAU_ERR("0x%08x\n", e->inst[1]); } - #endif up = ptr = MALLOC(p->exec_size * 4); -- cgit v1.2.3 From 229992d2812581ffae24d69a5a983d2c8441f720 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 12:21:54 +0200 Subject: nv50: make LRP instruction nicer --- src/gallium/drivers/nv50/nv50_program.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index a33ec5997a..6aec9cc841 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1117,15 +1117,12 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_LRP: + temp = temp_temp(pc); for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; - /*XXX: we can do better than this */ - temp = alloc_temp(pc, NULL); - emit_neg(pc, temp, src[0][c]); - emit_mad(pc, temp, temp, src[2][c], src[2][c]); - emit_mad(pc, dst[c], src[0][c], src[1][c], temp); - free_temp(pc, temp); + emit_sub(pc, temp, src[1][c], src[2][c]); + emit_mad(pc, dst[c], temp, src[0][c], src[2][c]); } break; case TGSI_OPCODE_MAD: -- cgit v1.2.3 From 4a7cf8f66ff5d7e15ae7f8f5542f27bc72c68709 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 12:22:30 +0200 Subject: nv50: set dst.z,w to 0,1 in SCS and XPD According to tgsi-instruction-set.txt, if they are written, z and w should be set to 0 and 1 respectively in SCS, and w to 1.0 in XPD. --- src/gallium/drivers/nv50/nv50_program.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 6aec9cc841..877ead39ce 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -438,6 +438,14 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) emit(pc, e); } +static INLINE void +emit_mov_immdval(struct nv50_pc *pc, struct nv50_reg *dst, float f) +{ + struct nv50_reg *imm = alloc_immd(pc, f); + emit_mov(pc, dst, imm); + FREE(imm); +} + static boolean check_swap_src_0_1(struct nv50_pc *pc, struct nv50_reg **s0, struct nv50_reg **s1) @@ -1190,6 +1198,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) emit_flop(pc, 5, dst[0], temp); if (mask & (1 << 1)) emit_flop(pc, 4, dst[1], temp); + if (mask & (1 << 2)) + emit_mov_immdval(pc, dst[2], 0.0); + if (mask & (1 << 3)) + emit_mov_immdval(pc, dst[3], 1.0); break; case TGSI_OPCODE_SGE: for (c = 0; c < 4; c++) { @@ -1262,6 +1274,8 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) emit_mul(pc, temp, src[0][1], src[1][0]); emit_msb(pc, dst[2], src[0][0], src[1][1], temp); } + if (mask & (1 << 3)) + emit_mov_immdval(pc, dst[3], 1.0); break; case TGSI_OPCODE_END: break; -- cgit v1.2.3 From aad31d69ce9e2278d93e514b97e1a92a25f89826 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 12:24:33 +0200 Subject: nv50: fix SIGN_SET case in tgsi_src --- src/gallium/drivers/nv50/nv50_program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 877ead39ce..2241801542 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -956,7 +956,7 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) case TGSI_UTIL_SIGN_SET: temp = temp_temp(pc); emit_abs(pc, temp, r); - emit_neg(pc, temp, r); + emit_neg(pc, temp, temp); r = temp; break; default: -- cgit v1.2.3 From 7e7d3a87ec60f8e412d724c6586461501d420ec0 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 12:25:32 +0200 Subject: nv50: save some space in immediate buffer We could do even better (like just allocating 1 value in alloc_immd), but that's fine for now I guess. --- src/gallium/drivers/nv50/nv50_program.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 2241801542..40d2384c3e 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -250,7 +250,13 @@ alloc_immd(struct nv50_pc *pc, float f) struct nv50_reg *r = CALLOC_STRUCT(nv50_reg); unsigned hw; - hw = ctor_immd(pc, f, 0, 0, 0) * 4; + for (hw = 0; hw < pc->immd_nr * 4; hw++) + if (pc->immd_buf[hw] == f) + break; + + if (hw == pc->immd_nr * 4) + hw = ctor_immd(pc, f, -f, 0.5 * f, 0) * 4; + r->type = P_IMMD; r->hw = hw; r->index = -1; -- cgit v1.2.3 From bcecb8ff66d2c002ac1273c0a9e9b2b9f9d3d43e Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 13:32:51 +0200 Subject: nv50: record last access to temp and attr regs We now inspect the TGSI instructions in tx_prep to determine where temps and FP attrs are last accessed. This will enable us to reclaim some temporaries early and we also use it to omit pre-loading FP attributes that aren't used. --- src/gallium/drivers/nv50/nv50_program.c | 127 ++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 40d2384c3e..c73ed08a55 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -85,6 +85,8 @@ struct nv50_reg { int hw; int neg; + + int acc; /* instruction where this reg is last read (first insn == 1) */ }; struct nv50_pc { @@ -108,6 +110,10 @@ struct nv50_pc { struct nv50_reg *temp_temp[16]; unsigned temp_temp_nr; + + /* current instruction and total number of insns */ + unsigned insn_cur; + unsigned insn_nr; }; static void @@ -1323,6 +1329,112 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) return TRUE; } +/* Adjust a bitmask that indicates what components of a source are used, + * we use this in tx_prep so we only load interpolants that are needed. + */ +static void +insn_adjust_mask(const struct tgsi_full_instruction *insn, unsigned *mask) +{ + const struct tgsi_instruction_ext_texture *tex; + + switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_DP3: + *mask = 0x7; + break; + case TGSI_OPCODE_DP4: + case TGSI_OPCODE_DPH: + *mask = 0xF; + break; + case TGSI_OPCODE_LIT: + *mask = 0xB; + break; + case TGSI_OPCODE_RCP: + case TGSI_OPCODE_RSQ: + *mask = 0x1; + break; + case TGSI_OPCODE_TEX: + case TGSI_OPCODE_TXP: + assert(insn->Instruction.Extended); + tex = &insn->InstructionExtTexture; + + *mask = 0x7; + if (tex->Texture == TGSI_TEXTURE_1D) + *mask = 0x1; + else + if (tex->Texture == TGSI_TEXTURE_2D) + *mask = 0x3; + + if (insn->Instruction.Opcode == TGSI_OPCODE_TXP) + *mask |= 0x8; + break; + default: + break; + } +} + +static void +prep_inspect_insn(struct nv50_pc *pc, const union tgsi_full_token *tok, + unsigned *r_usage[2]) +{ + const struct tgsi_full_instruction *insn; + const struct tgsi_full_src_register *src; + const struct tgsi_dst_register *dst; + + unsigned i, c, k, n, mask, *acc_p; + + insn = &tok->FullInstruction; + dst = &insn->FullDstRegisters[0].DstRegister; + mask = dst->WriteMask; + + if (!r_usage[0]) + r_usage[0] = CALLOC(pc->temp_nr * 4, sizeof(unsigned)); + if (!r_usage[1]) + r_usage[1] = CALLOC(pc->attr_nr * 4, sizeof(unsigned)); + + if (dst->File == TGSI_FILE_TEMPORARY) { + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + r_usage[0][dst->Index * 4 + c] = pc->insn_nr; + } + } + + for (i = 0; i < insn->Instruction.NumSrcRegs; i++) { + src = &insn->FullSrcRegisters[i]; + + switch (src->SrcRegister.File) { + case TGSI_FILE_TEMPORARY: + acc_p = r_usage[0]; + break; + case TGSI_FILE_INPUT: + acc_p = r_usage[1]; + break; + default: + continue; + } + + insn_adjust_mask(insn, &mask); + + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + + k = tgsi_util_get_full_src_register_extswizzle(src, c); + switch (k) { + case TGSI_EXTSWIZZLE_X: + case TGSI_EXTSWIZZLE_Y: + case TGSI_EXTSWIZZLE_Z: + case TGSI_EXTSWIZZLE_W: + n = src->SrcRegister.Index * 4 + k; + acc_p[n] = pc->insn_nr; + break; + default: + break; + } + } + } +} + static boolean nv50_program_tx_prep(struct nv50_pc *pc) { @@ -1330,6 +1442,11 @@ nv50_program_tx_prep(struct nv50_pc *pc) boolean ret = FALSE; unsigned i, c; + /* track register access for temps and attrs */ + unsigned *r_usage[2]; + r_usage[0] = NULL; + r_usage[1] = NULL; + tgsi_parse_init(&p, pc->p->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { const union tgsi_full_token *tok = &p.FullToken; @@ -1382,6 +1499,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) } break; case TGSI_TOKEN_TYPE_INSTRUCTION: + pc->insn_nr++; + prep_inspect_insn(pc, tok, r_usage); break; default: break; @@ -1398,6 +1517,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) pc->temp[i*4+c].type = P_TEMP; pc->temp[i*4+c].hw = -1; pc->temp[i*4+c].index = i; + pc->temp[i*4+c].acc = r_usage[0][i*4+c]; } } } @@ -1427,6 +1547,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) pc->attr[i*4+c].type = at->type; pc->attr[i*4+c].hw = at->hw; pc->attr[i*4+c].index = at->index; + pc->attr[i*4+c].acc = r_usage[1][i*4+c]; } else { pc->p->cfg.vp.attr[aid/32] |= (1 << (aid % 32)); @@ -1504,6 +1625,11 @@ nv50_program_tx_prep(struct nv50_pc *pc) ret = TRUE; out_err: + if (r_usage[0]) + FREE(r_usage[0]); + if (r_usage[1]) + FREE(r_usage[1]); + tgsi_parse_free(&p); return ret; } @@ -1558,6 +1684,7 @@ nv50_program_tx(struct nv50_program *p) switch (tok->Token.Type) { case TGSI_TOKEN_TYPE_INSTRUCTION: + ++pc->insn_cur; ret = nv50_program_tx_insn(pc, tok); if (ret == FALSE) goto out_err; -- cgit v1.2.3 From e88ec312df000ac335d9bba6b75d836dfa1a1043 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 13:38:03 +0200 Subject: nv50: inspect decl semantic and interpolation mode Record interpolation mode for attributes while parsing declarations, and also remember the indices of FP color inputs and FP depth output, which has to end up in the highest output register. --- src/gallium/drivers/nv50/nv50_program.c | 75 ++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index c73ed08a55..85e5432208 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -111,6 +111,8 @@ struct nv50_pc { struct nv50_reg *temp_temp[16]; unsigned temp_temp_nr; + unsigned interp_mode[32]; + /* current instruction and total number of insns */ unsigned insn_cur; unsigned insn_nr; @@ -366,6 +368,12 @@ set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) e->inst[1] |= (val >> 6) << 2; } + +#define INTERP_LINEAR 0 +#define INTERP_FLAT 1 +#define INTERP_PERSPECTIVE 2 +#define INTERP_CENTROID 4 + static void emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src, struct nv50_reg *iv) @@ -1441,12 +1449,19 @@ nv50_program_tx_prep(struct nv50_pc *pc) struct tgsi_parse_context p; boolean ret = FALSE; unsigned i, c; + unsigned fcol, bcol, fcrd, depr; + + /* count (centroid) perspective interpolations */ + unsigned centroid_loads = 0; + unsigned perspect_loads = 0; /* track register access for temps and attrs */ unsigned *r_usage[2]; r_usage[0] = NULL; r_usage[1] = NULL; + depr = fcol = bcol = fcrd = 0xffff; + tgsi_parse_init(&p, pc->p->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { const union tgsi_full_token *tok = &p.FullToken; @@ -1467,9 +1482,10 @@ nv50_program_tx_prep(struct nv50_pc *pc) case TGSI_TOKEN_TYPE_DECLARATION: { const struct tgsi_full_declaration *d; - unsigned last; + unsigned last, first, mode; d = &p.FullToken.FullDeclaration; + first = d->DeclarationRange.First; last = d->DeclarationRange.Last; switch (d->Declaration.File) { @@ -1480,10 +1496,67 @@ nv50_program_tx_prep(struct nv50_pc *pc) case TGSI_FILE_OUTPUT: if (pc->result_nr < (last + 1)) pc->result_nr = last + 1; + + if (!d->Declaration.Semantic) + break; + + switch (d->Semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + depr = first; + break; + default: + break; + } + break; case TGSI_FILE_INPUT: + { if (pc->attr_nr < (last + 1)) pc->attr_nr = last + 1; + + if (pc->p->type != PIPE_SHADER_FRAGMENT) + break; + + switch (d->Declaration.Interpolate) { + case TGSI_INTERPOLATE_CONSTANT: + mode = INTERP_FLAT; + break; + case TGSI_INTERPOLATE_PERSPECTIVE: + mode = INTERP_PERSPECTIVE; + break; + default: + mode = INTERP_LINEAR; + break; + } + + if (d->Declaration.Semantic) { + switch (d->Semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + fcrd = first; + break; + case TGSI_SEMANTIC_COLOR: + fcol = first; + mode = INTERP_PERSPECTIVE; + break; + case TGSI_SEMANTIC_BCOLOR: + bcol = first; + mode = INTERP_PERSPECTIVE; + break; + } + } + + if (d->Declaration.Centroid) { + mode |= INTERP_CENTROID; + if (mode & INTERP_PERSPECTIVE) + centroid_loads++; + } else + if (mode & INTERP_PERSPECTIVE) + perspect_loads++; + + assert(last < 32); + for (i = first; i <= last; i++) + pc->interp_mode[i] = mode; + } break; case TGSI_FILE_CONSTANT: if (pc->param_nr < (last + 1)) -- cgit v1.2.3 From dd9ded42b9ff75aa0bbabef30d385a9f77851dce Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 14:56:48 +0200 Subject: nv50: modified FP attribute loading VP outputs that should be loadable in the FP are mapped to interpolant indices by HPOS, COL0 etc.; of course HPOS is always written, so the highest byte of 1988 is a bitmask that selects which components of HPOS are used for interpolants, i.e. the FP inputs in COL0 start at index POPCNT(1988[24:28]). --- src/gallium/drivers/nv50/nv50_program.c | 187 ++++++++++++++++++++++++-------- src/gallium/drivers/nv50/nv50_program.h | 5 + 2 files changed, 147 insertions(+), 45 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 85e5432208..5d391f9b24 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -86,6 +86,7 @@ struct nv50_reg { int hw; int neg; + int rhw; /* result hw for FP outputs, or interpolant index */ int acc; /* instruction where this reg is last read (first insn == 1) */ }; @@ -112,6 +113,9 @@ struct nv50_pc { unsigned temp_temp_nr; unsigned interp_mode[32]; + /* perspective interpolation registers */ + struct nv50_reg *iv_p; + struct nv50_reg *iv_c; /* current instruction and total number of insns */ unsigned insn_cur; @@ -374,20 +378,29 @@ set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) #define INTERP_PERSPECTIVE 2 #define INTERP_CENTROID 4 +/* interpolant index has been stored in dst->rhw */ static void -emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, - struct nv50_reg *src, struct nv50_reg *iv) +emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *iv, + unsigned mode) { + assert(dst->rhw != -1); struct nv50_program_exec *e = exec(pc); e->inst[0] |= 0x80000000; set_dst(pc, dst, e); - alloc_reg(pc, src); - e->inst[0] |= (src->hw << 16); - if (iv) { - e->inst[0] |= (1 << 25); - alloc_reg(pc, iv); - e->inst[0] |= (iv->hw << 9); + e->inst[0] |= (dst->rhw << 16); + + if (mode & INTERP_FLAT) { + e->inst[0] |= (1 << 8); + } else { + if (mode & INTERP_PERSPECTIVE) { + e->inst[0] |= (1 << 25); + alloc_reg(pc, iv); + e->inst[0] |= (iv->hw << 9); + } + + if (mode & INTERP_CENTROID) + e->inst[0] |= (1 << 24); } emit(pc, e); @@ -1443,6 +1456,40 @@ prep_inspect_insn(struct nv50_pc *pc, const union tgsi_full_token *tok, } } +static unsigned +load_fp_attrib(struct nv50_pc *pc, int i, unsigned *acc, int *mid, + int *aid, int *p_oid) +{ + struct nv50_reg *iv; + int oid, c, n; + unsigned mask = 0; + + iv = (pc->interp_mode[i] & INTERP_CENTROID) ? pc->iv_c : pc->iv_p; + + for (c = 0, n = i * 4; c < 4; c++, n++) { + oid = (*p_oid)++; + pc->attr[n].type = P_TEMP; + pc->attr[n].index = i; + + if (pc->attr[n].acc == acc[n]) + continue; + mask |= (1 << c); + + pc->attr[n].acc = acc[n]; + pc->attr[n].rhw = pc->attr[n].hw = -1; + alloc_reg(pc, &pc->attr[n]); + + pc->attr[n].rhw = (*aid)++; + emit_interp(pc, &pc->attr[n], iv, pc->interp_mode[i]); + + pc->p->cfg.fp.map[(*mid) / 4] |= oid << (8 * ((*mid) % 4)); + (*mid)++; + pc->p->cfg.fp.regs[1] += 0x00010001; + } + + return mask; +} + static boolean nv50_program_tx_prep(struct nv50_pc *pc) { @@ -1462,6 +1509,11 @@ nv50_program_tx_prep(struct nv50_pc *pc) depr = fcol = bcol = fcrd = 0xffff; + if (pc->p->type == PIPE_SHADER_FRAGMENT) { + pc->p->cfg.fp.regs[0] = 0x01000404; + pc->p->cfg.fp.regs[1] = 0x00000400; + } + tgsi_parse_init(&p, pc->p->pipe.tokens); while (!tgsi_parse_end_of_tokens(&p)) { const union tgsi_full_token *tok = &p.FullToken; @@ -1503,6 +1555,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) switch (d->Semantic.SemanticName) { case TGSI_SEMANTIC_POSITION: depr = first; + pc->p->cfg.fp.regs[2] |= 0x00000100; + pc->p->cfg.fp.regs[3] |= 0x00000011; break; default: break; @@ -1589,6 +1643,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) for (c = 0; c < 4; c++) { pc->temp[i*4+c].type = P_TEMP; pc->temp[i*4+c].hw = -1; + pc->temp[i*4+c].rhw = -1; pc->temp[i*4+c].index = i; pc->temp[i*4+c].acc = r_usage[0][i*4+c]; } @@ -1596,51 +1651,87 @@ nv50_program_tx_prep(struct nv50_pc *pc) } if (pc->attr_nr) { - struct nv50_reg *iv = NULL; - int aid = 0; + int oid = 4, mid = 4, aid = 0; + /* oid = VP output id + * aid = FP attribute/interpolant id + * mid = VP output mapping field ID + */ pc->attr = CALLOC(pc->attr_nr * 4, sizeof(struct nv50_reg)); if (!pc->attr) goto out_err; if (pc->p->type == PIPE_SHADER_FRAGMENT) { - iv = alloc_temp(pc, NULL); - emit_interp(pc, iv, iv, NULL); - emit_flop(pc, 0, iv, iv); - aid++; - } + /* position should be loaded first */ + if (fcrd != 0xffff) { + unsigned mask; + mid = 0; + mask = load_fp_attrib(pc, fcrd, r_usage[1], + &mid, &aid, &oid); + oid = 0; + pc->p->cfg.fp.regs[1] |= (mask << 24); + pc->p->cfg.fp.map[0] = 0x04040404 * fcrd; + } + pc->p->cfg.fp.map[0] += 0x03020100; - for (i = 0; i < pc->attr_nr; i++) { - struct nv50_reg *a = &pc->attr[i*4]; + /* should do MAD fcrd.xy, fcrd, SOME_CONST, fcrd */ - for (c = 0; c < 4; c++) { - if (pc->p->type == PIPE_SHADER_FRAGMENT) { - struct nv50_reg *at = - alloc_temp(pc, NULL); - pc->attr[i*4+c].type = at->type; - pc->attr[i*4+c].hw = at->hw; - pc->attr[i*4+c].index = at->index; - pc->attr[i*4+c].acc = r_usage[1][i*4+c]; + if (perspect_loads) { + pc->iv_p = alloc_temp(pc, NULL); + + if (!(pc->p->cfg.fp.regs[1] & 0x08000000)) { + pc->p->cfg.fp.regs[1] |= 0x08000000; + pc->iv_p->rhw = aid++; + emit_interp(pc, pc->iv_p, NULL, + INTERP_LINEAR); + emit_flop(pc, 0, pc->iv_p, pc->iv_p); } else { - pc->p->cfg.vp.attr[aid/32] |= - (1 << (aid % 32)); - pc->attr[i*4+c].type = P_ATTR; - pc->attr[i*4+c].hw = aid++; - pc->attr[i*4+c].index = i; + pc->iv_p->rhw = aid - 1; + emit_flop(pc, 0, pc->iv_p, + &pc->attr[fcrd * 4 + 3]); } } - if (pc->p->type != PIPE_SHADER_FRAGMENT) - continue; + if (centroid_loads) { + pc->iv_c = alloc_temp(pc, NULL); + pc->iv_c->rhw = pc->iv_p ? aid - 1 : aid++; + emit_interp(pc, pc->iv_c, NULL, + INTERP_CENTROID); + emit_flop(pc, 0, pc->iv_c, pc->iv_c); + pc->p->cfg.fp.regs[1] |= 0x08000000; + } - emit_interp(pc, &a[0], &a[0], iv); - emit_interp(pc, &a[1], &a[1], iv); - emit_interp(pc, &a[2], &a[2], iv); - emit_interp(pc, &a[3], &a[3], iv); - } + for (c = 0; c < 4; c++) { + /* I don't know what these values do, but + * let's set them like the blob does: + */ + if (fcol != 0xffff && r_usage[1][fcol * 4 + c]) + pc->p->cfg.fp.regs[0] += 0x00010000; + if (bcol != 0xffff && r_usage[1][bcol * 4 + c]) + pc->p->cfg.fp.regs[0] += 0x00010000; + } + + for (i = 0; i < pc->attr_nr; i++) + load_fp_attrib(pc, i, r_usage[1], + &mid, &aid, &oid); - if (iv) - free_temp(pc, iv); + if (pc->iv_p) + free_temp(pc, pc->iv_p); + if (pc->iv_c) + free_temp(pc, pc->iv_c); + + pc->p->cfg.fp.high_map = (mid / 4); + pc->p->cfg.fp.high_map += ((mid % 4) ? 1 : 0); + } else { + /* vertex program */ + for (i = 0; i < pc->attr_nr * 4; i++) { + pc->p->cfg.vp.attr[aid / 32] |= + (1 << (aid % 32)); + pc->attr[i].type = P_ATTR; + pc->attr[i].hw = aid++; + pc->attr[i].index = i / 4; + } + } } if (pc->result_nr) { @@ -1983,6 +2074,7 @@ nv50_fragprog_validate(struct nv50_context *nv50) struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_program *p = nv50->fragprog; struct nouveau_stateobj *so; + unsigned i; if (!p->translated) { nv50_program_validate(nv50, p); @@ -2000,17 +2092,22 @@ nv50_fragprog_validate(struct nv50_context *nv50) so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); so_method(so, tesla, 0x1904, 4); - so_data (so, 0x00040404); /* p: 0x01000404 */ + so_data (so, p->cfg.fp.regs[0]); /* 0x01000404 / 0x00040404 */ so_data (so, 0x00000004); so_data (so, 0x00000000); so_data (so, 0x00000000); - so_method(so, tesla, 0x16bc, 3); /*XXX: fixme */ - so_data (so, 0x03020100); - so_data (so, 0x07060504); - so_data (so, 0x0b0a0908); + so_method(so, tesla, 0x16bc, p->cfg.fp.high_map); + for (i = 0; i < p->cfg.fp.high_map; i++) + so_data(so, p->cfg.fp.map[i]); so_method(so, tesla, 0x1988, 2); - so_data (so, 0x08080408); //0x08040404); /* p: 0x0f000401 */ + so_data (so, p->cfg.fp.regs[1]); /* 0x08040404 / 0x0f000401 */ so_data (so, p->cfg.high_temp); + so_method(so, tesla, 0x1298, 1); + so_data (so, p->cfg.high_result); + so_method(so, tesla, 0x19a8, 1); + so_data (so, p->cfg.fp.regs[2]); + so_method(so, tesla, 0x196c, 1); + so_data (so, p->cfg.fp.regs[3]); so_method(so, tesla, 0x1414, 1); so_data (so, 0); /* program start offset */ so_ref(so, &nv50->state.fragprog); diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index 78deed6a38..b3240b36ef 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -39,6 +39,11 @@ struct nv50_program { struct { unsigned attr[2]; } vp; + struct { + unsigned regs[4]; + unsigned map[5]; + unsigned high_map; + } fp; } cfg; }; -- cgit v1.2.3 From f579a99cc608eaba6f617c11ab0aec7f3e9ef953 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:01:36 +0200 Subject: nv50: put FP outputs where they belong Depth output in fragment programs should end up in the first register after the color outputs. --- src/gallium/drivers/nv50/nv50_program.c | 41 +++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 5d391f9b24..80b7630113 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -125,7 +125,7 @@ struct nv50_pc { static void alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg) { - int i; + int i = 0; if (reg->type == P_RESULT) { if (pc->p->cfg.high_result < (reg->hw + 1)) @@ -143,7 +143,22 @@ alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg) return; } - for (i = 0; i < NV50_SU_MAX_TEMP; i++) { + if (reg->rhw != -1) { + /* try to allocate temporary with index rhw first */ + if (!(pc->r_temp[reg->rhw])) { + pc->r_temp[reg->rhw] = reg; + reg->hw = reg->rhw; + if (pc->p->cfg.high_temp < (reg->rhw + 1)) + pc->p->cfg.high_temp = reg->rhw + 1; + return; + } + /* make sure we don't get things like $r0 needs to go + * in $r1 and $r1 in $r0 + */ + i = pc->result_nr * 4; + } + + for (; i < NV50_SU_MAX_TEMP; i++) { if (!(pc->r_temp[i])) { pc->r_temp[i] = reg; reg->hw = i; @@ -171,6 +186,7 @@ alloc_temp(struct nv50_pc *pc, struct nv50_reg *dst) r->type = P_TEMP; r->index = -1; r->hw = i; + r->rhw = -1; pc->r_temp[i] = r; return r; } @@ -1746,12 +1762,20 @@ nv50_program_tx_prep(struct nv50_pc *pc) if (pc->p->type == PIPE_SHADER_FRAGMENT) { pc->result[i*4+c].type = P_TEMP; pc->result[i*4+c].hw = -1; + pc->result[i*4+c].rhw = (i == depr) ? + -1 : rid++; } else { pc->result[i*4+c].type = P_RESULT; pc->result[i*4+c].hw = rid++; } pc->result[i*4+c].index = i; } + + if (pc->p->type == PIPE_SHADER_FRAGMENT && + depr != 0xffff) { + pc->result[depr * 4 + 2].rhw = + (pc->result_nr - 1) * 4; + } } } @@ -1828,6 +1852,7 @@ nv50_program_tx(struct nv50_program *p) { struct tgsi_parse_context parse; struct nv50_pc *pc; + unsigned k; boolean ret; pc = CALLOC_STRUCT(nv50_pc); @@ -1862,8 +1887,16 @@ nv50_program_tx(struct nv50_program *p) struct nv50_reg out; out.type = P_TEMP; - for (out.hw = 0; out.hw < pc->result_nr * 4; out.hw++) - emit_mov(pc, &out, &pc->result[out.hw]); + for (k = 0; k < pc->result_nr * 4; k++) { + if (pc->result[k].rhw == -1) + continue; + if (pc->result[k].hw != pc->result[k].rhw) { + out.hw = pc->result[k].rhw; + emit_mov(pc, &out, &pc->result[k]); + } + if (pc->p->cfg.high_result < (pc->result[k].rhw + 1)) + pc->p->cfg.high_result = pc->result[k].rhw + 1; + } } assert(is_long(pc->p->exec_tail) && !is_immd(pc->p->exec_head)); -- cgit v1.2.3 From dac709d0cf3258ad8e131964e513c2eabe1d554e Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:04:53 +0200 Subject: nv50: don't overwrite sources before they're used This would have happened in p.e. ADD TEMP[0], TEMP[0].xyxy, TEMP[1] or RCP/RSQ TEMP[i], TEMP[i]. --- src/gallium/drivers/nv50/nv50_program.c | 95 ++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 80b7630113..fa13133922 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -196,6 +196,22 @@ alloc_temp(struct nv50_pc *pc, struct nv50_reg *dst) return NULL; } +/* Assign the hw of the discarded temporary register src + * to the tgsi register dst and free src. + */ +static void +assimilate_temp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) +{ + assert(src->index == -1 && src->hw != -1); + + if (dst->hw != -1) + pc->r_temp[dst->hw] = NULL; + pc->r_temp[src->hw] = dst; + dst->hw = src->hw; + + FREE(src); +} + static void free_temp(struct nv50_pc *pc, struct nv50_reg *r) { @@ -852,17 +868,8 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, struct nv50_reg *pos128 = alloc_immd(pc, 127.999999); struct nv50_reg *tmp[4]; - if (mask & (1 << 0)) - emit_mov(pc, dst[0], one); - - if (mask & (1 << 3)) - emit_mov(pc, dst[3], one); - if (mask & (3 << 1)) { - if (mask & (1 << 1)) - tmp[0] = dst[1]; - else - tmp[0] = temp_temp(pc); + tmp[0] = alloc_temp(pc, NULL); emit_minmax(pc, 4, tmp[0], src[0], zero); } @@ -881,6 +888,19 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, set_pred(pc, 3, 0, pc->p->exec_tail); } + if (mask & (1 << 1)) + assimilate_temp(pc, dst[1], tmp[0]); + else + if (mask & (1 << 2)) + free_temp(pc, tmp[0]); + + /* do this last, in case src[i,j] == dst[0,3] */ + if (mask & (1 << 0)) + emit_mov(pc, dst[0], one); + + if (mask & (1 << 3)) + emit_mov(pc, dst[3], one); + FREE(pos128); FREE(neg128); FREE(zero); @@ -1016,12 +1036,40 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) return r; } +/* returns TRUE if instruction can overwrite sources before they're read */ +static boolean +direct2dest_op(const struct tgsi_full_instruction *insn) +{ + if (insn->Instruction.Saturate) + return FALSE; + + switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_COS: + case TGSI_OPCODE_DP3: + case TGSI_OPCODE_DP4: + case TGSI_OPCODE_DPH: + case TGSI_OPCODE_KIL: + case TGSI_OPCODE_LIT: + case TGSI_OPCODE_POW: + case TGSI_OPCODE_RCP: + case TGSI_OPCODE_RSQ: + case TGSI_OPCODE_SCS: + case TGSI_OPCODE_SIN: + case TGSI_OPCODE_TEX: + case TGSI_OPCODE_TXP: + return FALSE; + default: + return TRUE; + } +} + static boolean nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) { const struct tgsi_full_instruction *inst = &tok->FullInstruction; struct nv50_reg *rdst[4], *dst[4], *src[3][4], *temp; unsigned mask, sat, unit; + boolean assimilate = FALSE; int i, c; mask = inst->FullDstRegisters[0].DstRegister.WriteMask; @@ -1053,6 +1101,25 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) rdst[c] = dst[c]; dst[c] = temp_temp(pc); } + } else + if (direct2dest_op(inst)) { + for (c = 0; c < 4; c++) { + if (!dst[c] || dst[c]->type != P_TEMP) + continue; + + for (i = c + 1; i < 4; i++) { + if (dst[c] == src[0][i] || + dst[c] == src[1][i] || + dst[c] == src[2][i]) + break; + } + if (i == 4) + continue; + + assimilate = TRUE; + rdst[c] = dst[c]; + dst[c] = alloc_temp(pc, NULL); + } } switch (inst->Instruction.Opcode) { @@ -1227,14 +1294,14 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_RCP: - for (c = 0; c < 4; c++) { + for (c = 3; c >= 0; c--) { if (!(mask & (1 << c))) continue; emit_flop(pc, 0, dst[c], src[0][0]); } break; case TGSI_OPCODE_RSQ: - for (c = 0; c < 4; c++) { + for (c = 3; c >= 0; c--) { if (!(mask & (1 << c))) continue; emit_flop(pc, 2, dst[c], src[0][0]); @@ -1351,6 +1418,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) set_src_0(pc, dst[c], e); emit(pc, e); } + } else if (assimilate) { + for (c = 0; c < 4; c++) + if (rdst[c]) + assimilate_temp(pc, rdst[c], dst[c]); } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { -- cgit v1.2.3 From de651a228f9bbe5ab0e3b749b3dfda9aa5497097 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:05:55 +0200 Subject: nv50: enable KIL in register 19a8 --- src/gallium/drivers/nv50/nv50_program.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index fa13133922..c420b8be1c 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1227,6 +1227,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) emit_kil(pc, src[0][1]); emit_kil(pc, src[0][2]); emit_kil(pc, src[0][3]); + pc->p->cfg.fp.regs[2] |= 0x00100000; break; case TGSI_OPCODE_LIT: emit_lit(pc, &dst[0], mask, &src[0][0]); -- cgit v1.2.3 From 44b3bfaa7599add72d76b3802ddea05b5b5c6316 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:10:01 +0200 Subject: nv50: make sure half-long insns are paired I chose to just convert unpaired 32 bit length instructions after parsing all instructions, although it might be possible to determine beforehand whether there would be any lone ones, and then even do some swapping to bring them together ... --- src/gallium/drivers/nv50/nv50_program.c | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index c420b8be1c..78ffc7f7ce 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -945,6 +945,54 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) emit(pc, e); } +static void +convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) +{ + unsigned q = 0, m = ~0; + + assert(!is_long(e)); + + switch (e->inst[0] >> 28) { + case 0x1: + /* MOV */ + q = 0x0403c000; + m = 0xffff7fff; + break; + case 0x8: + /* INTERP */ + m = ~0x02000000; + if (e->inst[0] & 0x02000000) + q = 0x00020000; + break; + case 0x9: + /* RCP */ + break; + case 0xB: + /* ADD */ + m = ~(127 << 16); + q = ((e->inst[0] & (~m)) >> 2); + break; + case 0xC: + /* MUL */ + m = ~0x00008000; + q = ((e->inst[0] & (~m)) << 12); + break; + case 0xE: + /* MAD (if src2 == dst) */ + q = ((e->inst[0] & 0x1fc) << 12); + break; + default: + assert(0); + break; + } + + set_long(pc, e); + pc->p->exec_size++; + + e->inst[0] &= m; + e->inst[1] |= q; +} + static struct nv50_reg * tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst) { @@ -1971,6 +2019,30 @@ nv50_program_tx(struct nv50_program *p) } } + /* look for single half instructions and make them long */ + struct nv50_program_exec *e, *e_prev; + + for (k = 0, e = pc->p->exec_head, e_prev = NULL; e; e = e->next) { + if (!is_long(e)) + k++; + + if (!e->next || is_long(e->next)) { + if (k & 1) + convert_to_long(pc, e); + k = 0; + } + + if (e->next) + e_prev = e; + } + + if (!is_long(pc->p->exec_tail)) { + /* this may occur if moving FP results */ + assert(e_prev && !is_long(e_prev)); + convert_to_long(pc, e_prev); + convert_to_long(pc, pc->p->exec_tail); + } + assert(is_long(pc->p->exec_tail) && !is_immd(pc->p->exec_head)); pc->p->exec_tail->inst[1] |= 0x00000001; -- cgit v1.2.3 From d015cba88f1ef217f6ef9d116ba6abb32e043baa Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:10:56 +0200 Subject: nv50: enable half insns for MOV and MUL --- src/gallium/drivers/nv50/nv50_program.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 78ffc7f7ce..05b63be60a 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -120,6 +120,8 @@ struct nv50_pc { /* current instruction and total number of insns */ unsigned insn_cur; unsigned insn_nr; + + boolean allow32; }; static void @@ -491,14 +493,13 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) e->inst[0] |= (src->hw << 9); } - /* We really should support "half" instructions here at some point, - * but I don't feel confident enough about them yet. - */ - set_long(pc, e); if (is_long(e) && !is_immd(e)) { e->inst[1] |= 0x04000000; /* 32-bit */ - e->inst[1] |= 0x0003c000; /* "subsubop" 0xf == mov */ - } + e->inst[1] |= 0x0000c000; /* "subsubop" 0x3 */ + if (!(e->inst[1] & 0x20000000)) + e->inst[1] |= 0x00030000; /* "subsubop" 0xf */ + } else + e->inst[0] |= 0x00008000; emit(pc, e); } @@ -614,7 +615,6 @@ emit_mul(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_program_exec *e = exec(pc); e->inst[0] |= 0xc0000000; - set_long(pc, e); check_swap_src_0_1(pc, &src0, &src1); set_dst(pc, dst, e); @@ -1989,6 +1989,11 @@ nv50_program_tx(struct nv50_program *p) while (!tgsi_parse_end_of_tokens(&parse)) { const union tgsi_full_token *tok = &parse.FullToken; + /* don't allow half insn/immd on first and last instruction */ + pc->allow32 = TRUE; + if (pc->insn_cur == 0 || pc->insn_cur + 2 == pc->insn_nr) + pc->allow32 = FALSE; + tgsi_parse_token(&parse); switch (tok->Token.Type) { -- cgit v1.2.3 From 708c711f8361ea82c1217e2614914ae047bc5bdf Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:12:04 +0200 Subject: nv50: allow immediates for MOV, ADD and MUL Immediates are inlined now where possible, so we need to set pc->allow32 to FALSE in LIT where we have the conditional MOV, since immediates swallow the predicate bits. --- src/gallium/drivers/nv50/nv50_program.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 05b63be60a..30aa358860 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -393,7 +393,8 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e) static INLINE void set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) { - unsigned val = fui(pc->immd_buf[imm->hw]); /* XXX */ + assert(imm->hw >= pc->param_nr * 4); + unsigned val = fui(pc->immd_buf[imm->hw - pc->param_nr * 4]); set_long(pc, e); /*XXX: can't be predicated - bits overlap.. catch cases where both @@ -472,12 +473,11 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) set_dst(pc, dst, e); - if (0 && dst->type != P_RESULT && src->type == P_IMMD) { + if (pc->allow32 && dst->type != P_RESULT && src->type == P_IMMD) { set_immd(pc, src, e); /*XXX: 32-bit, but steals part of "half" reg space - need to * catch and handle this case if/when we do half-regs */ - e->inst[0] |= 0x00008000; } else if (src->type == P_IMMD || src->type == P_CONST) { set_long(pc, e); @@ -616,10 +616,16 @@ emit_mul(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, e->inst[0] |= 0xc0000000; + if (!pc->allow32) + set_long(pc, e); + check_swap_src_0_1(pc, &src0, &src1); set_dst(pc, dst, e); set_src_0(pc, src0, e); - set_src_1(pc, src1, e); + if (src1->type == P_IMMD && !is_long(e)) + set_immd(pc, src1, e); + else + set_src_1(pc, src1, e); emit(pc, e); } @@ -632,11 +638,17 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst, e->inst[0] |= 0xb0000000; + if (!pc->allow32) + set_long(pc, e); + check_swap_src_0_1(pc, &src0, &src1); set_dst(pc, dst, e); set_src_0(pc, src0, e); - if (is_long(e)) + if (is_long(e) || src1->type == P_CONST || src1->type == P_ATTR) set_src_2(pc, src1, e); + else + if (src1->type == P_IMMD) + set_immd(pc, src1, e); else set_src_1(pc, src1, e); @@ -867,6 +879,9 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, struct nv50_reg *neg128 = alloc_immd(pc, -127.999999); struct nv50_reg *pos128 = alloc_immd(pc, 127.999999); struct nv50_reg *tmp[4]; + boolean allow32 = pc->allow32; + + pc->allow32 = FALSE; if (mask & (3 << 1)) { tmp[0] = alloc_temp(pc, NULL); @@ -894,6 +909,8 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, if (mask & (1 << 2)) free_temp(pc, tmp[0]); + pc->allow32 = allow32; + /* do this last, in case src[i,j] == dst[0,3] */ if (mask & (1 << 0)) emit_mov(pc, dst[0], one); -- cgit v1.2.3 From 7ab96f4f733437de693b9578c3649b56069e6f24 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:15:20 +0200 Subject: nv50: release hw TEMPs early Since we know when we don't use a TEMP or FP ATTR register anymore, we can release their hw resources early. --- src/gallium/drivers/nv50/nv50_program.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 30aa358860..15d7ab0da5 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -214,6 +214,22 @@ assimilate_temp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) FREE(src); } +/* release the hardware resource held by r */ +static void +release_hw(struct nv50_pc *pc, struct nv50_reg *r) +{ + assert(r->type == P_TEMP); + if (r->hw == -1) + return; + + assert(pc->r_temp[r->hw] == r); + pc->r_temp[r->hw] = NULL; + + r->acc = 0; + if (r->index == -1) + FREE(r); +} + static void free_temp(struct nv50_pc *pc, struct nv50_reg *r) { @@ -1496,6 +1512,9 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) continue; if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD) FREE(src[i][c]); + else + if (src[i][c]->acc == pc->insn_cur) + release_hw(pc, src[i][c]); } } -- cgit v1.2.3 From f9268ccd7f2ef2476db48f0aaca739bfb4ee9eab Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 15:17:03 +0200 Subject: nv50: don't look for unfreed temps in free_nv50_pc Since we stopped using alloc_temp to get hw indices for FP attrs there shouldn't be any non-deallocated temps left. --- src/gallium/drivers/nv50/nv50_program.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 15d7ab0da5..ea519e0c03 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1981,8 +1981,6 @@ out_err: static void free_nv50_pc(struct nv50_pc *pc) { - unsigned i; - if (pc->immd) FREE(pc->immd); if (pc->param) @@ -1994,12 +1992,6 @@ free_nv50_pc(struct nv50_pc *pc) if (pc->temp) FREE(pc->temp); - for (i = 0; i < NV50_SU_MAX_TEMP; i++) { - /* deallocate fragment program attributes */ - if (pc->r_temp[i] && pc->r_temp[i]->index == -1) - FREE(pc->r_temp[i]); - } - FREE(pc); } -- cgit v1.2.3 From 94ba165dffa4d364a1335d3cd7c15558bf35fe3e Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 16:13:24 +0200 Subject: nv50: use multiple constant buffers Use different buffers for immds, FP params, and VP params. One has to map constant buffer indices in shader code to buffers defined via CB_DEF. In principle, we could use more buffers so we'd have to change the shader code less frequently. --- src/gallium/drivers/nv50/nv50_program.c | 86 +++++++++++++++++++-------------- src/gallium/drivers/nv50/nv50_program.h | 4 +- src/gallium/drivers/nv50/nv50_screen.c | 56 ++++++++++++++++++--- src/gallium/drivers/nv50/nv50_screen.h | 7 ++- 4 files changed, 105 insertions(+), 48 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index ea519e0c03..6c07fbfe0c 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -409,8 +409,7 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e) static INLINE void set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) { - assert(imm->hw >= pc->param_nr * 4); - unsigned val = fui(pc->immd_buf[imm->hw - pc->param_nr * 4]); + unsigned val = fui(pc->immd_buf[imm->hw]); set_long(pc, e); /*XXX: can't be predicated - bits overlap.. catch cases where both @@ -462,22 +461,12 @@ set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s, struct nv50_program_exec *e) { set_long(pc, e); -#if 1 - e->inst[1] |= (1 << 22); -#else - if (src->type == P_IMMD) { - e->inst[1] |= (NV50_CB_PMISC << 22); - } else { - if (pc->p->type == PIPE_SHADER_VERTEX) - e->inst[1] |= (NV50_CB_PVP << 22); - else - e->inst[1] |= (NV50_CB_PFP << 22); - } -#endif e->param.index = src->hw; e->param.shift = s; e->param.mask = m << (s % 32); + + e->inst[1] |= (((src->type == P_IMMD) ? 0 : 1) << 22); } static void @@ -1952,7 +1941,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) } if (pc->immd_nr) { - int rid = pc->param_nr * 4; + int rid = 0; pc->immd = CALLOC(pc->immd_nr * 4, sizeof(struct nv50_reg)); if (!pc->immd) @@ -2101,7 +2090,7 @@ nv50_program_validate(struct nv50_context *nv50, struct nv50_program *p) static void nv50_program_upload_data(struct nv50_context *nv50, float *map, - unsigned start, unsigned count) + unsigned start, unsigned count, unsigned cbuf) { struct nouveau_channel *chan = nv50->screen->nvws->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; @@ -2110,7 +2099,7 @@ nv50_program_upload_data(struct nv50_context *nv50, float *map, unsigned nr = count > 2047 ? 2047 : count; BEGIN_RING(chan, tesla, 0x00000f00, 1); - OUT_RING (chan, (NV50_CB_PMISC << 0) | (start << 8)); + OUT_RING (chan, (cbuf << 0) | (start << 8)); BEGIN_RING(chan, tesla, 0x40000f04, nr); OUT_RINGp (chan, map, nr); @@ -2125,35 +2114,50 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) { struct nouveau_winsys *nvws = nv50->screen->nvws; struct pipe_winsys *ws = nv50->pipe.winsys; - unsigned nr = p->param_nr + p->immd_nr; - if (!p->data && nr) { - struct nouveau_resource *heap = nv50->screen->vp_data_heap; + if (!p->data[0] && p->immd_nr) { + struct nouveau_resource *heap = nv50->screen->immd_heap[0]; + + if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0])) { + while (heap->next && heap->size < p->immd_nr) { + struct nv50_program *evict = heap->next->priv; + nvws->res_free(&evict->data[0]); + } + + if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0])) + assert(0); + } + + /* immediates only need to be uploaded again when freed */ + nv50_program_upload_data(nv50, p->immd, p->data[0]->start, + p->immd_nr, NV50_CB_PMISC); + } - if (nvws->res_alloc(heap, nr, p, &p->data)) { - while (heap->next && heap->size < nr) { + if (!p->data[1] && p->param_nr) { + struct nouveau_resource *heap = + nv50->screen->parm_heap[p->type]; + + if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1])) { + while (heap->next && heap->size < p->param_nr) { struct nv50_program *evict = heap->next->priv; - nvws->res_free(&evict->data); + nvws->res_free(&evict->data[1]); } - if (nvws->res_alloc(heap, nr, p, &p->data)) + if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1])) assert(0); } } if (p->param_nr) { + unsigned cbuf = NV50_CB_PVP; float *map = ws->buffer_map(ws, nv50->constbuf[p->type], PIPE_BUFFER_USAGE_CPU_READ); - nv50_program_upload_data(nv50, map, p->data->start, - p->param_nr); + if (p->type == PIPE_SHADER_FRAGMENT) + cbuf = NV50_CB_PFP; + nv50_program_upload_data(nv50, map, p->data[1]->start, + p->param_nr, cbuf); ws->buffer_unmap(ws, nv50->constbuf[p->type]); } - - if (p->immd_nr) { - nv50_program_upload_data(nv50, p->immd, - p->data->start + p->param_nr, - p->immd_nr); - } } static void @@ -2173,20 +2177,27 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) upload = TRUE; } - if (p->data && p->data->start != p->data_start) { + if ((p->data[0] && p->data[0]->start != p->data_start[0]) || + (p->data[1] && p->data[1]->start != p->data_start[1])) { for (e = p->exec_head; e; e = e->next) { - unsigned ei, ci; + unsigned ei, ci, bs; if (e->param.index < 0) continue; + bs = (e->inst[1] >> 22) & 0x07; + assert(bs < 2); ei = e->param.shift >> 5; - ci = e->param.index + p->data->start; + ci = e->param.index + p->data[bs]->start; e->inst[ei] &= ~e->param.mask; e->inst[ei] |= (ci << e->param.shift); } - p->data_start = p->data->start; + if (p->data[0]) + p->data_start[0] = p->data[0]->start; + if (p->data[1]) + p->data_start[1] = p->data[1]->start; + upload = TRUE; } @@ -2341,7 +2352,8 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p) if (p->buffer) pipe_buffer_reference(&p->buffer, NULL); - nv50->screen->nvws->res_free(&p->data); + nv50->screen->nvws->res_free(&p->data[0]); + nv50->screen->nvws->res_free(&p->data[1]); p->translated = 0; } diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index b3240b36ef..c650ecfc81 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -24,8 +24,8 @@ struct nv50_program { struct nv50_program_exec *exec_head; struct nv50_program_exec *exec_tail; unsigned exec_size; - struct nouveau_resource *data; - unsigned data_start; + struct nouveau_resource *data[2]; + unsigned data_start[2]; struct pipe_buffer *buffer; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 2980564594..a7981a3615 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -290,20 +290,62 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->tesla, 0x16b8, 1); so_data (so, 8); - /* Shared constant buffer */ - screen->constbuf = screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); - if (nvws->res_init(&screen->vp_data_heap, 0, 128)) { - NOUVEAU_ERR("Error initialising constant buffer\n"); + /* constant buffers for immediates and VP/FP parameters */ + screen->constbuf_misc[0] = + screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); + + screen->constbuf_parm[0] = + screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); + + screen->constbuf_parm[1] = + screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); + + if (nvws->res_init(&screen->immd_heap[0], 0, 128) || + nvws->res_init(&screen->parm_heap[0], 0, 128) || + nvws->res_init(&screen->parm_heap[1], 0, 128)) + { + NOUVEAU_ERR("Error initialising constant buffers.\n"); nv50_screen_destroy(&screen->pipe); return NULL; } + /* + // map constant buffers: + // B = buffer ID (maybe more than 1 byte) + // N = CB index used in shader instruction + // P = program type (0 = VP, 2 = GP, 3 = FP) + so_method(so, screen->tesla, 0x1694, 1); + so_data (so, 0x000BBNP1); + */ + + so_method(so, screen->tesla, 0x1280, 3); + so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); + so_data (so, (NV50_CB_PMISC << 16) | 0x00000800); + so_method(so, screen->tesla, 0x1694, 1); + so_data (so, 0x00000001 | (NV50_CB_PMISC << 12)); + so_method(so, screen->tesla, 0x1694, 1); + so_data (so, 0x00000031 | (NV50_CB_PMISC << 12)); + + so_method(so, screen->tesla, 0x1280, 3); + so_reloc (so, screen->constbuf_parm[0], 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, screen->constbuf_parm[0], 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); + so_data (so, (NV50_CB_PVP << 16) | 0x00000800); + so_method(so, screen->tesla, 0x1694, 1); + so_data (so, 0x00000101 | (NV50_CB_PVP << 12)); + so_method(so, screen->tesla, 0x1280, 3); - so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM | + so_reloc (so, screen->constbuf_parm[1], 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM | + so_reloc (so, screen->constbuf_parm[1], 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, (NV50_CB_PMISC << 16) | 0x00001000); + so_data (so, (NV50_CB_PFP << 16) | 0x00000800); + so_method(so, screen->tesla, 0x1694, 1); + so_data (so, 0x00000131 | (NV50_CB_PFP << 12)); /* Texture sampler/image unit setup - we abuse the constant buffer * upload mechanism for the moment to upload data to the tex config diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h index db567aaac8..31b8ef29c9 100644 --- a/src/gallium/drivers/nv50/nv50_screen.h +++ b/src/gallium/drivers/nv50/nv50_screen.h @@ -15,8 +15,11 @@ struct nv50_screen { struct nouveau_grobj *m2mf; struct nouveau_notifier *sync; - struct pipe_buffer *constbuf; - struct nouveau_resource *vp_data_heap; + struct pipe_buffer *constbuf_misc[1]; + struct pipe_buffer *constbuf_parm[2]; + + struct nouveau_resource *immd_heap[1]; + struct nouveau_resource *parm_heap[2]; struct pipe_buffer *tic; struct pipe_buffer *tsc; -- cgit v1.2.3 From 3accd7ebe971624bed5624f73ed3522c9de4c193 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 16:14:06 +0200 Subject: nv50: fix TXP For TXP we need to divide texture coords by their w component, or use the coords' 1/w in the perspective interpolation instruction. This also tries to support 1D, 3D and CUBE textures, and lets the instruction only load the components that are used. --- src/gallium/drivers/nv50/nv50_program.c | 135 ++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 6c07fbfe0c..e038031f57 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -967,6 +967,113 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) emit(pc, e); } +static void +emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, + struct nv50_reg **src, unsigned unit, unsigned type, boolean proj) +{ + struct nv50_reg *temp, *t[4]; + struct nv50_program_exec *e; + + unsigned c, mode, dim; + + switch (type) { + case TGSI_TEXTURE_1D: + dim = 1; + break; + case TGSI_TEXTURE_UNKNOWN: + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_SHADOW1D: /* XXX: x, z */ + case TGSI_TEXTURE_RECT: + dim = 2; + break; + case TGSI_TEXTURE_3D: + case TGSI_TEXTURE_CUBE: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_SHADOWRECT: /* XXX */ + dim = 3; + break; + default: + assert(0); + break; + } + + alloc_temp4(pc, t, 0); + + if (proj) { + if (src[0]->type == P_TEMP && src[0]->rhw != -1) { + mode = pc->interp_mode[src[0]->index]; + + t[3]->rhw = src[3]->rhw; + emit_interp(pc, t[3], NULL, (mode & INTERP_CENTROID)); + emit_flop(pc, 0, t[3], t[3]); + + for (c = 0; c < dim; c++) { + t[c]->rhw = src[c]->rhw; + emit_interp(pc, t[c], t[3], + (mode | INTERP_PERSPECTIVE)); + } + } else { + emit_flop(pc, 0, t[3], src[3]); + for (c = 0; c < dim; c++) + emit_mul(pc, t[c], src[c], t[3]); + + /* XXX: for some reason the blob sometimes uses MAD: + * emit_mad(pc, t[c], src[0][c], t[3], t[3]) + * pc->p->exec_tail->inst[1] |= 0x080fc000; + */ + } + } else { + if (type == TGSI_TEXTURE_CUBE) { + temp = temp_temp(pc); + emit_minmax(pc, 4, temp, src[0], src[1]); + emit_minmax(pc, 4, temp, temp, src[2]); + emit_flop(pc, 0, temp, temp); + for (c = 0; c < 3; c++) + emit_mul(pc, t[c], src[c], temp); + } else { + for (c = 0; c < dim; c++) + emit_mov(pc, t[c], src[c]); + } + } + + e = exec(pc); + set_long(pc, e); + e->inst[0] |= 0xf0000000; + e->inst[1] |= 0x00000004; + set_dst(pc, t[0], e); + e->inst[0] |= (unit << 9); + + if (dim == 2) + e->inst[0] |= 0x00400000; + else + if (dim == 3) + e->inst[0] |= 0x00800000; + + e->inst[0] |= (mask & 0x3) << 25; + e->inst[1] |= (mask & 0xc) << 12; + + emit(pc, e); + +#if 1 + if (mask & 1) emit_mov(pc, dst[0], t[0]); + if (mask & 2) emit_mov(pc, dst[1], t[1]); + if (mask & 4) emit_mov(pc, dst[2], t[2]); + if (mask & 8) emit_mov(pc, dst[3], t[3]); + + free_temp4(pc, t); +#else + /* XXX: if p.e. MUL is used directly after TEX, it would still use + * the texture coordinates, not the fetched values: latency ? */ + + for (c = 0; c < 4; c++) { + if (mask & (1 << c)) + assimilate_temp(pc, dst[c], t[c]); + else + free_temp(pc, t[c]); + } +#endif +} + static void convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) { @@ -1422,30 +1529,12 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) } break; case TGSI_OPCODE_TEX: + emit_tex(pc, dst, mask, src[0], unit, + inst->InstructionExtTexture.Texture, FALSE); + break; case TGSI_OPCODE_TXP: - { - struct nv50_reg *t[4]; - struct nv50_program_exec *e; - - alloc_temp4(pc, t, 0); - emit_mov(pc, t[0], src[0][0]); - emit_mov(pc, t[1], src[0][1]); - - e = exec(pc); - e->inst[0] = 0xf6400000; - e->inst[0] |= (unit << 9); - set_long(pc, e); - e->inst[1] |= 0x0000c004; - set_dst(pc, t[0], e); - emit(pc, e); - - if (mask & (1 << 0)) emit_mov(pc, dst[0], t[0]); - if (mask & (1 << 1)) emit_mov(pc, dst[1], t[1]); - if (mask & (1 << 2)) emit_mov(pc, dst[2], t[2]); - if (mask & (1 << 3)) emit_mov(pc, dst[3], t[3]); - - free_temp4(pc, t); - } + emit_tex(pc, dst, mask, src[0], unit, + inst->InstructionExtTexture.Texture, TRUE); break; case TGSI_OPCODE_XPD: temp = temp_temp(pc); -- cgit v1.2.3 From 87eea6e2b2df57bddb7155df794f02143e1ece40 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 23 May 2009 16:14:37 +0200 Subject: nv50: introduce emit_cvt and use it This makes some code cleaner, and we can now easily do CEIL and TRUNC. --- src/gallium/drivers/nv50/nv50_program.c | 88 ++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index e038031f57..89051069bc 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -783,6 +783,48 @@ emit_precossin(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) emit(pc, e); } +#define CVTOP_RN 0x01 +#define CVTOP_FLOOR 0x03 +#define CVTOP_CEIL 0x05 +#define CVTOP_TRUNC 0x07 +#define CVTOP_SAT 0x08 +#define CVTOP_ABS 0x10 + +#define CVT_F32_F32 0xc4 +#define CVT_F32_S32 0x44 +#define CVT_F32_U32 0x64 +#define CVT_S32_F32 0x8c +#define CVT_S32_S32 0x0c +#define CVT_F32_F32_ROP 0xcc + +static void +emit_cvt(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src, + int wp, unsigned cop, unsigned fmt) +{ + struct nv50_program_exec *e; + + e = exec(pc); + set_long(pc, e); + + e->inst[0] |= 0xa0000000; + e->inst[1] |= 0x00004000; + e->inst[1] |= (cop << 16); + e->inst[1] |= (fmt << 24); + set_src_0(pc, src, e); + + if (wp >= 0) + set_pred_wr(pc, 1, wp, e); + + if (dst) + set_dst(pc, dst, e); + else { + e->inst[0] |= 0x000001fc; + e->inst[1] |= 0x00000008; + } + + emit(pc, e); +} + static void emit_set(struct nv50_pc *pc, unsigned c_op, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1) @@ -826,22 +868,10 @@ emit_set(struct nv50_pc *pc, unsigned c_op, struct nv50_reg *dst, free_temp(pc, dst); } -static void +static INLINE void emit_flr(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { - struct nv50_program_exec *e = exec(pc); - - e->inst[0] = 0xa0000000; /* cvt */ - set_long(pc, e); - e->inst[1] |= (6 << 29); /* cvt */ - e->inst[1] |= 0x08000000; /* integer mode */ - e->inst[1] |= 0x04000000; /* 32 bit */ - e->inst[1] |= ((0x1 << 3)) << 14; /* .rn */ - e->inst[1] |= (1 << 14); /* src .f32 */ - set_dst(pc, dst, e); - set_src_0(pc, src, e); - - emit(pc, e); + emit_cvt(pc, dst, src, -1, CVTOP_FLOOR, CVT_F32_F32_ROP); } static void @@ -858,21 +888,10 @@ emit_pow(struct nv50_pc *pc, struct nv50_reg *dst, free_temp(pc, temp); } -static void +static INLINE void emit_abs(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { - struct nv50_program_exec *e = exec(pc); - - e->inst[0] = 0xa0000000; /* cvt */ - set_long(pc, e); - e->inst[1] |= (6 << 29); /* cvt */ - e->inst[1] |= 0x04000000; /* 32 bit */ - e->inst[1] |= (1 << 14); /* src .f32 */ - e->inst[1] |= ((1 << 6) << 14); /* .abs */ - set_dst(pc, dst, e); - set_src_0(pc, src, e); - - emit(pc, e); + emit_cvt(pc, dst, src, -1, CVTOP_ABS, CVT_F32_F32); } static void @@ -1562,21 +1581,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) if (sat) { for (c = 0; c < 4; c++) { - struct nv50_program_exec *e; - if (!(mask & (1 << c))) continue; - e = exec(pc); - - e->inst[0] = 0xa0000000; /* cvt */ - set_long(pc, e); - e->inst[1] |= (6 << 29); /* cvt */ - e->inst[1] |= 0x04000000; /* 32 bit */ - e->inst[1] |= (1 << 14); /* src .f32 */ - e->inst[1] |= ((1 << 5) << 14); /* .sat */ - set_dst(pc, rdst[c], e); - set_src_0(pc, dst[c], e); - emit(pc, e); + emit_cvt(pc, rdst[c], dst[c], -1, CVTOP_SAT, + CVT_F32_F32); } } else if (assimilate) { for (c = 0; c < 4; c++) -- cgit v1.2.3 From c11c107f7d8f289f0cb83968c265fb78a274024a Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 28 May 2009 00:17:14 +0200 Subject: nv50: negate sources directly where supported --- src/gallium/drivers/nv50/nv50_program.c | 110 ++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 42 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 89051069bc..aada285f2c 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -409,7 +409,8 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e) static INLINE void set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) { - unsigned val = fui(pc->immd_buf[imm->hw]); + float f = pc->immd_buf[imm->hw]; + unsigned val = fui(imm->neg ? -f : f); set_long(pc, e); /*XXX: can't be predicated - bits overlap.. catch cases where both @@ -627,10 +628,19 @@ emit_mul(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, check_swap_src_0_1(pc, &src0, &src1); set_dst(pc, dst, e); set_src_0(pc, src0, e); - if (src1->type == P_IMMD && !is_long(e)) + if (src1->type == P_IMMD && !is_long(e)) { + if (src0->neg) + e->inst[0] |= 0x00008000; set_immd(pc, src1, e); - else + } else { set_src_1(pc, src1, e); + if (src0->neg ^ src1->neg) { + if (is_long(e)) + e->inst[1] |= 0x08000000; + else + e->inst[0] |= 0x00008000; + } + } emit(pc, e); } @@ -643,13 +653,16 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst, e->inst[0] |= 0xb0000000; - if (!pc->allow32) + check_swap_src_0_1(pc, &src0, &src1); + + if (!pc->allow32 || src0->neg || src1->neg) { set_long(pc, e); + e->inst[1] |= (src0->neg << 26) | (src1->neg << 27); + } - check_swap_src_0_1(pc, &src0, &src1); set_dst(pc, dst, e); set_src_0(pc, src0, e); - if (is_long(e) || src1->type == P_CONST || src1->type == P_ATTR) + if (src1->type == P_CONST || src1->type == P_ATTR || is_long(e)) set_src_2(pc, src1, e); else if (src1->type == P_IMMD) @@ -678,25 +691,13 @@ emit_minmax(struct nv50_pc *pc, unsigned sub, struct nv50_reg *dst, emit(pc, e); } -static void +static INLINE void emit_sub(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1) { - struct nv50_program_exec *e = exec(pc); - - e->inst[0] |= 0xb0000000; - - set_long(pc, e); - if (check_swap_src_0_1(pc, &src0, &src1)) - e->inst[1] |= 0x04000000; - else - e->inst[1] |= 0x08000000; - - set_dst(pc, dst, e); - set_src_0(pc, src0, e); - set_src_2(pc, src1, e); - - emit(pc, e); + src1->neg ^= 1; + emit_add(pc, dst, src0, src1); + src1->neg ^= 1; } static void @@ -713,26 +714,21 @@ emit_mad(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, set_src_1(pc, src1, e); set_src_2(pc, src2, e); + if (src0->neg ^ src1->neg) + e->inst[1] |= 0x04000000; + if (src2->neg) + e->inst[1] |= 0x08000000; + emit(pc, e); } -static void +static INLINE void emit_msb(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1, struct nv50_reg *src2) { - struct nv50_program_exec *e = exec(pc); - - e->inst[0] |= 0xe0000000; - set_long(pc, e); - e->inst[1] |= 0x08000000; /* src0 * src1 - src2 */ - - check_swap_src_0_1(pc, &src0, &src1); - set_dst(pc, dst, e); - set_src_0(pc, src0, e); - set_src_1(pc, src1, e); - set_src_2(pc, src2, e); - - emit(pc, e); + src2->neg ^= 1; + emit_mad(pc, dst, src0, src1, src2); + src2->neg ^= 1; } static void @@ -976,6 +972,8 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) e->inst[1] = 0xc4014788; set_src_0(pc, src, e); set_pred_wr(pc, 1, r_pred, e); + if (src->neg) + e->inst[1] |= 0x20000000; emit(pc, e); /* This is probably KILP */ @@ -1141,6 +1139,25 @@ convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) e->inst[1] |= q; } +static boolean +negate_supported(const struct tgsi_full_instruction *insn, int i) +{ + switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_DP3: + case TGSI_OPCODE_DP4: + case TGSI_OPCODE_MUL: + case TGSI_OPCODE_KIL: + case TGSI_OPCODE_ADD: + case TGSI_OPCODE_SUB: + case TGSI_OPCODE_MAD: + return TRUE; + case TGSI_OPCODE_POW: + return (i == 1) ? TRUE : FALSE; + default: + return FALSE; + } +} + static struct nv50_reg * tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst) { @@ -1159,7 +1176,8 @@ tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst) } static struct nv50_reg * -tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) +tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, + boolean neg) { struct nv50_reg *r = NULL; struct nv50_reg *temp; @@ -1214,14 +1232,21 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src) r = temp; break; case TGSI_UTIL_SIGN_TOGGLE: - temp = temp_temp(pc); - emit_neg(pc, temp, r); - r = temp; + if (neg) + r->neg = 1; + else { + temp = temp_temp(pc); + emit_neg(pc, temp, r); + r = temp; + } break; case TGSI_UTIL_SIGN_SET: temp = temp_temp(pc); emit_abs(pc, temp, r); - emit_neg(pc, temp, temp); + if (neg) + temp->neg = 1; + else + emit_neg(pc, temp, temp); r = temp; break; default: @@ -1289,7 +1314,8 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) unit = fs->SrcRegister.Index; for (c = 0; c < 4; c++) - src[i][c] = tgsi_src(pc, c, fs); + src[i][c] = tgsi_src(pc, c, fs, + negate_supported(inst, i)); } if (sat) { -- cgit v1.2.3 From 534f1e8f022ea7408c2ad49013e8f2446aa16364 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 28 May 2009 15:47:54 +1000 Subject: nv50: some mipmapping fixes --- src/gallium/drivers/nv50/nv50_state.c | 9 +++++++- src/gallium/drivers/nv50/nv50_surface.c | 2 +- src/gallium/drivers/nv50/nv50_tex.c | 6 +++--- src/gallium/drivers/nv50/nv50_transfer.c | 36 +++++++++++++++++--------------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index ba852194cd..9d41ef55b0 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -137,8 +137,9 @@ nv50_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { unsigned *tsc = CALLOC(8, sizeof(unsigned)); + float limit; - tsc[0] = (0x00024000 | + tsc[0] = (0x00026000 | (wrap_mode(cso->wrap_s) << 0) | (wrap_mode(cso->wrap_t) << 3) | (wrap_mode(cso->wrap_r) << 6)); @@ -202,6 +203,12 @@ nv50_sampler_state_create(struct pipe_context *pipe, tsc[0] |= (nvgl_comparison_op(cso->compare_func) & 0x7); } + limit = CLAMP(cso->lod_bias, -16.0, 15.0); + tsc[1] |= ((int)(limit * 256.0) & 0x1fff) << 11; + + tsc[2] |= ((int)CLAMP(cso->max_lod, 0.0, 15.0) << 20) | + ((int)CLAMP(cso->min_lod, 0.0, 15.0) << 8); + return (void *)tsc; } diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 0cc5168144..c0f0efe158 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -57,7 +57,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) struct nouveau_bo *bo; int format, mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; int flags = NOUVEAU_BO_VRAM | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD); - + bo = screen->nvws->get_bo(nv50_miptree(ps->texture)->buffer); if (!bo) return 1; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 223c8a3a45..775e9f30ef 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -122,10 +122,10 @@ nv50_tex_construct(struct nouveau_stateobj *so, struct nv50_miptree *mt) so_data (so, 0xd0005000); so_data (so, 0x00300000); so_data (so, mt->base.width[0]); - so_data (so, (mt->base.depth[0] << 16) | mt->base.height[0]); + so_data (so, (mt->base.last_level << 28) | + (mt->base.depth[0] << 16) | mt->base.height[0]); so_data (so, 0x03000000); - so_reloc(so, mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH | - NOUVEAU_BO_RD, 0, 0); + so_data (so, mt->base.last_level << 4); return 0; } diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 747195b4f6..28e7edd144 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -7,7 +7,7 @@ struct nv50_transfer { struct pipe_transfer base; struct pipe_buffer *buffer; - struct nv50_miptree_level *level; + unsigned level_offset; int level_pitch; int level_width; int level_height; @@ -17,8 +17,9 @@ struct nv50_transfer { static void nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, - int src_pitch, int sx, int sy, int sw, int sh, - struct pipe_buffer *dst, int dst_pitch, int dx, int dy, + unsigned src_offset, int src_pitch, int sx, int sy, + int sw, int sh, struct pipe_buffer *dst, + unsigned dst_offset, int dst_pitch, int dx, int dy, int dw, int dh, int cpp, int width, int height, unsigned src_reloc, unsigned dst_reloc) { @@ -28,7 +29,6 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, struct nouveau_grobj *m2mf = screen->m2mf; struct nouveau_bo *src_bo = nvws->get_bo(src); struct nouveau_bo *dst_bo = nvws->get_bo(dst); - unsigned src_offset = 0, dst_offset = 0; src_reloc |= NOUVEAU_BO_RD; dst_reloc |= NOUVEAU_BO_WR; @@ -40,7 +40,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, OUT_RING (chan, 1); BEGIN_RING(chan, m2mf, 0x0314, 1); OUT_RING (chan, src_pitch); - src_offset = (sy * src_pitch) + (sx * cpp); + src_offset += (sy * src_pitch) + (sx * cpp); } else { BEGIN_RING(chan, m2mf, 0x0200, 6); OUT_RING (chan, 0); @@ -56,7 +56,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, OUT_RING (chan, 1); BEGIN_RING(chan, m2mf, 0x0318, 1); OUT_RING (chan, dst_pitch); - dst_offset = (dy * dst_pitch) + (dx * cpp); + dst_offset += (dy * dst_pitch) + (dx * cpp); } else { BEGIN_RING(chan, m2mf, 0x021c, 6); OUT_RING (chan, 0); @@ -133,10 +133,10 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.stride = (w * pt->block.size); tx->base.usage = usage; - tx->level = lvl; tx->level_pitch = lvl->pitch; tx->level_width = mt->base.width[level]; tx->level_height = mt->base.height[level]; + tx->level_offset = lvl->image_offset[image]; tx->level_x = x; tx->level_y = y; tx->buffer = @@ -144,9 +144,10 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, w * tx->base.block.size * h); if (usage != PIPE_TRANSFER_WRITE) { - nv50_transfer_rect_m2mf(pscreen, mt->buffer, tx->level_pitch, - x, y, tx->level_width, tx->level_height, - tx->buffer, tx->base.stride, 0, 0, + nv50_transfer_rect_m2mf(pscreen, mt->buffer, tx->level_offset, + tx->level_pitch, x, y, tx->level_width, + tx->level_height, tx->buffer, 0, + tx->base.stride, 0, 0, tx->base.width, tx->base.height, tx->base.block.size, w, h, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART, @@ -164,14 +165,15 @@ nv50_transfer_del(struct pipe_transfer *ptx) if (ptx->usage != PIPE_TRANSFER_READ) { struct pipe_screen *pscreen = ptx->texture->screen; - nv50_transfer_rect_m2mf(pscreen, tx->buffer, tx->base.stride, + nv50_transfer_rect_m2mf(pscreen, tx->buffer, 0, tx->base.stride, 0, 0, tx->base.width, tx->base.height, - mt->buffer, tx->level_pitch, - tx->level_x, tx->level_y, - tx->level_width, tx->level_height, - tx->base.block.size, tx->base.width, - tx->base.height, NOUVEAU_BO_GART, - NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); + mt->buffer, tx->level_offset, + tx->level_pitch, tx->level_x, + tx->level_y, tx->level_width, + tx->level_height, tx->base.block.size, + tx->base.width, tx->base.height, + NOUVEAU_BO_GART, NOUVEAU_BO_VRAM | + NOUVEAU_BO_GART); } pipe_buffer_reference(&tx->buffer, NULL); -- cgit v1.2.3 From 2f9189d538ac56bd241ccc8f8f82bc4fdd779aa6 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 28 May 2009 11:40:58 +0200 Subject: r300: rework texture offset emission. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 60ad8ea14b..e605076a51 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -179,27 +179,33 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) if (r300->radeon.radeonScreen->kernel_mm && notexture) { return; } - BEGIN_BATCH_NO_AUTOSTATE(4 * numtmus); for(i = 0; i < numtmus; ++i) { radeonTexObj *t = r300->hw.textures[i]; - OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1); if (t && !t->image_override) { + BEGIN_BATCH_NO_AUTOSTATE(4); + OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1); OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + END_BATCH(); } else if (!t) { - OUT_BATCH(r300->radeon.radeonScreen->texOffset[0]); + /* Texture unit hasn't a texture bound nothings to do */ } else { /* override cases */ if (t->bo) { + BEGIN_BATCH_NO_AUTOSTATE(4); + OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1); OUT_BATCH_RELOC(t->tile_bits, t->bo, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + END_BATCH(); } else if (!r300->radeon.radeonScreen->kernel_mm) { + BEGIN_BATCH_NO_AUTOSTATE(2); + OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1); OUT_BATCH(t->override_offset); - } - else - OUT_BATCH(r300->radeon.radeonScreen->texOffset[0]); + END_BATCH(); + } else { + /* Texture unit hasn't a texture bound nothings to do */ + } } } - END_BATCH(); } } -- cgit v1.2.3 From 5dcbcbfca4f3c00de1fdab28d1cc8d691f67edce Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 28 May 2009 13:48:38 +0200 Subject: r300: when using cs path emit scissor in the cmdbuffer --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 39 +++++++++++++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_cmdbuf.h | 1 + src/mesa/drivers/dri/r300/r300_render.c | 2 ++ src/mesa/drivers/dri/r300/r300_swtcl.c | 1 + 4 files changed, 43 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index e605076a51..b949c3b5b2 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -209,6 +209,45 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) } } +void r300_emit_scissor(GLcontext *ctx) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + BATCH_LOCALS(&r300->radeon); + unsigned x1, y1, x2, y2; + struct radeon_renderbuffer *rrb; + + if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) { + return; + } + rrb = radeon_get_colorbuffer(&r300->radeon); + if (!rrb || !rrb->bo) { + fprintf(stderr, "no rrb\n"); + return; + } + if (r300->radeon.state.scissor.enabled) { + x1 = r300->radeon.state.scissor.rect.x1; + y1 = r300->radeon.state.scissor.rect.y1; + x2 = r300->radeon.state.scissor.rect.x2 - 1; + y2 = r300->radeon.state.scissor.rect.y2 - 1; + } else { + x1 = 0; + y1 = 0; + x2 = rrb->width - 1; + y2 = rrb->height - 1; + } + if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { + x1 += R300_SCISSORS_OFFSET; + y1 += R300_SCISSORS_OFFSET; + x2 += R300_SCISSORS_OFFSET; + y2 += R300_SCISSORS_OFFSET; + } + BEGIN_BATCH_NO_AUTOSTATE(3); + OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); + OUT_BATCH((x1 << R300_SCISSORS_X_SHIFT)|(y1 << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT)); + END_BATCH(); +} + static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 3786813de3..53bcc0eeb4 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" extern void r300InitCmdBuf(r300ContextPtr r300); +void r300_emit_scissor(GLcontext *ctx); void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom); int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 7edeaed6d8..92310a0264 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -189,6 +189,7 @@ static void r300FireEB(r300ContextPtr rmesa, int vertex_count, int type) { BATCH_LOCALS(&rmesa->radeon); + r300_emit_scissor(rmesa->radeon.glCtx); if (vertex_count > 0) { BEGIN_BATCH(10); OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0); @@ -329,6 +330,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) { BATCH_LOCALS(&rmesa->radeon); + r300_emit_scissor(rmesa->radeon.glCtx); BEGIN_BATCH(3); OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0); OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (vertex_count << 16) | type); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 78fa031479..68e24dec8f 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -683,6 +683,7 @@ void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset) rmesa->radeon.hw.max_state_size + (12*sizeof(int)), __FUNCTION__); radeonEmitState(&rmesa->radeon); + r300_emit_scissor(ctx); r300EmitVertexAOS(rmesa, rmesa->radeon.swtcl.vertex_size, rmesa->radeon.dma.current, -- cgit v1.2.3 From b70fcd620d69850c6e19213d84ae4584e77ab689 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 28 May 2009 07:46:34 -0700 Subject: r300-gallium, radeon-gallium: Make add_buffer indicate when a flush is needed. On a side note, why is RADEON_MAX_BOS 24? Should ask airlied about that. --- src/gallium/drivers/r300/r300_emit.c | 28 +++++++++++++++++------- src/gallium/drivers/r300/r300_surface.c | 21 +++++++++++++----- src/gallium/drivers/r300/r300_winsys.h | 8 +++---- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 16 +++++++++----- 4 files changed, 50 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 5e4b179505..caeb73a8ed 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -467,27 +467,39 @@ validate: for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); - r300->winsys->add_buffer(r300->winsys, tex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); + if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } } /* ...depth buffer... */ if (r300->framebuffer_state.zsbuf) { tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture; assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); - r300->winsys->add_buffer(r300->winsys, tex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); + if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } } /* ...textures... */ for (i = 0; i < r300->texture_count; i++) { tex = r300->textures[i]; assert(tex && tex->buffer && "texture is marked, but NULL!"); - r300->winsys->add_buffer(r300->winsys, tex->buffer, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } } /* ...and vertex buffer. */ if (r300->vbo) { - r300->winsys->add_buffer(r300->winsys, r300->vbo, - RADEON_GEM_DOMAIN_GTT, 0); + if (!r300->winsys->add_buffer(r300->winsys, r300->vbo, + RADEON_GEM_DOMAIN_GTT, 0)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } } else { debug_printf("No VBO while emitting dirty state!\n"); } diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 7711e8f569..c9e2dff14e 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -120,8 +120,11 @@ fallback: /* Make sure our target BO is okay. */ validate: - r300->winsys->add_buffer(r300->winsys, tex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); + if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } if (r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { @@ -242,10 +245,16 @@ fallback: /* Add our target BOs to the list. */ validate: - r300->winsys->add_buffer(r300->winsys, srctex->buffer, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - r300->winsys->add_buffer(r300->winsys, desttex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM); + if (!r300->winsys->add_buffer(r300->winsys, srctex->buffer, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } + if (!r300->winsys->add_buffer(r300->winsys, desttex->buffer, + 0, RADEON_GEM_DOMAIN_VRAM)) { + r300->context.flush(&r300->context, 0, NULL); + goto validate; + } if (r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index a5ced8041c..d2893c3b9d 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -52,10 +52,10 @@ struct r300_winsys { uint32_t vram_size; /* Add a pipe_buffer to the list of buffer objects to validate. */ - void (*add_buffer)(struct r300_winsys* winsys, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd); + boolean (*add_buffer)(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd); /* Revalidate all currently setup pipe_buffers. * Returns TRUE if a flush is required. */ diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 995bf6aa22..63aa3179ac 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,10 +22,10 @@ #include "radeon_r300.h" -static void radeon_r300_add_buffer(struct r300_winsys* winsys, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd) +static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd) { int i; struct radeon_winsys_priv* priv = @@ -35,7 +35,6 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, /* Check to see if this BO is already in line for validation; * find a slot for it otherwise. */ - assert(priv->bo_count <= RADEON_MAX_BOS); for (i = 0; i < priv->bo_count; i++) { if (sc[i].bo == bo) { sc[i].read_domains |= rd; @@ -44,10 +43,17 @@ static void radeon_r300_add_buffer(struct r300_winsys* winsys, } } + if (priv->bo_count >= RADEON_MAX_BOS) { + /* Dohoho. Not falling for that one again. Request a flush. */ + return FALSE; + } + sc[priv->bo_count].bo = bo; sc[priv->bo_count].read_domains = rd; sc[priv->bo_count].write_domain = wd; priv->bo_count++; + + return TRUE; } static boolean radeon_r300_validate(struct r300_winsys* winsys) -- cgit v1.2.3 From 425c39058b54ebbde4130e4eebb1c302005ba6ac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 29 May 2009 00:55:54 -0600 Subject: softpipe: increase max 2D/cube texture size to 4K x 4K --- src/gallium/drivers/softpipe/sp_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index a32fd3a1ba..4ead6c928c 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -82,11 +82,11 @@ softpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 12; /* max 2Kx2K */ + return 13; /* max 2Kx2K */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return 8; /* max 128x128x128 */ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 12; /* max 2Kx2K */ + return 13; /* max 2Kx2K */ default: return 0; } -- cgit v1.2.3 From fa0ca31586f2523ac65dbf9c1fdca99dfbca7456 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 29 May 2009 08:22:21 -0600 Subject: softpipe: update comments for max texture size --- src/gallium/drivers/softpipe/sp_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 4ead6c928c..ce6d8ebd12 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -82,11 +82,11 @@ softpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 13; /* max 2Kx2K */ + return 13; /* max 4Kx4K */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return 8; /* max 128x128x128 */ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 13; /* max 2Kx2K */ + return 13; /* max 4Kx4K */ default: return 0; } -- cgit v1.2.3 From a59575d8fbe8b0ca053cc8366ce7a42bc660158a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 30 May 2009 20:07:18 -0600 Subject: softpipe: fix incorrect provoking vertex color for PIPE_PRIM_POLYGON This fixes the incorrect colors seen when rendering flat-shaded polygons. Note that clipped polygons were correct, but unclipped polygons were wrong. See the glean/clipFlat test for regression testing. --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index eef6e5806c..329c92b8da 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -378,7 +378,6 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, 0, stride), @@ -386,6 +385,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) get_vert(vertex_buffer, i-0, stride)); } break; + case PIPE_PRIM_QUADS: for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, @@ -412,6 +412,20 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) get_vert(vertex_buffer, i-0, stride)); } break; + + case PIPE_PRIM_POLYGON: + /* Almost same as tri fan but the _first_ vertex specifies the flat + * shading color. Note that the first polygon vertex is passed as + * the last triangle vertex here. + */ + for (i = 2; i < nr; i += 1) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, i-0, stride), + get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, 0, stride)); + } + break; + default: assert(0); } -- cgit v1.2.3 From 6c3cefdda6c98d5f0df874c7f1d8c5421cc8468b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 30 May 2009 20:09:19 -0600 Subject: Revert "softpipe: fix flat shading provoking vertex for PIPE_PRIM_POLYGON" This reverts commit 5d75124db480b37977c353511b4e228905b7cc95. This fixed unclipped polygons, but broke clipped polygons. A better fix from the mesa 7.5 branch will be merged next... --- src/gallium/drivers/softpipe/sp_context.h | 1 - src/gallium/drivers/softpipe/sp_draw_arrays.c | 1 - src/gallium/drivers/softpipe/sp_setup.c | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 2f90d538a5..b89a7292e5 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -107,7 +107,6 @@ struct softpipe_context { /** Which vertex shader output slot contains point size */ int psize_slot; - unsigned api_prim; /**< current prim type being drawn: PIPE_PRIM_x */ unsigned reduced_api_prim; /**< PIPE_PRIM_POINTS, _LINES or _TRIANGLES */ /** Derived from scissor and surface bounds: */ diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 1460bc4b4b..f117096bf7 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -129,7 +129,6 @@ softpipe_draw_range_elements(struct pipe_context *pipe, struct draw_context *draw = sp->draw; unsigned i; - sp->api_prim = mode; sp->reduced_api_prim = reduced_prim[mode]; if (sp->dirty) diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 4f0baa3fd4..c6844a2649 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -514,10 +514,7 @@ static boolean setup_sort_vertices( struct setup_context *setup, const float (*v1)[4], const float (*v2)[4] ) { - if (setup->softpipe->api_prim == PIPE_PRIM_POLYGON) - setup->vprovoke = v0; - else - setup->vprovoke = v2; + setup->vprovoke = v2; /* determine bottom to top order of vertices */ { -- cgit v1.2.3 From 29c6c8eb18ace95b9af6dcf34e02c2b8db0ffda8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 12:38:45 -0700 Subject: mesa: Add success/failures return value to _mesa_make_current. --- src/mesa/main/context.c | 8 +++++--- src/mesa/main/context.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ec0dc12a3e..884b6ad282 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1259,7 +1259,7 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb) * \param drawBuffer the drawing framebuffer * \param readBuffer the reading framebuffer */ -void +GLboolean _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { @@ -1272,14 +1272,14 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, if (!check_compatible(newCtx, drawBuffer)) { _mesa_warning(newCtx, "MakeCurrent: incompatible visuals for context and drawbuffer"); - return; + return GL_FALSE; } } if (newCtx && readBuffer && newCtx->WinSysReadBuffer != readBuffer) { if (!check_compatible(newCtx, readBuffer)) { _mesa_warning(newCtx, "MakeCurrent: incompatible visuals for context and readbuffer"); - return; + return GL_FALSE; } } @@ -1384,6 +1384,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, newCtx->FirstTimeCurrent = GL_FALSE; } } + + return GL_TRUE; } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 5b57d88029..6b3e1b2b97 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -130,7 +130,7 @@ extern void _mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); -extern void +extern GLboolean _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); -- cgit v1.2.3 From 8aef306c342a973f31b384a71d7a22ade9153a99 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 12:41:14 -0700 Subject: mesa: Check/propagate return value on st_make_current. Prevents segmentation fault when trying to set the viewport/scissor after a context/drawable visual mismatch. --- src/mesa/state_tracker/st_context.c | 13 ++++++++----- src/mesa/state_tracker/st_public.h | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index e536029e86..92ddffc014 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -263,9 +263,10 @@ void st_destroy_context( struct st_context *st ) } -void st_make_current(struct st_context *st, - struct st_framebuffer *draw, - struct st_framebuffer *read) +GLboolean +st_make_current(struct st_context *st, + struct st_framebuffer *draw, + struct st_framebuffer *read) { /* Call this periodically to detect when the user has begun using * GL rendering from multiple threads. @@ -274,7 +275,8 @@ void st_make_current(struct st_context *st, if (st) { GLboolean firstTime = st->ctx->FirstTimeCurrent; - _mesa_make_current(st->ctx, &draw->Base, &read->Base); + if(!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) + return GL_FALSE; /* Need to initialize viewport here since draw->Base->Width/Height * will still be zero at this point. * This could be improved, but would require rather extensive work @@ -286,9 +288,10 @@ void st_make_current(struct st_context *st, _mesa_set_scissor(st->ctx, 0, 0, w, h); } + return GL_TRUE; } else { - _mesa_make_current(NULL, NULL, NULL); + return _mesa_make_current(NULL, NULL, NULL); } } diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 290b8a974e..c411687bb6 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -91,9 +91,9 @@ void *st_framebuffer_private( struct st_framebuffer *stfb ); void st_unreference_framebuffer( struct st_framebuffer *stfb ); -void st_make_current(struct st_context *st, - struct st_framebuffer *draw, - struct st_framebuffer *read); +GLboolean st_make_current(struct st_context *st, + struct st_framebuffer *draw, + struct st_framebuffer *read); struct st_context *st_get_current(void); -- cgit v1.2.3 From 5bb2074798a752557a1eaa8f2d2b8b45282f9f7e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 12:42:55 -0700 Subject: mesa: Output warnings to debugger on Windows. Stderr of Windows applications without console is not usually visible. --- src/mesa/main/imports.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 615f7c9a6d..3fb67083a2 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1008,6 +1008,16 @@ output_if_debug(const char *prefixString, const char *outputString, fprintf(stderr, "%s: %s", prefixString, outputString); if (newline) fprintf(stderr, "\n"); + +#if defined(_WIN32) && !defined(_WIN32_WCE) + /* stderr from windows applications without console is not usually + * visible, so communicate with the debugger instead */ + { + char buf[4096]; + _mesa_snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : ""); + OutputDebugStringA(buf); + } +#endif } } -- cgit v1.2.3 From 1124f786c1a839036cc1b17f9398eead9f16b1c9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 14:33:11 -0700 Subject: wgl: Remove unused field. --- src/gallium/state_trackers/wgl/shared/stw_context.c | 1 - src/gallium/state_trackers/wgl/shared/stw_context.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index dd97e48b14..09dba61603 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -128,7 +128,6 @@ stw_create_layer_context( goto no_ctx; ctx->hdc = hdc; - ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL ); /* Create visual based on flags */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h index e276737e85..92df7e6136 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.h +++ b/src/gallium/state_trackers/wgl/shared/stw_context.h @@ -38,7 +38,6 @@ struct stw_context struct st_context *st; UINT_PTR hglrc; HDC hdc; - DWORD color_bits; const struct stw_pixelformat_info *pfi; }; -- cgit v1.2.3 From 76f2bacb07b1b55a50018a1ccee42943d5e8a477 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 18:00:18 -0700 Subject: wgl: Rename function. --- src/gallium/state_trackers/wgl/shared/stw_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index eef848988c..ada2511581 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -57,7 +57,7 @@ struct stw_device *stw_dev = NULL; * stw_winsys::flush_front_buffer. */ static void -st_flush_frontbuffer(struct pipe_screen *screen, +stw_flush_frontbuffer(struct pipe_screen *screen, struct pipe_surface *surface, void *context_private ) { @@ -111,7 +111,7 @@ stw_init(const struct stw_winsys *stw_winsys) stw_dev->screen = screen; #endif - stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer; + stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer; pipe_mutex_init( stw_dev->mutex ); -- cgit v1.2.3 From be7c56be06183239008b168181aa6f1c78591579 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 19:51:33 -0700 Subject: wgl: Fix debugging output. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 36 +++++++++++++++++++++------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index 62af765211..347f40aa06 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -54,7 +54,15 @@ DrvCreateLayerContext( HDC hdc, INT iLayerPlane ) { - return stw_create_layer_context( hdc, iLayerPlane ); + DHGLRC r; + + r = stw_create_layer_context( hdc, iLayerPlane ); + + if (DBG) + debug_printf( "%s( %p, %i ) = %u\n", + __FUNCTION__, hdc, iLayerPlane, r ); + + return r; } DHGLRC APIENTRY @@ -68,7 +76,15 @@ BOOL APIENTRY DrvDeleteContext( DHGLRC dhglrc ) { - return stw_delete_context( dhglrc ); + BOOL r; + + r = stw_delete_context( dhglrc ); + + if (DBG) + debug_printf( "%s( %u ) = %u\n", + __FUNCTION__, dhglrc, r ); + + return r; } BOOL APIENTRY @@ -126,7 +142,7 @@ DrvGetProcAddress( r = stw_get_proc_address( lpszProc ); if (DBG) - debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r ); + debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r ); return r; } @@ -515,14 +531,16 @@ DrvSetContext( DHGLRC dhglrc, PFN_SETPROCTABLE pfnSetProcTable ) { - if (DBG) - debug_printf( "%s( 0x%p, %u, 0x%p )\n", - __FUNCTION__, hdc, dhglrc, pfnSetProcTable ); - + PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt; + if (!stw_make_current( hdc, dhglrc )) - return NULL; + r = NULL; - return (GLCLTPROCTABLE *)&cpt; + if (DBG) + debug_printf( "%s( 0x%p, %u, 0x%p ) = %p\n", + __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r ); + + return r; } int APIENTRY -- cgit v1.2.3 From fe69b6bdc7bbde2cefec856ff338788d7be20f4e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 30 May 2009 19:58:50 -0700 Subject: wgl: Use the right pixel format. There is no current pixel format. Each HDC has its pixelformat which is kept by gdi and set/get via the SetPixelFormat/GetPixelFormat functions. Now the HDC's pixelformat is kept in the stw_framebuffer, which is created during the SetPixelFormat. --- .../state_trackers/wgl/shared/stw_context.c | 176 ++++++---------- .../state_trackers/wgl/shared/stw_context.h | 3 +- src/gallium/state_trackers/wgl/shared/stw_device.c | 2 + .../state_trackers/wgl/shared/stw_framebuffer.c | 223 +++++++++++++++++---- .../state_trackers/wgl/shared/stw_framebuffer.h | 26 ++- .../state_trackers/wgl/shared/stw_pixelformat.c | 65 +++--- .../state_trackers/wgl/shared/stw_pixelformat.h | 5 + src/gallium/state_trackers/wgl/shared/stw_tls.c | 2 - src/gallium/state_trackers/wgl/shared/stw_tls.h | 1 - 9 files changed, 301 insertions(+), 202 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c index 09dba61603..662b5fbcd2 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ b/src/gallium/state_trackers/wgl/shared/stw_context.c @@ -90,7 +90,7 @@ stw_share_lists( ctx2 = stw_lookup_context_locked( hglrc2 ); if (ctx1 && ctx2 && - ctx1->pfi == ctx2->pfi) { + ctx1->iPixelFormat == ctx2->iPixelFormat) { ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); } @@ -104,51 +104,32 @@ stw_create_layer_context( HDC hdc, int iLayerPlane ) { - uint pfi; - const struct stw_pixelformat_info *pf = NULL; + int iPixelFormat; + const struct stw_pixelformat_info *pfi; + GLvisual visual; struct stw_context *ctx = NULL; - GLvisual *visual = NULL; struct pipe_screen *screen = NULL; struct pipe_context *pipe = NULL; - + if(!stw_dev) return 0; if (iLayerPlane != 0) return 0; - pfi = stw_pixelformat_get( hdc ); - if (pfi == 0) + iPixelFormat = GetPixelFormat(hdc); + if(!iPixelFormat) return 0; - - pf = stw_pixelformat_get_info( pfi - 1 ); - + + pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); + stw_pixelformat_visual(&visual, pfi); + ctx = CALLOC_STRUCT( stw_context ); if (ctx == NULL) goto no_ctx; ctx->hdc = hdc; - - /* Create visual based on flags - */ - visual = _mesa_create_visual( - (pf->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE, - (pf->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, - (pf->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE, - pf->pfd.cRedBits, - pf->pfd.cGreenBits, - pf->pfd.cBlueBits, - pf->pfd.cAlphaBits, - (pf->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pf->pfd.cColorBits : 0, - pf->pfd.cDepthBits, - pf->pfd.cStencilBits, - pf->pfd.cAccumRedBits, - pf->pfd.cAccumGreenBits, - pf->pfd.cAccumBlueBits, - pf->pfd.cAccumAlphaBits, - pf->numSamples ); - if (visual == NULL) - goto no_visual; + ctx->iPixelFormat = iPixelFormat; screen = stw_dev->screen; @@ -168,15 +149,15 @@ stw_create_layer_context( pipe = trace_context_create(stw_dev->screen, pipe); #endif + /* pass to stw_flush_frontbuffer as context_private */ assert(!pipe->priv); pipe->priv = hdc; - ctx->st = st_create_context( pipe, visual, NULL ); + ctx->st = st_create_context( pipe, &visual, NULL ); if (ctx->st == NULL) goto no_st_ctx; ctx->st->ctx->DriverCtx = ctx; - ctx->pfi = pf; pipe_mutex_lock( stw_dev->mutex ); ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); @@ -192,9 +173,7 @@ no_hglrc: no_st_ctx: pipe->destroy( pipe ); no_pipe: - _mesa_destroy_visual( visual ); -no_visual: - FREE( ctx ); + FREE(ctx); no_ctx: return 0; } @@ -217,20 +196,11 @@ stw_delete_context( if (ctx) { GLcontext *glctx = ctx->st->ctx; GET_CURRENT_CONTEXT( glcurctx ); - struct stw_framebuffer *fb; - /* Unbind current if deleting current context. - */ + /* Unbind current if deleting current context. */ if (glcurctx == glctx) st_make_current( NULL, NULL, NULL ); - fb = stw_framebuffer_from_hdc( ctx->hdc ); - if (fb) - stw_framebuffer_destroy( fb ); - - if (WindowFromDC( ctx->hdc ) != NULL) - ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc ); - st_destroy_context(ctx->st); FREE(ctx); @@ -274,34 +244,6 @@ stw_release_context( return TRUE; } -/* Find the width and height of the window named by hdc. - */ -static void -stw_get_window_size( HDC hdc, GLuint *pwidth, GLuint *pheight ) -{ - GLuint width, height; - HWND hwnd; - - hwnd = WindowFromDC( hdc ); - if (hwnd) { - RECT rect; - GetClientRect( hwnd, &rect ); - width = rect.right - rect.left; - height = rect.bottom - rect.top; - } - else { - width = GetDeviceCaps( hdc, HORZRES ); - height = GetDeviceCaps( hdc, VERTRES ); - } - - if(width < 1) - width = 1; - if(height < 1) - height = 1; - - *pwidth = width; - *pheight = height; -} UINT_PTR stw_get_current_context( void ) @@ -345,64 +287,68 @@ stw_make_current( struct stw_context *ctx; GET_CURRENT_CONTEXT( glcurctx ); struct stw_framebuffer *fb; - GLuint width = 0; - GLuint height = 0; - struct stw_context *curctx = NULL; if (!stw_dev) - return FALSE; - - pipe_mutex_lock( stw_dev->mutex ); - ctx = stw_lookup_context_locked( hglrc ); - pipe_mutex_unlock( stw_dev->mutex ); + goto fail; if (glcurctx != NULL) { + struct stw_context *curctx; curctx = (struct stw_context *) glcurctx->DriverCtx; - if (curctx != ctx) + if (curctx->hglrc != hglrc) st_flush(glcurctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + + /* Return if already current. */ + if (curctx->hglrc == hglrc && curctx->hdc == hdc) + return TRUE; } if (hdc == NULL || hglrc == 0) { - st_make_current( NULL, NULL, NULL ); - return TRUE; + return st_make_current( NULL, NULL, NULL ); } - /* Return if already current. - */ - if (glcurctx != NULL) { - if (curctx != NULL && curctx == ctx && ctx->hdc == hdc) - return TRUE; - } - - fb = stw_framebuffer_from_hdc( hdc ); - - if (hdc != NULL) - stw_get_window_size( hdc, &width, &height ); + pipe_mutex_lock( stw_dev->mutex ); - /* Lazy creation of stw_framebuffers. - */ - if (fb == NULL && ctx != NULL && hdc != NULL) { - GLvisual *visual = &ctx->st->ctx->Visual; + ctx = stw_lookup_context_locked( hglrc ); + if(!ctx) + goto fail; - fb = stw_framebuffer_create( hdc, visual, ctx->pfi, width, height ); - if (fb == NULL) - return FALSE; + fb = stw_framebuffer_from_hdc_locked( hdc ); + if(!fb) { + /* Applications should call SetPixelFormat before creating a context, + * but not all do, and the opengl32 runtime seems to use a default pixel + * format in some cases, so we must create a framebuffer for those here + */ + int iPixelFormat = GetPixelFormat(hdc); + if(iPixelFormat) + fb = stw_framebuffer_create_locked( hdc, iPixelFormat ); + if(!fb) + goto fail; } + + pipe_mutex_unlock( stw_dev->mutex ); - if (ctx && fb) { - pipe_mutex_lock( fb->mutex ); - st_make_current( ctx->st, fb->stfb, fb->stfb ); - st_resize_framebuffer( fb->stfb, width, height ); - pipe_mutex_unlock( fb->mutex ); + if(fb->iPixelFormat != ctx->iPixelFormat) + goto fail; - ctx->hdc = hdc; - ctx->st->pipe->priv = hdc; - } - else { - /* Detach */ - st_make_current( NULL, NULL, NULL ); - } + /* Lazy allocation of the frame buffer */ + if(!stw_framebuffer_allocate(fb)) + goto fail; + /* Bind the new framebuffer */ + ctx->hdc = hdc; + + /* pass to stw_flush_frontbuffer as context_private */ + ctx->st->pipe->priv = hdc; + + if(!st_make_current( ctx->st, fb->stfb, fb->stfb )) + goto fail; + + stw_framebuffer_resize(fb); + return TRUE; + +fail: + st_make_current( NULL, NULL, NULL ); + return FALSE; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h index 92df7e6136..166471de5e 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_context.h +++ b/src/gallium/state_trackers/wgl/shared/stw_context.h @@ -31,14 +31,13 @@ #include struct st_context; -struct stw_pixelformat_info; struct stw_context { struct st_context *st; UINT_PTR hglrc; + int iPixelFormat; HDC hdc; - const struct stw_pixelformat_info *pfi; }; #endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c index ada2511581..1a6b29807d 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ b/src/gallium/state_trackers/wgl/shared/stw_device.c @@ -173,6 +173,8 @@ stw_cleanup(void) } pipe_mutex_unlock( stw_dev->mutex ); + stw_framebuffer_cleanup(); + pipe_mutex_destroy( stw_dev->mutex ); stw_dev->screen->destroy(stw_dev->screen); diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index f66f429542..45ac3477e8 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -94,32 +94,16 @@ stw_call_window_proc( } -/* Create a new framebuffer object which will correspond to the given HDC. +/** + * Create a new framebuffer object which will correspond to the given HDC. */ struct stw_framebuffer * -stw_framebuffer_create( +stw_framebuffer_create_locked( HDC hdc, - GLvisual *visual, - const struct stw_pixelformat_info *pfi, - GLuint width, - GLuint height ) + int iPixelFormat ) { - enum pipe_format colorFormat, depthFormat, stencilFormat; struct stw_framebuffer *fb; - - colorFormat = pfi->color_format; - - assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); - - if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z )) - depthFormat = pfi->depth_stencil_format; - else - depthFormat = PIPE_FORMAT_NONE; - - if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S )) - stencilFormat = pfi->depth_stencil_format; - else - stencilFormat = PIPE_FORMAT_NONE; + const struct stw_pixelformat_info *pfi; fb = CALLOC_STRUCT( stw_framebuffer ); if (fb == NULL) @@ -127,31 +111,102 @@ stw_framebuffer_create( fb->hDC = hdc; fb->hWnd = WindowFromDC( hdc ); + fb->iPixelFormat = iPixelFormat; - pipe_mutex_init( fb->mutex ); + fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); - fb->stfb = st_create_framebuffer( - visual, - colorFormat, - depthFormat, - stencilFormat, - width, - height, - (void *) fb ); - if(!fb->stfb) { - FREE(fb); - return NULL; - } + stw_pixelformat_visual(&fb->visual, pfi); + + pipe_mutex_init( fb->mutex ); - pipe_mutex_lock( stw_dev->mutex ); fb->next = stw_dev->fb_head; stw_dev->fb_head = fb; - pipe_mutex_unlock( stw_dev->mutex ); return fb; } + +static void +stw_framebuffer_get_size( struct stw_framebuffer *fb, GLuint *pwidth, GLuint *pheight ) +{ + GLuint width, height; + + if (fb->hWnd) { + RECT rect; + GetClientRect( fb->hWnd, &rect ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + } + else { + width = GetDeviceCaps( fb->hDC, HORZRES ); + height = GetDeviceCaps( fb->hDC, VERTRES ); + } + + if(width < 1) + width = 1; + if(height < 1) + height = 1; + + *pwidth = width; + *pheight = height; +} + + +BOOL +stw_framebuffer_allocate( + struct stw_framebuffer *fb) +{ + pipe_mutex_lock( fb->mutex ); + + if(!fb->stfb) { + const struct stw_pixelformat_info *pfi = fb->pfi; + enum pipe_format colorFormat, depthFormat, stencilFormat; + GLuint width, height; + + colorFormat = pfi->color_format; + + assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z )) + depthFormat = pfi->depth_stencil_format; + else + depthFormat = PIPE_FORMAT_NONE; + + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S )) + stencilFormat = pfi->depth_stencil_format; + else + stencilFormat = PIPE_FORMAT_NONE; + + stw_framebuffer_get_size(fb, &width, &height); + + fb->stfb = st_create_framebuffer( + &fb->visual, + colorFormat, + depthFormat, + stencilFormat, + width, + height, + (void *) fb ); + } + + pipe_mutex_unlock( fb->mutex ); + + return fb->stfb ? TRUE : FALSE; +} + + void +stw_framebuffer_resize( + struct stw_framebuffer *fb) +{ + GLuint width, height; + assert(fb->stfb); + stw_framebuffer_get_size(fb, &width, &height); + st_resize_framebuffer(fb->stfb, width, height); +} + + +static INLINE void stw_framebuffer_destroy( struct stw_framebuffer *fb ) { @@ -176,25 +231,117 @@ stw_framebuffer_destroy( FREE( fb ); } + +void +stw_framebuffer_cleanup( void ) +{ + struct stw_framebuffer *fb; + struct stw_framebuffer *next; + + pipe_mutex_lock( stw_dev->mutex ); + + fb = stw_dev->fb_head; + while (fb) { + next = fb->next; + stw_framebuffer_destroy(fb); + fb = next; + } + stw_dev->fb_head = NULL; + + pipe_mutex_unlock( stw_dev->mutex ); +} + + /** * Given an hdc, return the corresponding stw_framebuffer. */ struct stw_framebuffer * -stw_framebuffer_from_hdc( +stw_framebuffer_from_hdc_locked( HDC hdc ) { struct stw_framebuffer *fb; - pipe_mutex_lock( stw_dev->mutex ); for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) if (fb->hDC == hdc) break; + + return fb; +} + + +/** + * Given an hdc, return the corresponding stw_framebuffer. + */ +struct stw_framebuffer * +stw_framebuffer_from_hdc( + HDC hdc ) +{ + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->mutex ); + fb = stw_framebuffer_from_hdc_locked(hdc); pipe_mutex_unlock( stw_dev->mutex ); return fb; } +BOOL +stw_pixelformat_set( + HDC hdc, + int iPixelFormat ) +{ + uint count; + uint index; + struct stw_framebuffer *fb; + + index = (uint) iPixelFormat - 1; + count = stw_pixelformat_get_extended_count(); + if (index >= count) + return FALSE; + + pipe_mutex_lock( stw_dev->mutex ); + + fb = stw_framebuffer_from_hdc_locked(hdc); + if(fb) { + /* SetPixelFormat must be called only once */ + pipe_mutex_unlock( stw_dev->mutex ); + return FALSE; + } + + fb = stw_framebuffer_create_locked(hdc, iPixelFormat); + if(!fb) { + pipe_mutex_unlock( stw_dev->mutex ); + return FALSE; + } + + pipe_mutex_unlock( stw_dev->mutex ); + + /* Some applications mistakenly use the undocumented wglSetPixelFormat + * function instead of SetPixelFormat, so we call SetPixelFormat here to + * avoid opengl32.dll's wglCreateContext to fail */ + if (GetPixelFormat(hdc) == 0) { + SetPixelFormat(hdc, iPixelFormat, NULL); + } + + return TRUE; +} + + +int +stw_pixelformat_get( + HDC hdc ) +{ + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc(hdc); + if(!fb) + return 0; + + return fb->iPixelFormat; +} + + BOOL stw_swap_buffers( HDC hdc ) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h index f5b48db048..e7fa51c3a8 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h @@ -44,6 +44,10 @@ struct stw_framebuffer HDC hDC; HWND hWnd; + int iPixelFormat; + const struct stw_pixelformat_info *pfi; + GLvisual visual; + pipe_mutex mutex; struct st_framebuffer *stfb; @@ -52,17 +56,25 @@ struct stw_framebuffer }; struct stw_framebuffer * -stw_framebuffer_create( +stw_framebuffer_create_locked( HDC hdc, - GLvisual *visual, - const struct stw_pixelformat_info *pfi, - GLuint width, - GLuint height ); + int iPixelFormat ); -void -stw_framebuffer_destroy( +BOOL +stw_framebuffer_allocate( struct stw_framebuffer *fb ); +void +stw_framebuffer_resize( + struct stw_framebuffer *fb); + +void +stw_framebuffer_cleanup(void); + +struct stw_framebuffer * +stw_framebuffer_from_hdc_locked( + HDC hdc ); + struct stw_framebuffer * stw_framebuffer_from_hdc( HDC hdc ); diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c index b81d2b59a4..c296744838 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c @@ -25,12 +25,14 @@ * **************************************************************************/ +#include "main/mtypes.h" +#include "main/context.h" + #include "pipe/p_format.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "util/u_debug.h" -#include "util/u_memory.h" #include "stw_device.h" #include "stw_pixelformat.h" @@ -261,6 +263,31 @@ stw_pixelformat_get_info( uint index ) } +void +stw_pixelformat_visual(GLvisual *visual, + const struct stw_pixelformat_info *pfi ) +{ + memset(visual, 0, sizeof *visual); + _mesa_initialize_visual( + visual, + (pfi->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE, + (pfi->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, + (pfi->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE, + pfi->pfd.cRedBits, + pfi->pfd.cGreenBits, + pfi->pfd.cBlueBits, + pfi->pfd.cAlphaBits, + (pfi->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pfi->pfd.cColorBits : 0, + pfi->pfd.cDepthBits, + pfi->pfd.cStencilBits, + pfi->pfd.cAccumRedBits, + pfi->pfd.cAccumGreenBits, + pfi->pfd.cAccumBlueBits, + pfi->pfd.cAccumAlphaBits, + pfi->numSamples ); +} + + int stw_pixelformat_describe( HDC hdc, @@ -341,39 +368,3 @@ int stw_pixelformat_choose( HDC hdc, return bestindex + 1; } - - -int -stw_pixelformat_get( - HDC hdc ) -{ - return stw_tls_get_data()->currentPixelFormat; -} - - -BOOL -stw_pixelformat_set( - HDC hdc, - int iPixelFormat ) -{ - uint count; - uint index; - - (void) hdc; - - index = (uint) iPixelFormat - 1; - count = stw_pixelformat_get_extended_count(); - if (index >= count) - return FALSE; - - stw_tls_get_data()->currentPixelFormat = iPixelFormat; - - /* Some applications mistakenly use the undocumented wglSetPixelFormat - * function instead of SetPixelFormat, so we call SetPixelFormat here to - * avoid opengl32.dll's wglCreateContext to fail */ - if (GetPixelFormat(hdc) == 0) { - SetPixelFormat(hdc, iPixelFormat, NULL); - } - - return TRUE; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h index 34522ebef3..bec429231b 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h @@ -30,6 +30,8 @@ #include +#include "main/mtypes.h" + #include "pipe/p_compiler.h" #include "pipe/p_format.h" @@ -56,5 +58,8 @@ stw_pixelformat_get_extended_count( void ); const struct stw_pixelformat_info * stw_pixelformat_get_info( uint index ); +void +stw_pixelformat_visual(GLvisual *visual, + const struct stw_pixelformat_info *pfi ); #endif /* STW_PIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.c b/src/gallium/state_trackers/wgl/shared/stw_tls.c index 95863ca9cf..0c18a52352 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.c +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.c @@ -53,8 +53,6 @@ stw_tls_data_create() if (!data) return NULL; - data->currentPixelFormat = 0; - return data; } diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h index 6cfb0899f2..6af8be70c9 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.h +++ b/src/gallium/state_trackers/wgl/shared/stw_tls.h @@ -32,7 +32,6 @@ struct stw_tls_data { - uint currentPixelFormat; HHOOK hCallWndProcHook; }; -- cgit v1.2.3 From 0ea519f931a14e4dff6ef391803baba8bec84160 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 31 May 2009 11:10:22 -0700 Subject: wgl: Ensure we only create framebuffers for HDC associated with a window. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 45ac3477e8..030a155f54 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -102,15 +102,21 @@ stw_framebuffer_create_locked( HDC hdc, int iPixelFormat ) { + HWND hWnd; struct stw_framebuffer *fb; const struct stw_pixelformat_info *pfi; + /* We only support drawing to a window. */ + hWnd = WindowFromDC( hdc ); + if(!hWnd) + return NULL; + fb = CALLOC_STRUCT( stw_framebuffer ); if (fb == NULL) return NULL; fb->hDC = hdc; - fb->hWnd = WindowFromDC( hdc ); + fb->hWnd = hWnd; fb->iPixelFormat = iPixelFormat; fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); -- cgit v1.2.3 From ea3ee4791eb8b9eefdd40b6ce9bbfc2dc86542bf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 31 May 2009 17:16:26 -0700 Subject: wgl: Cleanup framebuffer destruction logic. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 030a155f54..768cef3db6 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -213,23 +213,18 @@ stw_framebuffer_resize( static INLINE void -stw_framebuffer_destroy( +stw_framebuffer_destroy_locked( struct stw_framebuffer *fb ) { struct stw_framebuffer **link; - pipe_mutex_lock( stw_dev->mutex ); - link = &stw_dev->fb_head; - while (link && *link != fb) + while (*link != fb) link = &(*link)->next; assert(*link); - if (link) - *link = fb->next; + *link = fb->next; fb->next = NULL; - pipe_mutex_unlock( stw_dev->mutex ); - st_unreference_framebuffer(fb->stfb); pipe_mutex_destroy( fb->mutex ); @@ -249,7 +244,7 @@ stw_framebuffer_cleanup( void ) fb = stw_dev->fb_head; while (fb) { next = fb->next; - stw_framebuffer_destroy(fb); + stw_framebuffer_destroy_locked(fb); fb = next; } stw_dev->fb_head = NULL; -- cgit v1.2.3 From aee1a6f70413235c0c4c2c2adfca97d5128a155e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 22 Mar 2009 04:22:33 +0100 Subject: util: Add simple network functions --- src/gallium/auxiliary/util/Makefile | 1 + src/gallium/auxiliary/util/SConscript | 1 + src/gallium/auxiliary/util/u_network.c | 188 +++++++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_network.h | 24 +++++ 4 files changed, 214 insertions(+) create mode 100644 src/gallium/auxiliary/util/u_network.c create mode 100644 src/gallium/auxiliary/util/u_network.h diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile index 2995aba1b9..6a8eb73e84 100644 --- a/src/gallium/auxiliary/util/Makefile +++ b/src/gallium/auxiliary/util/Makefile @@ -16,6 +16,7 @@ C_SOURCES = \ u_hash.c \ u_keymap.c \ u_linear.c \ + u_network.c \ u_math.c \ u_mm.c \ u_rect.c \ diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index d3ac7f747f..fb142eebca 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -17,6 +17,7 @@ util = env.ConvenienceLibrary( 'u_hash.c', 'u_hash_table.c', 'u_keymap.c', + 'u_network.c', 'u_math.c', 'u_mm.c', 'u_rect.c', diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c new file mode 100644 index 0000000000..465d50255e --- /dev/null +++ b/src/gallium/auxiliary/util/u_network.c @@ -0,0 +1,188 @@ + +#include "pipe/p_compiler.h" +#include "util/u_network.h" +#include "util/u_debug.h" + +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) +# include +# include +#elif defined(PIPE_OS_LINUX) +# include +# include +# include +# include +# include +#else +# warning "No socket implementation" +#endif + +boolean +u_socket_init() +{ +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + WORD wVersionRequested; + WSADATA wsaData; + int err; + + /* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */ + wVersionRequested = MAKEWORD(1, 1); + + err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + debug_printf("WSAStartup failed with error: %d\n", err); + return FALSE; + } + return TRUE; +#elif defined(PIPE_HAVE_SOCKETS) + return TRUE; +#else + return FALSE; +#endif +} + +void +u_socket_stop() +{ +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + WSACleanup(); +#endif +} + +void +u_socket_close(int s) +{ + if (s < 0) + return; + +#if defined(PIPE_OS_LINUX) + shutdown(s, SHUT_RDWR); + close(s); +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) + shutdown(s, SD_BOTH); + closesocket(s); +#else + assert(0); +#endif +} + +int u_socket_accept(int s) +{ +#if defined(PIPE_HAVE_SOCKETS) + return accept(s, NULL, NULL); +#else + return -1; +#endif +} + +int +u_socket_send(int s, void *data, size_t size) +{ +#if defined(PIPE_HAVE_SOCKETS) + return send(s, data, size, 0); +#else + return -1; +#endif +} + +int +u_socket_peek(int s, void *data, size_t size) +{ +#if defined(PIPE_HAVE_SOCKETS) + return recv(s, data, size, MSG_PEEK); +#else + return -1; +#endif +} + +int +u_socket_recv(int s, void *data, size_t size) +{ +#if defined(PIPE_HAVE_SOCKETS) + return recv(s, data, size, 0); +#else + return -1; +#endif +} + +int +u_socket_connect(const char *hostname, uint16_t port) +{ +#if defined(PIPE_HAVE_SOCKETS) + int s; + struct sockaddr_in sa; + struct hostent *host = NULL; + + memset(&sa, 0, sizeof(struct sockaddr_in)); + host = gethostbyname(hostname); + if (!host) + return -1; + + memcpy((char *)&sa.sin_addr,host->h_addr,host->h_length); + sa.sin_family= host->h_addrtype; + sa.sin_port = htons(port); + + s = socket(host->h_addrtype, SOCK_STREAM, IPPROTO_TCP); + if (s < 0) + return -1; + + if (connect(s, (struct sockaddr *)&sa, sizeof(sa))) { + u_socket_close(s); + return -1; + } + + return s; +#else + assert(0); + return -1; +#endif +} + +int +u_socket_listen_on_port(uint16_t portnum) +{ +#if defined(PIPE_HAVE_SOCKETS) + int s; + struct sockaddr_in sa; + memset(&sa, 0, sizeof(struct sockaddr_in)); + + sa.sin_family = AF_INET; + sa.sin_port = htons(portnum); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s < 0) + return -1; + + if (bind(s, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1) { + u_socket_close(s); + return -1; + } + + listen(s, 0); + + return s; +#else + assert(0); + return -1; +#endif +} + +void +u_socket_block(int s, boolean block) +{ +#if defined(PIPE_OS_LINUX) + int old = fcntl(s, F_GETFL, 0); + if (old == -1) + return; + + /* TODO obey block */ + if (block) + fcntl(s, F_SETFL, old & ~O_NONBLOCK); + else + fcntl(s, F_SETFL, old | O_NONBLOCK); +#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) + u_long iMode = block ? 0 : 1; + ioctlsocket(s, FIONBIO, &iMode); +#else + assert(0); +#endif +} diff --git a/src/gallium/auxiliary/util/u_network.h b/src/gallium/auxiliary/util/u_network.h new file mode 100644 index 0000000000..14d3884427 --- /dev/null +++ b/src/gallium/auxiliary/util/u_network.h @@ -0,0 +1,24 @@ + +#ifndef _U_NETWORK_H_ +#define _U_NETWORK_H_ + +#include "pipe/p_compiler.h" + +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) +# define PIPE_HAVE_SOCKETS +#elif defined(PIPE_OS_LINUX) +# define PIPE_HAVE_SOCKETS +#endif + +boolean u_socket_init(void); +void u_socket_stop(void); +void u_socket_close(int s); +int u_socket_listen_on_port(uint16_t portnum); +int u_socket_accept(int s); +int u_socket_connect(const char *host, uint16_t port); +int u_socket_send(int s, void *data, size_t size); +int u_socket_peek(int s, void *data, size_t size); +int u_socket_recv(int s, void *data, size_t size); +void u_socket_block(int s, boolean block); + +#endif -- cgit v1.2.3 From dfa4ebcbcc9c7e9e7562f73a4ddc367756623e5e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 15 May 2009 01:07:05 +0200 Subject: rbug: Add Gallium Remote Debugger Protocol code This is the (de)marshalling and connection managment code --- configs/default | 2 +- configure.ac | 2 +- src/gallium/SConscript | 1 + src/gallium/auxiliary/rbug/Makefile | 14 + src/gallium/auxiliary/rbug/README | 21 + src/gallium/auxiliary/rbug/SConscript | 14 + src/gallium/auxiliary/rbug/rbug.h | 33 ++ src/gallium/auxiliary/rbug/rbug_connection.c | 167 +++++++ src/gallium/auxiliary/rbug/rbug_connection.h | 45 ++ src/gallium/auxiliary/rbug/rbug_context.c | 442 +++++++++++++++++++ src/gallium/auxiliary/rbug/rbug_context.h | 128 ++++++ src/gallium/auxiliary/rbug/rbug_core.c | 359 +++++++++++++++ src/gallium/auxiliary/rbug/rbug_core.h | 101 +++++ src/gallium/auxiliary/rbug/rbug_demarshal.c | 85 ++++ src/gallium/auxiliary/rbug/rbug_internal.h | 100 +++++ src/gallium/auxiliary/rbug/rbug_proto.h | 90 ++++ src/gallium/auxiliary/rbug/rbug_shader.c | 468 ++++++++++++++++++++ src/gallium/auxiliary/rbug/rbug_shader.h | 144 ++++++ src/gallium/auxiliary/rbug/rbug_texture.c | 631 +++++++++++++++++++++++++++ src/gallium/auxiliary/rbug/rbug_texture.h | 207 +++++++++ 20 files changed, 3052 insertions(+), 2 deletions(-) create mode 100644 src/gallium/auxiliary/rbug/Makefile create mode 100644 src/gallium/auxiliary/rbug/README create mode 100644 src/gallium/auxiliary/rbug/SConscript create mode 100644 src/gallium/auxiliary/rbug/rbug.h create mode 100644 src/gallium/auxiliary/rbug/rbug_connection.c create mode 100644 src/gallium/auxiliary/rbug/rbug_connection.h create mode 100644 src/gallium/auxiliary/rbug/rbug_context.c create mode 100644 src/gallium/auxiliary/rbug/rbug_context.h create mode 100644 src/gallium/auxiliary/rbug/rbug_core.c create mode 100644 src/gallium/auxiliary/rbug/rbug_core.h create mode 100644 src/gallium/auxiliary/rbug/rbug_demarshal.c create mode 100644 src/gallium/auxiliary/rbug/rbug_internal.h create mode 100644 src/gallium/auxiliary/rbug/rbug_proto.h create mode 100644 src/gallium/auxiliary/rbug/rbug_shader.c create mode 100644 src/gallium/auxiliary/rbug/rbug_shader.h create mode 100644 src/gallium/auxiliary/rbug/rbug_texture.c create mode 100644 src/gallium/auxiliary/rbug/rbug_texture.h diff --git a/configs/default b/configs/default index 9c479fccdf..d2ea3b2487 100644 --- a/configs/default +++ b/configs/default @@ -90,7 +90,7 @@ EGL_DRIVERS_DIRS = demo # Gallium directories and GALLIUM_DIRS = auxiliary drivers state_trackers -GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices +GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) diff --git a/configure.ac b/configure.ac index 8110e0f869..24aa13a7ca 100644 --- a/configure.ac +++ b/configure.ac @@ -409,7 +409,7 @@ WINDOW_SYSTEM="" GALLIUM_DIRS="auxiliary drivers state_trackers" GALLIUM_WINSYS_DIRS="" GALLIUM_WINSYS_DRM_DIRS="" -GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices" +GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices" GALLIUM_DRIVERS_DIRS="softpipe failover trace" GALLIUM_STATE_TRACKERS_DIRS="" diff --git a/src/gallium/SConscript b/src/gallium/SConscript index b6ceaf3edf..32b7c2980a 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -22,6 +22,7 @@ SConscript([ 'auxiliary/draw/SConscript', 'auxiliary/pipebuffer/SConscript', 'auxiliary/indices/SConscript', + 'auxiliary/rbug/SConscript', ]) for driver in env['drivers']: diff --git a/src/gallium/auxiliary/rbug/Makefile b/src/gallium/auxiliary/rbug/Makefile new file mode 100644 index 0000000000..cd12e8468f --- /dev/null +++ b/src/gallium/auxiliary/rbug/Makefile @@ -0,0 +1,14 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = rbug + +C_SOURCES = \ + rbug_connection.c \ + rbug_core.c \ + rbug_texture.c \ + rbug_context.c \ + rbug_shader.c \ + rbug_demarshal.c + +include ../../Makefile.template diff --git a/src/gallium/auxiliary/rbug/README b/src/gallium/auxiliary/rbug/README new file mode 100644 index 0000000000..33d76371de --- /dev/null +++ b/src/gallium/auxiliary/rbug/README @@ -0,0 +1,21 @@ + GALLIUM REMOTE DEBUGGING COMMON CODE + += About = + +This directory contains the common code for the Gallium 3D remote debugging +driver and clients. The code is two parts the connection managment code and +the (de)marsheller. + +The code currently uses tcp and ip4v for connections. + +Information about driver integration can be found in: + +src/gallium/drivers/trace/README + +for information about applications look in: + +progs/rbug/README + + +-- +Jakob Bornecrantz diff --git a/src/gallium/auxiliary/rbug/SConscript b/src/gallium/auxiliary/rbug/SConscript new file mode 100644 index 0000000000..4a9afb45d3 --- /dev/null +++ b/src/gallium/auxiliary/rbug/SConscript @@ -0,0 +1,14 @@ +Import('*') + +rbug = env.ConvenienceLibrary( + target = 'rbug', + source = [ + 'rbug_core.c', + 'rbug_shader.c', + 'rbug_context.c', + 'rbug_texture.c', + 'rbug_demarshal.c', + 'rbug_connection.c', + ]) + +auxiliaries.insert(0, rbug) diff --git a/src/gallium/auxiliary/rbug/rbug.h b/src/gallium/auxiliary/rbug/rbug.h new file mode 100644 index 0000000000..259bfc6c79 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug.h @@ -0,0 +1,33 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Include all for users the remote debugger protocol code. + */ + +#include "rbug/rbug_core.h" +#include "rbug/rbug_shader.h" +#include "rbug/rbug_context.h" +#include "rbug/rbug_texture.h" +#include "rbug/rbug_connection.h" diff --git a/src/gallium/auxiliary/rbug/rbug_connection.c b/src/gallium/auxiliary/rbug/rbug_connection.c new file mode 100644 index 0000000000..52acb700af --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_connection.c @@ -0,0 +1,167 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "rbug/rbug.h" +#include "rbug/rbug_internal.h" + +#include "util/u_network.h" + +struct rbug_connection +{ + int socket; + uint32_t send_serial; + uint32_t recv_serial; + enum rbug_opcode opcode; +}; + +/** + * Create a rbug connection from a socket created with u_socket. + * + * Result: + * A new allocated connection using socket as communication path + */ +struct rbug_connection * +rbug_from_socket(int socket) +{ + struct rbug_connection *c = CALLOC_STRUCT(rbug_connection); + c->socket = socket; + return c; +} + +/** + * Free a connection, also closes socket. + */ +void +rbug_disconnect(struct rbug_connection *c) +{ + u_socket_close(c->socket); + FREE(c); +} + +/** + * Waits for a message to be fully received. + * Also returns the serial for the message, serial is not touched for replys. + * + * Result: + * demarshaled message on success, NULL on connection error + */ +struct rbug_header * +rbug_get_message(struct rbug_connection *c, uint32_t *serial) +{ + struct rbug_proto_header header; + struct rbug_header *out; + struct rbug_proto_header *data; + size_t length = 0; + size_t read = 0; + int ret; + + + ret = u_socket_peek(c->socket, &header, sizeof(header)); + if (ret <= 0) { + return NULL; + } + + length = (size_t)header.length * 4; + data = MALLOC(length); + if (!data) { + return NULL; + } + + do { + uint8_t *ptr = ((uint8_t*)data) + read; + ret = u_socket_recv(c->socket, ptr, length - read); + + if (ret <= 0) { + FREE(data); + return NULL; + } + + read += ret; + } while(read < length); + + out = rbug_demarshal(data); + if (!out) + FREE(data); + else if (serial) + *serial = c->recv_serial++; + else + c->recv_serial++; + + return out; +} + +/** + * Frees a message and associated data. + */ +void +rbug_free_header(struct rbug_header *header) +{ + if (!header) + return; + + FREE(header->__message); + FREE(header); +} + +/** + * Internal function used by rbug_send_* functions. + * + * Start sending a message. + */ +int +rbug_connection_send_start(struct rbug_connection *c, enum rbug_opcode opcode, uint32_t length) +{ + c->opcode = opcode; + return 0; +} + +/** + * Internal function used by rbug_send_* functions. + * + * Write data to the socket. + */ +int +rbug_connection_write(struct rbug_connection *c, void *to, uint32_t size) +{ + int ret = u_socket_send(c->socket, to, size); + return ret; +} + +/** + * Internal function used by rbug_send_* functions. + * + * Finish writeing data to the socket. + * Ups the send_serial and sets the serial argument if supplied. + */ +int rbug_connection_send_finish(struct rbug_connection *c, uint32_t *serial) +{ + if (c->opcode < 0) + return 0; + else if (serial) + *serial = c->send_serial++; + else + c->send_serial++; + + return 0; +} diff --git a/src/gallium/auxiliary/rbug/rbug_connection.h b/src/gallium/auxiliary/rbug/rbug_connection.h new file mode 100644 index 0000000000..1f2c9ff347 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_connection.h @@ -0,0 +1,45 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file contains the function defentions for connection see c file for + * more comments covering function use. + */ + +#ifndef _RBUG_CONNECTION_H_ +#define _RBUG_CONNECTION_H_ + +#include "rbug/rbug_proto.h" + +struct rbug_connection * rbug_from_socket(int socket); + +void rbug_disconnect(struct rbug_connection *c); + +struct rbug_header * rbug_get_message(struct rbug_connection *c, uint32_t *serial); + +void rbug_free_header(struct rbug_header *header); + +struct rbug_header * rbug_demarshal(struct rbug_proto_header *header); + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c new file mode 100644 index 0000000000..b4fad5300d --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -0,0 +1,442 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds the function implementation for one of the rbug extensions. + * Prototypes and declerations of functions and structs is in the same folder + * in the header file matching this file's name. + * + * The functions starting rbug_send_* encodes a call to the write format and + * sends that to the supplied connection, while functions starting with + * rbug_demarshal_* demarshal data in the wire protocol. + * + * Functions ending with _reply are replies to requests. + */ + +#include "rbug_internal.h" +#include "rbug/rbug_context.h" + +int rbug_send_context_list(struct rbug_connection *__con, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_info(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_block_draw(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_BLOCK_DRAW)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_BLOCK_DRAW, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_unblock_draw(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_UNBLOCK_DRAW, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_context_t *contexts, + uint32_t contexts_len, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN_ARRAY(8, contexts); /* contexts */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE_ARRAY(8, rbug_context_t, contexts); /* contexts */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_info_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_texture_t *cbufs, + uint32_t cbufs_len, + rbug_texture_t zdbuf, + uint8_t blocked, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN_ARRAY(8, cbufs); /* cbufs */ + LEN(8); /* zdbuf */ + LEN(1); /* blocked */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ + WRITE(8, rbug_texture_t, zdbuf); /* zdbuf */ + WRITE(1, uint8_t, blocked); /* blocked */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_list *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + + return ret; +} + +struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_info *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + + return ret; +} + +struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_block_draw *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_BLOCK_DRAW) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + + return ret; +} + +struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_unblock_draw *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + + return ret; +} + +struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_list_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ_ARRAY(8, rbug_context_t, contexts); /* contexts */ + + return ret; +} + +struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_info_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ + READ(8, rbug_texture_t, zdbuf); /* zdbuf */ + READ(1, uint8_t, blocked); /* blocked */ + + return ret; +} diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h new file mode 100644 index 0000000000..bcd2a826a7 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_context.h @@ -0,0 +1,128 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds structs decelerations and function prototypes for one of + * the rbug extensions. Implementation of the functions is in the same folder + * in the c file matching this file's name. + * + * The structs what is returned from the demarshal functions. The functions + * starting rbug_send_* encodes a call to the write format and sends that to + * the supplied connection, while functions starting with rbug_demarshal_* + * demarshal data from the wire protocol. + * + * Structs and functions ending with _reply are replies to requests. + */ + +#ifndef _RBUG_PROTO_CONTEXT_H_ +#define _RBUG_PROTO_CONTEXT_H_ + +#include "rbug/rbug_proto.h" +#include "rbug/rbug_texture.h" + +typedef uint64_t rbug_context_t; + +struct rbug_proto_context_list +{ + struct rbug_header header; +}; + +struct rbug_proto_context_info +{ + struct rbug_header header; + rbug_context_t context; +}; + +struct rbug_proto_context_block_draw +{ + struct rbug_header header; + rbug_context_t context; +}; + +struct rbug_proto_context_unblock_draw +{ + struct rbug_header header; + rbug_context_t context; +}; + +struct rbug_proto_context_list_reply +{ + struct rbug_header header; + uint32_t serial; + rbug_context_t *contexts; + uint32_t contexts_len; +}; + +struct rbug_proto_context_info_reply +{ + struct rbug_header header; + uint32_t serial; + rbug_texture_t *cbufs; + uint32_t cbufs_len; + rbug_texture_t zdbuf; + uint8_t blocked; +}; + +int rbug_send_context_list(struct rbug_connection *__con, + uint32_t *__serial); + +int rbug_send_context_info(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial); + +int rbug_send_context_block_draw(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial); + +int rbug_send_context_unblock_draw(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial); + +int rbug_send_context_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_context_t *contexts, + uint32_t contexts_len, + uint32_t *__serial); + +int rbug_send_context_info_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_texture_t *cbufs, + uint32_t cbufs_len, + rbug_texture_t zdbuf, + uint8_t blocked, + uint32_t *__serial); + +struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header); + +struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header); + +struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header); + +struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header); + +struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); + +struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_core.c b/src/gallium/auxiliary/rbug/rbug_core.c new file mode 100644 index 0000000000..876ae5a0ce --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_core.c @@ -0,0 +1,359 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds the function implementation for one of the rbug extensions. + * Prototypes and declerations of functions and structs is in the same folder + * in the header file matching this file's name. + * + * The functions starting rbug_send_* encodes a call to the write format and + * sends that to the supplied connection, while functions starting with + * rbug_demarshal_* demarshal data in the wire protocol. + * + * Functions ending with _reply are replies to requests. + */ + +#include "rbug_internal.h" +#include "rbug/rbug_core.h" + +int rbug_send_noop(struct rbug_connection *__con, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_NOOP)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_NOOP, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_ping(struct rbug_connection *__con, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_PING)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_PING, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_error(struct rbug_connection *__con, + uint32_t error, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* error */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, error); /* error */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_ERROR, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_ping_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_PING_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_PING_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_error_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t error, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN(4); /* error */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE(4, uint32_t, error); /* error */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_ERROR_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_noop *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_NOOP) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + + return ret; +} + +struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_ping *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_PING) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + + return ret; +} + +struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_error *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_ERROR) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, error); /* error */ + + return ret; +} + +struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_ping_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_PING_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + + return ret; +} + +struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_error_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_ERROR_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ(4, uint32_t, error); /* error */ + + return ret; +} diff --git a/src/gallium/auxiliary/rbug/rbug_core.h b/src/gallium/auxiliary/rbug/rbug_core.h new file mode 100644 index 0000000000..d63a8c8076 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_core.h @@ -0,0 +1,101 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds structs decelerations and function prototypes for one of + * the rbug extensions. Implementation of the functions is in the same folder + * in the c file matching this file's name. + * + * The structs what is returned from the demarshal functions. The functions + * starting rbug_send_* encodes a call to the write format and sends that to + * the supplied connection, while functions starting with rbug_demarshal_* + * demarshal data from the wire protocol. + * + * Structs and functions ending with _reply are replies to requests. + */ + +#ifndef _RBUG_PROTO_CORE_H_ +#define _RBUG_PROTO_CORE_H_ + +#include "rbug/rbug_proto.h" + +struct rbug_proto_noop +{ + struct rbug_header header; +}; + +struct rbug_proto_ping +{ + struct rbug_header header; +}; + +struct rbug_proto_error +{ + struct rbug_header header; + uint32_t error; +}; + +struct rbug_proto_ping_reply +{ + struct rbug_header header; + uint32_t serial; +}; + +struct rbug_proto_error_reply +{ + struct rbug_header header; + uint32_t serial; + uint32_t error; +}; + +int rbug_send_noop(struct rbug_connection *__con, + uint32_t *__serial); + +int rbug_send_ping(struct rbug_connection *__con, + uint32_t *__serial); + +int rbug_send_error(struct rbug_connection *__con, + uint32_t error, + uint32_t *__serial); + +int rbug_send_ping_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t *__serial); + +int rbug_send_error_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t error, + uint32_t *__serial); + +struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header); + +struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header); + +struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header); + +struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header); + +struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header); + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c new file mode 100644 index 0000000000..e3c0954f9e --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -0,0 +1,85 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "rbug.h" + +/** + * Small function that looks at the proto_header and selects the correct + * demarshal functions and return the result. + */ +struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) +{ + switch(header->opcode) { + case RBUG_OP_NOOP: + return (struct rbug_header *)rbug_demarshal_noop(header); + case RBUG_OP_PING: + return (struct rbug_header *)rbug_demarshal_ping(header); + case RBUG_OP_ERROR: + return (struct rbug_header *)rbug_demarshal_error(header); + case RBUG_OP_PING_REPLY: + return (struct rbug_header *)rbug_demarshal_ping_reply(header); + case RBUG_OP_ERROR_REPLY: + return (struct rbug_header *)rbug_demarshal_error_reply(header); + case RBUG_OP_TEXTURE_LIST: + return (struct rbug_header *)rbug_demarshal_texture_list(header); + case RBUG_OP_TEXTURE_INFO: + return (struct rbug_header *)rbug_demarshal_texture_info(header); + case RBUG_OP_TEXTURE_WRITE: + return (struct rbug_header *)rbug_demarshal_texture_write(header); + case RBUG_OP_TEXTURE_READ: + return (struct rbug_header *)rbug_demarshal_texture_read(header); + case RBUG_OP_TEXTURE_LIST_REPLY: + return (struct rbug_header *)rbug_demarshal_texture_list_reply(header); + case RBUG_OP_TEXTURE_INFO_REPLY: + return (struct rbug_header *)rbug_demarshal_texture_info_reply(header); + case RBUG_OP_TEXTURE_READ_REPLY: + return (struct rbug_header *)rbug_demarshal_texture_read_reply(header); + case RBUG_OP_CONTEXT_LIST: + return (struct rbug_header *)rbug_demarshal_context_list(header); + case RBUG_OP_CONTEXT_INFO: + return (struct rbug_header *)rbug_demarshal_context_info(header); + case RBUG_OP_CONTEXT_BLOCK_DRAW: + return (struct rbug_header *)rbug_demarshal_context_block_draw(header); + case RBUG_OP_CONTEXT_UNBLOCK_DRAW: + return (struct rbug_header *)rbug_demarshal_context_unblock_draw(header); + case RBUG_OP_CONTEXT_LIST_REPLY: + return (struct rbug_header *)rbug_demarshal_context_list_reply(header); + case RBUG_OP_CONTEXT_INFO_REPLY: + return (struct rbug_header *)rbug_demarshal_context_info_reply(header); + case RBUG_OP_SHADER_LIST: + return (struct rbug_header *)rbug_demarshal_shader_list(header); + case RBUG_OP_SHADER_INFO: + return (struct rbug_header *)rbug_demarshal_shader_info(header); + case RBUG_OP_SHADER_DISABLE: + return (struct rbug_header *)rbug_demarshal_shader_disable(header); + case RBUG_OP_SHADER_REPLACE: + return (struct rbug_header *)rbug_demarshal_shader_replace(header); + case RBUG_OP_SHADER_LIST_REPLY: + return (struct rbug_header *)rbug_demarshal_shader_list_reply(header); + case RBUG_OP_SHADER_INFO_REPLY: + return (struct rbug_header *)rbug_demarshal_shader_info_reply(header); + default: + return NULL; + } +} diff --git a/src/gallium/auxiliary/rbug/rbug_internal.h b/src/gallium/auxiliary/rbug/rbug_internal.h new file mode 100644 index 0000000000..4aba1a810f --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_internal.h @@ -0,0 +1,100 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file is internal to the rbug protocol code, and contains asorted + * features needed by the code. + */ + +#ifndef _RBUG_INTERNAL_H_ +#define _RBUG_INTERNAL_H_ + +#include "rbug/rbug_proto.h" + +#include "util/u_memory.h" +#include "util/u_debug.h" +#include + +int rbug_connection_send_start(struct rbug_connection *con, enum rbug_opcode opcode, uint32_t length); +int rbug_connection_write(struct rbug_connection *con, void *data, uint32_t size); +int rbug_connection_send_finish(struct rbug_connection *con, uint32_t *c); + +/** + * Only works with multiples of 2 + */ +#define PAD(from, to) \ +do { \ + from = (from + to - 1) & ~(to - 1); \ +} while(0) + +#define LEN(size) \ +do { \ + PAD(__len, size); \ + __len += size; \ +} while(0) + +#define LEN_ARRAY(size, name) \ +do { \ + LEN(4); \ + PAD(__len, size); \ + __len += size * name##_len; \ +} while(0) + +#define WRITE(size, type, name) \ +do { \ + PAD(__pos, size); \ + *((type *)(&__data[__pos])) = name; \ + __pos += size; \ +} while(0) + +#define WRITE_ARRAY(size, type, name) \ +do { \ + WRITE(4, uint32_t, name##_len); \ + PAD(__pos, size); \ + memcpy(&__data[__pos], name, size * name##_len); \ + __pos += size * name##_len; \ +} while(0) + +#define READ(size, type, name) \ +do { \ + PAD(pos, size); \ + pos += size; \ + if (pos > len) \ + break; \ + ret->name = *((type *)(&data[pos - size])); \ +} while(0) + +#define READ_ARRAY(size, type, name) \ +do { \ + READ(4, uint32_t, name##_len); \ + if (pos > len) \ + break; \ + PAD(pos, size); \ + pos += size * ret->name##_len; \ + if (pos > len) \ + break; \ + ret->name = (type *)&data[pos - size * ret->name##_len]; \ +} while(0) + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h new file mode 100644 index 0000000000..8fa1836771 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -0,0 +1,90 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds common definitions of the gallium remote debugging protocol. + */ + +#ifndef _RBUG_PROTO_H_ +#define _RBUG_PROTO_H_ + +#include "pipe/p_compiler.h" + +/** + * Uniqe indentifier for each command. + * + * Replys are designated by negative. + */ +enum rbug_opcode +{ + RBUG_OP_NOOP = 0, + RBUG_OP_PING = 1, + RBUG_OP_ERROR = 2, + RBUG_OP_PING_REPLY = -1, + RBUG_OP_ERROR_REPLY = -2, + RBUG_OP_TEXTURE_LIST = 256, + RBUG_OP_TEXTURE_INFO = 257, + RBUG_OP_TEXTURE_WRITE = 258, + RBUG_OP_TEXTURE_READ = 259, + RBUG_OP_TEXTURE_LIST_REPLY = -256, + RBUG_OP_TEXTURE_INFO_REPLY = -257, + RBUG_OP_TEXTURE_READ_REPLY = -259, + RBUG_OP_CONTEXT_LIST = 512, + RBUG_OP_CONTEXT_INFO = 513, + RBUG_OP_CONTEXT_BLOCK_DRAW = 514, + RBUG_OP_CONTEXT_UNBLOCK_DRAW = 515, + RBUG_OP_CONTEXT_LIST_REPLY = -512, + RBUG_OP_CONTEXT_INFO_REPLY = -513, + RBUG_OP_SHADER_LIST = 768, + RBUG_OP_SHADER_INFO = 769, + RBUG_OP_SHADER_DISABLE = 770, + RBUG_OP_SHADER_REPLACE = 771, + RBUG_OP_SHADER_LIST_REPLY = -768, + RBUG_OP_SHADER_INFO_REPLY = -769, +}; + +/** + * Header for demarshaled message. + */ +struct rbug_header +{ + enum rbug_opcode opcode; + void *__message; +}; + +/** + * Header for a message in wire format. + */ +struct rbug_proto_header +{ + int32_t opcode; + uint32_t length; +}; + +/** + * Forward declare connection here, as this file is included by all users. + */ +struct rbug_connection; + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_shader.c b/src/gallium/auxiliary/rbug/rbug_shader.c new file mode 100644 index 0000000000..fccd2f55ef --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_shader.c @@ -0,0 +1,468 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds the function implementation for one of the rbug extensions. + * Prototypes and declerations of functions and structs is in the same folder + * in the header file matching this file's name. + * + * The functions starting rbug_send_* encodes a call to the write format and + * sends that to the supplied connection, while functions starting with + * rbug_demarshal_* demarshal data in the wire protocol. + * + * Functions ending with _reply are replies to requests. + */ + +#include "rbug_internal.h" +#include "rbug/rbug_shader.h" + +int rbug_send_shader_list(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_shader_info(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(8); /* shader */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(8, rbug_shader_t, shader); /* shader */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_shader_disable(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint8_t disable, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(8); /* shader */ + LEN(1); /* disable */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_DISABLE)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(8, rbug_shader_t, shader); /* shader */ + WRITE(1, uint8_t, disable); /* disable */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_DISABLE, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_shader_replace(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint32_t *tokens, + uint32_t tokens_len, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(8); /* shader */ + LEN_ARRAY(4, tokens); /* tokens */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_REPLACE)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(8, rbug_shader_t, shader); /* shader */ + WRITE_ARRAY(4, uint32_t, tokens); /* tokens */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_REPLACE, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_shader_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_shader_t *shaders, + uint32_t shaders_len, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN_ARRAY(8, shaders); /* shaders */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE_ARRAY(8, rbug_shader_t, shaders); /* shaders */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_shader_info_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t *original, + uint32_t original_len, + uint32_t *replaced, + uint32_t replaced_len, + uint8_t disabled, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN_ARRAY(4, original); /* original */ + LEN_ARRAY(4, replaced); /* replaced */ + LEN(1); /* disabled */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE_ARRAY(4, uint32_t, original); /* original */ + WRITE_ARRAY(4, uint32_t, replaced); /* replaced */ + WRITE(1, uint8_t, disabled); /* disabled */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_list *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + + return ret; +} + +struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_info *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(8, rbug_shader_t, shader); /* shader */ + + return ret; +} + +struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_disable *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_DISABLE) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(8, rbug_shader_t, shader); /* shader */ + READ(1, uint8_t, disable); /* disable */ + + return ret; +} + +struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_replace *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_REPLACE) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(8, rbug_shader_t, shader); /* shader */ + READ_ARRAY(4, uint32_t, tokens); /* tokens */ + + return ret; +} + +struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_list_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ_ARRAY(8, rbug_shader_t, shaders); /* shaders */ + + return ret; +} + +struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_shader_info_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ_ARRAY(4, uint32_t, original); /* original */ + READ_ARRAY(4, uint32_t, replaced); /* replaced */ + READ(1, uint8_t, disabled); /* disabled */ + + return ret; +} diff --git a/src/gallium/auxiliary/rbug/rbug_shader.h b/src/gallium/auxiliary/rbug/rbug_shader.h new file mode 100644 index 0000000000..fe1b9ac0f7 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_shader.h @@ -0,0 +1,144 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds structs decelerations and function prototypes for one of + * the rbug extensions. Implementation of the functions is in the same folder + * in the c file matching this file's name. + * + * The structs what is returned from the demarshal functions. The functions + * starting rbug_send_* encodes a call to the write format and sends that to + * the supplied connection, while functions starting with rbug_demarshal_* + * demarshal data from the wire protocol. + * + * Structs and functions ending with _reply are replies to requests. + */ + +#ifndef _RBUG_PROTO_SHADER_H_ +#define _RBUG_PROTO_SHADER_H_ + +#include "rbug/rbug_proto.h" +#include "rbug/rbug_context.h" + +typedef uint64_t rbug_shader_t; + +struct rbug_proto_shader_list +{ + struct rbug_header header; + rbug_context_t context; +}; + +struct rbug_proto_shader_info +{ + struct rbug_header header; + rbug_context_t context; + rbug_shader_t shader; +}; + +struct rbug_proto_shader_disable +{ + struct rbug_header header; + rbug_context_t context; + rbug_shader_t shader; + uint8_t disable; +}; + +struct rbug_proto_shader_replace +{ + struct rbug_header header; + rbug_context_t context; + rbug_shader_t shader; + uint32_t *tokens; + uint32_t tokens_len; +}; + +struct rbug_proto_shader_list_reply +{ + struct rbug_header header; + uint32_t serial; + rbug_shader_t *shaders; + uint32_t shaders_len; +}; + +struct rbug_proto_shader_info_reply +{ + struct rbug_header header; + uint32_t serial; + uint32_t *original; + uint32_t original_len; + uint32_t *replaced; + uint32_t replaced_len; + uint8_t disabled; +}; + +int rbug_send_shader_list(struct rbug_connection *__con, + rbug_context_t context, + uint32_t *__serial); + +int rbug_send_shader_info(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint32_t *__serial); + +int rbug_send_shader_disable(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint8_t disable, + uint32_t *__serial); + +int rbug_send_shader_replace(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t shader, + uint32_t *tokens, + uint32_t tokens_len, + uint32_t *__serial); + +int rbug_send_shader_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_shader_t *shaders, + uint32_t shaders_len, + uint32_t *__serial); + +int rbug_send_shader_info_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t *original, + uint32_t original_len, + uint32_t *replaced, + uint32_t replaced_len, + uint8_t disabled, + uint32_t *__serial); + +struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header); + +struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header); + +struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header); + +struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header); + +struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header); + +struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header); + +#endif diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c new file mode 100644 index 0000000000..5a918fe6bc --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_texture.c @@ -0,0 +1,631 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds the function implementation for one of the rbug extensions. + * Prototypes and declerations of functions and structs is in the same folder + * in the header file matching this file's name. + * + * The functions starting rbug_send_* encodes a call to the write format and + * sends that to the supplied connection, while functions starting with + * rbug_demarshal_* demarshal data in the wire protocol. + * + * Functions ending with _reply are replies to requests. + */ + +#include "rbug_internal.h" +#include "rbug/rbug_texture.h" + +int rbug_send_texture_list(struct rbug_connection *__con, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_info(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* texture */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_texture_t, texture); /* texture */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_write(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t face, + uint32_t level, + uint32_t zslice, + uint32_t x, + uint32_t y, + uint32_t w, + uint32_t h, + uint8_t *data, + uint32_t data_len, + uint32_t stride, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* texture */ + LEN(4); /* face */ + LEN(4); /* level */ + LEN(4); /* zslice */ + LEN(4); /* x */ + LEN(4); /* y */ + LEN(4); /* w */ + LEN(4); /* h */ + LEN_ARRAY(1, data); /* data */ + LEN(4); /* stride */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_WRITE)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_texture_t, texture); /* texture */ + WRITE(4, uint32_t, face); /* face */ + WRITE(4, uint32_t, level); /* level */ + WRITE(4, uint32_t, zslice); /* zslice */ + WRITE(4, uint32_t, x); /* x */ + WRITE(4, uint32_t, y); /* y */ + WRITE(4, uint32_t, w); /* w */ + WRITE(4, uint32_t, h); /* h */ + WRITE_ARRAY(1, uint8_t, data); /* data */ + WRITE(4, uint32_t, stride); /* stride */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_WRITE, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_read(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t face, + uint32_t level, + uint32_t zslice, + uint32_t x, + uint32_t y, + uint32_t w, + uint32_t h, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* texture */ + LEN(4); /* face */ + LEN(4); /* level */ + LEN(4); /* zslice */ + LEN(4); /* x */ + LEN(4); /* y */ + LEN(4); /* w */ + LEN(4); /* h */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_texture_t, texture); /* texture */ + WRITE(4, uint32_t, face); /* face */ + WRITE(4, uint32_t, level); /* level */ + WRITE(4, uint32_t, zslice); /* zslice */ + WRITE(4, uint32_t, x); /* x */ + WRITE(4, uint32_t, y); /* y */ + WRITE(4, uint32_t, w); /* w */ + WRITE(4, uint32_t, h); /* h */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_texture_t *textures, + uint32_t textures_len, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN_ARRAY(8, textures); /* textures */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE_ARRAY(8, rbug_texture_t, textures); /* textures */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_info_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t target, + uint32_t format, + uint32_t *width, + uint32_t width_len, + uint32_t *height, + uint32_t height_len, + uint32_t *depth, + uint32_t depth_len, + uint32_t blockw, + uint32_t blockh, + uint32_t blocksize, + uint32_t last_level, + uint32_t nr_samples, + uint32_t tex_usage, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN(4); /* target */ + LEN(4); /* format */ + LEN_ARRAY(4, width); /* width */ + LEN_ARRAY(4, height); /* height */ + LEN_ARRAY(4, depth); /* depth */ + LEN(4); /* blockw */ + LEN(4); /* blockh */ + LEN(4); /* blocksize */ + LEN(4); /* last_level */ + LEN(4); /* nr_samples */ + LEN(4); /* tex_usage */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE(4, uint32_t, target); /* target */ + WRITE(4, uint32_t, format); /* format */ + WRITE_ARRAY(4, uint32_t, width); /* width */ + WRITE_ARRAY(4, uint32_t, height); /* height */ + WRITE_ARRAY(4, uint32_t, depth); /* depth */ + WRITE(4, uint32_t, blockw); /* blockw */ + WRITE(4, uint32_t, blockh); /* blockh */ + WRITE(4, uint32_t, blocksize); /* blocksize */ + WRITE(4, uint32_t, last_level); /* last_level */ + WRITE(4, uint32_t, nr_samples); /* nr_samples */ + WRITE(4, uint32_t, tex_usage); /* tex_usage */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_texture_read_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t format, + uint32_t blockw, + uint32_t blockh, + uint32_t blocksize, + uint8_t *data, + uint32_t data_len, + uint32_t stride, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN(4); /* format */ + LEN(4); /* blockw */ + LEN(4); /* blockh */ + LEN(4); /* blocksize */ + LEN_ARRAY(1, data); /* data */ + LEN(4); /* stride */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE(4, uint32_t, format); /* format */ + WRITE(4, uint32_t, blockw); /* blockw */ + WRITE(4, uint32_t, blockh); /* blockh */ + WRITE(4, uint32_t, blocksize); /* blocksize */ + WRITE_ARRAY(1, uint8_t, data); /* data */ + WRITE(4, uint32_t, stride); /* stride */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_list *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + + return ret; +} + +struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_info *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_texture_t, texture); /* texture */ + + return ret; +} + +struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_write *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_WRITE) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_texture_t, texture); /* texture */ + READ(4, uint32_t, face); /* face */ + READ(4, uint32_t, level); /* level */ + READ(4, uint32_t, zslice); /* zslice */ + READ(4, uint32_t, x); /* x */ + READ(4, uint32_t, y); /* y */ + READ(4, uint32_t, w); /* w */ + READ(4, uint32_t, h); /* h */ + READ_ARRAY(1, uint8_t, data); /* data */ + READ(4, uint32_t, stride); /* stride */ + + return ret; +} + +struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_read *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_texture_t, texture); /* texture */ + READ(4, uint32_t, face); /* face */ + READ(4, uint32_t, level); /* level */ + READ(4, uint32_t, zslice); /* zslice */ + READ(4, uint32_t, x); /* x */ + READ(4, uint32_t, y); /* y */ + READ(4, uint32_t, w); /* w */ + READ(4, uint32_t, h); /* h */ + + return ret; +} + +struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_list_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ_ARRAY(8, rbug_texture_t, textures); /* textures */ + + return ret; +} + +struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_info_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ(4, uint32_t, target); /* target */ + READ(4, uint32_t, format); /* format */ + READ_ARRAY(4, uint32_t, width); /* width */ + READ_ARRAY(4, uint32_t, height); /* height */ + READ_ARRAY(4, uint32_t, depth); /* depth */ + READ(4, uint32_t, blockw); /* blockw */ + READ(4, uint32_t, blockh); /* blockh */ + READ(4, uint32_t, blocksize); /* blocksize */ + READ(4, uint32_t, last_level); /* last_level */ + READ(4, uint32_t, nr_samples); /* nr_samples */ + READ(4, uint32_t, tex_usage); /* tex_usage */ + + return ret; +} + +struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_texture_read_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ(4, uint32_t, format); /* format */ + READ(4, uint32_t, blockw); /* blockw */ + READ(4, uint32_t, blockh); /* blockh */ + READ(4, uint32_t, blocksize); /* blocksize */ + READ_ARRAY(1, uint8_t, data); /* data */ + READ(4, uint32_t, stride); /* stride */ + + return ret; +} diff --git a/src/gallium/auxiliary/rbug/rbug_texture.h b/src/gallium/auxiliary/rbug/rbug_texture.h new file mode 100644 index 0000000000..2bcc3566f3 --- /dev/null +++ b/src/gallium/auxiliary/rbug/rbug_texture.h @@ -0,0 +1,207 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file holds structs decelerations and function prototypes for one of + * the rbug extensions. Implementation of the functions is in the same folder + * in the c file matching this file's name. + * + * The structs what is returned from the demarshal functions. The functions + * starting rbug_send_* encodes a call to the write format and sends that to + * the supplied connection, while functions starting with rbug_demarshal_* + * demarshal data from the wire protocol. + * + * Structs and functions ending with _reply are replies to requests. + */ + +#ifndef _RBUG_PROTO_TEXTURE_H_ +#define _RBUG_PROTO_TEXTURE_H_ + +#include "rbug/rbug_proto.h" + +typedef uint64_t rbug_texture_t; + +struct rbug_proto_texture_list +{ + struct rbug_header header; +}; + +struct rbug_proto_texture_info +{ + struct rbug_header header; + rbug_texture_t texture; +}; + +struct rbug_proto_texture_write +{ + struct rbug_header header; + rbug_texture_t texture; + uint32_t face; + uint32_t level; + uint32_t zslice; + uint32_t x; + uint32_t y; + uint32_t w; + uint32_t h; + uint8_t *data; + uint32_t data_len; + uint32_t stride; +}; + +struct rbug_proto_texture_read +{ + struct rbug_header header; + rbug_texture_t texture; + uint32_t face; + uint32_t level; + uint32_t zslice; + uint32_t x; + uint32_t y; + uint32_t w; + uint32_t h; +}; + +struct rbug_proto_texture_list_reply +{ + struct rbug_header header; + uint32_t serial; + rbug_texture_t *textures; + uint32_t textures_len; +}; + +struct rbug_proto_texture_info_reply +{ + struct rbug_header header; + uint32_t serial; + uint32_t target; + uint32_t format; + uint32_t *width; + uint32_t width_len; + uint32_t *height; + uint32_t height_len; + uint32_t *depth; + uint32_t depth_len; + uint32_t blockw; + uint32_t blockh; + uint32_t blocksize; + uint32_t last_level; + uint32_t nr_samples; + uint32_t tex_usage; +}; + +struct rbug_proto_texture_read_reply +{ + struct rbug_header header; + uint32_t serial; + uint32_t format; + uint32_t blockw; + uint32_t blockh; + uint32_t blocksize; + uint8_t *data; + uint32_t data_len; + uint32_t stride; +}; + +int rbug_send_texture_list(struct rbug_connection *__con, + uint32_t *__serial); + +int rbug_send_texture_info(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t *__serial); + +int rbug_send_texture_write(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t face, + uint32_t level, + uint32_t zslice, + uint32_t x, + uint32_t y, + uint32_t w, + uint32_t h, + uint8_t *data, + uint32_t data_len, + uint32_t stride, + uint32_t *__serial); + +int rbug_send_texture_read(struct rbug_connection *__con, + rbug_texture_t texture, + uint32_t face, + uint32_t level, + uint32_t zslice, + uint32_t x, + uint32_t y, + uint32_t w, + uint32_t h, + uint32_t *__serial); + +int rbug_send_texture_list_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_texture_t *textures, + uint32_t textures_len, + uint32_t *__serial); + +int rbug_send_texture_info_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t target, + uint32_t format, + uint32_t *width, + uint32_t width_len, + uint32_t *height, + uint32_t height_len, + uint32_t *depth, + uint32_t depth_len, + uint32_t blockw, + uint32_t blockh, + uint32_t blocksize, + uint32_t last_level, + uint32_t nr_samples, + uint32_t tex_usage, + uint32_t *__serial); + +int rbug_send_texture_read_reply(struct rbug_connection *__con, + uint32_t serial, + uint32_t format, + uint32_t blockw, + uint32_t blockh, + uint32_t blocksize, + uint8_t *data, + uint32_t data_len, + uint32_t stride, + uint32_t *__serial); + +struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header); + +struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header); + +struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header); + +struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header); + +struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header); + +struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header); + +struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header); + +#endif -- cgit v1.2.3 From 01fa34cb98d9ea6008c7108b6112348e278864f4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 1 Jun 2009 11:19:55 +0100 Subject: trace/rbug: Add rbug integration for remote debugging --- src/gallium/drivers/trace/Makefile | 1 + src/gallium/drivers/trace/README | 18 +- src/gallium/drivers/trace/SConscript | 1 + src/gallium/drivers/trace/tr_rbug.c | 636 ++++++++++++++++++++++++++++++++++ src/gallium/drivers/trace/tr_screen.c | 14 +- src/gallium/drivers/trace/tr_screen.h | 21 +- 6 files changed, 685 insertions(+), 6 deletions(-) create mode 100644 src/gallium/drivers/trace/tr_rbug.c diff --git a/src/gallium/drivers/trace/Makefile b/src/gallium/drivers/trace/Makefile index ecb69fb996..4aeb8e3d7e 100644 --- a/src/gallium/drivers/trace/Makefile +++ b/src/gallium/drivers/trace/Makefile @@ -10,6 +10,7 @@ C_SOURCES = \ tr_dump_state.c \ tr_screen.c \ tr_state.c \ + tr_rbug.c \ tr_texture.c include ../../Makefile.template diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README index 73dce20372..1000c31e49 100644 --- a/src/gallium/drivers/trace/README +++ b/src/gallium/drivers/trace/README @@ -3,7 +3,8 @@ = About = -This directory contains a Gallium3D pipe driver which traces all incoming calls. +This directory contains a Gallium3D debugger pipe driver. +It can traces all incoming calls and/or provide remote debugging functionality. = Build Instructions = @@ -23,7 +24,9 @@ ensure the right libGL.so is being picked by doing ldd progs/trivial/tri -and then try running +== Traceing == + +For traceing then do export XMESA_TRACE=y GALLIUM_TRACE=tri.trace progs/trivial/tri @@ -32,6 +35,16 @@ which should create a tri.trace file, which is an XML file. You can view copying trace.xsl to the same directory, and opening with a XSLT capable browser such as Firefox or Internet Explorer. +== Remote debugging == + +For remote debugging + + export XMESA_TRACE=y + GALLIUM_RBUG=true progs/trivial/tri + +which should open gallium remote debugging session. While the program is running +you can launch the small remote debugging application from progs/rbug. More +information is in that directory. = Integrating = @@ -62,3 +75,4 @@ trace_screen with real_screen when creating them. -- Jose Fonseca +Jakob Bornecrantz diff --git a/src/gallium/drivers/trace/SConscript b/src/gallium/drivers/trace/SConscript index 9b5af0d86f..e635fed77d 100644 --- a/src/gallium/drivers/trace/SConscript +++ b/src/gallium/drivers/trace/SConscript @@ -11,6 +11,7 @@ trace = env.ConvenienceLibrary( 'tr_dump_state.c', 'tr_screen.c', 'tr_state.c', + 'tr_rbug.c', 'tr_texture.c', ]) diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c new file mode 100644 index 0000000000..1b26f60da4 --- /dev/null +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -0,0 +1,636 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "util/u_string.h" +#include "util/u_memory.h" +#include "util/u_simple_list.h" +#include "util/u_network.h" + +#include "tgsi/tgsi_parse.h" + +#include "tr_dump.h" +#include "tr_state.h" +#include "tr_buffer.h" +#include "tr_texture.h" + +#include "rbug/rbug.h" + +#include + +#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) +# define sleep Sleep +#elif defined(PIPE_OS_LINUX) +void usleep(int); +# define sleep usleep +#else +# warning "No socket implementation" +#endif + +#define U642VOID(x) ((void *)(unsigned long)(x)) +#define VOID2U64(x) ((uint64_t)(unsigned long)(x)) + +struct trace_rbug +{ + struct trace_screen *tr_scr; + struct rbug_connection *con; + pipe_thread thread; + boolean running; +}; + +PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug); + + +/********************************************************** + * Helper functions + */ + + +static struct trace_context * +trace_rbug_get_context_locked(struct trace_screen *tr_scr, rbug_context_t ctx) +{ + struct trace_context *tr_ctx = NULL; + struct tr_list *ptr; + + foreach(ptr, &tr_scr->contexts) { + tr_ctx = (struct trace_context *)((char*)ptr - offsetof(struct trace_context, list)); + if (ctx == VOID2U64(tr_ctx)) + break; + tr_ctx = NULL; + } + + return tr_ctx; +} + +static struct trace_shader * +trace_rbug_get_shader_locked(struct trace_context *tr_ctx, rbug_shader_t shdr) +{ + struct trace_shader *tr_shdr = NULL; + struct tr_list *ptr; + + foreach(ptr, &tr_ctx->shaders) { + tr_shdr = (struct trace_shader *)((char*)ptr - offsetof(struct trace_shader, list)); + if (shdr == VOID2U64(tr_shdr)) + break; + tr_shdr = NULL; + } + + return tr_shdr; +} + +static void * +trace_shader_create_locked(struct pipe_context *pipe, + struct trace_shader *tr_shdr, + struct tgsi_token *tokens) +{ + void *state = NULL; + struct pipe_shader_state pss = { 0 }; + pss.tokens = tokens; + + if (tr_shdr->type == TRACE_SHADER_FRAGMENT) { + state = pipe->create_fs_state(pipe, &pss); + } else if (tr_shdr->type == TRACE_SHADER_VERTEX) { + state = pipe->create_vs_state(pipe, &pss); + } else + assert(0); + + return state; +} + +static void +trace_shader_bind_locked(struct pipe_context *pipe, + struct trace_shader *tr_shdr, + void *state) +{ + if (tr_shdr->type == TRACE_SHADER_FRAGMENT) { + pipe->bind_fs_state(pipe, state); + } else if (tr_shdr->type == TRACE_SHADER_VERTEX) { + pipe->bind_vs_state(pipe, state); + } else + assert(0); +} + +static void +trace_shader_delete_locked(struct pipe_context *pipe, + struct trace_shader *tr_shdr, + void *state) +{ + if (tr_shdr->type == TRACE_SHADER_FRAGMENT) { + pipe->delete_fs_state(pipe, state); + } else if (tr_shdr->type == TRACE_SHADER_VERTEX) { + pipe->delete_vs_state(pipe, state); + } else + assert(0); +} + +/************************************************ + * Request handler functions + */ + + +static int +trace_rbug_texture_list(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_texture *tr_tex = NULL; + struct tr_list *ptr; + rbug_texture_t *texs; + int i = 0; + + pipe_mutex_lock(tr_scr->list_mutex); + texs = MALLOC(tr_scr->num_textures * sizeof(rbug_texture_t)); + foreach(ptr, &tr_scr->textures) { + tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list)); + texs[i++] = VOID2U64(tr_tex); + } + pipe_mutex_unlock(tr_scr->list_mutex); + + rbug_send_texture_list_reply(tr_rbug->con, serial, texs, i, NULL); + FREE(texs); + + return 0; +} + +static int +trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_texture *tr_tex; + struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header; + struct tr_list *ptr; + struct pipe_texture *t; + + pipe_mutex_lock(tr_scr->list_mutex); + foreach(ptr, &tr_scr->textures) { + tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list)); + if (gpti->texture == VOID2U64(tr_tex)) + break; + tr_tex = NULL; + } + + if (!tr_tex) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + t = tr_tex->texture; + rbug_send_texture_info_reply(tr_rbug->con, serial, + t->target, t->format, + t->width, t->last_level + 1, + t->height, t->last_level + 1, + t->depth, t->last_level + 1, + t->block.width, t->block.height, t->block.size, + t->last_level, + t->nr_samples, + t->tex_usage, + NULL); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_texture_read *gptr = (struct rbug_proto_texture_read *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_texture *tr_tex; + struct tr_list *ptr; + + struct pipe_screen *screen = tr_scr->screen; + struct pipe_texture *tex; + struct pipe_transfer *t; + + void *map; + + pipe_mutex_lock(tr_scr->list_mutex); + foreach(ptr, &tr_scr->textures) { + tr_tex = (struct trace_texture *)((char*)ptr - offsetof(struct trace_texture, list)); + if (gptr->texture == VOID2U64(tr_tex)) + break; + tr_tex = NULL; + } + + if (!tr_tex) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + tex = tr_tex->texture; + t = screen->get_tex_transfer(tr_scr->screen, tex, + gptr->face, gptr->level, gptr->zslice, + PIPE_TRANSFER_READ, + gptr->x, gptr->y, gptr->w, gptr->h); + + map = screen->transfer_map(screen, t); + + rbug_send_texture_read_reply(tr_rbug->con, serial, + t->format, + t->block.width, t->block.height, t->block.size, + (uint8_t*)map, t->stride * t->nblocksy, + t->stride, + NULL); + + screen->transfer_unmap(screen, t); + screen->tex_transfer_destroy(t); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_context_list(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct tr_list *ptr; + struct trace_context *tr_ctx = NULL; + rbug_context_t *ctxs; + int i = 0; + + pipe_mutex_lock(tr_scr->list_mutex); + ctxs = MALLOC(tr_scr->num_contexts * sizeof(rbug_context_t)); + foreach(ptr, &tr_scr->contexts) { + tr_ctx = (struct trace_context *)((char*)ptr - offsetof(struct trace_context, list)); + ctxs[i++] = VOID2U64(tr_ctx); + } + pipe_mutex_unlock(tr_scr->list_mutex); + + rbug_send_context_list_reply(tr_rbug->con, serial, ctxs, i, NULL); + FREE(ctxs); + + return 0; +} + +static int +trace_rbug_shader_list(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_shader_list *list = (struct rbug_proto_shader_list *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + struct trace_shader *tr_shdr = NULL; + struct tr_list *ptr; + rbug_shader_t *shdrs; + int i = 0; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, list->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->list_mutex); + shdrs = MALLOC(tr_ctx->num_shaders * sizeof(rbug_shader_t)); + foreach(ptr, &tr_ctx->shaders) { + tr_shdr = (struct trace_shader *)((char*)ptr - offsetof(struct trace_shader, list)); + shdrs[i++] = VOID2U64(tr_shdr); + } + + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + + rbug_send_shader_list_reply(tr_rbug->con, serial, shdrs, i, NULL); + FREE(shdrs); + + return 0; +} + +static int +trace_rbug_shader_info(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_shader_info *info = (struct rbug_proto_shader_info *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + struct trace_shader *tr_shdr = NULL; + unsigned original_len; + unsigned replaced_len; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, info->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->list_mutex); + + tr_shdr = trace_rbug_get_shader_locked(tr_ctx, info->shader); + + if (!tr_shdr) { + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + /* just in case */ + assert(sizeof(struct tgsi_token) == 4); + + original_len = tgsi_num_tokens(tr_shdr->tokens); + if (tr_shdr->replaced_tokens) + replaced_len = tgsi_num_tokens(tr_shdr->replaced_tokens); + else + replaced_len = 0; + + rbug_send_shader_info_reply(tr_rbug->con, serial, + (uint32_t*)tr_shdr->tokens, original_len, + (uint32_t*)tr_shdr->replaced_tokens, replaced_len, + tr_shdr->disabled, + NULL); + + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_shader_disable(struct trace_rbug *tr_rbug, struct rbug_header *header) +{ + struct rbug_proto_shader_disable *dis = (struct rbug_proto_shader_disable *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + struct trace_shader *tr_shdr = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, dis->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->list_mutex); + + tr_shdr = trace_rbug_get_shader_locked(tr_ctx, dis->shader); + + if (!tr_shdr) { + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + tr_shdr->disabled = dis->disable; + + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_shader_replace(struct trace_rbug *tr_rbug, struct rbug_header *header) +{ + struct rbug_proto_shader_replace *rep = (struct rbug_proto_shader_replace *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + struct trace_shader *tr_shdr = NULL; + struct pipe_context *pipe = NULL; + void *state; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, rep->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->list_mutex); + + tr_shdr = trace_rbug_get_shader_locked(tr_ctx, rep->shader); + + if (!tr_shdr) { + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + /* protect the pipe context */ + trace_dump_call_lock(); + + pipe = tr_ctx->pipe; + + /* remove old replaced shader */ + if (tr_shdr->replaced) { + if (tr_ctx->curr.fs == tr_shdr || tr_ctx->curr.vs == tr_shdr) + trace_shader_bind_locked(pipe, tr_shdr, tr_shdr->state); + + FREE(tr_shdr->replaced_tokens); + trace_shader_delete_locked(pipe, tr_shdr, tr_shdr->replaced); + tr_shdr->replaced = NULL; + tr_shdr->replaced_tokens = NULL; + } + + /* empty inputs means restore old which we did above */ + if (rep->tokens_len == 0) + goto out; + + tr_shdr->replaced_tokens = tgsi_dup_tokens((struct tgsi_token *)rep->tokens); + if (!tr_shdr->replaced_tokens) + goto err; + + state = trace_shader_create_locked(pipe, tr_shdr, tr_shdr->replaced_tokens); + if (!state) + goto err; + + /* bind new shader if the shader is currently a bound */ + if (tr_ctx->curr.fs == tr_shdr || tr_ctx->curr.vs == tr_shdr) + trace_shader_bind_locked(pipe, tr_shdr, state); + + /* save state */ + tr_shdr->replaced = state; + +out: + trace_dump_call_unlock(); + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; + +err: + FREE(tr_shdr->replaced_tokens); + tr_shdr->replaced = NULL; + tr_shdr->replaced_tokens = NULL; + + trace_dump_call_unlock(); + pipe_mutex_unlock(tr_ctx->list_mutex); + pipe_mutex_unlock(tr_scr->list_mutex); + return -EINVAL; +} + +static boolean +trace_rbug_header(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + int ret = 0; + + switch(header->opcode) { + case RBUG_OP_PING: + rbug_send_ping_reply(tr_rbug->con, serial, NULL); + break; + case RBUG_OP_TEXTURE_LIST: + ret = trace_rbug_texture_list(tr_rbug, header, serial); + break; + case RBUG_OP_TEXTURE_INFO: + ret = trace_rbug_texture_info(tr_rbug, header, serial); + break; + case RBUG_OP_TEXTURE_READ: + ret = trace_rbug_texture_read(tr_rbug, header, serial); + break; + case RBUG_OP_CONTEXT_LIST: + ret = trace_rbug_context_list(tr_rbug, header, serial); + break; + case RBUG_OP_SHADER_LIST: + ret = trace_rbug_shader_list(tr_rbug, header, serial); + break; + case RBUG_OP_SHADER_INFO: + ret = trace_rbug_shader_info(tr_rbug, header, serial); + break; + case RBUG_OP_SHADER_DISABLE: + ret = trace_rbug_shader_disable(tr_rbug, header); + break; + case RBUG_OP_SHADER_REPLACE: + ret = trace_rbug_shader_replace(tr_rbug, header); + break; + default: + debug_printf("%s - unsupported opcode %u\n", __FUNCTION__, header->opcode); + ret = -ENOSYS; + break; + } + rbug_free_header(header); + + if (ret) + rbug_send_error_reply(tr_rbug->con, serial, ret, NULL); + + return TRUE; +} + +static void +trace_rbug_con(struct trace_rbug *tr_rbug) +{ + struct rbug_header *header; + uint32_t serial; + + debug_printf("%s - connection received\n", __FUNCTION__); + + while(tr_rbug->running) { + header = rbug_get_message(tr_rbug->con, &serial); + if (!header) + break; + + if (!trace_rbug_header(tr_rbug, header, serial)) + break; + } + + debug_printf("%s - connection closed\n", __FUNCTION__); + + rbug_disconnect(tr_rbug->con); + tr_rbug->con = NULL; +} + +PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug) +{ + struct trace_rbug *tr_rbug = void_tr_rbug; + uint16_t port = 13370; + int s = -1; + int c; + + u_socket_init(); + + for (;port <= 13379 && s < 0; port++) + s = u_socket_listen_on_port(port); + + if (s < 0) { + debug_printf("trace_rbug - failed to listen\n"); + return NULL; + } + + u_socket_block(s, false); + + debug_printf("trace_rbug - remote debugging listening on port %u\n", --port); + + while(tr_rbug->running) { + sleep(1); + + c = u_socket_accept(s); + if (c < 0) + continue; + + u_socket_block(c, true); + tr_rbug->con = rbug_from_socket(c); + + trace_rbug_con(tr_rbug); + + u_socket_close(c); + } + + u_socket_close(s); + + u_socket_stop(); + + return NULL; +} + +/********************************************************** + * + */ + +struct trace_rbug * +trace_rbug_start(struct trace_screen *tr_scr) +{ + struct trace_rbug *tr_rbug = MALLOC_STRUCT(trace_rbug); + if (!tr_rbug) + return NULL; + + tr_rbug->tr_scr = tr_scr; + tr_rbug->running = TRUE; + tr_rbug->thread = pipe_thread_create(trace_rbug_thread, tr_rbug); + + return tr_rbug; +} + +void +trace_rbug_stop(struct trace_rbug *tr_rbug) +{ + if (!tr_rbug) + return; + + tr_rbug->running = false; + pipe_thread_wait(tr_rbug->thread); + + FREE(tr_rbug); + + return; +} diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index bc14248eeb..920f418ebf 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -826,24 +826,26 @@ trace_screen_destroy(struct pipe_screen *_screen) trace_dump_call_end(); trace_dump_trace_end(); + if (tr_scr->rbug) + trace_rbug_stop(tr_scr->rbug); + screen->destroy(screen); FREE(tr_scr); } - boolean trace_enabled(void) { return trace; } - struct pipe_screen * trace_screen_create(struct pipe_screen *screen) { struct trace_screen *tr_scr; struct pipe_winsys *winsys; + boolean rbug = FALSE; if(!screen) goto error1; @@ -855,6 +857,11 @@ trace_screen_create(struct pipe_screen *screen) trace = TRUE; } + if (debug_get_bool_option("GALLIUM_RBUG", FALSE)) { + trace = TRUE; + rbug = TRUE; + } + if (!trace) goto error1; @@ -915,6 +922,9 @@ trace_screen_create(struct pipe_screen *screen) trace_dump_ret(ptr, screen); trace_dump_call_end(); + if (rbug) + tr_scr->rbug = trace_rbug_start(tr_scr); + return &tr_scr->base; #if 0 diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 7fae182985..dba8cd7c65 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -57,6 +57,9 @@ struct trace_screen struct pipe_screen *screen; + /* remote debugger */ + struct trace_rbug *rbug; + pipe_mutex list_mutex; int num_buffers; int num_contexts; @@ -71,21 +74,34 @@ struct trace_screen }; +/* + * tr_rbug.c + */ + + +struct trace_rbug; + +struct trace_rbug * +trace_rbug_start(struct trace_screen *tr_scr); + +void +trace_rbug_stop(struct trace_rbug *tr_rbug); + + /* * tr_screen.c */ + boolean trace_enabled(void); struct trace_screen * trace_screen(struct pipe_screen *screen); - struct pipe_screen * trace_screen_create(struct pipe_screen *screen); - void trace_screen_user_buffer_update(struct pipe_screen *screen, struct pipe_buffer *buffer); @@ -106,6 +122,7 @@ trace_screen_user_buffer_update(struct pipe_screen *screen, pipe_mutex_unlock(tr_scr->list_mutex); \ } while (0) + #ifdef __cplusplus } #endif -- cgit v1.2.3 From 85e0572756b85b7025740fbbefb673cf75a46cea Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 1 Jun 2009 11:20:05 +0100 Subject: progs/rbug: Add small remote debugging cli applications --- progs/rbug/.gitignore | 9 ++++ progs/rbug/Makefile | 46 ++++++++++++++++ progs/rbug/README | 39 ++++++++++++++ progs/rbug/ctx_info.c | 80 ++++++++++++++++++++++++++++ progs/rbug/shdr_disable.c | 82 +++++++++++++++++++++++++++++ progs/rbug/shdr_dump.c | 115 ++++++++++++++++++++++++++++++++++++++++ progs/rbug/shdr_info.c | 98 ++++++++++++++++++++++++++++++++++ progs/rbug/simple_client.c | 64 +++++++++++++++++++++++ progs/rbug/simple_server.c | 62 ++++++++++++++++++++++ progs/rbug/tex_dump.c | 127 +++++++++++++++++++++++++++++++++++++++++++++ progs/rbug/tex_info.c | 78 ++++++++++++++++++++++++++++ 11 files changed, 800 insertions(+) create mode 100644 progs/rbug/.gitignore create mode 100644 progs/rbug/Makefile create mode 100644 progs/rbug/README create mode 100644 progs/rbug/ctx_info.c create mode 100644 progs/rbug/shdr_disable.c create mode 100644 progs/rbug/shdr_dump.c create mode 100644 progs/rbug/shdr_info.c create mode 100644 progs/rbug/simple_client.c create mode 100644 progs/rbug/simple_server.c create mode 100644 progs/rbug/tex_dump.c create mode 100644 progs/rbug/tex_info.c diff --git a/progs/rbug/.gitignore b/progs/rbug/.gitignore new file mode 100644 index 0000000000..317290bbb3 --- /dev/null +++ b/progs/rbug/.gitignore @@ -0,0 +1,9 @@ +simple_client +simple_server +shdr_info +shdr_dump +shdr_disable +ctx_info +tex_dump +tex_info +*.bmp diff --git a/progs/rbug/Makefile b/progs/rbug/Makefile new file mode 100644 index 0000000000..8df03dd4e1 --- /dev/null +++ b/progs/rbug/Makefile @@ -0,0 +1,46 @@ +# progs/rbug/Makefile + +TOP = ../.. +include $(TOP)/configs/current + +INCLUDES = \ + -I. \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/gallium/drivers \ + $(PROG_INCLUDES) + +LINKS = \ + $(GALLIUM_AUXILIARIES) \ + $(PROG_LINKS) + +SOURCES = \ + simple_client.c \ + simple_server.c \ + shdr_info.c \ + shdr_dump.c \ + shdr_disable.c \ + ctx_info.c \ + tex_info.c \ + tex_dump.c + + +OBJECTS = $(SOURCES:.c=.o) + +PROGS = $(OBJECTS:.o=) + +##### TARGETS ##### + +default: $(OBJECTS) $(PROGS) + +clean: + -rm -f $(PROGS) + -rm -f *.o + +##### RULES ##### + +$(OBJECTS): %.o: %.c + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@ + +$(PROGS): %: %.o + $(CC) $(LDFLAGS) $< $(LINKS) -o $@ diff --git a/progs/rbug/README b/progs/rbug/README new file mode 100644 index 0000000000..0eb0a5de9a --- /dev/null +++ b/progs/rbug/README @@ -0,0 +1,39 @@ + REMOTE DEBUGGING CLI APPLICATIONS + + += About = + +This directory contains a Gallium3D remote debugging cli applications. + + += Build Instructions = + +To build, build a normal gallium build and from this directory do the following. + + make + += Usage = + +Make sure that you driver has trace integration, see +src/gallium/driver/trace/README for more information about that. Then from on +the computer that you want to debug do: + + export GALLIUM_RBUG=true + + + +From the debugging computer launch apps form this directory. Currently ip +addresses are hardcoded and you need to edit the application, but that will +change in the future. + += Testing = + +The two apps simple_client and simple_server. Are unit testing of the +connection and (de)marsheler. Just run the server first and then the client: + + ./simple_server & + ./simple_client + + +-- +Jakob Bornecrantz diff --git a/progs/rbug/ctx_info.c b/progs/rbug/ctx_info.c new file mode 100644 index 0000000000..d72c326719 --- /dev/null +++ b/progs/rbug/ctx_info.c @@ -0,0 +1,80 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_proto_context_list_reply *list; + struct rbug_proto_context_info_reply *info; + int i; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get contexts\n"); + rbug_send_context_list(con, NULL); + + debug_printf("Waiting for contexts\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY); + list = (struct rbug_proto_context_list_reply *)header; + + debug_printf("Got contexts:\n"); + for (i = 0; i < list->contexts_len; i++) { +#if 0 + rbug_send_contexts_info(con, list->contexts[i], NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_CONTEXT_INFO_REPLY); + info = (struct rbug_proto_context_info_reply *)header; +#else + (void)info; + header = NULL; +#endif + + debug_printf("%llu\n", + (unsigned long long)list->contexts[i]); + rbug_free_header(header); + } + + rbug_free_header(&list->header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} diff --git a/progs/rbug/shdr_disable.c b/progs/rbug/shdr_disable.c new file mode 100644 index 0000000000..e6b12073d8 --- /dev/null +++ b/progs/rbug/shdr_disable.c @@ -0,0 +1,82 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void talk(rbug_context_t ctx, rbug_shader_t shdr) +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + rbug_send_shader_disable(con, ctx, shdr, true, NULL); + + rbug_send_ping(con, NULL); + + debug_printf("Sent waiting for reply\n"); + header = rbug_get_message(con, NULL); + + if (header->opcode != RBUG_OP_PING_REPLY) + debug_printf("Error\n"); + else + debug_printf("Ok!\n"); + + rbug_free_header(header); + rbug_disconnect(con); +} + +static void print_usage() +{ + printf("Usage shdr_disable \n"); + exit(-1); +} + +int main(int argc, char** argv) +{ + long ctx; + long shdr; + + if (argc < 3) + print_usage(); + + ctx = atol(argv[1]); + shdr = atol(argv[2]); + + if (ctx <= 0 && ctx <= 0) + print_usage(); + + talk((uint64_t)ctx, (uint64_t)shdr); + + return 0; +} diff --git a/progs/rbug/shdr_dump.c b/progs/rbug/shdr_dump.c new file mode 100644 index 0000000000..8f9d758d51 --- /dev/null +++ b/progs/rbug/shdr_dump.c @@ -0,0 +1,115 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +#include "tgsi/tgsi_dump.h" + +static void shader_info(struct rbug_connection *con, rbug_context_t ctx) +{ + struct rbug_header *header; + struct rbug_proto_shader_list_reply *list; + struct rbug_proto_shader_info_reply *info; + int i; + + debug_printf("Sending get shaders to %llu\n", (unsigned long long)ctx); + rbug_send_shader_list(con, ctx, NULL); + + debug_printf("Waiting for shaders from %llu\n", (unsigned long long)ctx); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY); + list = (struct rbug_proto_shader_list_reply *)header; + + debug_printf("Got shaders:\n"); + for (i = 0; i < list->shaders_len; i++) { + rbug_send_shader_info(con, ctx, list->shaders[i], NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY); + info = (struct rbug_proto_shader_info_reply *)header; + + debug_printf("#####################################################\n"); + debug_printf("ctx: %llu shdr: %llu disabled %u\n", + (unsigned long long)ctx, + (unsigned long long)list->shaders[i], + info->disabled); + + /* just to be sure */ + assert(sizeof(struct tgsi_token) == 4); + + debug_printf("-----------------------------------------------------\n"); + tgsi_dump((struct tgsi_token *)info->original, 0); + + if (info->replaced_len > 0) { + debug_printf("-----------------------------------------------------\n"); + tgsi_dump((struct tgsi_token *)info->replaced, 0); + } + + rbug_free_header(header); + } + + debug_printf("#####################################################\n"); + rbug_free_header(&list->header); +} + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_proto_context_list_reply *list; + int i; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get contexts\n"); + rbug_send_context_list(con, NULL); + + debug_printf("Waiting for contexts\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY); + list = (struct rbug_proto_context_list_reply *)header; + + debug_printf("Got contexts:\n"); + for (i = 0; i < list->contexts_len; i++) { + shader_info(con, list->contexts[i]); + } + + rbug_free_header(&list->header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} diff --git a/progs/rbug/shdr_info.c b/progs/rbug/shdr_info.c new file mode 100644 index 0000000000..b6864e988e --- /dev/null +++ b/progs/rbug/shdr_info.c @@ -0,0 +1,98 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void shader_info(struct rbug_connection *con, rbug_context_t ctx) +{ + struct rbug_header *header; + struct rbug_proto_shader_list_reply *list; + struct rbug_proto_shader_info_reply *info; + int i; + + rbug_send_shader_list(con, ctx, NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY); + list = (struct rbug_proto_shader_list_reply *)header; + + debug_printf(" context | shader | disabled |\n"); + for (i = 0; i < list->shaders_len; i++) { + rbug_send_shader_info(con, ctx, list->shaders[i], NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY); + info = (struct rbug_proto_shader_info_reply *)header; + + debug_printf("% 15llu |% 15llu |% 15u |\n", + (unsigned long long)ctx, + (unsigned long long)list->shaders[i], + (unsigned)info->disabled); + + rbug_free_header(header); + } + + rbug_free_header(&list->header); +} + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_proto_context_list_reply *list; + int i; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get contexts\n"); + rbug_send_context_list(con, NULL); + + debug_printf("Waiting for contexts\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY); + list = (struct rbug_proto_context_list_reply *)header; + + debug_printf("Got contexts:\n"); + for (i = 0; i < list->contexts_len; i++) { + shader_info(con, list->contexts[i]); + } + + rbug_free_header(&list->header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} diff --git a/progs/rbug/simple_client.c b/progs/rbug/simple_client.c new file mode 100644 index 0000000000..38929fa796 --- /dev/null +++ b/progs/rbug/simple_client.c @@ -0,0 +1,64 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_proto_texture_list_reply *list; + int i; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get textures\n"); + rbug_send_texture_list(con, NULL); + + debug_printf("Waiting for textures\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY); + list = (struct rbug_proto_texture_list_reply *)header; + + debug_printf("Got textures:\n"); + for (i = 0; i < list->textures_len; i++) + debug_printf("\ttex %llu\n", (unsigned long long)list->textures[i]); + + rbug_free_header(header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} diff --git a/progs/rbug/simple_server.c b/progs/rbug/simple_server.c new file mode 100644 index 0000000000..04380c3310 --- /dev/null +++ b/progs/rbug/simple_server.c @@ -0,0 +1,62 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void wait() +{ + int s = u_socket_listen_on_port(13370); + int c = u_socket_accept(s); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + rbug_texture_t texs[2]; + uint32_t serial; + texs[0] = 1337; + texs[1] = 7331; + + assert(s >= 0); + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Waiting for get textures\n"); + header = rbug_get_message(con, &serial); + assert(header); + assert(header->opcode == RBUG_OP_TEXTURE_LIST); + rbug_free_header(header); + + rbug_send_texture_list_reply(con, serial, texs, 2, NULL); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + wait(); + return 0; +} diff --git a/progs/rbug/tex_dump.c b/progs/rbug/tex_dump.c new file mode 100644 index 0000000000..f9e06ee994 --- /dev/null +++ b/progs/rbug/tex_dump.c @@ -0,0 +1,127 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" +#include "util/u_tile.h" +#include "rbug/rbug.h" + +static void dump(rbug_texture_t tex, + struct rbug_proto_texture_info_reply *info, + struct rbug_proto_texture_read_reply *read, + int mip) +{ + enum pipe_format format = info->format; + uint8_t *data = read->data; + unsigned width = info->width[mip]; + unsigned height = info->height[mip]; + unsigned dst_stride = width * 4 * 4; + unsigned src_stride = read->stride; + float *rgba = MALLOC(dst_stride * height); + int i; + char filename[512]; + + util_snprintf(filename, 512, "%llu_%s_%u.bmp", + (unsigned long long)tex, pf_name(info->format), mip); + + if (pf_is_compressed(info->format)) { + debug_printf("skipping: %s\n", filename); + return; + } + + debug_printf("saving: %s\n", filename); + + for (i = 0; i < height; i++) { + pipe_tile_raw_to_rgba(format, data + src_stride * i, + width, 1, + &rgba[width*4*i], dst_stride); + } + + debug_dump_float_rgba_bmp(filename, width, height, rgba, width); + + FREE(rgba); +} + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_header *header2; + struct rbug_proto_texture_list_reply *list; + struct rbug_proto_texture_info_reply *info; + struct rbug_proto_texture_read_reply *read; + int i, j; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get textures\n"); + rbug_send_texture_list(con, NULL); + + debug_printf("Waiting for textures\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY); + list = (struct rbug_proto_texture_list_reply *)header; + + debug_printf("Got textures:\n"); + for (i = 0; i < list->textures_len; i++) { + rbug_send_texture_info(con, list->textures[i], NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY); + info = (struct rbug_proto_texture_info_reply *)header; + + for (j = 0; j <= info->last_level; j++) { + rbug_send_texture_read(con, list->textures[i], + 0, j, 0, + 0, 0, info->width[j], info->height[j], + NULL); + + header2 = rbug_get_message(con, NULL); + assert(header2->opcode == RBUG_OP_TEXTURE_READ_REPLY); + read = (struct rbug_proto_texture_read_reply *)header2; + + dump(list->textures[i], info, read, j); + + rbug_free_header(header2); + } + + rbug_free_header(header); + + } + rbug_free_header(&list->header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} diff --git a/progs/rbug/tex_info.c b/progs/rbug/tex_info.c new file mode 100644 index 0000000000..4a21bae359 --- /dev/null +++ b/progs/rbug/tex_info.c @@ -0,0 +1,78 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" + +#include "rbug/rbug.h" + +static void talk() +{ + int c = u_socket_connect("localhost", 13370); + struct rbug_connection *con = rbug_from_socket(c); + struct rbug_header *header; + struct rbug_proto_texture_list_reply *list; + struct rbug_proto_texture_info_reply *info; + int i; + + assert(c >= 0); + assert(con); + debug_printf("Connection get!\n"); + + debug_printf("Sending get textures\n"); + rbug_send_texture_list(con, NULL); + + debug_printf("Waiting for textures\n"); + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY); + list = (struct rbug_proto_texture_list_reply *)header; + + debug_printf("Got textures:\n"); + for (i = 0; i < list->textures_len; i++) { + rbug_send_texture_info(con, list->textures[i], NULL); + + header = rbug_get_message(con, NULL); + assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY); + info = (struct rbug_proto_texture_info_reply *)header; + + debug_printf("%llu %s %u x %u x %u, block(%ux%u %u), last_level: %u, nr_samples: %u, usage: %u\n", + (unsigned long long)list->textures[i], pf_name(info->format), + info->width[0], info->height[0], info->depth[0], + info->blockw, info->blockh, info->blocksize, + info->last_level, info->nr_samples, info->tex_usage); + rbug_free_header(header); + } + + rbug_free_header(&list->header); + rbug_disconnect(con); +} + +int main(int argc, char** argv) +{ + talk(); + return 0; +} -- cgit v1.2.3 From bc302b2a33ceffe454bcf443daa0ac1edc118e9b Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 22 May 2009 09:39:02 -0700 Subject: Use separate $(MINSTALL) for installing libraries The special feature of bin/minstall to copy symlinks is only ever needed when installing libraries which may have .so symlinks. All the headers and directories can use a normal install program. These two modes are separated as $(INSTALL) and $(MINSTALL) to allow the user (or autoconf) to override installing normal files as they please. An autoconf check for the install program has been added and will be used in preference to minstall when available. Fixes bug 16053. --- configs/autoconf.in | 1 + configs/default | 5 ++++- configure.ac | 5 +++++ src/egl/drivers/dri/Makefile | 2 +- src/egl/drivers/glx/Makefile | 2 +- src/egl/drivers/xdri/Makefile | 2 +- src/egl/main/Makefile | 2 +- src/gallium/winsys/drm/Makefile.template | 2 +- src/gallium/winsys/drm/intel/xorg/Makefile | 2 +- src/gallium/winsys/drm/radeon/xorg/Makefile | 2 +- src/gallium/winsys/egl_xlib/Makefile | 2 +- src/gallium/winsys/xlib/Makefile | 2 +- src/glu/Makefile | 2 +- src/glut/fbdev/Makefile | 2 +- src/glut/glx/Makefile | 2 +- src/glut/mini/Makefile | 2 +- src/glw/Makefile | 2 +- src/mesa/Makefile | 4 ++-- src/mesa/drivers/dri/Makefile.template | 2 +- 19 files changed, 27 insertions(+), 18 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index b61d7f33f0..77422e3fe5 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -31,6 +31,7 @@ SHELL = @SHELL@ MKLIB_OPTIONS = @MKLIB_OPTIONS@ MKDEP = @MKDEP@ MKDEP_OPTIONS = @MKDEP_OPTIONS@ +INSTALL = @INSTALL@ # Python and flags (generally only needed by the developers) PYTHON2 = python diff --git a/configs/default b/configs/default index d2ea3b2487..dc28be37dd 100644 --- a/configs/default +++ b/configs/default @@ -36,7 +36,10 @@ MKLIB_OPTIONS = MKDEP = makedepend MKDEP_OPTIONS = -fdepend MAKE = make -INSTALL = $(SHELL) $(TOP)/bin/minstall + +# Use MINSTALL for installing libraries, INSTALL for everything else +MINSTALL = $(SHELL) $(TOP)/bin/minstall +INSTALL = $(MINSTALL) # Tools for regenerating glapi (generally only needed by the developers) PYTHON2 = python diff --git a/configure.ac b/configure.ac index 24aa13a7ca..772fb29973 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,11 @@ AC_CHECK_PROGS([MAKE], [gmake make]) AC_PATH_PROG([MKDEP], [makedepend]) AC_PATH_PROG([SED], [sed]) +dnl Our fallback install-sh is a symlink to minstall. Use the existing +dnl configuration in that case. +AC_PROG_INSTALL +test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)' + dnl We need a POSIX shell for parts of the build. Assume we have one dnl in most cases. case "$host_os" in diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile index 4041d5c906..567edfae97 100644 --- a/src/egl/drivers/dri/Makefile +++ b/src/egl/drivers/dri/Makefile @@ -50,7 +50,7 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR) clean: -rm -f *.o diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile index 5f041a268f..20ef0352ad 100644 --- a/src/egl/drivers/glx/Makefile +++ b/src/egl/drivers/glx/Makefile @@ -58,7 +58,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS) install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) clean: rm -f *.o diff --git a/src/egl/drivers/xdri/Makefile b/src/egl/drivers/xdri/Makefile index eb83867b71..8a14027fc7 100644 --- a/src/egl/drivers/xdri/Makefile +++ b/src/egl/drivers/xdri/Makefile @@ -54,7 +54,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS) install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR) clean: rm -f *.o diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index 8cfa25ca16..cddba9f088 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -66,7 +66,7 @@ $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) install: default $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR) clean: -rm -f *.o *.so* diff --git a/src/gallium/winsys/drm/Makefile.template b/src/gallium/winsys/drm/Makefile.template index 9f92cb4207..985e5a861f 100644 --- a/src/gallium/winsys/drm/Makefile.template +++ b/src/gallium/winsys/drm/Makefile.template @@ -118,7 +118,7 @@ clean: install: $(LIBNAME) $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) include depend diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile index b1b6b9362b..d9aa5d54e1 100644 --- a/src/gallium/winsys/drm/intel/xorg/Makefile +++ b/src/gallium/winsys/drm/intel/xorg/Makefile @@ -39,6 +39,6 @@ clean: install: $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) .PHONY = all clean install diff --git a/src/gallium/winsys/drm/radeon/xorg/Makefile b/src/gallium/winsys/drm/radeon/xorg/Makefile index 6ffd4a3a54..0241625f69 100644 --- a/src/gallium/winsys/drm/radeon/xorg/Makefile +++ b/src/gallium/winsys/drm/radeon/xorg/Makefile @@ -37,6 +37,6 @@ clean: install: $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) .PHONY = all clean install diff --git a/src/gallium/winsys/egl_xlib/Makefile b/src/gallium/winsys/egl_xlib/Makefile index 8646ee3b52..a33a50ec22 100644 --- a/src/gallium/winsys/egl_xlib/Makefile +++ b/src/gallium/winsys/egl_xlib/Makefile @@ -74,7 +74,7 @@ depend: $(ALL_SOURCES) install: default $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) @if [ -e $(TOP)/$(LIB_DIR) ]; then \ - $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(INSTALL_DIR)/$(LIB_DIR); \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(INSTALL_DIR)/$(LIB_DIR); \ fi diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile index 04309e67ee..522f6dc5ae 100644 --- a/src/gallium/winsys/xlib/Makefile +++ b/src/gallium/winsys/xlib/Makefile @@ -90,7 +90,7 @@ install: default $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ - $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \ fi diff --git a/src/glu/Makefile b/src/glu/Makefile index 5c26ead1bb..b268265976 100644 --- a/src/glu/Makefile +++ b/src/glu/Makefile @@ -30,7 +30,7 @@ glu.pc: glu.pc.in install: glu.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) $(TOP)/$(LIB_DIR)/$(GLU_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLU_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig clean: diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile index 199d8c390a..c150ea88dc 100644 --- a/src/glut/fbdev/Makefile +++ b/src/glut/fbdev/Makefile @@ -72,7 +72,7 @@ install: $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) # Run 'make -f Makefile.solo dep' to update the dependencies if you change # what's included by any source file. diff --git a/src/glut/glx/Makefile b/src/glut/glx/Makefile index 1b072906c7..6889cd4b40 100644 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@ -117,7 +117,7 @@ install: glut.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile index 0e42436133..b82a758d2c 100644 --- a/src/glut/mini/Makefile +++ b/src/glut/mini/Makefile @@ -91,7 +91,7 @@ install: glut.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig diff --git a/src/glw/Makefile b/src/glw/Makefile index d88d773313..1fb3d3c320 100644 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@ -43,7 +43,7 @@ install: glw.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig $(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) $(TOP)/$(LIB_DIR)/$(GLW_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLW_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig clean: diff --git a/src/mesa/Makefile b/src/mesa/Makefile index bb18bee8ea..8300b30144 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -129,14 +129,14 @@ install-headers: install-libgl: default gl.pc install-headers $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \ $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig install-osmesa: default osmesa.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \ $(DESTDIR)$(INSTALL_LIB_DIR) $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 5c01d233c1..bd38e3be47 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -92,7 +92,7 @@ clean: install: $(LIBNAME) $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) - $(INSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) -include depend -- cgit v1.2.3 From c1ccc7d5394c23a371540e1b2c3d35b0da3b30d6 Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Sun, 31 May 2009 16:32:58 +0200 Subject: radeon: Provide a more detailled GL_RENDERER string. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display the chip family and PCI ID. This can be parsed easily, and essentially all information that the driver has about the chip can be deduced from it. Signed-off-by: Nicolai Hähnle --- .../drivers/dri/radeon/radeon_common_context.c | 50 +++++++++++++++++++--- src/mesa/drivers/dri/radeon/radeon_screen.c | 1 + src/mesa/drivers/dri/radeon/radeon_screen.h | 1 + 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index e9967986a3..eb0e5b35e5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -52,6 +52,40 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. int RADEON_DEBUG = (0); #endif + +static const char* get_chip_family_name(int chip_family) +{ + switch(chip_family) { + case CHIP_FAMILY_R100: return "R100"; + case CHIP_FAMILY_RV100: return "RV100"; + case CHIP_FAMILY_RS100: return "RS100"; + case CHIP_FAMILY_RV200: return "RV200"; + case CHIP_FAMILY_RS200: return "RS200"; + case CHIP_FAMILY_R200: return "R200"; + case CHIP_FAMILY_RV250: return "RV250"; + case CHIP_FAMILY_RS300: return "RS300"; + case CHIP_FAMILY_RV280: return "RV280"; + case CHIP_FAMILY_R300: return "R300"; + case CHIP_FAMILY_R350: return "R350"; + case CHIP_FAMILY_RV350: return "RV350"; + case CHIP_FAMILY_RV380: return "RV380"; + case CHIP_FAMILY_R420: return "R420"; + case CHIP_FAMILY_RV410: return "RV410"; + case CHIP_FAMILY_RS400: return "RS400"; + case CHIP_FAMILY_RS600: return "RS600"; + case CHIP_FAMILY_RS690: return "RS690"; + case CHIP_FAMILY_RS740: return "RS740"; + case CHIP_FAMILY_RV515: return "RV515"; + case CHIP_FAMILY_R520: return "R520"; + case CHIP_FAMILY_RV530: return "RV530"; + case CHIP_FAMILY_R580: return "R580"; + case CHIP_FAMILY_RV560: return "RV560"; + case CHIP_FAMILY_RV570: return "RV570"; + default: return "unknown"; + } +} + + /* Return various strings for glGetString(). */ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name) @@ -71,16 +105,22 @@ static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name) unsigned offset; GLuint agp_mode = (radeon->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 : radeon->radeonScreen->AGPMode; - const char* chipname; + const char* chipclass; + char hardwarename[32]; if (IS_R300_CLASS(radeon->radeonScreen)) - chipname = "R300"; + chipclass = "R300"; else if (IS_R200_CLASS(radeon->radeonScreen)) - chipname = "R200"; + chipclass = "R200"; else - chipname = "R100"; + chipclass = "R100"; + + sprintf(hardwarename, "%s (%s %04X)", + chipclass, + get_chip_family_name(radeon->radeonScreen->chip_family), + radeon->radeonScreen->device_id); - offset = driGetRendererString(buffer, chipname, DRIVER_DATE, + offset = driGetRendererString(buffer, hardwarename, DRIVER_DATE, agp_mode); if (IS_R300_CLASS(radeon->radeonScreen)) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 3ba11e848e..12ae4ada5d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -400,6 +400,7 @@ static const __DRItexBufferExtension r300TexBufferExtension = { static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id) { + screen->device_id = device_id; screen->chip_flags = 0; switch ( device_id ) { case PCI_CHIP_RADEON_LY: diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 8605eb4f07..fe5c7d875a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -59,6 +59,7 @@ typedef struct radeon_screen { int chip_flags; int cpp; int card_type; + int device_id; /* PCI ID */ int AGPMode; unsigned int irq; /* IRQ number (0 means none) */ -- cgit v1.2.3 From a5d033e89bab6c5e913cd2ca17df02e56b5fe31d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 1 Jun 2009 11:23:39 -0600 Subject: demos: add missing dependencies for util files --- progs/glsl/Makefile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile index 71db895d1d..f97cdb6942 100644 --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@ -80,25 +80,26 @@ clean: -rm -f *.o *~ -rm -f extfuncs.h -rm -f shaderutil.* + -rm -f readtex.* ##### Extra dependencies -extfuncs.h: - cp $(TOP)/progs/util/extfuncs.h . +extfuncs.h: $(TOP)/progs/util/extfuncs.h + cp $< . -readtex.c: - cp $(TOP)/progs/util/readtex.c . +readtex.c: $(TOP)/progs/util/readtex.c + cp $< . -readtex.h: - cp $(TOP)/progs/util/readtex.h . +readtex.h: $(TOP)/progs/util/readtex.h + cp $< . -shaderutil.c: - cp $(TOP)/progs/util/shaderutil.c . +shaderutil.c: $(TOP)/progs/util/shaderutil.c + cp $< . -shaderutil.h: - cp $(TOP)/progs/util/shaderutil.h . +shaderutil.h: $(TOP)/progs/util/shaderutil.h + cp $< . -- cgit v1.2.3 From 1fa023ae48c31176434f5ad4691eae347e7a395f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 1 Jun 2009 12:04:29 -0700 Subject: r300-gallium: Slightly hacky fix for glxgears-style TCL. --- src/gallium/drivers/r300/r300_state_derived.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7ae339cf97..2477b30822 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -163,6 +163,13 @@ static void r300_vs_tab_routes(struct r300_context* r300, vinfo->hwfmt[3] |= (4 << (3 * i)); } + /* Handle the case where the vertex shader will be generating some of + * the attribs based on its inputs. */ + if (r300screen->caps->has_tcl && + info->num_inputs < info->num_outputs) { + vinfo->num_attribs = info->num_inputs; + } + draw_compute_vertex_size(vinfo); } -- cgit v1.2.3 From 427554211b5b8ab2c6afcd5bd574ac97fb3457da Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 1 Jun 2009 14:28:57 -0600 Subject: draw: reset extra_vp_outputs.slot to zero in widepoint_flush() Fixes a crash when clearing the window with a quad after drawing large points. We were asking the draw module how many vertex shader outputs there were and got 3 instead of 2. This led to creating vertices with too many attributes and trying to read invalid memory. We reset extra_vp_outputs.slot to zero in the aaline/aapoint stage's flush functions already. This omission was just an oversight in the wide_point stage. --- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 49034ae86a..d84bab9eaa 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -253,6 +253,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags ) { stage->point = widepoint_first_point; stage->next->flush( stage->next, flags ); + stage->draw->extra_vp_outputs.slot = 0; } -- cgit v1.2.3 From 0e8a5a84742adf6e99236f246c77325fad174204 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 1 Jun 2009 14:59:11 -0600 Subject: st/mesa: fix incorrect sprite origin when drawing to FBO/texture Need to take the draw buffer's up/down orientation into consideration when setting the sprite_coord_mode field. Fixes inverted sprites when drawing into an FBO. --- src/mesa/state_tracker/st_atom_rasterizer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 4e70510c0c..5c7206409c 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -192,7 +192,8 @@ static void update_raster_state( struct st_context *st ) raster->point_sprite = ctx->Point.PointSprite; for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (ctx->Point.CoordReplace[i]) { - if (ctx->Point.SpriteOrigin == GL_UPPER_LEFT) + if ((ctx->Point.SpriteOrigin == GL_UPPER_LEFT) ^ + (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM)) raster->sprite_coord_mode[i] = PIPE_SPRITE_COORD_UPPER_LEFT; else raster->sprite_coord_mode[i] = PIPE_SPRITE_COORD_LOWER_LEFT; -- cgit v1.2.3 From 76ad2b4a5a38389ed733d1bf31a6cbba1881dc10 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 14 May 2009 13:28:09 +0100 Subject: progs/wgl: Use an invisible window in wglinfo. --- progs/wgl/wglinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progs/wgl/wglinfo.c b/progs/wgl/wglinfo.c index 881d35b297..43a216da18 100644 --- a/progs/wgl/wglinfo.c +++ b/progs/wgl/wglinfo.c @@ -364,7 +364,7 @@ print_screen_info(HDC _hdc, GLboolean limits) win = CreateWindowEx(0, wc.lpszClassName, "wglinfo", - WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, width, -- cgit v1.2.3 From 3c756ed39f93bd26bc81f6e3be0440429ad58c40 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 14 May 2009 15:32:10 +0100 Subject: progs/wgl: Small cleanup to wglinfo. --- progs/wgl/wglinfo.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/progs/wgl/wglinfo.c b/progs/wgl/wglinfo.c index 43a216da18..864372c2f9 100644 --- a/progs/wgl/wglinfo.c +++ b/progs/wgl/wglinfo.c @@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits) HWND win; HGLRC ctx; int visinfo; - int width = 100, height = 100; HDC hdc; PIXELFORMATDESCRIPTOR pfd; @@ -367,15 +366,15 @@ print_screen_info(HDC _hdc, GLboolean limits) WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, - width, - height, + CW_USEDEFAULT, + CW_USEDEFAULT, NULL, NULL, wc.hInstance, NULL); if (!win) { fprintf(stderr, "Couldn't create window"); - exit(1); + return; } hdc = GetDC(win); @@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd) ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0); printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n", 0 /* ppfd->bufferSize */, 0 /* ppfd->level */, - visual_render_type_name(ppfd->dwFlags), + visual_render_type_name(ppfd->iPixelType), ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0, ppfd->dwFlags & PFD_STEREO ? 1 : 0); printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n", -- cgit v1.2.3 From 00e7a600776ceb589bd5939ccd8aad937527db81 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 May 2009 13:47:38 +0100 Subject: trivial/tri-z: add controls for depthrange min/max Also add key to set up quake-1 style ztrick rendering with clear depth 1.0, deptrange(1.0, 0.0) and depthfunc GL_GREATER. --- progs/trivial/tri-z.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/progs/trivial/tri-z.c b/progs/trivial/tri-z.c index 335d2b90e2..014aaa071a 100644 --- a/progs/trivial/tri-z.c +++ b/progs/trivial/tri-z.c @@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] = static int curFunc = 0; static double clearVal = 1.0; - +static float minZ = 0.0; +static float maxZ = 1.0; static void usage(void) { - printf("t - toggle rendering order of triangles\n"); - printf("c - toggle Z clear value between 0, 1\n"); - printf("f - cycle through depth test functions\n"); + printf("t - toggle rendering order of triangles\n"); + printf("c - toggle Z clear value between 0, 1\n"); + printf("f - cycle through depth test functions\n"); + printf("n/N - decrease/increase depthrange minZ\n"); + printf("x/X - decrease/increase depthrange maxZ\n"); + printf("spc - reset\n"); + printf("z - set to reverse-direction (ztrick) mode\n"); + fflush(stdout); } @@ -97,9 +103,11 @@ static void drawRightTriangle(void) void display(void) { - printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n", - clearVal, funcs[curFunc].str); + printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n", + clearVal, funcs[curFunc].str, minZ, maxZ); + fflush(stdout); glClearDepth(clearVal); + glDepthRange(minZ, maxZ); glDepthFunc(funcs[curFunc].func); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -131,27 +139,49 @@ void reshape(int w, int h) void keyboard(unsigned char key, int x, int y) { switch (key) { + case 'n': + minZ -= .1; + break; + case 'N': + minZ += .1; + break; + case 'x': + maxZ -= .1; + break; + case 'X': + maxZ += .1; + break; case 'c': case 'C': clearVal = 1.0 - clearVal; - glutPostRedisplay(); break; case 'f': case 'F': curFunc = (curFunc + 1) % NUM_FUNCS; - glutPostRedisplay(); break; case 't': case 'T': leftFirst = !leftFirst; - glutPostRedisplay(); + break; + case ' ': + curFunc = 0; + clearVal = 1.0; + minZ = 0.0; + maxZ = 1.0; + break; + case 'z': + curFunc = 2; + clearVal = 0.0; + minZ = 1.0; + maxZ = 0.0; break; case 27: /* Escape key */ exit(0); break; default: - break; + return; } + glutPostRedisplay(); } /* Main Loop -- cgit v1.2.3 From f989390af6f827d1ea36560381340148811836f3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 13 May 2009 22:35:06 +0200 Subject: st/gl: Fix mip gen for compressed textures --- src/mesa/state_tracker/st_cb_texture.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b182106fd5..aaed155925 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -673,7 +673,7 @@ st_TexImage(GLcontext * ctx, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth, format, type, pixels, unpack, texImage)) { - return; + goto done; } } @@ -750,6 +750,7 @@ st_TexImage(GLcontext * ctx, _mesa_unmap_teximage_pbo(ctx, unpack); +done: if (stImage->pt && texImage->Data) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; @@ -1061,7 +1062,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, packing, texImage)) { - return; + goto done; } } @@ -1110,16 +1111,17 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } } - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, texObj); - } - _mesa_unmap_teximage_pbo(ctx, packing); +done: if (stImage->pt) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; } + + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + ctx->Driver.GenerateMipmap(ctx, target, texObj); + } } -- cgit v1.2.3 From 97f5953ced6938ca8e92cde62e8717ff505cc4e2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 May 2009 15:57:27 +0100 Subject: progs/vpglsl: add similar support for point rendering as progs/vp --- progs/vpglsl/psiz-imm.glsl | 6 +++++ progs/vpglsl/psiz-mul.glsl | 6 +++++ progs/vpglsl/vp-tris.c | 58 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 progs/vpglsl/psiz-imm.glsl create mode 100644 progs/vpglsl/psiz-mul.glsl diff --git a/progs/vpglsl/psiz-imm.glsl b/progs/vpglsl/psiz-imm.glsl new file mode 100644 index 0000000000..101d314d58 --- /dev/null +++ b/progs/vpglsl/psiz-imm.glsl @@ -0,0 +1,6 @@ + +void main() { + gl_FrontColor = gl_Color; + gl_PointSize = 2.0; + gl_Position = gl_Vertex; +} diff --git a/progs/vpglsl/psiz-mul.glsl b/progs/vpglsl/psiz-mul.glsl new file mode 100644 index 0000000000..77f4a46b52 --- /dev/null +++ b/progs/vpglsl/psiz-mul.glsl @@ -0,0 +1,6 @@ + +void main() { + gl_FrontColor = gl_Color; + gl_PointSize = 10 * gl_Color.x; + gl_Position = gl_Vertex; +} diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c index 9ae410bf98..b2b0508091 100644 --- a/progs/vpglsl/vp-tris.c +++ b/progs/vpglsl/vp-tris.c @@ -10,6 +10,10 @@ static const char *filename = NULL; static GLuint nr_steps = 4; +static GLuint prim = GL_TRIANGLES; +static GLfloat psz = 1.0; +static GLboolean pointsmooth = 0; +static GLboolean program_point_size = 0; static GLuint fragShader; static GLuint vertShader; @@ -229,6 +233,14 @@ static void subdiv( union vert *v0, } } +static void enable( GLenum value, GLboolean flag ) +{ + if (flag) + glEnable(value); + else + glDisable(value); +} + /** Assignment */ #define ASSIGN_3V( V, V0, V1, V2 ) \ do { \ @@ -241,10 +253,13 @@ static void Display( void ) { glClearColor(0.3, 0.3, 0.3, 1); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + glPointSize(psz); glUseProgram(program); + enable( GL_POINT_SMOOTH, pointsmooth ); + enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size ); - glBegin(GL_TRIANGLES); + glBegin(prim); { @@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y ) (void) x; (void) y; switch (key) { - case 27: - CleanUp(); - exit(0); - break; + case 'p': + prim = GL_POINTS; + break; + case 't': + prim = GL_TRIANGLES; + break; + case 's': + psz += .5; + break; + case 'S': + if (psz > .5) + psz -= .5; + break; + case 'm': + pointsmooth = !pointsmooth; + break; + case 'z': + program_point_size = !program_point_size; + break; + case '+': + nr_steps++; + break; + case '-': + if (nr_steps) + nr_steps--; + break; + case ' ': + psz = 1.0; + prim = GL_TRIANGLES; + nr_steps = 4; + break; + case 27: + CleanUp(); + exit(0); + break; } glutPostRedisplay(); } @@ -305,7 +351,7 @@ int main( int argc, char *argv[] ) glutInitWindowPosition( 0, 0 ); glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); + glutCreateWindow(argv[argc-1]); glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); -- cgit v1.2.3 From 557d2bb42397bb5511c32b4a2b39c7978e69dc8e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 1 Jun 2009 20:20:48 -0700 Subject: wgl: Destroy the framebuffer when the window is destroyed. --- .../state_trackers/wgl/shared/stw_framebuffer.c | 72 ++++++++++++++-------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index 768cef3db6..de37d135df 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -45,6 +45,41 @@ #include "stw_tls.h" +struct stw_framebuffer * +stw_framebuffer_from_hwnd_locked( + HWND hwnd ) +{ + struct stw_framebuffer *fb; + + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) + if (fb->hWnd == hwnd) + break; + + return fb; +} + + +static INLINE void +stw_framebuffer_destroy_locked( + struct stw_framebuffer *fb ) +{ + struct stw_framebuffer **link; + + link = &stw_dev->fb_head; + while (*link != fb) + link = &(*link)->next; + assert(*link); + *link = fb->next; + fb->next = NULL; + + st_unreference_framebuffer(fb->stfb); + + pipe_mutex_destroy( fb->mutex ); + + FREE( fb ); +} + + /** * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx @@ -69,9 +104,7 @@ stw_call_window_proc( struct stw_framebuffer *fb; pipe_mutex_lock( stw_dev->mutex ); - for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hWnd == pParams->hwnd) - break; + fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); pipe_mutex_unlock( stw_dev->mutex ); if(fb) { @@ -90,6 +123,18 @@ stw_call_window_proc( } } + if (pParams->message == WM_DESTROY) { + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->mutex ); + + fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); + if(fb) + stw_framebuffer_destroy_locked(fb); + + pipe_mutex_unlock( stw_dev->mutex ); + } + return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); } @@ -212,27 +257,6 @@ stw_framebuffer_resize( } -static INLINE void -stw_framebuffer_destroy_locked( - struct stw_framebuffer *fb ) -{ - struct stw_framebuffer **link; - - link = &stw_dev->fb_head; - while (*link != fb) - link = &(*link)->next; - assert(*link); - *link = fb->next; - fb->next = NULL; - - st_unreference_framebuffer(fb->stfb); - - pipe_mutex_destroy( fb->mutex ); - - FREE( fb ); -} - - void stw_framebuffer_cleanup( void ) { -- cgit v1.2.3 From 503632557e8904b775e1b6f3f84eb41bda3af122 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 May 2009 10:26:56 +0100 Subject: mesa/st: restore flush to copy_texsubimage (was previously finish) Need a flush here even though the original finish was overkill. --- src/mesa/state_tracker/st_cb_texture.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index aaed155925..14b78d1253 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1317,6 +1317,9 @@ st_copy_texsubimage(GLcontext *ctx, GLboolean use_fallback = GL_TRUE; GLboolean matching_base_formats; + /* any rendering in progress must flushed before we grab the fb image */ + st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + /* make sure finalize_textures has been called? */ if (0) st_validate_state(ctx->st); -- cgit v1.2.3 From 69a765df1c3bf6acc549a5a6a047bbde16988721 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 1 Jun 2009 19:48:40 -0700 Subject: draw: avoid leaking tokens when building pstipple fragment shader Add missing FREE() after MALLOC(). --- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 9287fc130e..bc63b700de 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -358,6 +358,7 @@ generate_pstip_fs(struct pstip_stage *pstip) pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs); + FREE((void *)pstip_fs.tokens); return TRUE; } -- cgit v1.2.3 From 003cfd4dd2491675058c53a8f59553f2443be349 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 1 Jun 2009 20:15:28 -0700 Subject: draw: free more token arrays The AA line and point code also needs to free token arrays after building driver shaders. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 9 ++++++--- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 9fedeef2d3..0d322b0aab 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -60,8 +60,6 @@ struct aaline_fragment_shader struct pipe_shader_state state; void *driver_fs; void *aaline_fs; - void *aapoint_fs; /* not yet */ - void *sprite_fs; /* not yet */ uint sampler_unit; int generic_attrib; /**< texcoord/generic used for texture */ }; @@ -373,10 +371,15 @@ generate_aaline_fs(struct aaline_stage *aaline) aaline->fs->aaline_fs = aaline->driver_create_fs_state(aaline->pipe, &aaline_fs); if (aaline->fs->aaline_fs == NULL) - return FALSE; + goto fail; aaline->fs->generic_attrib = transform.maxGeneric + 1; + FREE((void *)aaline_fs.tokens); return TRUE; + +fail: + FREE((void *)aaline_fs.tokens); + return FALSE; } diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 66839f7873..729cf75e65 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -523,11 +523,15 @@ generate_aapoint_fs(struct aapoint_stage *aapoint) aapoint->fs->aapoint_fs = aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs); if (aapoint->fs->aapoint_fs == NULL) - return FALSE; + goto fail; aapoint->fs->generic_attrib = transform.maxGeneric + 1; - + FREE((void *)aapoint_fs.tokens); return TRUE; + +fail: + FREE((void *)aapoint_fs.tokens); + return FALSE; } -- cgit v1.2.3 From 1aef032d438aaa40ec28bf279ad5c089370773f0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 1 Jun 2009 20:16:20 -0700 Subject: gallium/draw: Free specialized versions of driver shaders The pstipple, aaline and aapoint code would create specialized versions of shaders and upload them to the driver -- but never free them. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 4 ++++ src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 5 +++++ src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 0d322b0aab..9f956715a2 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -819,6 +819,10 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs) struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs; /* pass-through */ aaline->driver_delete_fs_state(aaline->pipe, aafs->driver_fs); + + if (aafs->aaline_fs) + aaline->driver_delete_fs_state(aaline->pipe, aafs->aaline_fs); + FREE(aafs); } diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 729cf75e65..ae1712fe12 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -829,8 +829,13 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs) { struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe); struct aapoint_fragment_shader *aafs = (struct aapoint_fragment_shader *) fs; + /* pass-through */ aapoint->driver_delete_fs_state(aapoint->pipe, aafs->driver_fs); + + if (aafs->aapoint_fs) + aapoint->driver_delete_fs_state(aapoint->pipe, aafs->aapoint_fs); + FREE(aafs); } diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index bc63b700de..30a6d2919d 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -650,6 +650,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs) struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs; /* pass-through */ pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs); + + if (aafs->pstip_fs) + pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs); + FREE(aafs); } -- cgit v1.2.3 From 0ab8e2622e932593f39e5a634808567322bd669b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 28 May 2009 10:34:08 -0700 Subject: i965: Support OPCODE_TRUNC in the brw_wm_fp.c code. This gets two more glean glsl1 tests using the non-GLSL path. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 17 +++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 1 - src/mesa/drivers/dri/i965/brw_wm_pass1.c | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 72fc21d2eb..14ab9042de 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -353,6 +353,19 @@ static void emit_mad( struct brw_compile *p, } } +static void emit_trunc( struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) +{ + GLuint i; + + for (i = 0; i < 4; i++) { + if (mask & (1<Base.Instructions[i]; switch (inst->Opcode) { case OPCODE_IF: - case OPCODE_TRUNC: case OPCODE_ENDIF: case OPCODE_CAL: case OPCODE_BRK: diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass1.c b/src/mesa/drivers/dri/i965/brw_wm_pass1.c index ab9aa2f10d..3436a24717 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass1.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass1.c @@ -159,6 +159,7 @@ void brw_wm_pass1( struct brw_wm_compile *c ) case OPCODE_FRC: case OPCODE_MOV: case OPCODE_SWZ: + case OPCODE_TRUNC: read0 = writemask; break; -- cgit v1.2.3 From a945e203d4fe254593bc0c5c5d6caca45e65f9f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 2 Jun 2009 06:53:40 -0700 Subject: i915: Don't put VBOs in graphics memory unless required for an operation. This saves doing swtnl from uncached memory, which is painful. Improves clutter test-text performance by 10% since it started using VBOs. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 39 ++++++++++++++++++++++- src/mesa/drivers/dri/intel/intel_buffer_objects.h | 2 ++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 0db1f392c0..23ba3b9ef6 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -111,6 +111,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) if (obj->Pointer) intel_bufferobj_unmap(ctx, 0, obj); + _mesa_free(intel_obj->sys_buffer); if (intel_obj->region) { intel_bufferobj_release_region(intel, intel_obj); } @@ -151,7 +152,23 @@ intel_bufferobj_data(GLcontext * ctx, dri_bo_unreference(intel_obj->buffer); intel_obj->buffer = NULL; } + _mesa_free(intel_obj->sys_buffer); + intel_obj->sys_buffer = NULL; + if (size != 0) { +#ifdef I915 + /* On pre-965, stick VBOs in system memory, as we're always doing swtnl + * with their contents anyway. + */ + if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) { + intel_obj->sys_buffer = _mesa_malloc(size); + if (intel_obj->sys_buffer != NULL) { + if (data != NULL) + memcpy(intel_obj->sys_buffer, data, size); + return; + } + } +#endif intel_bufferobj_alloc_buffer(intel, intel_obj); if (data != NULL) @@ -181,7 +198,10 @@ intel_bufferobj_subdata(GLcontext * ctx, if (intel_obj->region) intel_bufferobj_cow(intel, intel_obj); - dri_bo_subdata(intel_obj->buffer, offset, size, data); + if (intel_obj->sys_buffer) + memcpy((char *)intel_obj->sys_buffer + offset, data, size); + else + dri_bo_subdata(intel_obj->buffer, offset, size, data); } @@ -218,6 +238,11 @@ intel_bufferobj_map(GLcontext * ctx, assert(intel_obj); + if (intel_obj->sys_buffer) { + obj->Pointer = intel_obj->sys_buffer; + return obj->Pointer; + } + if (intel_obj->region) intel_bufferobj_cow(intel, intel_obj); @@ -274,6 +299,18 @@ intel_bufferobj_buffer(struct intel_context *intel, } } + if (intel_obj->buffer == NULL) { + intel_bufferobj_alloc_buffer(intel, intel_obj); + intel_bufferobj_subdata(&intel->ctx, + GL_ARRAY_BUFFER_ARB, + 0, + intel_obj->Base.Size, + intel_obj->sys_buffer, + &intel_obj->Base); + _mesa_free(intel_obj->sys_buffer); + intel_obj->sys_buffer = NULL; + } + return intel_obj->buffer; } diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.h b/src/mesa/drivers/dri/intel/intel_buffer_objects.h index 7ef723833c..0431015631 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.h +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.h @@ -42,6 +42,8 @@ struct intel_buffer_object { struct gl_buffer_object Base; dri_bo *buffer; /* the low-level buffer manager's buffer handle */ + /** System memory buffer data, if not using a BO to store the data. */ + void *sys_buffer; struct intel_region *region; /* Is there a zero-copy texture associated with this (pixel) -- cgit v1.2.3 From 129f311673c99eb912d659023e50bc5f0ef53249 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 18 May 2009 13:26:16 -0700 Subject: intel: Clip to window after calling Driver.TexImage2D This prevents the width / height from being clipped to the window size before the texture is allocated. This matches intelCopyTexImage1D. This should fix bug #21227 Signed-off-by: Ian Romanick --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 7c2b26ef1d..a25626ae28 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -231,6 +231,14 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, if (border) goto fail; + /* Setup or redefine the texture object, mipmap tree and texture + * image. Don't populate yet. + */ + ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + width, height, border, + GL_RGBA, CHAN_TYPE, NULL, + &ctx->DefaultPacking, texObj, texImage); + srcx = x; srcy = y; dstx = 0; @@ -241,15 +249,6 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, &width, &height)) return; - /* Setup or redefine the texture object, mipmap tree and texture - * image. Don't populate yet. - */ - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, - width, height, border, - GL_RGBA, CHAN_TYPE, NULL, - &ctx->DefaultPacking, texObj, texImage); - - if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), internalFormat, 0, 0, x, y, width, height)) -- cgit v1.2.3 From 16fbd391291de8eddcd01a1a10e6801da299209b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 18 May 2009 13:26:16 -0700 Subject: intel: Clip to window after calling Driver.TexImage2D This prevents the width / height from being clipped to the window size before the texture is allocated. This matches intelCopyTexImage1D. This should fix bug #21227 Signed-off-by: Ian Romanick (cherry picked from commit 129f311673c99eb912d659023e50bc5f0ef53249) --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 08437aa0e2..90bbb8c6bb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -231,6 +231,14 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, if (border) goto fail; + /* Setup or redefine the texture object, mipmap tree and texture + * image. Don't populate yet. + */ + ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + width, height, border, + GL_RGBA, CHAN_TYPE, NULL, + &ctx->DefaultPacking, texObj, texImage); + srcx = x; srcy = y; dstx = 0; @@ -241,15 +249,6 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, &width, &height)) return; - /* Setup or redefine the texture object, mipmap tree and texture - * image. Don't populate yet. - */ - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, - width, height, border, - GL_RGBA, CHAN_TYPE, NULL, - &ctx->DefaultPacking, texObj, texImage); - - if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), internalFormat, 0, 0, x, y, width, height)) -- cgit v1.2.3 From cb3a9f984de6b1a167c60c345d51d55b8c0ca80b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 10:26:50 -0600 Subject: mesa: add #define FEATURE_ARB_pixel_buffer_object --- src/mesa/main/mfeatures.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index f570647942..62c3ead3e1 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -61,6 +61,7 @@ #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL #define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL +#define FEATURE_ARB_pixel_buffer_object _HAVE_FULL_GL #define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL #define FEATURE_ARB_vertex_program _HAVE_FULL_GL #define FEATURE_ARB_vertex_shader _HAVE_FULL_GL -- cgit v1.2.3 From 12e94d892e3322be5c8a1594702d69e7a02d5274 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 10:27:05 -0600 Subject: mesa: release VBO and PBO references upon context destruction --- src/mesa/main/context.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 884b6ad282..a947f69632 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1007,6 +1007,16 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); +#if FEATURE_ARB_pixel_buffer_object + _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL); +#endif + +#if FEATURE_ARB_vertex_buffer_object + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); + _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL); +#endif + #if FEATURE_ARB_vertex_buffer_object _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); #endif -- cgit v1.2.3 From c91df4c1534e2db2274b6d08e90470bf21a49e2a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 2 Jun 2009 11:46:06 -0700 Subject: util: Fix 24 to 32 bit expansion binary arithmetic expression. When approaching y = x * 0xffffffff / 0xffffff with bit arithmetic, the 8 least significant bits of y should come from the 8 most significant bits of x. --- src/gallium/auxiliary/util/u_tile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index f0a5a339eb..9becd9fea4 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1126,7 +1126,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 24-bit Z to 32-bit Z */ - pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff); + pDest[j] = (ptrc[j] << 8) | ((ptrc[j] >> 16) & 0xff); } pDest += dstStride; ptrc += pt->stride/4; -- cgit v1.2.3 From 840af5fd62edc01769cc3818702ea399a0c68c40 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 2 Jun 2009 11:46:53 -0700 Subject: util: Support Z24S8/Z24X8 -> unsigned conversion. --- src/gallium/auxiliary/util/u_tile.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 9becd9fea4..a2fcdad9e4 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1133,6 +1133,21 @@ pipe_get_tile_z(struct pipe_transfer *pt, } } break; + case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: + { + const uint *ptrc + = (const uint *)(map + y * pt->stride + x*4); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert 24-bit Z to 32-bit Z */ + pDest[j] = (ptrc[j] & 0xffffff00) | (ptrc[j] & 0xff); + } + pDest += dstStride; + ptrc += pt->stride/4; + } + } + break; case PIPE_FORMAT_Z16_UNORM: { const ushort *ptrc -- cgit v1.2.3 From 45b77830eb6fa1b712b0416a27990ad8b6eaf78b Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Tue, 2 Jun 2009 22:23:17 +0200 Subject: r300-gallium: strip swtcl to the bare minimum This was originally taken from i915 and it shows. Basically most the stuff in r300_render.c was never needed and shouldn't have worked in the first place --- src/gallium/drivers/r300/r300_render.c | 56 +++++++++++++--------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 29b66cee7e..cd458d019a 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -45,11 +45,7 @@ struct r300_render { /* VBO */ struct pipe_buffer* vbo; - size_t vbo_size; - size_t vbo_offset; - void* vbo_map; size_t vbo_alloc_size; - size_t vbo_max_used; }; static INLINE struct r300_render* @@ -78,24 +74,21 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render, struct pipe_screen* screen = r300->context.screen; size_t size = (size_t)vertex_size * (size_t)count; - if (r300render->vbo) { + if (r300render->vbo && (size > r300render->vbo_alloc_size)) { pipe_buffer_reference(&r300render->vbo, NULL); } + + if (!r300render->vbo) { + r300render->vbo = pipe_buffer_create(screen, + 64, + PIPE_BUFFER_USAGE_VERTEX, + size); + } - r300render->vbo_size = MAX2(size, r300render->vbo_alloc_size); - r300render->vbo_offset = 0; - r300render->vbo = pipe_buffer_create(screen, - 64, - PIPE_BUFFER_USAGE_VERTEX, - r300render->vbo_size); - + r300render->vbo_alloc_size = MAX2(size, r300render->vbo_alloc_size); r300render->vertex_size = vertex_size; - if (r300render->vbo) { - return TRUE; - } else { - return FALSE; - } + return (r300render->vbo) ? TRUE : FALSE; } static void* r300_render_map_vertices(struct vbuf_render* render) @@ -103,10 +96,8 @@ static void* r300_render_map_vertices(struct vbuf_render* render) struct r300_render* r300render = r300_render(render); struct pipe_screen* screen = r300render->r300->context.screen; - r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo, - PIPE_BUFFER_USAGE_CPU_WRITE); - - return (unsigned char*)r300render->vbo_map + r300render->vbo_offset; + return (unsigned char*)pipe_buffer_map(screen, r300render->vbo, + PIPE_BUFFER_USAGE_CPU_WRITE); } static void r300_render_unmap_vertices(struct vbuf_render* render, @@ -116,9 +107,6 @@ static void r300_render_unmap_vertices(struct vbuf_render* render, struct r300_render* r300render = r300_render(render); struct pipe_screen* screen = r300render->r300->context.screen; - r300render->vbo_max_used = MAX2(r300render->vbo_max_used, - r300render->vertex_size * (max + 1)); - pipe_buffer_unmap(screen, r300render->vbo); } @@ -181,7 +169,6 @@ static void prepare_render(struct r300_render* render, unsigned count) CS_LOCALS(r300); r300->vbo = render->vbo; - r300->vbo_offset = render->vbo_offset; r300_emit_dirty_state(r300); } @@ -195,8 +182,6 @@ static void r300_render_draw_arrays(struct vbuf_render* render, CS_LOCALS(r300); - r300render->vbo_offset = start; - prepare_render(r300render, count); debug_printf("r300: Doing vbuf render, count %d\n", count); @@ -231,13 +216,14 @@ static void r300_render_draw(struct vbuf_render* render, return; } +/* index_map = pipe_buffer_map(screen, index_buffer, PIPE_BUFFER_USAGE_CPU_WRITE); memcpy(index_map, indices, count); pipe_buffer_unmap(screen, index_buffer); debug_printf("r300: Doing indexbuf render, count %d\n", count); -/* + BEGIN_CS(8); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | @@ -247,13 +233,15 @@ static void r300_render_draw(struct vbuf_render* render, OUT_CS_INDEX_RELOC(index_buffer, 0, count, RADEON_GEM_DOMAIN_GTT, 0, 0); END_CS; */ - BEGIN_CS(2 + count); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, count); + BEGIN_CS(2 + (count+1)/2); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count+1)/2); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | - r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); - for (i = 0; i < count; i++) { - index = indices[i]; - OUT_CS(index); + r300render->hwprim); + for (i = 0; i < count-1; i += 2) { + OUT_CS(indices[i+1] << 16 | indices[i]); + } + if (count % 2) { + OUT_CS(indices[count-1]); } END_CS; } -- cgit v1.2.3 From 273117ceed47bff58a0f475dd36b37721e997f91 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 2 Jun 2009 16:41:45 -0700 Subject: util: Unsaved change missing from last commit. --- src/gallium/auxiliary/util/u_tile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index a2fcdad9e4..9747a55cbf 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1141,7 +1141,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 24-bit Z to 32-bit Z */ - pDest[j] = (ptrc[j] & 0xffffff00) | (ptrc[j] & 0xff); + pDest[j] = (ptrc[j] & 0xffffff00) | ((ptrc[j] >> 24) & 0xff); } pDest += dstStride; ptrc += pt->stride/4; -- cgit v1.2.3 From 0f50c4fab8acfe291ddd426f331eea5eec66ba13 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 2 Jun 2009 18:23:12 -0700 Subject: scons: Output nice summary messages instead of long command lines. You can still get the old behavior by passing the option quiet=no to scons. --- common.py | 2 +- scons/gallium.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common.py b/common.py index e57429eb75..a687efc86f 100644 --- a/common.py +++ b/common.py @@ -55,7 +55,7 @@ def AddOptions(opts): from SCons.Options.EnumOption import EnumOption opts.Add(BoolOption('debug', 'debug build', 'no')) opts.Add(BoolOption('profile', 'profile build', 'no')) - #opts.Add(BoolOption('quiet', 'quiet command lines', 'no')) + opts.Add(BoolOption('quiet', 'quiet command lines', 'yes')) opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine, allowed_values=('generic', 'ppc', 'x86', 'x86_64'))) opts.Add(EnumOption('platform', 'target platform', default_platform, diff --git a/scons/gallium.py b/scons/gallium.py index c7e74d7e59..5e59636087 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -42,11 +42,17 @@ import SCons.Scanner def quietCommandLines(env): # Quiet command lines # See also http://www.scons.org/wiki/HidingCommandLinesInOutput + env['ASCOMSTR'] = "Assembling $SOURCE ..." env['CCCOMSTR'] = "Compiling $SOURCE ..." + env['SHCCCOMSTR'] = "Compiling $SOURCE ..." env['CXXCOMSTR'] = "Compiling $SOURCE ..." + env['SHCXXCOMSTR'] = "Compiling $SOURCE ..." env['ARCOMSTR'] = "Archiving $TARGET ..." - env['RANLIBCOMSTR'] = "" + env['RANLIBCOMSTR'] = "Indexing $TARGET ..." env['LINKCOMSTR'] = "Linking $TARGET ..." + env['SHLINKCOMSTR'] = "Linking $TARGET ..." + env['LDMODULECOMSTR'] = "Linking $TARGET ..." + env['SWIGCOMSTR'] = "Generating $TARGET ..." def createConvenienceLibBuilder(env): @@ -185,9 +191,8 @@ def num_jobs(): def generate(env): """Common environment generation code""" - # FIXME: this is already too late - #if env.get('quiet', False): - # quietCommandLines(env) + if env.get('quiet', True): + quietCommandLines(env) # Toolchain platform = env['platform'] -- cgit v1.2.3 From fc7f92478286041a018ac4e72d2ccedeea7c0eca Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 2 Jun 2009 18:41:12 -0700 Subject: scons: Less aggressive optimizations for MSVC 64bit compiler. MSVC 64bit compiler takes forever on some of the files. Might want to revisit this again later. --- scons/gallium.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index 5e59636087..0d5843603e 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -362,11 +362,24 @@ def generate(env): '/GL-', # disable whole program optimization ] else: + if env['machine'] == 'x86_64': + cflags += [ + # Same as /O2, but without global optimizations or auto-inlining + # http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx + '/Ob1', # enable inline expansion, disable auto-inlining + '/Oi', # enable intrinsic functions + '/Ot', # favors fast code + '/Oy', # omit frame pointer + '/Gs', # enable stack probes + '/GF', # eliminate duplicate strings + '/Gy', # enable function-level linking + ] + else: + cflags += [ + '/O2', # optimize for speed + ] cflags += [ - '/Ox', # maximum optimizations - '/Oi', # enable intrinsic functions - '/Ot', # favor code speed - #'/fp:fast', # fast floating point + #'/fp:fast', # fast floating point ] if env['profile']: cflags += [ -- cgit v1.2.3 From 4a1e4f9881c30977bbce3f0844712539b7ef6b18 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:27:08 -0600 Subject: glapi: GL_ARB_copy_buffer xml info --- src/mesa/glapi/ARB_copy_buffer.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/mesa/glapi/ARB_copy_buffer.xml diff --git a/src/mesa/glapi/ARB_copy_buffer.xml b/src/mesa/glapi/ARB_copy_buffer.xml new file mode 100644 index 0000000000..719816d817 --- /dev/null +++ b/src/mesa/glapi/ARB_copy_buffer.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 68892872ef0e94b96ed1ff2bc41f17cfbbcf4a40 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:28:04 -0600 Subject: glapi: include ARB_copy_buffer.xml --- src/mesa/glapi/Makefile | 1 + src/mesa/glapi/gl_API.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index f524167a47..a0c1f9aa8a 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -47,6 +47,7 @@ SERVER_OUTPUTS = \ API_XML = gl_API.xml \ EXT_framebuffer_object.xml \ + ARB_copy_buffer.xml \ ARB_framebuffer_object.xml \ APPLE_vertex_array_object.xml diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 4b66793e1c..aa893b1e02 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -7948,6 +7948,8 @@ + + -- cgit v1.2.3 From 751977075f30076bd5e53f9ed9b19d9b36b5da69 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:29:11 -0600 Subject: glapi: regenerated files for GL_ARB_copy_buffer --- src/glx/x11/indirect.c | 60 - src/mesa/drivers/dri/common/extension_helper.h | 30 +- src/mesa/glapi/dispatch.h | 435 +- src/mesa/glapi/glapioffsets.h | 430 +- src/mesa/glapi/glapitable.h | 427 +- src/mesa/glapi/glapitemp.h | 166 +- src/mesa/glapi/glprocs.h | 1102 ++--- src/mesa/main/enums.c | 5300 ++++++++++++------------ src/mesa/sparc/glapi_sparc.S | 83 +- src/mesa/x86-64/glapi_x86-64.S | 2021 ++++----- src/mesa/x86/glapi_x86.S | 109 +- 11 files changed, 5094 insertions(+), 5069 deletions(-) diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index aea117ec32..08d52aeea3 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -5198,13 +5198,9 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); @@ -5270,13 +5266,9 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4; @@ -5336,13 +5328,9 @@ glIsTextureEXT(GLuint texture) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; @@ -5653,13 +5641,9 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -5730,14 +5714,10 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameterfv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -5804,14 +5784,10 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameteriv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6131,14 +6107,10 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionFilter(GET_DISPATCH(), (target, format, type, image)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6210,14 +6182,10 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6284,14 +6252,10 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6365,14 +6329,10 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, values)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6443,13 +6403,9 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6515,13 +6471,9 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6591,13 +6543,9 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6666,13 +6614,9 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6735,13 +6679,9 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else { -#else - { -#endif __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index 8dcaaee307..f5e35e4161 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -1763,6 +1763,13 @@ static const char DeleteFencesNV_names[] = ""; #endif +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformationMap3dSGIX_names[] = + "iddiiddiiddiip\0" /* Parameter signature */ + "glDeformationMap3dSGIX\0" + ""; +#endif + #if defined(need_GL_VERSION_2_0) static const char IsShader_names[] = "i\0" /* Parameter signature */ @@ -4396,6 +4403,13 @@ static const char WindowPos3ivMESA_names[] = ""; #endif +#if defined(need_GL_ARB_copy_buffer) +static const char CopyBufferSubData_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyBufferSubData\0" + ""; +#endif + #if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) static const char IsBufferARB_names[] = "i\0" /* Parameter signature */ @@ -4560,13 +4574,6 @@ static const char Minmax_names[] = ""; #endif -#if defined(need_GL_SGIX_polynomial_ffd) -static const char DeformationMap3dSGIX_names[] = - "iddiiddiiddiip\0" /* Parameter signature */ - "glDeformationMap3dSGIX\0" - ""; -#endif - #if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) static const char FogCoorddvEXT_names[] = "p\0" /* Parameter signature */ @@ -4939,6 +4946,13 @@ static const struct dri_extension_function GL_APPLE_vertex_array_object_function }; #endif +#if defined(need_GL_ARB_copy_buffer) +static const struct dri_extension_function GL_ARB_copy_buffer_functions[] = { + { CopyBufferSubData_names, CopyBufferSubData_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_ARB_draw_buffers) static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = { { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, @@ -6055,9 +6069,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = { #if defined(need_GL_SGIX_polynomial_ffd) static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = { { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 }, + { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, { DeformSGIX_names, DeformSGIX_remap_index, -1 }, { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 }, - { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, { NULL, 0, 0 } }; #endif diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 45b2fa077a..39ccf62f23 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -1746,6 +1746,9 @@ #define CALL_RenderbufferStorageMultisample(disp, parameters) (*((disp)->RenderbufferStorageMultisample)) parameters #define GET_RenderbufferStorageMultisample(disp) ((disp)->RenderbufferStorageMultisample) #define SET_RenderbufferStorageMultisample(disp, fn) ((disp)->RenderbufferStorageMultisample = fn) +#define CALL_CopyBufferSubData(disp, parameters) (*((disp)->CopyBufferSubData)) parameters +#define GET_CopyBufferSubData(disp) ((disp)->CopyBufferSubData) +#define SET_CopyBufferSubData(disp, fn) ((disp)->CopyBufferSubData = fn) #define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters #define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) #define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) @@ -2388,7 +2391,7 @@ #else -#define driDispatchRemapTable_size 367 +#define driDispatchRemapTable_size 368 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2545,219 +2548,220 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define GetAttribLocationARB_remap_index 151 #define DrawBuffersARB_remap_index 152 #define RenderbufferStorageMultisample_remap_index 153 -#define PolygonOffsetEXT_remap_index 154 -#define GetPixelTexGenParameterfvSGIS_remap_index 155 -#define GetPixelTexGenParameterivSGIS_remap_index 156 -#define PixelTexGenParameterfSGIS_remap_index 157 -#define PixelTexGenParameterfvSGIS_remap_index 158 -#define PixelTexGenParameteriSGIS_remap_index 159 -#define PixelTexGenParameterivSGIS_remap_index 160 -#define SampleMaskSGIS_remap_index 161 -#define SamplePatternSGIS_remap_index 162 -#define ColorPointerEXT_remap_index 163 -#define EdgeFlagPointerEXT_remap_index 164 -#define IndexPointerEXT_remap_index 165 -#define NormalPointerEXT_remap_index 166 -#define TexCoordPointerEXT_remap_index 167 -#define VertexPointerEXT_remap_index 168 -#define PointParameterfEXT_remap_index 169 -#define PointParameterfvEXT_remap_index 170 -#define LockArraysEXT_remap_index 171 -#define UnlockArraysEXT_remap_index 172 -#define CullParameterdvEXT_remap_index 173 -#define CullParameterfvEXT_remap_index 174 -#define SecondaryColor3bEXT_remap_index 175 -#define SecondaryColor3bvEXT_remap_index 176 -#define SecondaryColor3dEXT_remap_index 177 -#define SecondaryColor3dvEXT_remap_index 178 -#define SecondaryColor3fEXT_remap_index 179 -#define SecondaryColor3fvEXT_remap_index 180 -#define SecondaryColor3iEXT_remap_index 181 -#define SecondaryColor3ivEXT_remap_index 182 -#define SecondaryColor3sEXT_remap_index 183 -#define SecondaryColor3svEXT_remap_index 184 -#define SecondaryColor3ubEXT_remap_index 185 -#define SecondaryColor3ubvEXT_remap_index 186 -#define SecondaryColor3uiEXT_remap_index 187 -#define SecondaryColor3uivEXT_remap_index 188 -#define SecondaryColor3usEXT_remap_index 189 -#define SecondaryColor3usvEXT_remap_index 190 -#define SecondaryColorPointerEXT_remap_index 191 -#define MultiDrawArraysEXT_remap_index 192 -#define MultiDrawElementsEXT_remap_index 193 -#define FogCoordPointerEXT_remap_index 194 -#define FogCoorddEXT_remap_index 195 -#define FogCoorddvEXT_remap_index 196 -#define FogCoordfEXT_remap_index 197 -#define FogCoordfvEXT_remap_index 198 -#define PixelTexGenSGIX_remap_index 199 -#define BlendFuncSeparateEXT_remap_index 200 -#define FlushVertexArrayRangeNV_remap_index 201 -#define VertexArrayRangeNV_remap_index 202 -#define CombinerInputNV_remap_index 203 -#define CombinerOutputNV_remap_index 204 -#define CombinerParameterfNV_remap_index 205 -#define CombinerParameterfvNV_remap_index 206 -#define CombinerParameteriNV_remap_index 207 -#define CombinerParameterivNV_remap_index 208 -#define FinalCombinerInputNV_remap_index 209 -#define GetCombinerInputParameterfvNV_remap_index 210 -#define GetCombinerInputParameterivNV_remap_index 211 -#define GetCombinerOutputParameterfvNV_remap_index 212 -#define GetCombinerOutputParameterivNV_remap_index 213 -#define GetFinalCombinerInputParameterfvNV_remap_index 214 -#define GetFinalCombinerInputParameterivNV_remap_index 215 -#define ResizeBuffersMESA_remap_index 216 -#define WindowPos2dMESA_remap_index 217 -#define WindowPos2dvMESA_remap_index 218 -#define WindowPos2fMESA_remap_index 219 -#define WindowPos2fvMESA_remap_index 220 -#define WindowPos2iMESA_remap_index 221 -#define WindowPos2ivMESA_remap_index 222 -#define WindowPos2sMESA_remap_index 223 -#define WindowPos2svMESA_remap_index 224 -#define WindowPos3dMESA_remap_index 225 -#define WindowPos3dvMESA_remap_index 226 -#define WindowPos3fMESA_remap_index 227 -#define WindowPos3fvMESA_remap_index 228 -#define WindowPos3iMESA_remap_index 229 -#define WindowPos3ivMESA_remap_index 230 -#define WindowPos3sMESA_remap_index 231 -#define WindowPos3svMESA_remap_index 232 -#define WindowPos4dMESA_remap_index 233 -#define WindowPos4dvMESA_remap_index 234 -#define WindowPos4fMESA_remap_index 235 -#define WindowPos4fvMESA_remap_index 236 -#define WindowPos4iMESA_remap_index 237 -#define WindowPos4ivMESA_remap_index 238 -#define WindowPos4sMESA_remap_index 239 -#define WindowPos4svMESA_remap_index 240 -#define MultiModeDrawArraysIBM_remap_index 241 -#define MultiModeDrawElementsIBM_remap_index 242 -#define DeleteFencesNV_remap_index 243 -#define FinishFenceNV_remap_index 244 -#define GenFencesNV_remap_index 245 -#define GetFenceivNV_remap_index 246 -#define IsFenceNV_remap_index 247 -#define SetFenceNV_remap_index 248 -#define TestFenceNV_remap_index 249 -#define AreProgramsResidentNV_remap_index 250 -#define BindProgramNV_remap_index 251 -#define DeleteProgramsNV_remap_index 252 -#define ExecuteProgramNV_remap_index 253 -#define GenProgramsNV_remap_index 254 -#define GetProgramParameterdvNV_remap_index 255 -#define GetProgramParameterfvNV_remap_index 256 -#define GetProgramStringNV_remap_index 257 -#define GetProgramivNV_remap_index 258 -#define GetTrackMatrixivNV_remap_index 259 -#define GetVertexAttribPointervNV_remap_index 260 -#define GetVertexAttribdvNV_remap_index 261 -#define GetVertexAttribfvNV_remap_index 262 -#define GetVertexAttribivNV_remap_index 263 -#define IsProgramNV_remap_index 264 -#define LoadProgramNV_remap_index 265 -#define ProgramParameters4dvNV_remap_index 266 -#define ProgramParameters4fvNV_remap_index 267 -#define RequestResidentProgramsNV_remap_index 268 -#define TrackMatrixNV_remap_index 269 -#define VertexAttrib1dNV_remap_index 270 -#define VertexAttrib1dvNV_remap_index 271 -#define VertexAttrib1fNV_remap_index 272 -#define VertexAttrib1fvNV_remap_index 273 -#define VertexAttrib1sNV_remap_index 274 -#define VertexAttrib1svNV_remap_index 275 -#define VertexAttrib2dNV_remap_index 276 -#define VertexAttrib2dvNV_remap_index 277 -#define VertexAttrib2fNV_remap_index 278 -#define VertexAttrib2fvNV_remap_index 279 -#define VertexAttrib2sNV_remap_index 280 -#define VertexAttrib2svNV_remap_index 281 -#define VertexAttrib3dNV_remap_index 282 -#define VertexAttrib3dvNV_remap_index 283 -#define VertexAttrib3fNV_remap_index 284 -#define VertexAttrib3fvNV_remap_index 285 -#define VertexAttrib3sNV_remap_index 286 -#define VertexAttrib3svNV_remap_index 287 -#define VertexAttrib4dNV_remap_index 288 -#define VertexAttrib4dvNV_remap_index 289 -#define VertexAttrib4fNV_remap_index 290 -#define VertexAttrib4fvNV_remap_index 291 -#define VertexAttrib4sNV_remap_index 292 -#define VertexAttrib4svNV_remap_index 293 -#define VertexAttrib4ubNV_remap_index 294 -#define VertexAttrib4ubvNV_remap_index 295 -#define VertexAttribPointerNV_remap_index 296 -#define VertexAttribs1dvNV_remap_index 297 -#define VertexAttribs1fvNV_remap_index 298 -#define VertexAttribs1svNV_remap_index 299 -#define VertexAttribs2dvNV_remap_index 300 -#define VertexAttribs2fvNV_remap_index 301 -#define VertexAttribs2svNV_remap_index 302 -#define VertexAttribs3dvNV_remap_index 303 -#define VertexAttribs3fvNV_remap_index 304 -#define VertexAttribs3svNV_remap_index 305 -#define VertexAttribs4dvNV_remap_index 306 -#define VertexAttribs4fvNV_remap_index 307 -#define VertexAttribs4svNV_remap_index 308 -#define VertexAttribs4ubvNV_remap_index 309 -#define GetTexBumpParameterfvATI_remap_index 310 -#define GetTexBumpParameterivATI_remap_index 311 -#define TexBumpParameterfvATI_remap_index 312 -#define TexBumpParameterivATI_remap_index 313 -#define AlphaFragmentOp1ATI_remap_index 314 -#define AlphaFragmentOp2ATI_remap_index 315 -#define AlphaFragmentOp3ATI_remap_index 316 -#define BeginFragmentShaderATI_remap_index 317 -#define BindFragmentShaderATI_remap_index 318 -#define ColorFragmentOp1ATI_remap_index 319 -#define ColorFragmentOp2ATI_remap_index 320 -#define ColorFragmentOp3ATI_remap_index 321 -#define DeleteFragmentShaderATI_remap_index 322 -#define EndFragmentShaderATI_remap_index 323 -#define GenFragmentShadersATI_remap_index 324 -#define PassTexCoordATI_remap_index 325 -#define SampleMapATI_remap_index 326 -#define SetFragmentShaderConstantATI_remap_index 327 -#define PointParameteriNV_remap_index 328 -#define PointParameterivNV_remap_index 329 -#define ActiveStencilFaceEXT_remap_index 330 -#define BindVertexArrayAPPLE_remap_index 331 -#define DeleteVertexArraysAPPLE_remap_index 332 -#define GenVertexArraysAPPLE_remap_index 333 -#define IsVertexArrayAPPLE_remap_index 334 -#define GetProgramNamedParameterdvNV_remap_index 335 -#define GetProgramNamedParameterfvNV_remap_index 336 -#define ProgramNamedParameter4dNV_remap_index 337 -#define ProgramNamedParameter4dvNV_remap_index 338 -#define ProgramNamedParameter4fNV_remap_index 339 -#define ProgramNamedParameter4fvNV_remap_index 340 -#define DepthBoundsEXT_remap_index 341 -#define BlendEquationSeparateEXT_remap_index 342 -#define BindFramebufferEXT_remap_index 343 -#define BindRenderbufferEXT_remap_index 344 -#define CheckFramebufferStatusEXT_remap_index 345 -#define DeleteFramebuffersEXT_remap_index 346 -#define DeleteRenderbuffersEXT_remap_index 347 -#define FramebufferRenderbufferEXT_remap_index 348 -#define FramebufferTexture1DEXT_remap_index 349 -#define FramebufferTexture2DEXT_remap_index 350 -#define FramebufferTexture3DEXT_remap_index 351 -#define GenFramebuffersEXT_remap_index 352 -#define GenRenderbuffersEXT_remap_index 353 -#define GenerateMipmapEXT_remap_index 354 -#define GetFramebufferAttachmentParameterivEXT_remap_index 355 -#define GetRenderbufferParameterivEXT_remap_index 356 -#define IsFramebufferEXT_remap_index 357 -#define IsRenderbufferEXT_remap_index 358 -#define RenderbufferStorageEXT_remap_index 359 -#define BlitFramebufferEXT_remap_index 360 -#define FramebufferTextureLayerEXT_remap_index 361 -#define StencilFuncSeparateATI_remap_index 362 -#define ProgramEnvParameters4fvEXT_remap_index 363 -#define ProgramLocalParameters4fvEXT_remap_index 364 -#define GetQueryObjecti64vEXT_remap_index 365 -#define GetQueryObjectui64vEXT_remap_index 366 +#define CopyBufferSubData_remap_index 154 +#define PolygonOffsetEXT_remap_index 155 +#define GetPixelTexGenParameterfvSGIS_remap_index 156 +#define GetPixelTexGenParameterivSGIS_remap_index 157 +#define PixelTexGenParameterfSGIS_remap_index 158 +#define PixelTexGenParameterfvSGIS_remap_index 159 +#define PixelTexGenParameteriSGIS_remap_index 160 +#define PixelTexGenParameterivSGIS_remap_index 161 +#define SampleMaskSGIS_remap_index 162 +#define SamplePatternSGIS_remap_index 163 +#define ColorPointerEXT_remap_index 164 +#define EdgeFlagPointerEXT_remap_index 165 +#define IndexPointerEXT_remap_index 166 +#define NormalPointerEXT_remap_index 167 +#define TexCoordPointerEXT_remap_index 168 +#define VertexPointerEXT_remap_index 169 +#define PointParameterfEXT_remap_index 170 +#define PointParameterfvEXT_remap_index 171 +#define LockArraysEXT_remap_index 172 +#define UnlockArraysEXT_remap_index 173 +#define CullParameterdvEXT_remap_index 174 +#define CullParameterfvEXT_remap_index 175 +#define SecondaryColor3bEXT_remap_index 176 +#define SecondaryColor3bvEXT_remap_index 177 +#define SecondaryColor3dEXT_remap_index 178 +#define SecondaryColor3dvEXT_remap_index 179 +#define SecondaryColor3fEXT_remap_index 180 +#define SecondaryColor3fvEXT_remap_index 181 +#define SecondaryColor3iEXT_remap_index 182 +#define SecondaryColor3ivEXT_remap_index 183 +#define SecondaryColor3sEXT_remap_index 184 +#define SecondaryColor3svEXT_remap_index 185 +#define SecondaryColor3ubEXT_remap_index 186 +#define SecondaryColor3ubvEXT_remap_index 187 +#define SecondaryColor3uiEXT_remap_index 188 +#define SecondaryColor3uivEXT_remap_index 189 +#define SecondaryColor3usEXT_remap_index 190 +#define SecondaryColor3usvEXT_remap_index 191 +#define SecondaryColorPointerEXT_remap_index 192 +#define MultiDrawArraysEXT_remap_index 193 +#define MultiDrawElementsEXT_remap_index 194 +#define FogCoordPointerEXT_remap_index 195 +#define FogCoorddEXT_remap_index 196 +#define FogCoorddvEXT_remap_index 197 +#define FogCoordfEXT_remap_index 198 +#define FogCoordfvEXT_remap_index 199 +#define PixelTexGenSGIX_remap_index 200 +#define BlendFuncSeparateEXT_remap_index 201 +#define FlushVertexArrayRangeNV_remap_index 202 +#define VertexArrayRangeNV_remap_index 203 +#define CombinerInputNV_remap_index 204 +#define CombinerOutputNV_remap_index 205 +#define CombinerParameterfNV_remap_index 206 +#define CombinerParameterfvNV_remap_index 207 +#define CombinerParameteriNV_remap_index 208 +#define CombinerParameterivNV_remap_index 209 +#define FinalCombinerInputNV_remap_index 210 +#define GetCombinerInputParameterfvNV_remap_index 211 +#define GetCombinerInputParameterivNV_remap_index 212 +#define GetCombinerOutputParameterfvNV_remap_index 213 +#define GetCombinerOutputParameterivNV_remap_index 214 +#define GetFinalCombinerInputParameterfvNV_remap_index 215 +#define GetFinalCombinerInputParameterivNV_remap_index 216 +#define ResizeBuffersMESA_remap_index 217 +#define WindowPos2dMESA_remap_index 218 +#define WindowPos2dvMESA_remap_index 219 +#define WindowPos2fMESA_remap_index 220 +#define WindowPos2fvMESA_remap_index 221 +#define WindowPos2iMESA_remap_index 222 +#define WindowPos2ivMESA_remap_index 223 +#define WindowPos2sMESA_remap_index 224 +#define WindowPos2svMESA_remap_index 225 +#define WindowPos3dMESA_remap_index 226 +#define WindowPos3dvMESA_remap_index 227 +#define WindowPos3fMESA_remap_index 228 +#define WindowPos3fvMESA_remap_index 229 +#define WindowPos3iMESA_remap_index 230 +#define WindowPos3ivMESA_remap_index 231 +#define WindowPos3sMESA_remap_index 232 +#define WindowPos3svMESA_remap_index 233 +#define WindowPos4dMESA_remap_index 234 +#define WindowPos4dvMESA_remap_index 235 +#define WindowPos4fMESA_remap_index 236 +#define WindowPos4fvMESA_remap_index 237 +#define WindowPos4iMESA_remap_index 238 +#define WindowPos4ivMESA_remap_index 239 +#define WindowPos4sMESA_remap_index 240 +#define WindowPos4svMESA_remap_index 241 +#define MultiModeDrawArraysIBM_remap_index 242 +#define MultiModeDrawElementsIBM_remap_index 243 +#define DeleteFencesNV_remap_index 244 +#define FinishFenceNV_remap_index 245 +#define GenFencesNV_remap_index 246 +#define GetFenceivNV_remap_index 247 +#define IsFenceNV_remap_index 248 +#define SetFenceNV_remap_index 249 +#define TestFenceNV_remap_index 250 +#define AreProgramsResidentNV_remap_index 251 +#define BindProgramNV_remap_index 252 +#define DeleteProgramsNV_remap_index 253 +#define ExecuteProgramNV_remap_index 254 +#define GenProgramsNV_remap_index 255 +#define GetProgramParameterdvNV_remap_index 256 +#define GetProgramParameterfvNV_remap_index 257 +#define GetProgramStringNV_remap_index 258 +#define GetProgramivNV_remap_index 259 +#define GetTrackMatrixivNV_remap_index 260 +#define GetVertexAttribPointervNV_remap_index 261 +#define GetVertexAttribdvNV_remap_index 262 +#define GetVertexAttribfvNV_remap_index 263 +#define GetVertexAttribivNV_remap_index 264 +#define IsProgramNV_remap_index 265 +#define LoadProgramNV_remap_index 266 +#define ProgramParameters4dvNV_remap_index 267 +#define ProgramParameters4fvNV_remap_index 268 +#define RequestResidentProgramsNV_remap_index 269 +#define TrackMatrixNV_remap_index 270 +#define VertexAttrib1dNV_remap_index 271 +#define VertexAttrib1dvNV_remap_index 272 +#define VertexAttrib1fNV_remap_index 273 +#define VertexAttrib1fvNV_remap_index 274 +#define VertexAttrib1sNV_remap_index 275 +#define VertexAttrib1svNV_remap_index 276 +#define VertexAttrib2dNV_remap_index 277 +#define VertexAttrib2dvNV_remap_index 278 +#define VertexAttrib2fNV_remap_index 279 +#define VertexAttrib2fvNV_remap_index 280 +#define VertexAttrib2sNV_remap_index 281 +#define VertexAttrib2svNV_remap_index 282 +#define VertexAttrib3dNV_remap_index 283 +#define VertexAttrib3dvNV_remap_index 284 +#define VertexAttrib3fNV_remap_index 285 +#define VertexAttrib3fvNV_remap_index 286 +#define VertexAttrib3sNV_remap_index 287 +#define VertexAttrib3svNV_remap_index 288 +#define VertexAttrib4dNV_remap_index 289 +#define VertexAttrib4dvNV_remap_index 290 +#define VertexAttrib4fNV_remap_index 291 +#define VertexAttrib4fvNV_remap_index 292 +#define VertexAttrib4sNV_remap_index 293 +#define VertexAttrib4svNV_remap_index 294 +#define VertexAttrib4ubNV_remap_index 295 +#define VertexAttrib4ubvNV_remap_index 296 +#define VertexAttribPointerNV_remap_index 297 +#define VertexAttribs1dvNV_remap_index 298 +#define VertexAttribs1fvNV_remap_index 299 +#define VertexAttribs1svNV_remap_index 300 +#define VertexAttribs2dvNV_remap_index 301 +#define VertexAttribs2fvNV_remap_index 302 +#define VertexAttribs2svNV_remap_index 303 +#define VertexAttribs3dvNV_remap_index 304 +#define VertexAttribs3fvNV_remap_index 305 +#define VertexAttribs3svNV_remap_index 306 +#define VertexAttribs4dvNV_remap_index 307 +#define VertexAttribs4fvNV_remap_index 308 +#define VertexAttribs4svNV_remap_index 309 +#define VertexAttribs4ubvNV_remap_index 310 +#define GetTexBumpParameterfvATI_remap_index 311 +#define GetTexBumpParameterivATI_remap_index 312 +#define TexBumpParameterfvATI_remap_index 313 +#define TexBumpParameterivATI_remap_index 314 +#define AlphaFragmentOp1ATI_remap_index 315 +#define AlphaFragmentOp2ATI_remap_index 316 +#define AlphaFragmentOp3ATI_remap_index 317 +#define BeginFragmentShaderATI_remap_index 318 +#define BindFragmentShaderATI_remap_index 319 +#define ColorFragmentOp1ATI_remap_index 320 +#define ColorFragmentOp2ATI_remap_index 321 +#define ColorFragmentOp3ATI_remap_index 322 +#define DeleteFragmentShaderATI_remap_index 323 +#define EndFragmentShaderATI_remap_index 324 +#define GenFragmentShadersATI_remap_index 325 +#define PassTexCoordATI_remap_index 326 +#define SampleMapATI_remap_index 327 +#define SetFragmentShaderConstantATI_remap_index 328 +#define PointParameteriNV_remap_index 329 +#define PointParameterivNV_remap_index 330 +#define ActiveStencilFaceEXT_remap_index 331 +#define BindVertexArrayAPPLE_remap_index 332 +#define DeleteVertexArraysAPPLE_remap_index 333 +#define GenVertexArraysAPPLE_remap_index 334 +#define IsVertexArrayAPPLE_remap_index 335 +#define GetProgramNamedParameterdvNV_remap_index 336 +#define GetProgramNamedParameterfvNV_remap_index 337 +#define ProgramNamedParameter4dNV_remap_index 338 +#define ProgramNamedParameter4dvNV_remap_index 339 +#define ProgramNamedParameter4fNV_remap_index 340 +#define ProgramNamedParameter4fvNV_remap_index 341 +#define DepthBoundsEXT_remap_index 342 +#define BlendEquationSeparateEXT_remap_index 343 +#define BindFramebufferEXT_remap_index 344 +#define BindRenderbufferEXT_remap_index 345 +#define CheckFramebufferStatusEXT_remap_index 346 +#define DeleteFramebuffersEXT_remap_index 347 +#define DeleteRenderbuffersEXT_remap_index 348 +#define FramebufferRenderbufferEXT_remap_index 349 +#define FramebufferTexture1DEXT_remap_index 350 +#define FramebufferTexture2DEXT_remap_index 351 +#define FramebufferTexture3DEXT_remap_index 352 +#define GenFramebuffersEXT_remap_index 353 +#define GenRenderbuffersEXT_remap_index 354 +#define GenerateMipmapEXT_remap_index 355 +#define GetFramebufferAttachmentParameterivEXT_remap_index 356 +#define GetRenderbufferParameterivEXT_remap_index 357 +#define IsFramebufferEXT_remap_index 358 +#define IsRenderbufferEXT_remap_index 359 +#define RenderbufferStorageEXT_remap_index 360 +#define BlitFramebufferEXT_remap_index 361 +#define FramebufferTextureLayerEXT_remap_index 362 +#define StencilFuncSeparateATI_remap_index 363 +#define ProgramEnvParameters4fvEXT_remap_index 364 +#define ProgramLocalParameters4fvEXT_remap_index 365 +#define GetQueryObjecti64vEXT_remap_index 366 +#define GetQueryObjectui64vEXT_remap_index 367 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3221,6 +3225,9 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_RenderbufferStorageMultisample(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], parameters) #define GET_RenderbufferStorageMultisample(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]) #define SET_RenderbufferStorageMultisample(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], fn) +#define CALL_CopyBufferSubData(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)), driDispatchRemapTable[CopyBufferSubData_remap_index], parameters) +#define GET_CopyBufferSubData(disp) GET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index]) +#define SET_CopyBufferSubData(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index], fn) #define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) #define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) #define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index 14f305f025..e29e2e3bfa 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -594,220 +594,221 @@ #define _gloffset_GetAttribLocationARB 559 #define _gloffset_DrawBuffersARB 560 #define _gloffset_RenderbufferStorageMultisample 561 -#define _gloffset_PolygonOffsetEXT 562 -#define _gloffset_GetPixelTexGenParameterfvSGIS 563 -#define _gloffset_GetPixelTexGenParameterivSGIS 564 -#define _gloffset_PixelTexGenParameterfSGIS 565 -#define _gloffset_PixelTexGenParameterfvSGIS 566 -#define _gloffset_PixelTexGenParameteriSGIS 567 -#define _gloffset_PixelTexGenParameterivSGIS 568 -#define _gloffset_SampleMaskSGIS 569 -#define _gloffset_SamplePatternSGIS 570 -#define _gloffset_ColorPointerEXT 571 -#define _gloffset_EdgeFlagPointerEXT 572 -#define _gloffset_IndexPointerEXT 573 -#define _gloffset_NormalPointerEXT 574 -#define _gloffset_TexCoordPointerEXT 575 -#define _gloffset_VertexPointerEXT 576 -#define _gloffset_PointParameterfEXT 577 -#define _gloffset_PointParameterfvEXT 578 -#define _gloffset_LockArraysEXT 579 -#define _gloffset_UnlockArraysEXT 580 -#define _gloffset_CullParameterdvEXT 581 -#define _gloffset_CullParameterfvEXT 582 -#define _gloffset_SecondaryColor3bEXT 583 -#define _gloffset_SecondaryColor3bvEXT 584 -#define _gloffset_SecondaryColor3dEXT 585 -#define _gloffset_SecondaryColor3dvEXT 586 -#define _gloffset_SecondaryColor3fEXT 587 -#define _gloffset_SecondaryColor3fvEXT 588 -#define _gloffset_SecondaryColor3iEXT 589 -#define _gloffset_SecondaryColor3ivEXT 590 -#define _gloffset_SecondaryColor3sEXT 591 -#define _gloffset_SecondaryColor3svEXT 592 -#define _gloffset_SecondaryColor3ubEXT 593 -#define _gloffset_SecondaryColor3ubvEXT 594 -#define _gloffset_SecondaryColor3uiEXT 595 -#define _gloffset_SecondaryColor3uivEXT 596 -#define _gloffset_SecondaryColor3usEXT 597 -#define _gloffset_SecondaryColor3usvEXT 598 -#define _gloffset_SecondaryColorPointerEXT 599 -#define _gloffset_MultiDrawArraysEXT 600 -#define _gloffset_MultiDrawElementsEXT 601 -#define _gloffset_FogCoordPointerEXT 602 -#define _gloffset_FogCoorddEXT 603 -#define _gloffset_FogCoorddvEXT 604 -#define _gloffset_FogCoordfEXT 605 -#define _gloffset_FogCoordfvEXT 606 -#define _gloffset_PixelTexGenSGIX 607 -#define _gloffset_BlendFuncSeparateEXT 608 -#define _gloffset_FlushVertexArrayRangeNV 609 -#define _gloffset_VertexArrayRangeNV 610 -#define _gloffset_CombinerInputNV 611 -#define _gloffset_CombinerOutputNV 612 -#define _gloffset_CombinerParameterfNV 613 -#define _gloffset_CombinerParameterfvNV 614 -#define _gloffset_CombinerParameteriNV 615 -#define _gloffset_CombinerParameterivNV 616 -#define _gloffset_FinalCombinerInputNV 617 -#define _gloffset_GetCombinerInputParameterfvNV 618 -#define _gloffset_GetCombinerInputParameterivNV 619 -#define _gloffset_GetCombinerOutputParameterfvNV 620 -#define _gloffset_GetCombinerOutputParameterivNV 621 -#define _gloffset_GetFinalCombinerInputParameterfvNV 622 -#define _gloffset_GetFinalCombinerInputParameterivNV 623 -#define _gloffset_ResizeBuffersMESA 624 -#define _gloffset_WindowPos2dMESA 625 -#define _gloffset_WindowPos2dvMESA 626 -#define _gloffset_WindowPos2fMESA 627 -#define _gloffset_WindowPos2fvMESA 628 -#define _gloffset_WindowPos2iMESA 629 -#define _gloffset_WindowPos2ivMESA 630 -#define _gloffset_WindowPos2sMESA 631 -#define _gloffset_WindowPos2svMESA 632 -#define _gloffset_WindowPos3dMESA 633 -#define _gloffset_WindowPos3dvMESA 634 -#define _gloffset_WindowPos3fMESA 635 -#define _gloffset_WindowPos3fvMESA 636 -#define _gloffset_WindowPos3iMESA 637 -#define _gloffset_WindowPos3ivMESA 638 -#define _gloffset_WindowPos3sMESA 639 -#define _gloffset_WindowPos3svMESA 640 -#define _gloffset_WindowPos4dMESA 641 -#define _gloffset_WindowPos4dvMESA 642 -#define _gloffset_WindowPos4fMESA 643 -#define _gloffset_WindowPos4fvMESA 644 -#define _gloffset_WindowPos4iMESA 645 -#define _gloffset_WindowPos4ivMESA 646 -#define _gloffset_WindowPos4sMESA 647 -#define _gloffset_WindowPos4svMESA 648 -#define _gloffset_MultiModeDrawArraysIBM 649 -#define _gloffset_MultiModeDrawElementsIBM 650 -#define _gloffset_DeleteFencesNV 651 -#define _gloffset_FinishFenceNV 652 -#define _gloffset_GenFencesNV 653 -#define _gloffset_GetFenceivNV 654 -#define _gloffset_IsFenceNV 655 -#define _gloffset_SetFenceNV 656 -#define _gloffset_TestFenceNV 657 -#define _gloffset_AreProgramsResidentNV 658 -#define _gloffset_BindProgramNV 659 -#define _gloffset_DeleteProgramsNV 660 -#define _gloffset_ExecuteProgramNV 661 -#define _gloffset_GenProgramsNV 662 -#define _gloffset_GetProgramParameterdvNV 663 -#define _gloffset_GetProgramParameterfvNV 664 -#define _gloffset_GetProgramStringNV 665 -#define _gloffset_GetProgramivNV 666 -#define _gloffset_GetTrackMatrixivNV 667 -#define _gloffset_GetVertexAttribPointervNV 668 -#define _gloffset_GetVertexAttribdvNV 669 -#define _gloffset_GetVertexAttribfvNV 670 -#define _gloffset_GetVertexAttribivNV 671 -#define _gloffset_IsProgramNV 672 -#define _gloffset_LoadProgramNV 673 -#define _gloffset_ProgramParameters4dvNV 674 -#define _gloffset_ProgramParameters4fvNV 675 -#define _gloffset_RequestResidentProgramsNV 676 -#define _gloffset_TrackMatrixNV 677 -#define _gloffset_VertexAttrib1dNV 678 -#define _gloffset_VertexAttrib1dvNV 679 -#define _gloffset_VertexAttrib1fNV 680 -#define _gloffset_VertexAttrib1fvNV 681 -#define _gloffset_VertexAttrib1sNV 682 -#define _gloffset_VertexAttrib1svNV 683 -#define _gloffset_VertexAttrib2dNV 684 -#define _gloffset_VertexAttrib2dvNV 685 -#define _gloffset_VertexAttrib2fNV 686 -#define _gloffset_VertexAttrib2fvNV 687 -#define _gloffset_VertexAttrib2sNV 688 -#define _gloffset_VertexAttrib2svNV 689 -#define _gloffset_VertexAttrib3dNV 690 -#define _gloffset_VertexAttrib3dvNV 691 -#define _gloffset_VertexAttrib3fNV 692 -#define _gloffset_VertexAttrib3fvNV 693 -#define _gloffset_VertexAttrib3sNV 694 -#define _gloffset_VertexAttrib3svNV 695 -#define _gloffset_VertexAttrib4dNV 696 -#define _gloffset_VertexAttrib4dvNV 697 -#define _gloffset_VertexAttrib4fNV 698 -#define _gloffset_VertexAttrib4fvNV 699 -#define _gloffset_VertexAttrib4sNV 700 -#define _gloffset_VertexAttrib4svNV 701 -#define _gloffset_VertexAttrib4ubNV 702 -#define _gloffset_VertexAttrib4ubvNV 703 -#define _gloffset_VertexAttribPointerNV 704 -#define _gloffset_VertexAttribs1dvNV 705 -#define _gloffset_VertexAttribs1fvNV 706 -#define _gloffset_VertexAttribs1svNV 707 -#define _gloffset_VertexAttribs2dvNV 708 -#define _gloffset_VertexAttribs2fvNV 709 -#define _gloffset_VertexAttribs2svNV 710 -#define _gloffset_VertexAttribs3dvNV 711 -#define _gloffset_VertexAttribs3fvNV 712 -#define _gloffset_VertexAttribs3svNV 713 -#define _gloffset_VertexAttribs4dvNV 714 -#define _gloffset_VertexAttribs4fvNV 715 -#define _gloffset_VertexAttribs4svNV 716 -#define _gloffset_VertexAttribs4ubvNV 717 -#define _gloffset_GetTexBumpParameterfvATI 718 -#define _gloffset_GetTexBumpParameterivATI 719 -#define _gloffset_TexBumpParameterfvATI 720 -#define _gloffset_TexBumpParameterivATI 721 -#define _gloffset_AlphaFragmentOp1ATI 722 -#define _gloffset_AlphaFragmentOp2ATI 723 -#define _gloffset_AlphaFragmentOp3ATI 724 -#define _gloffset_BeginFragmentShaderATI 725 -#define _gloffset_BindFragmentShaderATI 726 -#define _gloffset_ColorFragmentOp1ATI 727 -#define _gloffset_ColorFragmentOp2ATI 728 -#define _gloffset_ColorFragmentOp3ATI 729 -#define _gloffset_DeleteFragmentShaderATI 730 -#define _gloffset_EndFragmentShaderATI 731 -#define _gloffset_GenFragmentShadersATI 732 -#define _gloffset_PassTexCoordATI 733 -#define _gloffset_SampleMapATI 734 -#define _gloffset_SetFragmentShaderConstantATI 735 -#define _gloffset_PointParameteriNV 736 -#define _gloffset_PointParameterivNV 737 -#define _gloffset_ActiveStencilFaceEXT 738 -#define _gloffset_BindVertexArrayAPPLE 739 -#define _gloffset_DeleteVertexArraysAPPLE 740 -#define _gloffset_GenVertexArraysAPPLE 741 -#define _gloffset_IsVertexArrayAPPLE 742 -#define _gloffset_GetProgramNamedParameterdvNV 743 -#define _gloffset_GetProgramNamedParameterfvNV 744 -#define _gloffset_ProgramNamedParameter4dNV 745 -#define _gloffset_ProgramNamedParameter4dvNV 746 -#define _gloffset_ProgramNamedParameter4fNV 747 -#define _gloffset_ProgramNamedParameter4fvNV 748 -#define _gloffset_DepthBoundsEXT 749 -#define _gloffset_BlendEquationSeparateEXT 750 -#define _gloffset_BindFramebufferEXT 751 -#define _gloffset_BindRenderbufferEXT 752 -#define _gloffset_CheckFramebufferStatusEXT 753 -#define _gloffset_DeleteFramebuffersEXT 754 -#define _gloffset_DeleteRenderbuffersEXT 755 -#define _gloffset_FramebufferRenderbufferEXT 756 -#define _gloffset_FramebufferTexture1DEXT 757 -#define _gloffset_FramebufferTexture2DEXT 758 -#define _gloffset_FramebufferTexture3DEXT 759 -#define _gloffset_GenFramebuffersEXT 760 -#define _gloffset_GenRenderbuffersEXT 761 -#define _gloffset_GenerateMipmapEXT 762 -#define _gloffset_GetFramebufferAttachmentParameterivEXT 763 -#define _gloffset_GetRenderbufferParameterivEXT 764 -#define _gloffset_IsFramebufferEXT 765 -#define _gloffset_IsRenderbufferEXT 766 -#define _gloffset_RenderbufferStorageEXT 767 -#define _gloffset_BlitFramebufferEXT 768 -#define _gloffset_FramebufferTextureLayerEXT 769 -#define _gloffset_StencilFuncSeparateATI 770 -#define _gloffset_ProgramEnvParameters4fvEXT 771 -#define _gloffset_ProgramLocalParameters4fvEXT 772 -#define _gloffset_GetQueryObjecti64vEXT 773 -#define _gloffset_GetQueryObjectui64vEXT 774 -#define _gloffset_FIRST_DYNAMIC 775 +#define _gloffset_CopyBufferSubData 562 +#define _gloffset_PolygonOffsetEXT 563 +#define _gloffset_GetPixelTexGenParameterfvSGIS 564 +#define _gloffset_GetPixelTexGenParameterivSGIS 565 +#define _gloffset_PixelTexGenParameterfSGIS 566 +#define _gloffset_PixelTexGenParameterfvSGIS 567 +#define _gloffset_PixelTexGenParameteriSGIS 568 +#define _gloffset_PixelTexGenParameterivSGIS 569 +#define _gloffset_SampleMaskSGIS 570 +#define _gloffset_SamplePatternSGIS 571 +#define _gloffset_ColorPointerEXT 572 +#define _gloffset_EdgeFlagPointerEXT 573 +#define _gloffset_IndexPointerEXT 574 +#define _gloffset_NormalPointerEXT 575 +#define _gloffset_TexCoordPointerEXT 576 +#define _gloffset_VertexPointerEXT 577 +#define _gloffset_PointParameterfEXT 578 +#define _gloffset_PointParameterfvEXT 579 +#define _gloffset_LockArraysEXT 580 +#define _gloffset_UnlockArraysEXT 581 +#define _gloffset_CullParameterdvEXT 582 +#define _gloffset_CullParameterfvEXT 583 +#define _gloffset_SecondaryColor3bEXT 584 +#define _gloffset_SecondaryColor3bvEXT 585 +#define _gloffset_SecondaryColor3dEXT 586 +#define _gloffset_SecondaryColor3dvEXT 587 +#define _gloffset_SecondaryColor3fEXT 588 +#define _gloffset_SecondaryColor3fvEXT 589 +#define _gloffset_SecondaryColor3iEXT 590 +#define _gloffset_SecondaryColor3ivEXT 591 +#define _gloffset_SecondaryColor3sEXT 592 +#define _gloffset_SecondaryColor3svEXT 593 +#define _gloffset_SecondaryColor3ubEXT 594 +#define _gloffset_SecondaryColor3ubvEXT 595 +#define _gloffset_SecondaryColor3uiEXT 596 +#define _gloffset_SecondaryColor3uivEXT 597 +#define _gloffset_SecondaryColor3usEXT 598 +#define _gloffset_SecondaryColor3usvEXT 599 +#define _gloffset_SecondaryColorPointerEXT 600 +#define _gloffset_MultiDrawArraysEXT 601 +#define _gloffset_MultiDrawElementsEXT 602 +#define _gloffset_FogCoordPointerEXT 603 +#define _gloffset_FogCoorddEXT 604 +#define _gloffset_FogCoorddvEXT 605 +#define _gloffset_FogCoordfEXT 606 +#define _gloffset_FogCoordfvEXT 607 +#define _gloffset_PixelTexGenSGIX 608 +#define _gloffset_BlendFuncSeparateEXT 609 +#define _gloffset_FlushVertexArrayRangeNV 610 +#define _gloffset_VertexArrayRangeNV 611 +#define _gloffset_CombinerInputNV 612 +#define _gloffset_CombinerOutputNV 613 +#define _gloffset_CombinerParameterfNV 614 +#define _gloffset_CombinerParameterfvNV 615 +#define _gloffset_CombinerParameteriNV 616 +#define _gloffset_CombinerParameterivNV 617 +#define _gloffset_FinalCombinerInputNV 618 +#define _gloffset_GetCombinerInputParameterfvNV 619 +#define _gloffset_GetCombinerInputParameterivNV 620 +#define _gloffset_GetCombinerOutputParameterfvNV 621 +#define _gloffset_GetCombinerOutputParameterivNV 622 +#define _gloffset_GetFinalCombinerInputParameterfvNV 623 +#define _gloffset_GetFinalCombinerInputParameterivNV 624 +#define _gloffset_ResizeBuffersMESA 625 +#define _gloffset_WindowPos2dMESA 626 +#define _gloffset_WindowPos2dvMESA 627 +#define _gloffset_WindowPos2fMESA 628 +#define _gloffset_WindowPos2fvMESA 629 +#define _gloffset_WindowPos2iMESA 630 +#define _gloffset_WindowPos2ivMESA 631 +#define _gloffset_WindowPos2sMESA 632 +#define _gloffset_WindowPos2svMESA 633 +#define _gloffset_WindowPos3dMESA 634 +#define _gloffset_WindowPos3dvMESA 635 +#define _gloffset_WindowPos3fMESA 636 +#define _gloffset_WindowPos3fvMESA 637 +#define _gloffset_WindowPos3iMESA 638 +#define _gloffset_WindowPos3ivMESA 639 +#define _gloffset_WindowPos3sMESA 640 +#define _gloffset_WindowPos3svMESA 641 +#define _gloffset_WindowPos4dMESA 642 +#define _gloffset_WindowPos4dvMESA 643 +#define _gloffset_WindowPos4fMESA 644 +#define _gloffset_WindowPos4fvMESA 645 +#define _gloffset_WindowPos4iMESA 646 +#define _gloffset_WindowPos4ivMESA 647 +#define _gloffset_WindowPos4sMESA 648 +#define _gloffset_WindowPos4svMESA 649 +#define _gloffset_MultiModeDrawArraysIBM 650 +#define _gloffset_MultiModeDrawElementsIBM 651 +#define _gloffset_DeleteFencesNV 652 +#define _gloffset_FinishFenceNV 653 +#define _gloffset_GenFencesNV 654 +#define _gloffset_GetFenceivNV 655 +#define _gloffset_IsFenceNV 656 +#define _gloffset_SetFenceNV 657 +#define _gloffset_TestFenceNV 658 +#define _gloffset_AreProgramsResidentNV 659 +#define _gloffset_BindProgramNV 660 +#define _gloffset_DeleteProgramsNV 661 +#define _gloffset_ExecuteProgramNV 662 +#define _gloffset_GenProgramsNV 663 +#define _gloffset_GetProgramParameterdvNV 664 +#define _gloffset_GetProgramParameterfvNV 665 +#define _gloffset_GetProgramStringNV 666 +#define _gloffset_GetProgramivNV 667 +#define _gloffset_GetTrackMatrixivNV 668 +#define _gloffset_GetVertexAttribPointervNV 669 +#define _gloffset_GetVertexAttribdvNV 670 +#define _gloffset_GetVertexAttribfvNV 671 +#define _gloffset_GetVertexAttribivNV 672 +#define _gloffset_IsProgramNV 673 +#define _gloffset_LoadProgramNV 674 +#define _gloffset_ProgramParameters4dvNV 675 +#define _gloffset_ProgramParameters4fvNV 676 +#define _gloffset_RequestResidentProgramsNV 677 +#define _gloffset_TrackMatrixNV 678 +#define _gloffset_VertexAttrib1dNV 679 +#define _gloffset_VertexAttrib1dvNV 680 +#define _gloffset_VertexAttrib1fNV 681 +#define _gloffset_VertexAttrib1fvNV 682 +#define _gloffset_VertexAttrib1sNV 683 +#define _gloffset_VertexAttrib1svNV 684 +#define _gloffset_VertexAttrib2dNV 685 +#define _gloffset_VertexAttrib2dvNV 686 +#define _gloffset_VertexAttrib2fNV 687 +#define _gloffset_VertexAttrib2fvNV 688 +#define _gloffset_VertexAttrib2sNV 689 +#define _gloffset_VertexAttrib2svNV 690 +#define _gloffset_VertexAttrib3dNV 691 +#define _gloffset_VertexAttrib3dvNV 692 +#define _gloffset_VertexAttrib3fNV 693 +#define _gloffset_VertexAttrib3fvNV 694 +#define _gloffset_VertexAttrib3sNV 695 +#define _gloffset_VertexAttrib3svNV 696 +#define _gloffset_VertexAttrib4dNV 697 +#define _gloffset_VertexAttrib4dvNV 698 +#define _gloffset_VertexAttrib4fNV 699 +#define _gloffset_VertexAttrib4fvNV 700 +#define _gloffset_VertexAttrib4sNV 701 +#define _gloffset_VertexAttrib4svNV 702 +#define _gloffset_VertexAttrib4ubNV 703 +#define _gloffset_VertexAttrib4ubvNV 704 +#define _gloffset_VertexAttribPointerNV 705 +#define _gloffset_VertexAttribs1dvNV 706 +#define _gloffset_VertexAttribs1fvNV 707 +#define _gloffset_VertexAttribs1svNV 708 +#define _gloffset_VertexAttribs2dvNV 709 +#define _gloffset_VertexAttribs2fvNV 710 +#define _gloffset_VertexAttribs2svNV 711 +#define _gloffset_VertexAttribs3dvNV 712 +#define _gloffset_VertexAttribs3fvNV 713 +#define _gloffset_VertexAttribs3svNV 714 +#define _gloffset_VertexAttribs4dvNV 715 +#define _gloffset_VertexAttribs4fvNV 716 +#define _gloffset_VertexAttribs4svNV 717 +#define _gloffset_VertexAttribs4ubvNV 718 +#define _gloffset_GetTexBumpParameterfvATI 719 +#define _gloffset_GetTexBumpParameterivATI 720 +#define _gloffset_TexBumpParameterfvATI 721 +#define _gloffset_TexBumpParameterivATI 722 +#define _gloffset_AlphaFragmentOp1ATI 723 +#define _gloffset_AlphaFragmentOp2ATI 724 +#define _gloffset_AlphaFragmentOp3ATI 725 +#define _gloffset_BeginFragmentShaderATI 726 +#define _gloffset_BindFragmentShaderATI 727 +#define _gloffset_ColorFragmentOp1ATI 728 +#define _gloffset_ColorFragmentOp2ATI 729 +#define _gloffset_ColorFragmentOp3ATI 730 +#define _gloffset_DeleteFragmentShaderATI 731 +#define _gloffset_EndFragmentShaderATI 732 +#define _gloffset_GenFragmentShadersATI 733 +#define _gloffset_PassTexCoordATI 734 +#define _gloffset_SampleMapATI 735 +#define _gloffset_SetFragmentShaderConstantATI 736 +#define _gloffset_PointParameteriNV 737 +#define _gloffset_PointParameterivNV 738 +#define _gloffset_ActiveStencilFaceEXT 739 +#define _gloffset_BindVertexArrayAPPLE 740 +#define _gloffset_DeleteVertexArraysAPPLE 741 +#define _gloffset_GenVertexArraysAPPLE 742 +#define _gloffset_IsVertexArrayAPPLE 743 +#define _gloffset_GetProgramNamedParameterdvNV 744 +#define _gloffset_GetProgramNamedParameterfvNV 745 +#define _gloffset_ProgramNamedParameter4dNV 746 +#define _gloffset_ProgramNamedParameter4dvNV 747 +#define _gloffset_ProgramNamedParameter4fNV 748 +#define _gloffset_ProgramNamedParameter4fvNV 749 +#define _gloffset_DepthBoundsEXT 750 +#define _gloffset_BlendEquationSeparateEXT 751 +#define _gloffset_BindFramebufferEXT 752 +#define _gloffset_BindRenderbufferEXT 753 +#define _gloffset_CheckFramebufferStatusEXT 754 +#define _gloffset_DeleteFramebuffersEXT 755 +#define _gloffset_DeleteRenderbuffersEXT 756 +#define _gloffset_FramebufferRenderbufferEXT 757 +#define _gloffset_FramebufferTexture1DEXT 758 +#define _gloffset_FramebufferTexture2DEXT 759 +#define _gloffset_FramebufferTexture3DEXT 760 +#define _gloffset_GenFramebuffersEXT 761 +#define _gloffset_GenRenderbuffersEXT 762 +#define _gloffset_GenerateMipmapEXT 763 +#define _gloffset_GetFramebufferAttachmentParameterivEXT 764 +#define _gloffset_GetRenderbufferParameterivEXT 765 +#define _gloffset_IsFramebufferEXT 766 +#define _gloffset_IsRenderbufferEXT 767 +#define _gloffset_RenderbufferStorageEXT 768 +#define _gloffset_BlitFramebufferEXT 769 +#define _gloffset_FramebufferTextureLayerEXT 770 +#define _gloffset_StencilFuncSeparateATI 771 +#define _gloffset_ProgramEnvParameters4fvEXT 772 +#define _gloffset_ProgramLocalParameters4fvEXT 773 +#define _gloffset_GetQueryObjecti64vEXT 774 +#define _gloffset_GetQueryObjectui64vEXT 775 +#define _gloffset_FIRST_DYNAMIC 776 #else @@ -965,6 +966,7 @@ #define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] #define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index] #define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index] +#define _gloffset_CopyBufferSubData driDispatchRemapTable[CopyBufferSubData_remap_index] #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index] #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index] #define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 9ecb036461..c782c90087 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -602,219 +602,220 @@ struct _glapi_table GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 559 */ void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 560 */ void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 561 */ - void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 562 */ - void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 563 */ - void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 564 */ - void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 565 */ - void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 566 */ - void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 567 */ - void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 568 */ - void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 569 */ - void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 570 */ - void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 571 */ - void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 572 */ - void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 573 */ - void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 574 */ - void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 575 */ - void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 576 */ - void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 577 */ - void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 578 */ - void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 579 */ - void (GLAPIENTRYP UnlockArraysEXT)(void); /* 580 */ - void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 581 */ - void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 582 */ - void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 583 */ - void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 584 */ - void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 585 */ - void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 586 */ - void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 587 */ - void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 588 */ - void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 589 */ - void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 590 */ - void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 591 */ - void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 592 */ - void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 593 */ - void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 594 */ - void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 595 */ - void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 596 */ - void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 597 */ - void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 598 */ - void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 599 */ - void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 600 */ - void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 601 */ - void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ - void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 603 */ - void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 604 */ - void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 605 */ - void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 606 */ - void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 607 */ - void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 608 */ - void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 609 */ - void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 610 */ - void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 611 */ - void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 612 */ - void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 613 */ - void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 614 */ - void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 615 */ - void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 616 */ - void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 617 */ - void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 618 */ - void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 619 */ - void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 620 */ - void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 621 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 622 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 623 */ - void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 624 */ - void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 625 */ - void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 626 */ - void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 627 */ - void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 628 */ - void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 629 */ - void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 630 */ - void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 631 */ - void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 632 */ - void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 633 */ - void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 634 */ - void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 635 */ - void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 636 */ - void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 637 */ - void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 638 */ - void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 639 */ - void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 640 */ - void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 641 */ - void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 642 */ - void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 643 */ - void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 644 */ - void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 645 */ - void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 646 */ - void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 647 */ - void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 648 */ - void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 649 */ - void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 650 */ - void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 651 */ - void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 652 */ - void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 653 */ - void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 654 */ - GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 655 */ - void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 656 */ - GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 657 */ - GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 658 */ - void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 659 */ - void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 660 */ - void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 661 */ - void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 662 */ - void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 663 */ - void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 664 */ - void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 665 */ - void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 666 */ - void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 667 */ - void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 668 */ - void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 669 */ - void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 670 */ - void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 671 */ - GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 672 */ - void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 673 */ - void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 674 */ - void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 675 */ - void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 676 */ - void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 677 */ - void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 678 */ - void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 679 */ - void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 680 */ - void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 681 */ - void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 682 */ - void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 683 */ - void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 684 */ - void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 685 */ - void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 686 */ - void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 687 */ - void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 688 */ - void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 689 */ - void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 690 */ - void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 691 */ - void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 692 */ - void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 693 */ - void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 694 */ - void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 695 */ - void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 696 */ - void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 697 */ - void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 698 */ - void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 699 */ - void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 700 */ - void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 701 */ - void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 702 */ - void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 703 */ - void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 704 */ - void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 705 */ - void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 706 */ - void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 707 */ - void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 708 */ - void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 709 */ - void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 710 */ - void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 711 */ - void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 712 */ - void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 713 */ - void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 714 */ - void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 715 */ - void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 716 */ - void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 717 */ - void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 718 */ - void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 719 */ - void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 720 */ - void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 721 */ - void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 722 */ - void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 723 */ - void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 724 */ - void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 725 */ - void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 726 */ - void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 727 */ - void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 728 */ - void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 729 */ - void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 730 */ - void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 731 */ - GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 732 */ - void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 733 */ - void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 734 */ - void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 735 */ - void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 736 */ - void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 737 */ - void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 738 */ - void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 739 */ - void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 740 */ - void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 741 */ - GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 742 */ - void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 743 */ - void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 744 */ - void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 745 */ - void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 746 */ - void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 747 */ - void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 748 */ - void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 749 */ - void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 750 */ - void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 751 */ - void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 752 */ - GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 753 */ - void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 754 */ - void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 755 */ - void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 756 */ - void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 757 */ - void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 758 */ - void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 759 */ - void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 760 */ - void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 761 */ - void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 762 */ - void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 763 */ - void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 764 */ - GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 765 */ - GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 766 */ - void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 767 */ - void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 768 */ - void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 769 */ - void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 770 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */ + void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 562 */ + void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 563 */ + void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 564 */ + void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 565 */ + void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 566 */ + void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 567 */ + void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 568 */ + void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 569 */ + void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 570 */ + void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 571 */ + void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 572 */ + void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 573 */ + void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 574 */ + void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 575 */ + void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 576 */ + void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 577 */ + void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 578 */ + void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 579 */ + void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 580 */ + void (GLAPIENTRYP UnlockArraysEXT)(void); /* 581 */ + void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 582 */ + void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 583 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 584 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 585 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 586 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 587 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 588 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 589 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 590 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 591 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 592 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 593 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 594 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 595 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 596 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 597 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 598 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 599 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 600 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 601 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 602 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 603 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 604 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 605 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 606 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 607 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 608 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 609 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 610 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 611 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 612 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 613 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 614 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 615 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 616 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 617 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 618 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 619 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 620 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 621 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 622 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 623 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 624 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 625 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 626 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 627 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 628 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 629 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 630 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 631 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 632 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 633 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 634 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 635 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 636 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 637 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 638 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 639 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 640 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 641 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 642 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 643 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 644 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 645 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 646 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 647 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 648 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 649 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 650 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 651 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 652 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 653 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 654 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 655 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 656 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 657 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 658 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 659 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 660 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 661 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 662 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 663 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 664 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 665 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 666 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 667 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 668 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 669 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 670 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 671 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 672 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 673 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 674 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 675 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 676 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 677 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 678 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 679 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 680 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 681 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 682 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 683 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 684 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 685 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 686 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 687 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 688 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 689 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 690 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 691 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 692 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 693 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 694 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 695 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 696 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 697 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 698 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 699 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 700 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 701 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 702 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 703 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 704 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 705 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 706 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 707 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 708 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 709 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 710 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 711 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 712 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 713 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 714 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 715 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 716 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 717 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 718 */ + void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 719 */ + void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 720 */ + void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 721 */ + void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 722 */ + void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 723 */ + void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 724 */ + void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 725 */ + void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 726 */ + void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 727 */ + void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 728 */ + void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 729 */ + void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 730 */ + void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 731 */ + void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 732 */ + GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 733 */ + void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 734 */ + void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 735 */ + void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 736 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 737 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 738 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 739 */ + void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 740 */ + void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 741 */ + void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 742 */ + GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 743 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 744 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 745 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 746 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 747 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 748 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 749 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 750 */ + void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 751 */ + void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 752 */ + void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 753 */ + GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 754 */ + void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 755 */ + void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 756 */ + void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 757 */ + void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 758 */ + void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 759 */ + void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 760 */ + void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 761 */ + void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 762 */ + void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 763 */ + void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 764 */ + void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 765 */ + GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 766 */ + GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 767 */ + void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 768 */ + void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 769 */ + void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 770 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 771 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 773 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 774 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 775 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 7ccd9707c3..c37aed7bcd 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -4011,63 +4011,68 @@ KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisample)(GLenum target, GLsiz DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisample(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height)); } +KEYWORD1 void KEYWORD2 NAME(CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) +{ + DISPATCH(CopyBufferSubData, (readTarget, writeTarget, readOffset, writeOffset, size), (F, "glCopyBufferSubData(0x%x, 0x%x, %d, %d, %d);\n", readTarget, writeTarget, readOffset, writeOffset, size)); +} + KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) { DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_563)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_563)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLfloat * params) { DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_564)(GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLint * params) { DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_565)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, GLfloat param) { DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_566)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, const GLfloat * params) { DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, GLint param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLint param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_567)(GLenum pname, GLint param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, GLint param) { DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, const GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, const GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_568)(GLenum pname, const GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLenum pname, const GLint * params) { DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLclampf value, GLboolean invert); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLclampf value, GLboolean invert); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_569)(GLclampf value, GLboolean invert) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLclampf value, GLboolean invert) { DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLenum pattern); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pattern); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_570)(GLenum pattern) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_571)(GLenum pattern) { DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); } @@ -4117,9 +4122,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_577)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_577)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); } @@ -4139,9 +4144,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * p DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } @@ -4156,16 +4161,16 @@ KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_581)(GLenum pname, GLdouble * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLdouble * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_581)(GLenum pname, GLdouble * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLdouble * params) { DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, GLfloat * params) { DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } @@ -4410,9 +4415,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLenum mode); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum mode); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_607)(GLenum mode) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum mode) { DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); } @@ -4427,9 +4432,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } @@ -4794,65 +4799,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_649)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_650)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(GLsizei n, const GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLsizei n, const GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_651)(GLsizei n, const GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLsizei n, const GLuint * fences) { DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLuint fence); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLuint fence); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_652)(GLuint fence) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLuint fence) { DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLsizei n, GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLsizei n, GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_653)(GLsizei n, GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLsizei n, GLuint * fences) { DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLuint fence, GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence, GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_654)(GLuint fence, GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence, GLenum pname, GLint * params) { DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_655)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence) { RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence, GLenum condition); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence, GLenum condition); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_656)(GLuint fence, GLenum condition) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence, GLenum condition) { DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_658)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_657)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_658)(GLuint fence) { RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); } @@ -5297,37 +5302,37 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLenum face); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLenum face); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_738)(GLenum face) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLenum face) { DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLuint array); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLuint array); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_739)(GLuint array) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLuint array) { DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLsizei n, const GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, const GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_740)(GLsizei n, const GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, const GLuint * arrays) { DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_742)(GLsizei n, GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_741)(GLsizei n, GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_742)(GLsizei n, GLuint * arrays) { DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_742)(GLuint array); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_743)(GLuint array); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_742)(GLuint array) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_743)(GLuint array) { RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array)); } @@ -5362,9 +5367,9 @@ KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_749)(GLclampd zmin, GLclampd zmax); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLclampd zmin, GLclampd zmax); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_749)(GLclampd zmin, GLclampd zmax) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLclampd zmin, GLclampd zmax) { DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); } @@ -5374,9 +5379,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA) DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLenum modeRGB, GLenum modeA); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_751)(GLenum modeRGB, GLenum modeA); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_750)(GLenum modeRGB, GLenum modeA) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_751)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); } @@ -5556,9 +5561,9 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } @@ -5573,37 +5578,37 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTextureLayerEXT)(GLenum target, GLenum at DISPATCH(FramebufferTextureLayerEXT, (target, attachment, texture, level, layer), (F, "glFramebufferTextureLayerEXT(0x%x, 0x%x, %d, %d, %d);\n", target, attachment, texture, level, layer)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_775)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6184,8 +6189,8 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetAttribLocationARB), TABLE_ENTRY(DrawBuffersARB), TABLE_ENTRY(RenderbufferStorageMultisample), + TABLE_ENTRY(CopyBufferSubData), TABLE_ENTRY(PolygonOffsetEXT), - TABLE_ENTRY(_dispatch_stub_563), TABLE_ENTRY(_dispatch_stub_564), TABLE_ENTRY(_dispatch_stub_565), TABLE_ENTRY(_dispatch_stub_566), @@ -6193,6 +6198,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_568), TABLE_ENTRY(_dispatch_stub_569), TABLE_ENTRY(_dispatch_stub_570), + TABLE_ENTRY(_dispatch_stub_571), TABLE_ENTRY(ColorPointerEXT), TABLE_ENTRY(EdgeFlagPointerEXT), TABLE_ENTRY(IndexPointerEXT), @@ -6203,8 +6209,8 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(PointParameterfvEXT), TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), - TABLE_ENTRY(_dispatch_stub_581), TABLE_ENTRY(_dispatch_stub_582), + TABLE_ENTRY(_dispatch_stub_583), TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), @@ -6229,7 +6235,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), - TABLE_ENTRY(_dispatch_stub_607), + TABLE_ENTRY(_dispatch_stub_608), TABLE_ENTRY(BlendFuncSeparateEXT), TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), @@ -6271,7 +6277,6 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), - TABLE_ENTRY(_dispatch_stub_649), TABLE_ENTRY(_dispatch_stub_650), TABLE_ENTRY(_dispatch_stub_651), TABLE_ENTRY(_dispatch_stub_652), @@ -6280,6 +6285,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_655), TABLE_ENTRY(_dispatch_stub_656), TABLE_ENTRY(_dispatch_stub_657), + TABLE_ENTRY(_dispatch_stub_658), TABLE_ENTRY(AreProgramsResidentNV), TABLE_ENTRY(BindProgramNV), TABLE_ENTRY(DeleteProgramsNV), @@ -6360,19 +6366,19 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(SetFragmentShaderConstantATI), TABLE_ENTRY(PointParameteriNV), TABLE_ENTRY(PointParameterivNV), - TABLE_ENTRY(_dispatch_stub_738), TABLE_ENTRY(_dispatch_stub_739), TABLE_ENTRY(_dispatch_stub_740), TABLE_ENTRY(_dispatch_stub_741), TABLE_ENTRY(_dispatch_stub_742), + TABLE_ENTRY(_dispatch_stub_743), TABLE_ENTRY(GetProgramNamedParameterdvNV), TABLE_ENTRY(GetProgramNamedParameterfvNV), TABLE_ENTRY(ProgramNamedParameter4dNV), TABLE_ENTRY(ProgramNamedParameter4dvNV), TABLE_ENTRY(ProgramNamedParameter4fNV), TABLE_ENTRY(ProgramNamedParameter4fvNV), - TABLE_ENTRY(_dispatch_stub_749), TABLE_ENTRY(_dispatch_stub_750), + TABLE_ENTRY(_dispatch_stub_751), TABLE_ENTRY(BindFramebufferEXT), TABLE_ENTRY(BindRenderbufferEXT), TABLE_ENTRY(CheckFramebufferStatusEXT), @@ -6390,13 +6396,13 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(IsFramebufferEXT), TABLE_ENTRY(IsRenderbufferEXT), TABLE_ENTRY(RenderbufferStorageEXT), - TABLE_ENTRY(_dispatch_stub_768), + TABLE_ENTRY(_dispatch_stub_769), TABLE_ENTRY(FramebufferTextureLayerEXT), - TABLE_ENTRY(_dispatch_stub_770), TABLE_ENTRY(_dispatch_stub_771), TABLE_ENTRY(_dispatch_stub_772), TABLE_ENTRY(_dispatch_stub_773), TABLE_ENTRY(_dispatch_stub_774), + TABLE_ENTRY(_dispatch_stub_775), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index 680893cfc4..648609a35d 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -614,6 +614,7 @@ static const char gl_string_table[] = "glGetAttribLocationARB\0" "glDrawBuffersARB\0" "glRenderbufferStorageMultisample\0" + "glCopyBufferSubData\0" "glPolygonOffsetEXT\0" "glGetPixelTexGenParameterfvSGIS\0" "glGetPixelTexGenParameterivSGIS\0" @@ -1142,7 +1143,6 @@ static const char gl_string_table[] = #define gl_dispatch_stub_364 mgl_dispatch_stub_364 #define gl_dispatch_stub_365 mgl_dispatch_stub_365 #define gl_dispatch_stub_366 mgl_dispatch_stub_366 -#define gl_dispatch_stub_563 mgl_dispatch_stub_563 #define gl_dispatch_stub_564 mgl_dispatch_stub_564 #define gl_dispatch_stub_565 mgl_dispatch_stub_565 #define gl_dispatch_stub_566 mgl_dispatch_stub_566 @@ -1150,10 +1150,10 @@ static const char gl_string_table[] = #define gl_dispatch_stub_568 mgl_dispatch_stub_568 #define gl_dispatch_stub_569 mgl_dispatch_stub_569 #define gl_dispatch_stub_570 mgl_dispatch_stub_570 -#define gl_dispatch_stub_581 mgl_dispatch_stub_581 +#define gl_dispatch_stub_571 mgl_dispatch_stub_571 #define gl_dispatch_stub_582 mgl_dispatch_stub_582 -#define gl_dispatch_stub_607 mgl_dispatch_stub_607 -#define gl_dispatch_stub_649 mgl_dispatch_stub_649 +#define gl_dispatch_stub_583 mgl_dispatch_stub_583 +#define gl_dispatch_stub_608 mgl_dispatch_stub_608 #define gl_dispatch_stub_650 mgl_dispatch_stub_650 #define gl_dispatch_stub_651 mgl_dispatch_stub_651 #define gl_dispatch_stub_652 mgl_dispatch_stub_652 @@ -1162,19 +1162,20 @@ static const char gl_string_table[] = #define gl_dispatch_stub_655 mgl_dispatch_stub_655 #define gl_dispatch_stub_656 mgl_dispatch_stub_656 #define gl_dispatch_stub_657 mgl_dispatch_stub_657 -#define gl_dispatch_stub_738 mgl_dispatch_stub_738 +#define gl_dispatch_stub_658 mgl_dispatch_stub_658 #define gl_dispatch_stub_739 mgl_dispatch_stub_739 #define gl_dispatch_stub_740 mgl_dispatch_stub_740 #define gl_dispatch_stub_741 mgl_dispatch_stub_741 #define gl_dispatch_stub_742 mgl_dispatch_stub_742 -#define gl_dispatch_stub_749 mgl_dispatch_stub_749 +#define gl_dispatch_stub_743 mgl_dispatch_stub_743 #define gl_dispatch_stub_750 mgl_dispatch_stub_750 -#define gl_dispatch_stub_768 mgl_dispatch_stub_768 -#define gl_dispatch_stub_770 mgl_dispatch_stub_770 +#define gl_dispatch_stub_751 mgl_dispatch_stub_751 +#define gl_dispatch_stub_769 mgl_dispatch_stub_769 #define gl_dispatch_stub_771 mgl_dispatch_stub_771 #define gl_dispatch_stub_772 mgl_dispatch_stub_772 #define gl_dispatch_stub_773 mgl_dispatch_stub_773 #define gl_dispatch_stub_774 mgl_dispatch_stub_774 +#define gl_dispatch_stub_775 mgl_dispatch_stub_775 #endif /* USE_MGL_NAMESPACE */ @@ -1192,39 +1193,39 @@ void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params); void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_563(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_564(GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_565(GLenum pname, GLfloat param); -void GLAPIENTRY gl_dispatch_stub_566(GLenum pname, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_567(GLenum pname, GLint param); -void GLAPIENTRY gl_dispatch_stub_568(GLenum pname, const GLint * params); -void GLAPIENTRY gl_dispatch_stub_569(GLclampf value, GLboolean invert); -void GLAPIENTRY gl_dispatch_stub_570(GLenum pattern); -void GLAPIENTRY gl_dispatch_stub_581(GLenum pname, GLdouble * params); -void GLAPIENTRY gl_dispatch_stub_582(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_607(GLenum mode); -void GLAPIENTRY gl_dispatch_stub_649(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_650(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_651(GLsizei n, const GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_652(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_653(GLsizei n, GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_654(GLuint fence, GLenum pname, GLint * params); -GLboolean GLAPIENTRY gl_dispatch_stub_655(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_656(GLuint fence, GLenum condition); -GLboolean GLAPIENTRY gl_dispatch_stub_657(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_738(GLenum face); -void GLAPIENTRY gl_dispatch_stub_739(GLuint array); -void GLAPIENTRY gl_dispatch_stub_740(GLsizei n, const GLuint * arrays); -void GLAPIENTRY gl_dispatch_stub_741(GLsizei n, GLuint * arrays); -GLboolean GLAPIENTRY gl_dispatch_stub_742(GLuint array); -void GLAPIENTRY gl_dispatch_stub_749(GLclampd zmin, GLclampd zmax); -void GLAPIENTRY gl_dispatch_stub_750(GLenum modeRGB, GLenum modeA); -void GLAPIENTRY gl_dispatch_stub_768(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLAPIENTRY gl_dispatch_stub_770(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -void GLAPIENTRY gl_dispatch_stub_771(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_564(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_565(GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_566(GLenum pname, GLfloat param); +void GLAPIENTRY gl_dispatch_stub_567(GLenum pname, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_568(GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_569(GLenum pname, const GLint * params); +void GLAPIENTRY gl_dispatch_stub_570(GLclampf value, GLboolean invert); +void GLAPIENTRY gl_dispatch_stub_571(GLenum pattern); +void GLAPIENTRY gl_dispatch_stub_582(GLenum pname, GLdouble * params); +void GLAPIENTRY gl_dispatch_stub_583(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_608(GLenum mode); +void GLAPIENTRY gl_dispatch_stub_650(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_651(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_652(GLsizei n, const GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_653(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_654(GLsizei n, GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_655(GLuint fence, GLenum pname, GLint * params); +GLboolean GLAPIENTRY gl_dispatch_stub_656(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_657(GLuint fence, GLenum condition); +GLboolean GLAPIENTRY gl_dispatch_stub_658(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_739(GLenum face); +void GLAPIENTRY gl_dispatch_stub_740(GLuint array); +void GLAPIENTRY gl_dispatch_stub_741(GLsizei n, const GLuint * arrays); +void GLAPIENTRY gl_dispatch_stub_742(GLsizei n, GLuint * arrays); +GLboolean GLAPIENTRY gl_dispatch_stub_743(GLuint array); +void GLAPIENTRY gl_dispatch_stub_750(GLclampd zmin, GLclampd zmax); +void GLAPIENTRY gl_dispatch_stub_751(GLenum modeRGB, GLenum modeA); +void GLAPIENTRY gl_dispatch_stub_769(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void GLAPIENTRY gl_dispatch_stub_771(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); void GLAPIENTRY gl_dispatch_stub_772(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_773(GLuint id, GLenum pname, GLint64EXT * params); -void GLAPIENTRY gl_dispatch_stub_774(GLuint id, GLenum pname, GLuint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_773(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_774(GLuint id, GLenum pname, GLint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_775(GLuint id, GLenum pname, GLuint64EXT * params); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1790,517 +1791,518 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET( 8911, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), NAME_FUNC_OFFSET( 8934, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), NAME_FUNC_OFFSET( 8951, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), - NAME_FUNC_OFFSET( 8984, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), - NAME_FUNC_OFFSET( 9003, gl_dispatch_stub_563, gl_dispatch_stub_563, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9035, gl_dispatch_stub_564, gl_dispatch_stub_564, NULL, _gloffset_GetPixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9067, gl_dispatch_stub_565, gl_dispatch_stub_565, NULL, _gloffset_PixelTexGenParameterfSGIS), - NAME_FUNC_OFFSET( 9095, gl_dispatch_stub_566, gl_dispatch_stub_566, NULL, _gloffset_PixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9124, gl_dispatch_stub_567, gl_dispatch_stub_567, NULL, _gloffset_PixelTexGenParameteriSGIS), - NAME_FUNC_OFFSET( 9152, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_PixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9181, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET( 9198, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET( 9218, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), - NAME_FUNC_OFFSET( 9236, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), - NAME_FUNC_OFFSET( 9257, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), - NAME_FUNC_OFFSET( 9275, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), - NAME_FUNC_OFFSET( 9294, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), - NAME_FUNC_OFFSET( 9315, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), - NAME_FUNC_OFFSET( 9334, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET( 9355, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET( 9377, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), - NAME_FUNC_OFFSET( 9393, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), - NAME_FUNC_OFFSET( 9411, gl_dispatch_stub_581, gl_dispatch_stub_581, NULL, _gloffset_CullParameterdvEXT), - NAME_FUNC_OFFSET( 9432, gl_dispatch_stub_582, gl_dispatch_stub_582, NULL, _gloffset_CullParameterfvEXT), - NAME_FUNC_OFFSET( 9453, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET( 9475, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET( 9498, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET( 9520, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET( 9543, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET( 9565, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET( 9588, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET( 9610, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET( 9633, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET( 9655, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET( 9678, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET( 9701, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET( 9725, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET( 9748, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET( 9772, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET( 9795, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET( 9819, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET( 9846, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET( 9867, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET( 9890, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET( 9911, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET( 9926, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET( 9942, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET( 9957, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET( 9973, gl_dispatch_stub_607, gl_dispatch_stub_607, NULL, _gloffset_PixelTexGenSGIX), - NAME_FUNC_OFFSET( 9991, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(10014, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), - NAME_FUNC_OFFSET(10040, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), - NAME_FUNC_OFFSET(10061, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), - NAME_FUNC_OFFSET(10079, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), - NAME_FUNC_OFFSET(10098, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), - NAME_FUNC_OFFSET(10121, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), - NAME_FUNC_OFFSET(10145, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), - NAME_FUNC_OFFSET(10168, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), - NAME_FUNC_OFFSET(10192, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), - NAME_FUNC_OFFSET(10215, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10247, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10279, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), - NAME_FUNC_OFFSET(10312, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), - NAME_FUNC_OFFSET(10345, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10382, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10419, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), - NAME_FUNC_OFFSET(10439, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(10457, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(10476, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(10494, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(10513, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(10531, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(10550, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(10568, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(10587, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(10605, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(10624, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(10642, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(10661, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(10679, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(10698, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(10716, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(10735, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), - NAME_FUNC_OFFSET(10753, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), - NAME_FUNC_OFFSET(10772, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), - NAME_FUNC_OFFSET(10790, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), - NAME_FUNC_OFFSET(10809, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), - NAME_FUNC_OFFSET(10827, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), - NAME_FUNC_OFFSET(10846, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), - NAME_FUNC_OFFSET(10864, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), - NAME_FUNC_OFFSET(10883, gl_dispatch_stub_649, gl_dispatch_stub_649, NULL, _gloffset_MultiModeDrawArraysIBM), - NAME_FUNC_OFFSET(10908, gl_dispatch_stub_650, gl_dispatch_stub_650, NULL, _gloffset_MultiModeDrawElementsIBM), - NAME_FUNC_OFFSET(10935, gl_dispatch_stub_651, gl_dispatch_stub_651, NULL, _gloffset_DeleteFencesNV), - NAME_FUNC_OFFSET(10952, gl_dispatch_stub_652, gl_dispatch_stub_652, NULL, _gloffset_FinishFenceNV), - NAME_FUNC_OFFSET(10968, gl_dispatch_stub_653, gl_dispatch_stub_653, NULL, _gloffset_GenFencesNV), - NAME_FUNC_OFFSET(10982, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, _gloffset_GetFenceivNV), - NAME_FUNC_OFFSET(10997, gl_dispatch_stub_655, gl_dispatch_stub_655, NULL, _gloffset_IsFenceNV), - NAME_FUNC_OFFSET(11009, gl_dispatch_stub_656, gl_dispatch_stub_656, NULL, _gloffset_SetFenceNV), - NAME_FUNC_OFFSET(11022, gl_dispatch_stub_657, gl_dispatch_stub_657, NULL, _gloffset_TestFenceNV), - NAME_FUNC_OFFSET(11036, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), - NAME_FUNC_OFFSET(11060, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(11076, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(11095, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), - NAME_FUNC_OFFSET(11114, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(11130, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), - NAME_FUNC_OFFSET(11156, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), - NAME_FUNC_OFFSET(11182, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), - NAME_FUNC_OFFSET(11203, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), - NAME_FUNC_OFFSET(11220, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), - NAME_FUNC_OFFSET(11241, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(11269, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), - NAME_FUNC_OFFSET(11291, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), - NAME_FUNC_OFFSET(11313, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), - NAME_FUNC_OFFSET(11335, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(11349, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), - NAME_FUNC_OFFSET(11365, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), - NAME_FUNC_OFFSET(11390, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), - NAME_FUNC_OFFSET(11415, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), - NAME_FUNC_OFFSET(11443, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), - NAME_FUNC_OFFSET(11459, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), - NAME_FUNC_OFFSET(11478, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), - NAME_FUNC_OFFSET(11498, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), - NAME_FUNC_OFFSET(11517, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), - NAME_FUNC_OFFSET(11537, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), - NAME_FUNC_OFFSET(11556, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), - NAME_FUNC_OFFSET(11576, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), - NAME_FUNC_OFFSET(11595, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), - NAME_FUNC_OFFSET(11615, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), - NAME_FUNC_OFFSET(11634, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), - NAME_FUNC_OFFSET(11654, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), - NAME_FUNC_OFFSET(11673, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), - NAME_FUNC_OFFSET(11693, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), - NAME_FUNC_OFFSET(11712, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), - NAME_FUNC_OFFSET(11732, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), - NAME_FUNC_OFFSET(11751, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), - NAME_FUNC_OFFSET(11771, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), - NAME_FUNC_OFFSET(11790, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), - NAME_FUNC_OFFSET(11810, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), - NAME_FUNC_OFFSET(11829, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), - NAME_FUNC_OFFSET(11849, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), - NAME_FUNC_OFFSET(11868, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), - NAME_FUNC_OFFSET(11888, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), - NAME_FUNC_OFFSET(11907, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), - NAME_FUNC_OFFSET(11927, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), - NAME_FUNC_OFFSET(11947, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), - NAME_FUNC_OFFSET(11968, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), - NAME_FUNC_OFFSET(11992, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), - NAME_FUNC_OFFSET(12013, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), - NAME_FUNC_OFFSET(12034, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), - NAME_FUNC_OFFSET(12055, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), - NAME_FUNC_OFFSET(12076, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), - NAME_FUNC_OFFSET(12097, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), - NAME_FUNC_OFFSET(12118, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), - NAME_FUNC_OFFSET(12139, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), - NAME_FUNC_OFFSET(12160, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), - NAME_FUNC_OFFSET(12181, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), - NAME_FUNC_OFFSET(12202, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), - NAME_FUNC_OFFSET(12223, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), - NAME_FUNC_OFFSET(12244, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), - NAME_FUNC_OFFSET(12266, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), - NAME_FUNC_OFFSET(12293, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), - NAME_FUNC_OFFSET(12320, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), - NAME_FUNC_OFFSET(12344, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), - NAME_FUNC_OFFSET(12368, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), - NAME_FUNC_OFFSET(12390, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), - NAME_FUNC_OFFSET(12412, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), - NAME_FUNC_OFFSET(12434, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), - NAME_FUNC_OFFSET(12459, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), - NAME_FUNC_OFFSET(12483, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), - NAME_FUNC_OFFSET(12505, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), - NAME_FUNC_OFFSET(12527, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), - NAME_FUNC_OFFSET(12549, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), - NAME_FUNC_OFFSET(12575, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), - NAME_FUNC_OFFSET(12598, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), - NAME_FUNC_OFFSET(12622, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), - NAME_FUNC_OFFSET(12640, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), - NAME_FUNC_OFFSET(12655, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), - NAME_FUNC_OFFSET(12686, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(12706, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(12727, gl_dispatch_stub_738, gl_dispatch_stub_738, NULL, _gloffset_ActiveStencilFaceEXT), - NAME_FUNC_OFFSET(12750, gl_dispatch_stub_739, gl_dispatch_stub_739, NULL, _gloffset_BindVertexArrayAPPLE), - NAME_FUNC_OFFSET(12773, gl_dispatch_stub_740, gl_dispatch_stub_740, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(12799, gl_dispatch_stub_741, gl_dispatch_stub_741, NULL, _gloffset_GenVertexArraysAPPLE), - NAME_FUNC_OFFSET(12822, gl_dispatch_stub_742, gl_dispatch_stub_742, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(12843, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), - NAME_FUNC_OFFSET(12874, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), - NAME_FUNC_OFFSET(12905, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), - NAME_FUNC_OFFSET(12933, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), - NAME_FUNC_OFFSET(12962, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), - NAME_FUNC_OFFSET(12990, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), - NAME_FUNC_OFFSET(13019, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_DepthBoundsEXT), - NAME_FUNC_OFFSET(13036, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(13063, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(13084, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(13106, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(13134, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(13158, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(13183, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(13212, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(13238, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(13264, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(13290, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(13311, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(13333, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(13353, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(13394, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(13426, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(13445, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(13465, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(13490, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(13511, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(13540, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(13565, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13594, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13625, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13649, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13674, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13692, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13709, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13725, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13750, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13770, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13790, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13813, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13836, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13856, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13873, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13890, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13905, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13929, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13948, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13967, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13983, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(14002, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(14025, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14041, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14057, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14084, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14111, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14131, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14150, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14169, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14199, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14229, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14259, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14289, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14308, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14331, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14356, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14381, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14408, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14436, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14463, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14491, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14520, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14549, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14575, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14606, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14637, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14661, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14684, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14702, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14731, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14760, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14775, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14801, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14827, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14842, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14854, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14874, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14891, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14907, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14926, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14949, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14965, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14987, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(15005, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(15024, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(15042, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(15061, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15079, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15098, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15116, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15135, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15153, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15172, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15190, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15209, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15227, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15246, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15264, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15283, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15301, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15320, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15338, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15357, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15375, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15394, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15412, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15431, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15449, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15468, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15486, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15505, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15523, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15542, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15560, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15579, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), - NAME_FUNC_OFFSET(15602, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15625, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15648, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15671, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15694, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15711, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15734, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15757, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15780, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15806, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15832, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15858, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15882, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15909, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15935, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15955, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15975, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(15995, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), - NAME_FUNC_OFFSET(16018, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), - NAME_FUNC_OFFSET(16042, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), - NAME_FUNC_OFFSET(16065, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), - NAME_FUNC_OFFSET(16089, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(16106, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(16124, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(16141, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(16159, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(16176, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(16194, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(16211, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16229, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16246, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16264, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16281, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16299, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16316, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16334, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16351, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16369, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16386, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16404, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16423, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16442, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16461, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16480, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16500, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16520, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16540, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16558, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16575, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16593, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16610, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16628, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16646, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16663, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16681, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16700, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16719, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16738, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16760, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16773, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16786, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16802, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16818, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16831, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16854, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16874, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16893, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16904, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16916, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16930, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16943, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16959, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16970, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16983, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(17002, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(17022, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(17035, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(17045, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(17061, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(17080, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(17098, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(17119, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(17134, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(17149, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(17163, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(17178, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(17190, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(17203, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17215, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17228, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17240, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17253, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17265, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17278, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17290, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17303, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17315, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17328, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17340, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17353, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17365, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17378, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17397, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17416, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17435, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17448, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17466, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17487, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17505, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17525, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17539, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17556, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17572, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17591, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17609, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17630, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17652, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17671, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17693, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17716, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17735, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17755, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17774, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17794, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17813, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17833, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17852, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17872, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17891, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17911, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17931, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17952, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17972, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17993, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(18013, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(18034, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(18058, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(18076, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(18096, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(18114, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(18126, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(18139, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(18151, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(18164, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET( 8984, glCopyBufferSubData, glCopyBufferSubData, NULL, _gloffset_CopyBufferSubData), + NAME_FUNC_OFFSET( 9004, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), + NAME_FUNC_OFFSET( 9023, gl_dispatch_stub_564, gl_dispatch_stub_564, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9055, gl_dispatch_stub_565, gl_dispatch_stub_565, NULL, _gloffset_GetPixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9087, gl_dispatch_stub_566, gl_dispatch_stub_566, NULL, _gloffset_PixelTexGenParameterfSGIS), + NAME_FUNC_OFFSET( 9115, gl_dispatch_stub_567, gl_dispatch_stub_567, NULL, _gloffset_PixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9144, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_PixelTexGenParameteriSGIS), + NAME_FUNC_OFFSET( 9172, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_PixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9201, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET( 9218, gl_dispatch_stub_571, gl_dispatch_stub_571, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET( 9238, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), + NAME_FUNC_OFFSET( 9256, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), + NAME_FUNC_OFFSET( 9277, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), + NAME_FUNC_OFFSET( 9295, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), + NAME_FUNC_OFFSET( 9314, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), + NAME_FUNC_OFFSET( 9335, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), + NAME_FUNC_OFFSET( 9354, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET( 9375, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET( 9397, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), + NAME_FUNC_OFFSET( 9413, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), + NAME_FUNC_OFFSET( 9431, gl_dispatch_stub_582, gl_dispatch_stub_582, NULL, _gloffset_CullParameterdvEXT), + NAME_FUNC_OFFSET( 9452, gl_dispatch_stub_583, gl_dispatch_stub_583, NULL, _gloffset_CullParameterfvEXT), + NAME_FUNC_OFFSET( 9473, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET( 9495, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET( 9518, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET( 9540, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET( 9563, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET( 9585, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET( 9608, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET( 9630, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET( 9653, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET( 9675, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET( 9698, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET( 9721, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET( 9745, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET( 9768, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET( 9792, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET( 9815, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET( 9839, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET( 9866, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET( 9887, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET( 9910, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET( 9931, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET( 9946, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET( 9962, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET( 9977, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET( 9993, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, _gloffset_PixelTexGenSGIX), + NAME_FUNC_OFFSET(10011, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(10034, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), + NAME_FUNC_OFFSET(10060, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), + NAME_FUNC_OFFSET(10081, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), + NAME_FUNC_OFFSET(10099, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), + NAME_FUNC_OFFSET(10118, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), + NAME_FUNC_OFFSET(10141, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), + NAME_FUNC_OFFSET(10165, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), + NAME_FUNC_OFFSET(10188, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), + NAME_FUNC_OFFSET(10212, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), + NAME_FUNC_OFFSET(10235, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10267, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10299, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), + NAME_FUNC_OFFSET(10332, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), + NAME_FUNC_OFFSET(10365, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10402, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10439, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), + NAME_FUNC_OFFSET(10459, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(10477, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(10496, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(10514, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(10533, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(10551, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(10570, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(10588, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(10607, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(10625, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(10644, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(10662, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(10681, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(10699, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(10718, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(10736, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(10755, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), + NAME_FUNC_OFFSET(10773, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), + NAME_FUNC_OFFSET(10792, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), + NAME_FUNC_OFFSET(10810, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), + NAME_FUNC_OFFSET(10829, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), + NAME_FUNC_OFFSET(10847, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), + NAME_FUNC_OFFSET(10866, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), + NAME_FUNC_OFFSET(10884, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), + NAME_FUNC_OFFSET(10903, gl_dispatch_stub_650, gl_dispatch_stub_650, NULL, _gloffset_MultiModeDrawArraysIBM), + NAME_FUNC_OFFSET(10928, gl_dispatch_stub_651, gl_dispatch_stub_651, NULL, _gloffset_MultiModeDrawElementsIBM), + NAME_FUNC_OFFSET(10955, gl_dispatch_stub_652, gl_dispatch_stub_652, NULL, _gloffset_DeleteFencesNV), + NAME_FUNC_OFFSET(10972, gl_dispatch_stub_653, gl_dispatch_stub_653, NULL, _gloffset_FinishFenceNV), + NAME_FUNC_OFFSET(10988, gl_dispatch_stub_654, gl_dispatch_stub_654, NULL, _gloffset_GenFencesNV), + NAME_FUNC_OFFSET(11002, gl_dispatch_stub_655, gl_dispatch_stub_655, NULL, _gloffset_GetFenceivNV), + NAME_FUNC_OFFSET(11017, gl_dispatch_stub_656, gl_dispatch_stub_656, NULL, _gloffset_IsFenceNV), + NAME_FUNC_OFFSET(11029, gl_dispatch_stub_657, gl_dispatch_stub_657, NULL, _gloffset_SetFenceNV), + NAME_FUNC_OFFSET(11042, gl_dispatch_stub_658, gl_dispatch_stub_658, NULL, _gloffset_TestFenceNV), + NAME_FUNC_OFFSET(11056, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), + NAME_FUNC_OFFSET(11080, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(11096, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(11115, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), + NAME_FUNC_OFFSET(11134, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(11150, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), + NAME_FUNC_OFFSET(11176, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), + NAME_FUNC_OFFSET(11202, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), + NAME_FUNC_OFFSET(11223, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), + NAME_FUNC_OFFSET(11240, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), + NAME_FUNC_OFFSET(11261, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(11289, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), + NAME_FUNC_OFFSET(11311, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), + NAME_FUNC_OFFSET(11333, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), + NAME_FUNC_OFFSET(11355, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(11369, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), + NAME_FUNC_OFFSET(11385, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), + NAME_FUNC_OFFSET(11410, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), + NAME_FUNC_OFFSET(11435, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), + NAME_FUNC_OFFSET(11463, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), + NAME_FUNC_OFFSET(11479, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), + NAME_FUNC_OFFSET(11498, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), + NAME_FUNC_OFFSET(11518, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), + NAME_FUNC_OFFSET(11537, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), + NAME_FUNC_OFFSET(11557, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), + NAME_FUNC_OFFSET(11576, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), + NAME_FUNC_OFFSET(11596, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), + NAME_FUNC_OFFSET(11615, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), + NAME_FUNC_OFFSET(11635, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), + NAME_FUNC_OFFSET(11654, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), + NAME_FUNC_OFFSET(11674, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), + NAME_FUNC_OFFSET(11693, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), + NAME_FUNC_OFFSET(11713, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), + NAME_FUNC_OFFSET(11732, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), + NAME_FUNC_OFFSET(11752, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), + NAME_FUNC_OFFSET(11771, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), + NAME_FUNC_OFFSET(11791, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), + NAME_FUNC_OFFSET(11810, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), + NAME_FUNC_OFFSET(11830, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), + NAME_FUNC_OFFSET(11849, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), + NAME_FUNC_OFFSET(11869, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), + NAME_FUNC_OFFSET(11888, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), + NAME_FUNC_OFFSET(11908, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), + NAME_FUNC_OFFSET(11927, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), + NAME_FUNC_OFFSET(11947, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), + NAME_FUNC_OFFSET(11967, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), + NAME_FUNC_OFFSET(11988, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), + NAME_FUNC_OFFSET(12012, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), + NAME_FUNC_OFFSET(12033, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), + NAME_FUNC_OFFSET(12054, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), + NAME_FUNC_OFFSET(12075, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), + NAME_FUNC_OFFSET(12096, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), + NAME_FUNC_OFFSET(12117, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), + NAME_FUNC_OFFSET(12138, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), + NAME_FUNC_OFFSET(12159, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), + NAME_FUNC_OFFSET(12180, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), + NAME_FUNC_OFFSET(12201, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), + NAME_FUNC_OFFSET(12222, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), + NAME_FUNC_OFFSET(12243, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), + NAME_FUNC_OFFSET(12264, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), + NAME_FUNC_OFFSET(12286, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), + NAME_FUNC_OFFSET(12313, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), + NAME_FUNC_OFFSET(12340, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), + NAME_FUNC_OFFSET(12364, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), + NAME_FUNC_OFFSET(12388, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), + NAME_FUNC_OFFSET(12410, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), + NAME_FUNC_OFFSET(12432, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), + NAME_FUNC_OFFSET(12454, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), + NAME_FUNC_OFFSET(12479, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), + NAME_FUNC_OFFSET(12503, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), + NAME_FUNC_OFFSET(12525, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), + NAME_FUNC_OFFSET(12547, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), + NAME_FUNC_OFFSET(12569, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), + NAME_FUNC_OFFSET(12595, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), + NAME_FUNC_OFFSET(12618, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), + NAME_FUNC_OFFSET(12642, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), + NAME_FUNC_OFFSET(12660, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), + NAME_FUNC_OFFSET(12675, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), + NAME_FUNC_OFFSET(12706, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(12726, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(12747, gl_dispatch_stub_739, gl_dispatch_stub_739, NULL, _gloffset_ActiveStencilFaceEXT), + NAME_FUNC_OFFSET(12770, gl_dispatch_stub_740, gl_dispatch_stub_740, NULL, _gloffset_BindVertexArrayAPPLE), + NAME_FUNC_OFFSET(12793, gl_dispatch_stub_741, gl_dispatch_stub_741, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(12819, gl_dispatch_stub_742, gl_dispatch_stub_742, NULL, _gloffset_GenVertexArraysAPPLE), + NAME_FUNC_OFFSET(12842, gl_dispatch_stub_743, gl_dispatch_stub_743, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(12863, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), + NAME_FUNC_OFFSET(12894, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), + NAME_FUNC_OFFSET(12925, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), + NAME_FUNC_OFFSET(12953, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), + NAME_FUNC_OFFSET(12982, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), + NAME_FUNC_OFFSET(13010, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), + NAME_FUNC_OFFSET(13039, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_DepthBoundsEXT), + NAME_FUNC_OFFSET(13056, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13083, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(13104, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(13126, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(13154, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(13178, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(13203, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(13232, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(13258, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(13284, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(13310, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(13331, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(13353, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(13373, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(13414, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(13446, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(13465, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(13485, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(13510, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(13531, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(13560, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13585, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13614, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13645, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13669, gl_dispatch_stub_775, gl_dispatch_stub_775, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13694, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13712, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13729, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13745, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13770, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13790, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13810, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13833, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13856, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13876, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13893, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13910, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13925, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13949, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13968, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13987, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(14003, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(14022, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(14045, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14061, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14077, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14104, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14131, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14151, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14170, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14189, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14219, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14249, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14279, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14309, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14328, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14351, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14376, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14401, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14428, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14456, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14483, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14511, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14540, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14569, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14595, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14626, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14657, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14681, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14704, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14722, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14751, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14780, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14795, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14821, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14847, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14862, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14874, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14894, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14911, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14927, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14946, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14969, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14985, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(15007, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(15025, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(15044, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15062, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15081, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15099, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15118, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15136, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15155, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15173, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15192, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15210, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15229, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15247, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15266, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15284, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15303, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15321, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15340, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15358, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15377, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15395, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15414, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15432, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15451, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15469, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15488, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15506, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15525, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15543, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15562, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15580, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15599, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(15622, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15645, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15668, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15691, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15714, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15731, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15754, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15777, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15800, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15826, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15852, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15878, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(15902, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15929, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15955, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(15975, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(15995, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(16015, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), + NAME_FUNC_OFFSET(16038, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), + NAME_FUNC_OFFSET(16062, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), + NAME_FUNC_OFFSET(16085, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), + NAME_FUNC_OFFSET(16109, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(16126, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(16144, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(16161, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(16179, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16196, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16214, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16231, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16249, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16266, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16284, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16301, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16319, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16336, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16354, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16371, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16389, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16406, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16424, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16443, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16462, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16481, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16500, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16520, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16540, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16560, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16578, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16595, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16613, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16630, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16648, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16666, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16683, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16701, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16720, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16739, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16758, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16780, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16793, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16806, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16822, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16838, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16851, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16874, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16894, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16913, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16924, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16936, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16950, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16963, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16979, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16990, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(17003, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(17022, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(17042, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(17055, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(17065, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(17081, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(17100, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(17118, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(17139, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(17154, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(17169, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(17183, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17198, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17210, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17223, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17235, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17248, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17260, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17273, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17285, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17298, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17310, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17323, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17335, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17348, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17360, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17373, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17385, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17398, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17417, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17436, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17455, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17468, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17486, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17507, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17525, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17545, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17559, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17576, gl_dispatch_stub_570, gl_dispatch_stub_570, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17592, gl_dispatch_stub_571, gl_dispatch_stub_571, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17611, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17629, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17650, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17672, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17691, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17713, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17736, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17755, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17775, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17794, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17814, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17833, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17853, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17872, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17892, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17911, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17931, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17951, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17972, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17992, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(18013, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(18033, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(18054, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(18078, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(18096, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(18116, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(18134, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(18146, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(18159, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(18171, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), NAME_FUNC_OFFSET(18184, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18208, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18222, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18239, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18254, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18272, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18286, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18303, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18318, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18336, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18350, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18367, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18382, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18400, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18414, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18431, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18446, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18464, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18478, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18495, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18510, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18528, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18542, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18559, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18574, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18592, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18606, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18623, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18638, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18656, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18670, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18687, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18702, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18720, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18737, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18757, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18774, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18800, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18829, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18844, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18862, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18881, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18905, gl_dispatch_stub_750, gl_dispatch_stub_750, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18932, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(18950, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(18969, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(18994, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(19015, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(19037, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(19063, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(19086, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(19109, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(19132, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(19150, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(19169, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(19186, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(19224, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(19253, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(19269, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(19286, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(19308, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(19326, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(18204, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18228, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18242, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18259, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18274, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18292, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18306, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18323, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18338, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18356, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18370, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18387, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18402, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18420, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18434, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18451, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18466, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18484, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18498, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18515, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18530, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18548, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18562, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18579, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18594, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18612, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18626, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18643, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18658, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18676, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18690, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18707, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18722, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18740, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18757, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18777, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18794, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18820, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18849, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18864, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18882, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18901, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18925, gl_dispatch_stub_751, gl_dispatch_stub_751, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18952, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(18970, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(18989, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(19014, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(19035, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(19057, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(19083, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(19106, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(19129, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(19152, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(19170, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(19189, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(19206, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(19244, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(19273, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(19289, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(19306, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(19328, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(19346, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index cf893fdac5..4339e3ba4e 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -334,6 +334,8 @@ LONGSTRING static const char enum_string_table[] = "GL_COPY\0" "GL_COPY_INVERTED\0" "GL_COPY_PIXEL_TOKEN\0" + "GL_COPY_READ_BUFFER\0" + "GL_COPY_WRITE_BUFFER\0" "GL_CULL_FACE\0" "GL_CULL_FACE_MODE\0" "GL_CULL_VERTEX_EXT\0" @@ -948,8 +950,8 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" "GL_MAX_VARYING_FLOATS\0" "GL_MAX_VARYING_FLOATS_ARB\0" - "GL_MAX_VERTEX_GENERIC_ATTRIBS\0" - "GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB\0" + "GL_MAX_VERTEX_ATTRIBS\0" + "GL_MAX_VERTEX_ATTRIBS_ARB\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" @@ -1858,7 +1860,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1820] = +static const enum_elt all_enums[1822] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -2158,2131 +2160,2133 @@ static const enum_elt all_enums[1820] = { 6027, 0x00001503 }, /* GL_COPY */ { 6035, 0x0000150C }, /* GL_COPY_INVERTED */ { 6052, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ - { 6072, 0x00000B44 }, /* GL_CULL_FACE */ - { 6085, 0x00000B45 }, /* GL_CULL_FACE_MODE */ - { 6103, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ - { 6122, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - { 6154, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - { 6189, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ - { 6210, 0x00000001 }, /* GL_CURRENT_BIT */ - { 6225, 0x00000B00 }, /* GL_CURRENT_COLOR */ - { 6242, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ - { 6263, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ - { 6289, 0x00000B01 }, /* GL_CURRENT_INDEX */ - { 6306, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ - { 6328, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ - { 6356, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ - { 6377, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - { 6411, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ - { 6444, 0x00000B02 }, /* GL_CURRENT_NORMAL */ - { 6462, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - { 6492, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ - { 6511, 0x00008865 }, /* GL_CURRENT_QUERY */ - { 6528, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ - { 6549, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ - { 6573, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ - { 6600, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ - { 6624, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ - { 6651, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ - { 6684, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ - { 6718, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - { 6751, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ - { 6778, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ - { 6804, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ - { 6829, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ - { 6858, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ - { 6880, 0x00000900 }, /* GL_CW */ - { 6886, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ - { 6907, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ - { 6928, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ - { 6948, 0x00002101 }, /* GL_DECAL */ - { 6957, 0x00001E03 }, /* GL_DECR */ - { 6965, 0x00008508 }, /* GL_DECR_WRAP */ - { 6978, 0x00008508 }, /* GL_DECR_WRAP_EXT */ - { 6995, 0x00008B80 }, /* GL_DELETE_STATUS */ - { 7012, 0x00001801 }, /* GL_DEPTH */ - { 7021, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ - { 7041, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ - { 7061, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ - { 7085, 0x00000D1F }, /* GL_DEPTH_BIAS */ - { 7099, 0x00000D56 }, /* GL_DEPTH_BITS */ - { 7113, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ - { 7133, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ - { 7158, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ - { 7178, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ - { 7196, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ - { 7217, 0x00001902 }, /* GL_DEPTH_COMPONENT */ - { 7236, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ - { 7257, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ - { 7282, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ - { 7308, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ - { 7329, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ - { 7354, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ - { 7380, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ - { 7401, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ - { 7426, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ - { 7452, 0x00000B74 }, /* GL_DEPTH_FUNC */ - { 7466, 0x00000B70 }, /* GL_DEPTH_RANGE */ - { 7481, 0x00000D1E }, /* GL_DEPTH_SCALE */ - { 7496, 0x000084F9 }, /* GL_DEPTH_STENCIL */ - { 7513, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ - { 7541, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ - { 7561, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - { 7589, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - { 7617, 0x00000B71 }, /* GL_DEPTH_TEST */ - { 7631, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ - { 7653, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ - { 7679, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ - { 7698, 0x00001201 }, /* GL_DIFFUSE */ - { 7709, 0x00000BD0 }, /* GL_DITHER */ - { 7719, 0x00000A02 }, /* GL_DOMAIN */ - { 7729, 0x00001100 }, /* GL_DONT_CARE */ - { 7742, 0x000086AE }, /* GL_DOT3_RGB */ - { 7754, 0x000086AF }, /* GL_DOT3_RGBA */ - { 7767, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ - { 7784, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ - { 7801, 0x000086AE }, /* GL_DOT3_RGB_ARB */ - { 7817, 0x00008740 }, /* GL_DOT3_RGB_EXT */ - { 7833, 0x0000140A }, /* GL_DOUBLE */ - { 7843, 0x00000C32 }, /* GL_DOUBLEBUFFER */ - { 7859, 0x00000C01 }, /* GL_DRAW_BUFFER */ - { 7874, 0x00008825 }, /* GL_DRAW_BUFFER0 */ - { 7890, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ - { 7910, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ - { 7930, 0x00008826 }, /* GL_DRAW_BUFFER1 */ - { 7946, 0x0000882F }, /* GL_DRAW_BUFFER10 */ - { 7963, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ - { 7984, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ - { 8005, 0x00008830 }, /* GL_DRAW_BUFFER11 */ - { 8022, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ - { 8043, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ - { 8064, 0x00008831 }, /* GL_DRAW_BUFFER12 */ - { 8081, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ - { 8102, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ - { 8123, 0x00008832 }, /* GL_DRAW_BUFFER13 */ - { 8140, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ - { 8161, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ - { 8182, 0x00008833 }, /* GL_DRAW_BUFFER14 */ - { 8199, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ - { 8220, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ - { 8241, 0x00008834 }, /* GL_DRAW_BUFFER15 */ - { 8258, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ - { 8279, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ - { 8300, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ - { 8320, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ - { 8340, 0x00008827 }, /* GL_DRAW_BUFFER2 */ - { 8356, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ - { 8376, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ - { 8396, 0x00008828 }, /* GL_DRAW_BUFFER3 */ - { 8412, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ - { 8432, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ - { 8452, 0x00008829 }, /* GL_DRAW_BUFFER4 */ - { 8468, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ - { 8488, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ - { 8508, 0x0000882A }, /* GL_DRAW_BUFFER5 */ - { 8524, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ - { 8544, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ - { 8564, 0x0000882B }, /* GL_DRAW_BUFFER6 */ - { 8580, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ - { 8600, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ - { 8620, 0x0000882C }, /* GL_DRAW_BUFFER7 */ - { 8636, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ - { 8656, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ - { 8676, 0x0000882D }, /* GL_DRAW_BUFFER8 */ - { 8692, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ - { 8712, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ - { 8732, 0x0000882E }, /* GL_DRAW_BUFFER9 */ - { 8748, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ - { 8768, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ - { 8788, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ - { 8808, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - { 8840, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ - { 8864, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ - { 8884, 0x00000304 }, /* GL_DST_ALPHA */ - { 8897, 0x00000306 }, /* GL_DST_COLOR */ - { 8910, 0x0000877A }, /* GL_DU8DV8_ATI */ - { 8924, 0x00008779 }, /* GL_DUDV_ATI */ - { 8936, 0x000088EA }, /* GL_DYNAMIC_COPY */ - { 8952, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ - { 8972, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ - { 8988, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ - { 9008, 0x000088E9 }, /* GL_DYNAMIC_READ */ - { 9024, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ - { 9044, 0x00000B43 }, /* GL_EDGE_FLAG */ - { 9057, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ - { 9076, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - { 9110, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ - { 9148, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ - { 9175, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - { 9201, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ - { 9225, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - { 9257, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ - { 9293, 0x00001600 }, /* GL_EMISSION */ - { 9305, 0x00002000 }, /* GL_ENABLE_BIT */ - { 9319, 0x00000202 }, /* GL_EQUAL */ - { 9328, 0x00001509 }, /* GL_EQUIV */ - { 9337, 0x00010000 }, /* GL_EVAL_BIT */ - { 9349, 0x00000800 }, /* GL_EXP */ - { 9356, 0x00000801 }, /* GL_EXP2 */ - { 9364, 0x00001F03 }, /* GL_EXTENSIONS */ - { 9378, 0x00002400 }, /* GL_EYE_LINEAR */ - { 9392, 0x00002502 }, /* GL_EYE_PLANE */ - { 9405, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ - { 9430, 0x0000855B }, /* GL_EYE_RADIAL_NV */ - { 9447, 0x00000000 }, /* GL_FALSE */ - { 9456, 0x00001101 }, /* GL_FASTEST */ - { 9467, 0x00001C01 }, /* GL_FEEDBACK */ - { 9479, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ - { 9506, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ - { 9530, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ - { 9554, 0x00001B02 }, /* GL_FILL */ - { 9562, 0x00001D00 }, /* GL_FLAT */ - { 9570, 0x00001406 }, /* GL_FLOAT */ - { 9579, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9593, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9611, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 9627, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 9643, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9657, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9675, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 9691, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 9707, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 9721, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 9739, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 9755, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 9771, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 9785, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 9803, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 9817, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 9835, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 9849, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 9867, 0x00000B60 }, /* GL_FOG */ - { 9874, 0x00000080 }, /* GL_FOG_BIT */ - { 9885, 0x00000B66 }, /* GL_FOG_COLOR */ - { 9898, 0x00008451 }, /* GL_FOG_COORD */ - { 9911, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 9929, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 9953, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 9992, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 10035, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 10067, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 10098, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 10127, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 10152, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 10171, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 10205, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 10232, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10258, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10282, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10299, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10314, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10338, 0x00000B64 }, /* GL_FOG_END */ - { 10349, 0x00000C54 }, /* GL_FOG_HINT */ - { 10361, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10374, 0x00000B65 }, /* GL_FOG_MODE */ - { 10386, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10405, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10430, 0x00000B63 }, /* GL_FOG_START */ - { 10443, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10461, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10485, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10504, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10527, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10562, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10577, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10614, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10650, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 10691, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 10732, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 10769, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 10806, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 10844, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 10886, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 10924, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 10966, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 11001, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 11040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 11089, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 11137, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 11189, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 11229, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11273, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11313, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11357, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11384, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11408, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11436, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11459, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11478, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11515, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11556, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11597, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 11639, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 11690, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 11728, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 11773, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 11822, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 11860, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 11902, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 11934, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 11959, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 11986, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 12017, 0x00000404 }, /* GL_FRONT */ - { 12026, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 12044, 0x00000B46 }, /* GL_FRONT_FACE */ - { 12058, 0x00000400 }, /* GL_FRONT_LEFT */ - { 12072, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 12087, 0x00008006 }, /* GL_FUNC_ADD */ - { 12099, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 12115, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 12140, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 12169, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 12186, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 12207, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 12226, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 12250, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12279, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12303, 0x00000206 }, /* GL_GEQUAL */ - { 12313, 0x00000204 }, /* GL_GREATER */ - { 12324, 0x00001904 }, /* GL_GREEN */ - { 12333, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12347, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12361, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12376, 0x00008000 }, /* GL_HINT_BIT */ - { 12388, 0x00008024 }, /* GL_HISTOGRAM */ - { 12401, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12425, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12453, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12476, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12503, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12520, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 12540, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 12564, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 12588, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 12616, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 12644, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 12676, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 12698, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 12724, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 12742, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 12764, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 12783, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 12806, 0x0000862A }, /* GL_IDENTITY_NV */ - { 12821, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 12841, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 12881, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 12919, 0x00001E02 }, /* GL_INCR */ - { 12927, 0x00008507 }, /* GL_INCR_WRAP */ - { 12940, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 12957, 0x00008222 }, /* GL_INDEX */ - { 12966, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 12981, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13011, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13045, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13068, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13090, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13110, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13124, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13145, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13163, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13177, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13193, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13208, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13227, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13246, 0x00001404 }, /* GL_INT */ - { 13253, 0x00008049 }, /* GL_INTENSITY */ - { 13266, 0x0000804C }, /* GL_INTENSITY12 */ - { 13281, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13300, 0x0000804D }, /* GL_INTENSITY16 */ - { 13315, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13334, 0x0000804A }, /* GL_INTENSITY4 */ - { 13348, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13366, 0x0000804B }, /* GL_INTENSITY8 */ - { 13380, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13398, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13415, 0x00008575 }, /* GL_INTERPOLATE */ - { 13430, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13449, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13468, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13480, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13496, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13508, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13524, 0x00008B55 }, /* GL_INT_VEC4 */ - { 13536, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 13552, 0x00000500 }, /* GL_INVALID_ENUM */ - { 13568, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 13601, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 13638, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 13659, 0x00000501 }, /* GL_INVALID_VALUE */ - { 13676, 0x0000862B }, /* GL_INVERSE_NV */ - { 13690, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 13714, 0x0000150A }, /* GL_INVERT */ - { 13724, 0x00001E00 }, /* GL_KEEP */ - { 13732, 0x00000406 }, /* GL_LEFT */ - { 13740, 0x00000203 }, /* GL_LEQUAL */ - { 13750, 0x00000201 }, /* GL_LESS */ - { 13758, 0x00004000 }, /* GL_LIGHT0 */ - { 13768, 0x00004001 }, /* GL_LIGHT1 */ - { 13778, 0x00004002 }, /* GL_LIGHT2 */ - { 13788, 0x00004003 }, /* GL_LIGHT3 */ - { 13798, 0x00004004 }, /* GL_LIGHT4 */ - { 13808, 0x00004005 }, /* GL_LIGHT5 */ - { 13818, 0x00004006 }, /* GL_LIGHT6 */ - { 13828, 0x00004007 }, /* GL_LIGHT7 */ - { 13838, 0x00000B50 }, /* GL_LIGHTING */ - { 13850, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 13866, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 13889, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 13918, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 13951, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 13979, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14003, 0x00001B01 }, /* GL_LINE */ - { 14011, 0x00002601 }, /* GL_LINEAR */ - { 14021, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14043, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14073, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14104, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14128, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14153, 0x00000001 }, /* GL_LINES */ - { 14162, 0x00000004 }, /* GL_LINE_BIT */ - { 14174, 0x00000002 }, /* GL_LINE_LOOP */ - { 14187, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14207, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14222, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14242, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14258, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14282, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14305, 0x00000003 }, /* GL_LINE_STRIP */ - { 14319, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14333, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14347, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14373, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14393, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14408, 0x00000B32 }, /* GL_LIST_BASE */ - { 14421, 0x00020000 }, /* GL_LIST_BIT */ - { 14433, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14447, 0x00000B30 }, /* GL_LIST_MODE */ - { 14460, 0x00000101 }, /* GL_LOAD */ - { 14468, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 14480, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 14497, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 14511, 0x00001909 }, /* GL_LUMINANCE */ - { 14524, 0x00008041 }, /* GL_LUMINANCE12 */ - { 14539, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 14562, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 14589, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 14611, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 14637, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 14656, 0x00008042 }, /* GL_LUMINANCE16 */ - { 14671, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 14694, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 14721, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 14740, 0x0000803F }, /* GL_LUMINANCE4 */ - { 14754, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 14775, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 14800, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 14818, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 14839, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 14864, 0x00008040 }, /* GL_LUMINANCE8 */ - { 14878, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 14899, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 14924, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 14942, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 14961, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 14977, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 14997, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15019, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15033, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15048, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15072, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15096, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15120, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15144, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15161, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15178, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15206, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15235, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15264, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15293, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15322, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15351, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15380, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15408, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15436, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15464, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 15492, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 15520, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 15548, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 15576, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 15604, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 15632, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 15648, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 15668, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 15690, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 15704, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 15719, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 15743, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 15767, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 15791, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 15815, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 15832, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 15849, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 15877, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 15906, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 15935, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 15964, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 15993, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16022, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16051, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16079, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16107, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16135, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16163, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16191, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16219, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16247, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16275, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16303, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16316, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16331, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 16346, 0x00008630 }, /* GL_MATRIX0_NV */ - { 16360, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 16376, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 16392, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 16408, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 16424, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 16440, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 16456, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 16472, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 16488, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 16504, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 16520, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 16535, 0x00008631 }, /* GL_MATRIX1_NV */ - { 16549, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 16565, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 16581, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 16597, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 16613, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 16629, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 16645, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 16661, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 16677, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 16693, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 16709, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 16724, 0x00008632 }, /* GL_MATRIX2_NV */ - { 16738, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 16754, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 16770, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 16785, 0x00008633 }, /* GL_MATRIX3_NV */ - { 16799, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 16814, 0x00008634 }, /* GL_MATRIX4_NV */ - { 16828, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 16843, 0x00008635 }, /* GL_MATRIX5_NV */ - { 16857, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 16872, 0x00008636 }, /* GL_MATRIX6_NV */ - { 16886, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 16901, 0x00008637 }, /* GL_MATRIX7_NV */ - { 16915, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 16930, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 16945, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 16971, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17005, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17036, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17069, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17100, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17115, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17137, 0x00008008 }, /* GL_MAX */ - { 17144, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17167, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17199, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17225, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17258, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17284, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17318, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 17337, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 17366, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 17398, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 17434, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 17470, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 17510, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 17536, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 17566, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 17591, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 17620, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 17649, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 17682, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 17702, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 17726, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 17750, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 17774, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 17799, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 17817, 0x00008008 }, /* GL_MAX_EXT */ - { 17828, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 17863, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 17902, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 17916, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 17936, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 17974, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18003, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18027, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18055, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18078, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18115, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18151, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18178, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18207, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18241, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18277, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 18304, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 18336, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 18372, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 18401, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 18430, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 18458, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 18496, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 18540, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 18583, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 18617, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 18656, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 18693, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 18731, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 18774, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 18817, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 18847, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 18878, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 18914, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 18950, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 18980, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19014, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19047, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19076, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19091, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19111, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19135, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19157, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19183, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19210, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 19241, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 19265, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 19299, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 19319, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 19346, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 19367, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 19392, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 19417, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 19452, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 19474, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19500, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */ - { 19522, 0x00008869 }, /* GL_MAX_VERTEX_GENERIC_ATTRIBS_ARB */ - { 19548, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 19582, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 19620, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 19653, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 19690, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 19714, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 19735, 0x00008007 }, /* GL_MIN */ - { 19742, 0x0000802E }, /* GL_MINMAX */ - { 19752, 0x0000802E }, /* GL_MINMAX_EXT */ - { 19766, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 19783, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 19804, 0x00008030 }, /* GL_MINMAX_SINK */ - { 19819, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 19838, 0x00008007 }, /* GL_MIN_EXT */ - { 19849, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 19868, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 19891, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 19914, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 19934, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 19954, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 19984, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20012, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20040, 0x00001700 }, /* GL_MODELVIEW */ - { 20053, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20071, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20090, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20109, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20128, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20147, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20166, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20185, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20204, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20223, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 20242, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 20261, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 20279, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 20298, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 20317, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 20336, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 20355, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 20374, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 20393, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 20412, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 20431, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 20450, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 20469, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 20487, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 20506, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 20525, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 20543, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 20561, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 20579, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 20597, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 20615, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 20633, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 20651, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 20671, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 20698, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 20723, 0x00002100 }, /* GL_MODULATE */ - { 20735, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 20755, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 20782, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 20807, 0x00000103 }, /* GL_MULT */ - { 20815, 0x0000809D }, /* GL_MULTISAMPLE */ - { 20830, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 20850, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 20869, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 20888, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 20912, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 20935, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 20965, 0x00002A25 }, /* GL_N3F_V3F */ - { 20976, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 20996, 0x0000150E }, /* GL_NAND */ - { 21004, 0x00002600 }, /* GL_NEAREST */ - { 21015, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21046, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21078, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21103, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21129, 0x00000200 }, /* GL_NEVER */ - { 21138, 0x00001102 }, /* GL_NICEST */ - { 21148, 0x00000000 }, /* GL_NONE */ - { 21156, 0x00001505 }, /* GL_NOOP */ - { 21164, 0x00001508 }, /* GL_NOR */ - { 21171, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21184, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21200, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21231, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 21266, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 21290, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 21313, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 21334, 0x00008511 }, /* GL_NORMAL_MAP */ - { 21348, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 21366, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 21383, 0x00000205 }, /* GL_NOTEQUAL */ - { 21395, 0x00000000 }, /* GL_NO_ERROR */ - { 21407, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 21441, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 21479, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 21511, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 21553, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 21583, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 21623, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 21654, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 21683, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 21711, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 21741, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 21758, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 21784, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 21800, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 21835, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 21857, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 21876, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 21906, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 21927, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 21955, 0x00000001 }, /* GL_ONE */ - { 21962, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 21990, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22022, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22050, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22082, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22105, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22128, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22151, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22174, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22192, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22214, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 22236, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 22252, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 22272, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 22292, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 22310, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 22332, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 22354, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 22370, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 22390, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 22410, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 22428, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 22450, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 22472, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 22488, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 22508, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 22528, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 22549, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 22568, 0x00001507 }, /* GL_OR */ - { 22574, 0x00000A01 }, /* GL_ORDER */ - { 22583, 0x0000150D }, /* GL_OR_INVERTED */ - { 22598, 0x0000150B }, /* GL_OR_REVERSE */ - { 22612, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 22629, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 22647, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 22668, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 22688, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 22706, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 22725, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 22745, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 22765, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 22783, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 22802, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 22827, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 22851, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 22872, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 22894, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 22916, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 22941, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 22965, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 22986, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23008, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23030, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23052, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23083, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23103, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23128, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23148, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23173, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23193, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 23218, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 23238, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 23263, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 23283, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 23308, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 23328, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 23353, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 23373, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 23398, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 23418, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 23443, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 23463, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 23488, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 23508, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 23533, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 23551, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 23572, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 23601, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 23634, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 23659, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 23682, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 23713, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 23748, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 23775, 0x00001B00 }, /* GL_POINT */ - { 23784, 0x00000000 }, /* GL_POINTS */ - { 23794, 0x00000002 }, /* GL_POINT_BIT */ - { 23807, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 23837, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 23871, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 23905, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 23940, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 23969, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24002, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24035, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24069, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24083, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24109, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24127, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24149, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24171, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24194, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24212, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 24234, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 24256, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 24279, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 24299, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 24315, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 24336, 0x00008861 }, /* GL_POINT_SPRITE */ - { 24352, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 24372, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 24401, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 24420, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 24446, 0x00000701 }, /* GL_POINT_TOKEN */ - { 24461, 0x00000009 }, /* GL_POLYGON */ - { 24472, 0x00000008 }, /* GL_POLYGON_BIT */ - { 24487, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 24503, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 24526, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 24551, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 24574, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 24597, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 24621, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 24645, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 24663, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 24686, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 24705, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 24728, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 24745, 0x00001203 }, /* GL_POSITION */ - { 24757, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 24789, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 24825, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 24858, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 24895, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 24926, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 24961, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 24993, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25029, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25062, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25094, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25130, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25163, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25200, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 25230, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 25264, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 25295, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 25330, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 25361, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 25396, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 25428, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 25464, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 25494, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 25528, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 25559, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 25594, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 25626, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 25657, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 25692, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 25724, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 25760, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 25789, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 25822, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 25852, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 25886, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 25925, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 25958, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 25998, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26032, 0x00008578 }, /* GL_PREVIOUS */ - { 26044, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26060, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26076, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26093, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26114, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26135, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26168, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26200, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 26223, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 26246, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 26276, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 26305, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 26333, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 26355, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 26383, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 26411, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 26433, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 26454, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 26494, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 26533, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 26563, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 26598, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 26631, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 26665, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 26704, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 26743, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 26765, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 26791, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 26815, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 26838, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 26860, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 26881, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 26902, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 26929, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 26961, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 26993, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27028, 0x00001701 }, /* GL_PROJECTION */ - { 27042, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27063, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27089, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27110, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27129, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27152, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 27191, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 27229, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 27249, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 27279, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 27303, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 27323, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 27353, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 27377, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 27397, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 27430, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 27456, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 27486, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 27517, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 27547, 0x00002003 }, /* GL_Q */ - { 27552, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 27577, 0x00000007 }, /* GL_QUADS */ - { 27586, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 27603, 0x00000008 }, /* GL_QUAD_STRIP */ - { 27617, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 27639, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 27665, 0x00008866 }, /* GL_QUERY_RESULT */ - { 27681, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 27701, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 27727, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 27757, 0x00002002 }, /* GL_R */ - { 27762, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 27774, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 27807, 0x00000C02 }, /* GL_READ_BUFFER */ - { 27822, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 27842, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 27874, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 27898, 0x000088B8 }, /* GL_READ_ONLY */ - { 27911, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 27928, 0x000088BA }, /* GL_READ_WRITE */ - { 27942, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 27960, 0x00001903 }, /* GL_RED */ - { 27967, 0x00008016 }, /* GL_REDUCE */ - { 27977, 0x00008016 }, /* GL_REDUCE_EXT */ - { 27991, 0x00000D15 }, /* GL_RED_BIAS */ - { 28003, 0x00000D52 }, /* GL_RED_BITS */ - { 28015, 0x00000D14 }, /* GL_RED_SCALE */ - { 28028, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 28046, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 28068, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 28089, 0x00001C00 }, /* GL_RENDER */ - { 28099, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 28115, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 28142, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 28170, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 28196, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 28223, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 28243, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 28270, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 28293, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 28320, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 28352, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 28388, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 28413, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 28437, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 28466, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 28488, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 28514, 0x00001F01 }, /* GL_RENDERER */ - { 28526, 0x00000C40 }, /* GL_RENDER_MODE */ - { 28541, 0x00002901 }, /* GL_REPEAT */ - { 28551, 0x00001E01 }, /* GL_REPLACE */ - { 28562, 0x00008062 }, /* GL_REPLACE_EXT */ - { 28577, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 28600, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 28618, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 28640, 0x00000102 }, /* GL_RETURN */ - { 28650, 0x00001907 }, /* GL_RGB */ - { 28657, 0x00008052 }, /* GL_RGB10 */ - { 28666, 0x00008059 }, /* GL_RGB10_A2 */ - { 28678, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 28694, 0x00008052 }, /* GL_RGB10_EXT */ - { 28707, 0x00008053 }, /* GL_RGB12 */ - { 28716, 0x00008053 }, /* GL_RGB12_EXT */ - { 28729, 0x00008054 }, /* GL_RGB16 */ - { 28738, 0x00008054 }, /* GL_RGB16_EXT */ - { 28751, 0x0000804E }, /* GL_RGB2_EXT */ - { 28763, 0x0000804F }, /* GL_RGB4 */ - { 28771, 0x0000804F }, /* GL_RGB4_EXT */ - { 28783, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 28796, 0x00008050 }, /* GL_RGB5 */ - { 28804, 0x00008057 }, /* GL_RGB5_A1 */ - { 28815, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 28830, 0x00008050 }, /* GL_RGB5_EXT */ - { 28842, 0x00008051 }, /* GL_RGB8 */ - { 28850, 0x00008051 }, /* GL_RGB8_EXT */ - { 28862, 0x00001908 }, /* GL_RGBA */ - { 28870, 0x0000805A }, /* GL_RGBA12 */ - { 28880, 0x0000805A }, /* GL_RGBA12_EXT */ - { 28894, 0x0000805B }, /* GL_RGBA16 */ - { 28904, 0x0000805B }, /* GL_RGBA16_EXT */ - { 28918, 0x00008055 }, /* GL_RGBA2 */ - { 28927, 0x00008055 }, /* GL_RGBA2_EXT */ - { 28940, 0x00008056 }, /* GL_RGBA4 */ - { 28949, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 28968, 0x00008056 }, /* GL_RGBA4_EXT */ - { 28981, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 28995, 0x00008058 }, /* GL_RGBA8 */ - { 29004, 0x00008058 }, /* GL_RGBA8_EXT */ - { 29017, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 29032, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 29050, 0x00000C31 }, /* GL_RGBA_MODE */ - { 29063, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 29076, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 29090, 0x000083A0 }, /* GL_RGB_S3TC */ - { 29102, 0x00008573 }, /* GL_RGB_SCALE */ - { 29115, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 29132, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 29149, 0x00000407 }, /* GL_RIGHT */ - { 29158, 0x00002000 }, /* GL_S */ - { 29163, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 29177, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 29198, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 29212, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 29233, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 29247, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 29263, 0x000080A9 }, /* GL_SAMPLES */ - { 29274, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 29290, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 29305, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 29323, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 29345, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 29373, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 29405, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 29428, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 29455, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 29473, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 29496, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 29518, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 29537, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 29560, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 29586, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 29616, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 29641, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 29670, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 29685, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 29700, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 29716, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 29741, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 29781, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 29825, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 29858, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 29888, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 29920, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 29950, 0x00001C02 }, /* GL_SELECT */ - { 29960, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 29988, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 30013, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 30029, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 30056, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 30087, 0x0000150F }, /* GL_SET */ - { 30094, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 30115, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 30139, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 30154, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 30169, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 30197, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 30220, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 30250, 0x00001601 }, /* GL_SHININESS */ - { 30263, 0x00001402 }, /* GL_SHORT */ - { 30272, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 30293, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 30309, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 30329, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 30348, 0x00008C46 }, /* GL_SLUMINANCE */ - { 30362, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 30377, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 30399, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 30419, 0x00001D01 }, /* GL_SMOOTH */ - { 30429, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 30462, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 30489, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 30522, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 30549, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 30566, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 30587, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 30608, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 30623, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 30642, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 30661, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 30678, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 30699, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 30720, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 30735, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 30754, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 30773, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 30790, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 30811, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 30832, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 30847, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 30866, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 30885, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 30905, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 30923, 0x00001202 }, /* GL_SPECULAR */ - { 30935, 0x00002402 }, /* GL_SPHERE_MAP */ - { 30949, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 30964, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 30982, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 30999, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 31013, 0x00008580 }, /* GL_SRC0_RGB */ - { 31025, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 31039, 0x00008581 }, /* GL_SRC1_RGB */ - { 31051, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 31065, 0x00008582 }, /* GL_SRC2_RGB */ - { 31077, 0x00000302 }, /* GL_SRC_ALPHA */ - { 31090, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 31112, 0x00000300 }, /* GL_SRC_COLOR */ - { 31125, 0x00008C40 }, /* GL_SRGB */ - { 31133, 0x00008C41 }, /* GL_SRGB8 */ - { 31142, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 31158, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 31172, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 31190, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 31209, 0x000088E6 }, /* GL_STATIC_COPY */ - { 31224, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 31243, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 31258, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 31277, 0x000088E5 }, /* GL_STATIC_READ */ - { 31292, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 31311, 0x00001802 }, /* GL_STENCIL */ - { 31322, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 31344, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 31370, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 31391, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 31416, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 31437, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 31462, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 31494, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 31530, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 31562, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 31598, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 31618, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 31645, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 31671, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 31687, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 31709, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 31732, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 31748, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 31764, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 31781, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 31804, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 31826, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 31848, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 31870, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 31891, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 31918, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 31945, 0x00000B97 }, /* GL_STENCIL_REF */ - { 31960, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 31976, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 32005, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 32027, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 32048, 0x00000C33 }, /* GL_STEREO */ - { 32058, 0x000088E2 }, /* GL_STREAM_COPY */ - { 32073, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 32092, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 32107, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 32126, 0x000088E1 }, /* GL_STREAM_READ */ - { 32141, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 32160, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 32177, 0x000084E7 }, /* GL_SUBTRACT */ - { 32189, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 32205, 0x00002001 }, /* GL_T */ - { 32210, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 32225, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 32244, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 32260, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 32275, 0x00002A27 }, /* GL_T2F_V3F */ - { 32286, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 32305, 0x00002A28 }, /* GL_T4F_V4F */ - { 32316, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 32339, 0x00001702 }, /* GL_TEXTURE */ - { 32350, 0x000084C0 }, /* GL_TEXTURE0 */ - { 32362, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 32378, 0x000084C1 }, /* GL_TEXTURE1 */ - { 32390, 0x000084CA }, /* GL_TEXTURE10 */ - { 32403, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 32420, 0x000084CB }, /* GL_TEXTURE11 */ - { 32433, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 32450, 0x000084CC }, /* GL_TEXTURE12 */ - { 32463, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 32480, 0x000084CD }, /* GL_TEXTURE13 */ - { 32493, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 32510, 0x000084CE }, /* GL_TEXTURE14 */ - { 32523, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 32540, 0x000084CF }, /* GL_TEXTURE15 */ - { 32553, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 32570, 0x000084D0 }, /* GL_TEXTURE16 */ - { 32583, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 32600, 0x000084D1 }, /* GL_TEXTURE17 */ - { 32613, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 32630, 0x000084D2 }, /* GL_TEXTURE18 */ - { 32643, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 32660, 0x000084D3 }, /* GL_TEXTURE19 */ - { 32673, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 32690, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 32706, 0x000084C2 }, /* GL_TEXTURE2 */ - { 32718, 0x000084D4 }, /* GL_TEXTURE20 */ - { 32731, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 32748, 0x000084D5 }, /* GL_TEXTURE21 */ - { 32761, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 32778, 0x000084D6 }, /* GL_TEXTURE22 */ - { 32791, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 32808, 0x000084D7 }, /* GL_TEXTURE23 */ - { 32821, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 32838, 0x000084D8 }, /* GL_TEXTURE24 */ - { 32851, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 32868, 0x000084D9 }, /* GL_TEXTURE25 */ - { 32881, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 32898, 0x000084DA }, /* GL_TEXTURE26 */ - { 32911, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 32928, 0x000084DB }, /* GL_TEXTURE27 */ - { 32941, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 32958, 0x000084DC }, /* GL_TEXTURE28 */ - { 32971, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 32988, 0x000084DD }, /* GL_TEXTURE29 */ - { 33001, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 33018, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 33034, 0x000084C3 }, /* GL_TEXTURE3 */ - { 33046, 0x000084DE }, /* GL_TEXTURE30 */ - { 33059, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 33076, 0x000084DF }, /* GL_TEXTURE31 */ - { 33089, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 33106, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 33122, 0x000084C4 }, /* GL_TEXTURE4 */ - { 33134, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 33150, 0x000084C5 }, /* GL_TEXTURE5 */ - { 33162, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 33178, 0x000084C6 }, /* GL_TEXTURE6 */ - { 33190, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 33206, 0x000084C7 }, /* GL_TEXTURE7 */ - { 33218, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 33234, 0x000084C8 }, /* GL_TEXTURE8 */ - { 33246, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 33262, 0x000084C9 }, /* GL_TEXTURE9 */ - { 33274, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 33290, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 33304, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 33328, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 33342, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 33366, 0x0000806F }, /* GL_TEXTURE_3D */ - { 33380, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 33402, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 33428, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 33450, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 33472, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 33504, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 33526, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 33558, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 33580, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 33608, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 33640, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 33673, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 33705, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 33720, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 33741, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 33766, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 33784, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 33808, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 33839, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 33869, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 33899, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 33934, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 33965, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 34003, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 34030, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 34062, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 34096, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 34120, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 34148, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 34172, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 34200, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 34233, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 34257, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 34279, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 34301, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 34327, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 34361, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 34394, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 34431, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 34459, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 34491, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 34514, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 34552, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 34594, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 34625, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 34653, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 34683, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 34711, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 34731, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 34755, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 34786, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 34821, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 34852, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 34887, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 34918, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 34953, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 34984, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 35019, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 35050, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 35085, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 35116, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 35151, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 35168, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 35190, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 35216, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 35231, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 35252, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 35272, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 35298, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 35318, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 35335, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 35352, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 35369, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 35386, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 35411, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 35433, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 35459, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 35477, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 35503, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 35529, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 35559, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 35586, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 35611, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 35631, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 35655, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 35682, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 35709, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 35736, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 35762, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 35792, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 35814, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 35832, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 35862, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 35890, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 35918, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 35946, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 35967, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 35986, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 36008, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 36027, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 36047, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 36072, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 36096, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 36116, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 36140, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 36160, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 36183, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 36207, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 36232, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 36266, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 36283, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 36301, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 36319, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 36337, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 36357, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 36376, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 36405, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 36422, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 36448, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 36478, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 36510, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 36574, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 36590, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 36621, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 36656, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 36684, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 36716, 0x00000004 }, /* GL_TRIANGLES */ - { 36729, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 36745, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 36766, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 36784, 0x00000001 }, /* GL_TRUE */ - { 36792, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 36812, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 36835, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 36855, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 36876, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 36898, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 36920, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 36940, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 36961, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 36978, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 37005, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 37028, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 37044, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 37071, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 37092, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 37116, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 37147, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 37171, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 37199, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 37222, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 37240, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 37270, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 37296, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 37326, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 37352, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 37376, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 37404, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 37432, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 37459, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 37491, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 37522, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 37536, 0x00002A20 }, /* GL_V2F */ - { 37543, 0x00002A21 }, /* GL_V3F */ - { 37550, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 37569, 0x00001F00 }, /* GL_VENDOR */ - { 37579, 0x00001F02 }, /* GL_VERSION */ - { 37590, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 37606, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 37636, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 37667, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 37702, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 37726, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 37747, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 37770, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 37791, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 37818, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 37846, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 37874, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 37902, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 37930, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 37958, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 37986, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 38013, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 38040, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 38067, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 38094, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 38121, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 38148, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 38175, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 38202, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 38229, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 38267, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 38309, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 38340, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 38375, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 38409, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 38447, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 38478, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 38513, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 38541, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 38573, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 38637, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 38665, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 38697, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 38717, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 38739, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 38768, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 38789, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 38818, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 38851, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 38883, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 38910, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 38941, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 38971, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 38988, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 39009, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 39036, 0x00000BA2 }, /* GL_VIEWPORT */ - { 39048, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 39064, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 39084, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 39115, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 39150, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 39178, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 39203, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 39230, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 39255, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 39279, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 39298, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 39312, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 39330, 0x00001506 }, /* GL_XOR */ - { 39337, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 39356, 0x00008757 }, /* GL_YCBCR_MESA */ - { 39370, 0x00000000 }, /* GL_ZERO */ - { 39378, 0x00000D16 }, /* GL_ZOOM_X */ - { 39388, 0x00000D17 }, /* GL_ZOOM_Y */ + { 6072, 0x00008F36 }, /* GL_COPY_READ_BUFFER */ + { 6092, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */ + { 6113, 0x00000B44 }, /* GL_CULL_FACE */ + { 6126, 0x00000B45 }, /* GL_CULL_FACE_MODE */ + { 6144, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ + { 6163, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + { 6195, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + { 6230, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ + { 6251, 0x00000001 }, /* GL_CURRENT_BIT */ + { 6266, 0x00000B00 }, /* GL_CURRENT_COLOR */ + { 6283, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ + { 6304, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ + { 6330, 0x00000B01 }, /* GL_CURRENT_INDEX */ + { 6347, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ + { 6369, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ + { 6397, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ + { 6418, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + { 6452, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + { 6485, 0x00000B02 }, /* GL_CURRENT_NORMAL */ + { 6503, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + { 6533, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ + { 6552, 0x00008865 }, /* GL_CURRENT_QUERY */ + { 6569, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ + { 6590, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ + { 6614, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ + { 6641, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ + { 6665, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ + { 6692, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ + { 6725, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + { 6759, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + { 6792, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ + { 6819, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ + { 6845, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ + { 6870, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + { 6899, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ + { 6921, 0x00000900 }, /* GL_CW */ + { 6927, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ + { 6948, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ + { 6969, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ + { 6989, 0x00002101 }, /* GL_DECAL */ + { 6998, 0x00001E03 }, /* GL_DECR */ + { 7006, 0x00008508 }, /* GL_DECR_WRAP */ + { 7019, 0x00008508 }, /* GL_DECR_WRAP_EXT */ + { 7036, 0x00008B80 }, /* GL_DELETE_STATUS */ + { 7053, 0x00001801 }, /* GL_DEPTH */ + { 7062, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ + { 7082, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ + { 7102, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 7126, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 7140, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 7154, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 7174, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 7199, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 7219, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 7237, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 7258, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 7277, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 7298, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 7323, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 7349, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 7370, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 7395, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 7421, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 7442, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 7467, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 7493, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 7507, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 7522, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 7537, 0x000084F9 }, /* GL_DEPTH_STENCIL */ + { 7554, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ + { 7582, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 7602, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 7630, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 7658, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 7672, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 7694, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 7720, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 7739, 0x00001201 }, /* GL_DIFFUSE */ + { 7750, 0x00000BD0 }, /* GL_DITHER */ + { 7760, 0x00000A02 }, /* GL_DOMAIN */ + { 7770, 0x00001100 }, /* GL_DONT_CARE */ + { 7783, 0x000086AE }, /* GL_DOT3_RGB */ + { 7795, 0x000086AF }, /* GL_DOT3_RGBA */ + { 7808, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 7825, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 7842, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 7858, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 7874, 0x0000140A }, /* GL_DOUBLE */ + { 7884, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 7900, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 7915, 0x00008825 }, /* GL_DRAW_BUFFER0 */ + { 7931, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 7951, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 7971, 0x00008826 }, /* GL_DRAW_BUFFER1 */ + { 7987, 0x0000882F }, /* GL_DRAW_BUFFER10 */ + { 8004, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 8025, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 8046, 0x00008830 }, /* GL_DRAW_BUFFER11 */ + { 8063, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 8084, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 8105, 0x00008831 }, /* GL_DRAW_BUFFER12 */ + { 8122, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 8143, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 8164, 0x00008832 }, /* GL_DRAW_BUFFER13 */ + { 8181, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 8202, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 8223, 0x00008833 }, /* GL_DRAW_BUFFER14 */ + { 8240, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 8261, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 8282, 0x00008834 }, /* GL_DRAW_BUFFER15 */ + { 8299, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 8320, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 8341, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 8361, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 8381, 0x00008827 }, /* GL_DRAW_BUFFER2 */ + { 8397, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 8417, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 8437, 0x00008828 }, /* GL_DRAW_BUFFER3 */ + { 8453, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 8473, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 8493, 0x00008829 }, /* GL_DRAW_BUFFER4 */ + { 8509, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 8529, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 8549, 0x0000882A }, /* GL_DRAW_BUFFER5 */ + { 8565, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 8585, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 8605, 0x0000882B }, /* GL_DRAW_BUFFER6 */ + { 8621, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 8641, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 8661, 0x0000882C }, /* GL_DRAW_BUFFER7 */ + { 8677, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 8697, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 8717, 0x0000882D }, /* GL_DRAW_BUFFER8 */ + { 8733, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 8753, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 8773, 0x0000882E }, /* GL_DRAW_BUFFER9 */ + { 8789, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 8809, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 8829, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ + { 8849, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + { 8881, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ + { 8905, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 8925, 0x00000304 }, /* GL_DST_ALPHA */ + { 8938, 0x00000306 }, /* GL_DST_COLOR */ + { 8951, 0x0000877A }, /* GL_DU8DV8_ATI */ + { 8965, 0x00008779 }, /* GL_DUDV_ATI */ + { 8977, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 8993, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 9013, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 9029, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 9049, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 9065, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 9085, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 9098, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 9117, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 9151, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 9189, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 9216, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 9242, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 9266, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 9298, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 9334, 0x00001600 }, /* GL_EMISSION */ + { 9346, 0x00002000 }, /* GL_ENABLE_BIT */ + { 9360, 0x00000202 }, /* GL_EQUAL */ + { 9369, 0x00001509 }, /* GL_EQUIV */ + { 9378, 0x00010000 }, /* GL_EVAL_BIT */ + { 9390, 0x00000800 }, /* GL_EXP */ + { 9397, 0x00000801 }, /* GL_EXP2 */ + { 9405, 0x00001F03 }, /* GL_EXTENSIONS */ + { 9419, 0x00002400 }, /* GL_EYE_LINEAR */ + { 9433, 0x00002502 }, /* GL_EYE_PLANE */ + { 9446, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 9471, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 9488, 0x00000000 }, /* GL_FALSE */ + { 9497, 0x00001101 }, /* GL_FASTEST */ + { 9508, 0x00001C01 }, /* GL_FEEDBACK */ + { 9520, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 9547, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 9571, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 9595, 0x00001B02 }, /* GL_FILL */ + { 9603, 0x00001D00 }, /* GL_FLAT */ + { 9611, 0x00001406 }, /* GL_FLOAT */ + { 9620, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 9634, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 9652, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 9668, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 9684, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 9698, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 9716, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 9732, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 9748, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 9762, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 9780, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 9796, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 9812, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 9826, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 9844, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 9858, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 9876, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 9890, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 9908, 0x00000B60 }, /* GL_FOG */ + { 9915, 0x00000080 }, /* GL_FOG_BIT */ + { 9926, 0x00000B66 }, /* GL_FOG_COLOR */ + { 9939, 0x00008451 }, /* GL_FOG_COORD */ + { 9952, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 9970, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 9994, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 10033, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10076, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10108, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10139, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10168, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10193, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10212, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 10246, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 10273, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 10299, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 10323, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 10340, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 10355, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 10379, 0x00000B64 }, /* GL_FOG_END */ + { 10390, 0x00000C54 }, /* GL_FOG_HINT */ + { 10402, 0x00000B61 }, /* GL_FOG_INDEX */ + { 10415, 0x00000B65 }, /* GL_FOG_MODE */ + { 10427, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 10446, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 10471, 0x00000B63 }, /* GL_FOG_START */ + { 10484, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 10502, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 10526, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 10545, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 10568, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 10603, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 10618, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 10655, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 10691, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 10732, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 10773, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 10810, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 10847, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 10885, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 10927, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 10965, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 11007, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11042, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 11081, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 11130, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 11178, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 11230, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 11270, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 11314, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 11354, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 11398, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 11425, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 11449, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 11477, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 11500, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 11519, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 11556, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 11597, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 11638, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 11680, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 11731, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 11769, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 11814, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 11863, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 11901, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 11943, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 11975, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 12000, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 12027, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 12058, 0x00000404 }, /* GL_FRONT */ + { 12067, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 12085, 0x00000B46 }, /* GL_FRONT_FACE */ + { 12099, 0x00000400 }, /* GL_FRONT_LEFT */ + { 12113, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 12128, 0x00008006 }, /* GL_FUNC_ADD */ + { 12140, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 12156, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 12181, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 12210, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 12227, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 12248, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 12267, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 12291, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 12320, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 12344, 0x00000206 }, /* GL_GEQUAL */ + { 12354, 0x00000204 }, /* GL_GREATER */ + { 12365, 0x00001904 }, /* GL_GREEN */ + { 12374, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 12388, 0x00000D53 }, /* GL_GREEN_BITS */ + { 12402, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 12417, 0x00008000 }, /* GL_HINT_BIT */ + { 12429, 0x00008024 }, /* GL_HISTOGRAM */ + { 12442, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 12466, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 12494, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 12517, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 12544, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 12561, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 12581, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 12605, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 12629, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 12657, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 12685, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 12717, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 12739, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 12765, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 12783, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 12805, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 12824, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 12847, 0x0000862A }, /* GL_IDENTITY_NV */ + { 12862, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 12882, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 12922, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 12960, 0x00001E02 }, /* GL_INCR */ + { 12968, 0x00008507 }, /* GL_INCR_WRAP */ + { 12981, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 12998, 0x00008222 }, /* GL_INDEX */ + { 13007, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 13022, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 13052, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 13086, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 13109, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 13131, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 13151, 0x00000D51 }, /* GL_INDEX_BITS */ + { 13165, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 13186, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 13204, 0x00000C30 }, /* GL_INDEX_MODE */ + { 13218, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 13234, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 13249, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 13268, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 13287, 0x00001404 }, /* GL_INT */ + { 13294, 0x00008049 }, /* GL_INTENSITY */ + { 13307, 0x0000804C }, /* GL_INTENSITY12 */ + { 13322, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 13341, 0x0000804D }, /* GL_INTENSITY16 */ + { 13356, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 13375, 0x0000804A }, /* GL_INTENSITY4 */ + { 13389, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 13407, 0x0000804B }, /* GL_INTENSITY8 */ + { 13421, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 13439, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 13456, 0x00008575 }, /* GL_INTERPOLATE */ + { 13471, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 13490, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 13509, 0x00008B53 }, /* GL_INT_VEC2 */ + { 13521, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 13537, 0x00008B54 }, /* GL_INT_VEC3 */ + { 13549, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 13565, 0x00008B55 }, /* GL_INT_VEC4 */ + { 13577, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 13593, 0x00000500 }, /* GL_INVALID_ENUM */ + { 13609, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 13642, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 13679, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 13700, 0x00000501 }, /* GL_INVALID_VALUE */ + { 13717, 0x0000862B }, /* GL_INVERSE_NV */ + { 13731, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 13755, 0x0000150A }, /* GL_INVERT */ + { 13765, 0x00001E00 }, /* GL_KEEP */ + { 13773, 0x00000406 }, /* GL_LEFT */ + { 13781, 0x00000203 }, /* GL_LEQUAL */ + { 13791, 0x00000201 }, /* GL_LESS */ + { 13799, 0x00004000 }, /* GL_LIGHT0 */ + { 13809, 0x00004001 }, /* GL_LIGHT1 */ + { 13819, 0x00004002 }, /* GL_LIGHT2 */ + { 13829, 0x00004003 }, /* GL_LIGHT3 */ + { 13839, 0x00004004 }, /* GL_LIGHT4 */ + { 13849, 0x00004005 }, /* GL_LIGHT5 */ + { 13859, 0x00004006 }, /* GL_LIGHT6 */ + { 13869, 0x00004007 }, /* GL_LIGHT7 */ + { 13879, 0x00000B50 }, /* GL_LIGHTING */ + { 13891, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 13907, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 13930, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 13959, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 13992, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 14020, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 14044, 0x00001B01 }, /* GL_LINE */ + { 14052, 0x00002601 }, /* GL_LINEAR */ + { 14062, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 14084, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 14114, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 14145, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 14169, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 14194, 0x00000001 }, /* GL_LINES */ + { 14203, 0x00000004 }, /* GL_LINE_BIT */ + { 14215, 0x00000002 }, /* GL_LINE_LOOP */ + { 14228, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 14248, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 14263, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 14283, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 14299, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 14323, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 14346, 0x00000003 }, /* GL_LINE_STRIP */ + { 14360, 0x00000702 }, /* GL_LINE_TOKEN */ + { 14374, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 14388, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 14414, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 14434, 0x00008B82 }, /* GL_LINK_STATUS */ + { 14449, 0x00000B32 }, /* GL_LIST_BASE */ + { 14462, 0x00020000 }, /* GL_LIST_BIT */ + { 14474, 0x00000B33 }, /* GL_LIST_INDEX */ + { 14488, 0x00000B30 }, /* GL_LIST_MODE */ + { 14501, 0x00000101 }, /* GL_LOAD */ + { 14509, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 14521, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 14538, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 14552, 0x00001909 }, /* GL_LUMINANCE */ + { 14565, 0x00008041 }, /* GL_LUMINANCE12 */ + { 14580, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 14603, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 14630, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 14652, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 14678, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 14697, 0x00008042 }, /* GL_LUMINANCE16 */ + { 14712, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 14735, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 14762, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 14781, 0x0000803F }, /* GL_LUMINANCE4 */ + { 14795, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 14816, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 14841, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 14859, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 14880, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 14905, 0x00008040 }, /* GL_LUMINANCE8 */ + { 14919, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 14940, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 14965, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 14983, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 15002, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 15018, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 15038, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 15060, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 15074, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 15089, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 15113, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 15137, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 15161, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 15185, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 15202, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 15219, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 15247, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 15276, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 15305, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 15334, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 15363, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 15392, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 15421, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 15449, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 15477, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 15505, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 15533, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 15561, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 15589, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 15617, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 15645, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 15673, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 15689, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 15709, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 15731, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 15745, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 15760, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 15784, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 15808, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 15832, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 15856, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 15873, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 15890, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 15918, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 15947, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 15976, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 16005, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 16034, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 16063, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 16092, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 16120, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 16148, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 16176, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 16204, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 16232, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 16260, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 16288, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 16316, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 16344, 0x00000D10 }, /* GL_MAP_COLOR */ + { 16357, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 16372, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 16387, 0x00008630 }, /* GL_MATRIX0_NV */ + { 16401, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 16417, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 16433, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 16449, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 16465, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 16481, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 16497, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 16513, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 16529, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 16545, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 16561, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 16576, 0x00008631 }, /* GL_MATRIX1_NV */ + { 16590, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 16606, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 16622, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 16638, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 16654, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 16670, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 16686, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 16702, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 16718, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 16734, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 16750, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 16765, 0x00008632 }, /* GL_MATRIX2_NV */ + { 16779, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 16795, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 16811, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 16826, 0x00008633 }, /* GL_MATRIX3_NV */ + { 16840, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 16855, 0x00008634 }, /* GL_MATRIX4_NV */ + { 16869, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 16884, 0x00008635 }, /* GL_MATRIX5_NV */ + { 16898, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 16913, 0x00008636 }, /* GL_MATRIX6_NV */ + { 16927, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 16942, 0x00008637 }, /* GL_MATRIX7_NV */ + { 16956, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 16971, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 16986, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 17012, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 17046, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 17077, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 17110, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 17141, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 17156, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 17178, 0x00008008 }, /* GL_MAX */ + { 17185, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 17208, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 17240, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 17266, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 17299, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 17325, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 17359, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 17378, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 17407, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 17439, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 17475, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 17511, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 17551, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 17577, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 17607, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 17632, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 17661, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 17690, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 17723, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 17743, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 17767, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 17791, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 17815, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 17840, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 17858, 0x00008008 }, /* GL_MAX_EXT */ + { 17869, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 17904, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 17943, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 17957, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 17977, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 18015, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 18044, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 18068, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 18096, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 18119, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 18156, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 18192, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 18219, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 18248, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 18282, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 18318, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 18345, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 18377, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 18413, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 18442, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 18471, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 18499, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 18537, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 18581, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 18624, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 18658, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 18697, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 18734, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 18772, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 18815, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 18858, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 18888, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 18919, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 18955, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 18991, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 19021, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 19055, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 19088, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 19117, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 19132, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 19152, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 19176, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 19198, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 19224, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 19251, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 19282, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 19306, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 19340, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 19360, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 19387, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 19408, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 19433, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 19458, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 19493, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 19515, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 19541, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 19563, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 19589, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 19623, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 19661, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 19694, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 19731, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 19755, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 19776, 0x00008007 }, /* GL_MIN */ + { 19783, 0x0000802E }, /* GL_MINMAX */ + { 19793, 0x0000802E }, /* GL_MINMAX_EXT */ + { 19807, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 19824, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 19845, 0x00008030 }, /* GL_MINMAX_SINK */ + { 19860, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 19879, 0x00008007 }, /* GL_MIN_EXT */ + { 19890, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 19909, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 19932, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 19955, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 19975, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 19995, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 20025, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 20053, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 20081, 0x00001700 }, /* GL_MODELVIEW */ + { 20094, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 20112, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 20131, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 20150, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 20169, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 20188, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 20207, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 20226, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 20245, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 20264, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 20283, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 20302, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 20320, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 20339, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 20358, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 20377, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 20396, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 20415, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 20434, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 20453, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 20472, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 20491, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 20510, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 20528, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 20547, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 20566, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 20584, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 20602, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 20620, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 20638, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 20656, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 20674, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 20692, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 20712, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 20739, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 20764, 0x00002100 }, /* GL_MODULATE */ + { 20776, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 20796, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 20823, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 20848, 0x00000103 }, /* GL_MULT */ + { 20856, 0x0000809D }, /* GL_MULTISAMPLE */ + { 20871, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 20891, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 20910, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 20929, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 20953, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 20976, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 21006, 0x00002A25 }, /* GL_N3F_V3F */ + { 21017, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 21037, 0x0000150E }, /* GL_NAND */ + { 21045, 0x00002600 }, /* GL_NEAREST */ + { 21056, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 21087, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 21119, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 21144, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 21170, 0x00000200 }, /* GL_NEVER */ + { 21179, 0x00001102 }, /* GL_NICEST */ + { 21189, 0x00000000 }, /* GL_NONE */ + { 21197, 0x00001505 }, /* GL_NOOP */ + { 21205, 0x00001508 }, /* GL_NOR */ + { 21212, 0x00000BA1 }, /* GL_NORMALIZE */ + { 21225, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 21241, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 21272, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 21307, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 21331, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 21354, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 21375, 0x00008511 }, /* GL_NORMAL_MAP */ + { 21389, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 21407, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 21424, 0x00000205 }, /* GL_NOTEQUAL */ + { 21436, 0x00000000 }, /* GL_NO_ERROR */ + { 21448, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 21482, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 21520, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 21552, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 21594, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 21624, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 21664, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 21695, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 21724, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 21752, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 21782, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 21799, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 21825, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 21841, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 21876, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 21898, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 21917, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 21947, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 21968, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 21996, 0x00000001 }, /* GL_ONE */ + { 22003, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 22031, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 22063, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 22091, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 22123, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 22146, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 22169, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 22192, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 22215, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 22233, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 22255, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 22277, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 22293, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 22313, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 22333, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 22351, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 22373, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 22395, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 22411, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 22431, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 22451, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 22469, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 22491, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 22513, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 22529, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 22549, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 22569, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 22590, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 22609, 0x00001507 }, /* GL_OR */ + { 22615, 0x00000A01 }, /* GL_ORDER */ + { 22624, 0x0000150D }, /* GL_OR_INVERTED */ + { 22639, 0x0000150B }, /* GL_OR_REVERSE */ + { 22653, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 22670, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 22688, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 22709, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 22729, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 22747, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 22766, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 22786, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 22806, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 22824, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 22843, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 22868, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 22892, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 22913, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 22935, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 22957, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 22982, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 23006, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 23027, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 23049, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 23071, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 23093, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 23124, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 23144, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 23169, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 23189, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 23214, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 23234, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 23259, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 23279, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 23304, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 23324, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 23349, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 23369, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 23394, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 23414, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 23439, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 23459, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 23484, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 23504, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 23529, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 23549, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 23574, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 23592, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 23613, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 23642, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 23675, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 23700, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 23723, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 23754, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 23789, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 23816, 0x00001B00 }, /* GL_POINT */ + { 23825, 0x00000000 }, /* GL_POINTS */ + { 23835, 0x00000002 }, /* GL_POINT_BIT */ + { 23848, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 23878, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 23912, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 23946, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 23981, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 24010, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 24043, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 24076, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 24110, 0x00000B11 }, /* GL_POINT_SIZE */ + { 24124, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 24150, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 24168, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 24190, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 24212, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 24235, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 24253, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 24275, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 24297, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 24320, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 24340, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 24356, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 24377, 0x00008861 }, /* GL_POINT_SPRITE */ + { 24393, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 24413, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 24442, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 24461, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 24487, 0x00000701 }, /* GL_POINT_TOKEN */ + { 24502, 0x00000009 }, /* GL_POLYGON */ + { 24513, 0x00000008 }, /* GL_POLYGON_BIT */ + { 24528, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 24544, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 24567, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 24592, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 24615, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 24638, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 24662, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 24686, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 24704, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 24727, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 24746, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 24769, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 24786, 0x00001203 }, /* GL_POSITION */ + { 24798, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 24830, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 24866, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 24899, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 24936, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 24967, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 25002, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 25034, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 25070, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 25103, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 25135, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 25171, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 25204, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 25241, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 25271, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 25305, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 25336, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 25371, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 25402, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 25437, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 25469, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 25505, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 25535, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 25569, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 25600, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 25635, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 25667, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 25698, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 25733, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 25765, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 25801, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 25830, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 25863, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 25893, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 25927, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 25966, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 25999, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 26039, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 26073, 0x00008578 }, /* GL_PREVIOUS */ + { 26085, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 26101, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 26117, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 26134, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 26155, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 26176, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 26209, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 26241, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 26264, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 26287, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 26317, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 26346, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 26374, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 26396, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 26424, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 26452, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 26474, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 26495, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 26535, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 26574, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 26604, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 26639, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 26672, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 26706, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 26745, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 26784, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 26806, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 26832, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 26856, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 26879, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 26901, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 26922, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 26943, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 26970, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 27002, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 27034, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 27069, 0x00001701 }, /* GL_PROJECTION */ + { 27083, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 27104, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 27130, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 27151, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 27170, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 27193, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 27232, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 27270, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 27290, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 27320, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 27344, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 27364, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 27394, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 27418, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 27438, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 27471, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 27497, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 27527, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 27558, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 27588, 0x00002003 }, /* GL_Q */ + { 27593, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 27618, 0x00000007 }, /* GL_QUADS */ + { 27627, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 27644, 0x00000008 }, /* GL_QUAD_STRIP */ + { 27658, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 27680, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 27706, 0x00008866 }, /* GL_QUERY_RESULT */ + { 27722, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 27742, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 27768, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 27798, 0x00002002 }, /* GL_R */ + { 27803, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 27815, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 27848, 0x00000C02 }, /* GL_READ_BUFFER */ + { 27863, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 27883, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 27915, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 27939, 0x000088B8 }, /* GL_READ_ONLY */ + { 27952, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 27969, 0x000088BA }, /* GL_READ_WRITE */ + { 27983, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 28001, 0x00001903 }, /* GL_RED */ + { 28008, 0x00008016 }, /* GL_REDUCE */ + { 28018, 0x00008016 }, /* GL_REDUCE_EXT */ + { 28032, 0x00000D15 }, /* GL_RED_BIAS */ + { 28044, 0x00000D52 }, /* GL_RED_BITS */ + { 28056, 0x00000D14 }, /* GL_RED_SCALE */ + { 28069, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 28087, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 28109, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 28130, 0x00001C00 }, /* GL_RENDER */ + { 28140, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 28156, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 28183, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 28211, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 28237, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 28264, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 28284, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 28311, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 28334, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 28361, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 28393, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 28429, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 28454, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 28478, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 28507, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 28529, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 28555, 0x00001F01 }, /* GL_RENDERER */ + { 28567, 0x00000C40 }, /* GL_RENDER_MODE */ + { 28582, 0x00002901 }, /* GL_REPEAT */ + { 28592, 0x00001E01 }, /* GL_REPLACE */ + { 28603, 0x00008062 }, /* GL_REPLACE_EXT */ + { 28618, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 28641, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 28659, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 28681, 0x00000102 }, /* GL_RETURN */ + { 28691, 0x00001907 }, /* GL_RGB */ + { 28698, 0x00008052 }, /* GL_RGB10 */ + { 28707, 0x00008059 }, /* GL_RGB10_A2 */ + { 28719, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 28735, 0x00008052 }, /* GL_RGB10_EXT */ + { 28748, 0x00008053 }, /* GL_RGB12 */ + { 28757, 0x00008053 }, /* GL_RGB12_EXT */ + { 28770, 0x00008054 }, /* GL_RGB16 */ + { 28779, 0x00008054 }, /* GL_RGB16_EXT */ + { 28792, 0x0000804E }, /* GL_RGB2_EXT */ + { 28804, 0x0000804F }, /* GL_RGB4 */ + { 28812, 0x0000804F }, /* GL_RGB4_EXT */ + { 28824, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 28837, 0x00008050 }, /* GL_RGB5 */ + { 28845, 0x00008057 }, /* GL_RGB5_A1 */ + { 28856, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 28871, 0x00008050 }, /* GL_RGB5_EXT */ + { 28883, 0x00008051 }, /* GL_RGB8 */ + { 28891, 0x00008051 }, /* GL_RGB8_EXT */ + { 28903, 0x00001908 }, /* GL_RGBA */ + { 28911, 0x0000805A }, /* GL_RGBA12 */ + { 28921, 0x0000805A }, /* GL_RGBA12_EXT */ + { 28935, 0x0000805B }, /* GL_RGBA16 */ + { 28945, 0x0000805B }, /* GL_RGBA16_EXT */ + { 28959, 0x00008055 }, /* GL_RGBA2 */ + { 28968, 0x00008055 }, /* GL_RGBA2_EXT */ + { 28981, 0x00008056 }, /* GL_RGBA4 */ + { 28990, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 29009, 0x00008056 }, /* GL_RGBA4_EXT */ + { 29022, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 29036, 0x00008058 }, /* GL_RGBA8 */ + { 29045, 0x00008058 }, /* GL_RGBA8_EXT */ + { 29058, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 29073, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 29091, 0x00000C31 }, /* GL_RGBA_MODE */ + { 29104, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 29117, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 29131, 0x000083A0 }, /* GL_RGB_S3TC */ + { 29143, 0x00008573 }, /* GL_RGB_SCALE */ + { 29156, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 29173, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 29190, 0x00000407 }, /* GL_RIGHT */ + { 29199, 0x00002000 }, /* GL_S */ + { 29204, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 29218, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 29239, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 29253, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 29274, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 29288, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 29304, 0x000080A9 }, /* GL_SAMPLES */ + { 29315, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 29331, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 29346, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 29364, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 29386, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 29414, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 29446, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 29469, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 29496, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 29514, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 29537, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 29559, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 29578, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 29601, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 29627, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 29657, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 29682, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 29711, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 29726, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 29741, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 29757, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 29782, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 29822, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 29866, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 29899, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 29929, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 29961, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 29991, 0x00001C02 }, /* GL_SELECT */ + { 30001, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 30029, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 30054, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 30070, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 30097, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 30128, 0x0000150F }, /* GL_SET */ + { 30135, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 30156, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 30180, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 30195, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 30210, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 30238, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 30261, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 30291, 0x00001601 }, /* GL_SHININESS */ + { 30304, 0x00001402 }, /* GL_SHORT */ + { 30313, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 30334, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 30350, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 30370, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 30389, 0x00008C46 }, /* GL_SLUMINANCE */ + { 30403, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 30418, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 30440, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 30460, 0x00001D01 }, /* GL_SMOOTH */ + { 30470, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 30503, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 30530, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 30563, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 30590, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 30607, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 30628, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 30649, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 30664, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 30683, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 30702, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 30719, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 30740, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 30761, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 30776, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 30795, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 30814, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 30831, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 30852, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 30873, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 30888, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 30907, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 30926, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 30946, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 30964, 0x00001202 }, /* GL_SPECULAR */ + { 30976, 0x00002402 }, /* GL_SPHERE_MAP */ + { 30990, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 31005, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 31023, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 31040, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 31054, 0x00008580 }, /* GL_SRC0_RGB */ + { 31066, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 31080, 0x00008581 }, /* GL_SRC1_RGB */ + { 31092, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 31106, 0x00008582 }, /* GL_SRC2_RGB */ + { 31118, 0x00000302 }, /* GL_SRC_ALPHA */ + { 31131, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 31153, 0x00000300 }, /* GL_SRC_COLOR */ + { 31166, 0x00008C40 }, /* GL_SRGB */ + { 31174, 0x00008C41 }, /* GL_SRGB8 */ + { 31183, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 31199, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 31213, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 31231, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 31250, 0x000088E6 }, /* GL_STATIC_COPY */ + { 31265, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 31284, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 31299, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 31318, 0x000088E5 }, /* GL_STATIC_READ */ + { 31333, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 31352, 0x00001802 }, /* GL_STENCIL */ + { 31363, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 31385, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 31411, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 31432, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 31457, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 31478, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 31503, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 31535, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 31571, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 31603, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 31639, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 31659, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 31686, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 31712, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 31728, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 31750, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 31773, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 31789, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 31805, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 31822, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 31845, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 31867, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 31889, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 31911, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 31932, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 31959, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 31986, 0x00000B97 }, /* GL_STENCIL_REF */ + { 32001, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 32017, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 32046, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 32068, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 32089, 0x00000C33 }, /* GL_STEREO */ + { 32099, 0x000088E2 }, /* GL_STREAM_COPY */ + { 32114, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 32133, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 32148, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 32167, 0x000088E1 }, /* GL_STREAM_READ */ + { 32182, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 32201, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 32218, 0x000084E7 }, /* GL_SUBTRACT */ + { 32230, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 32246, 0x00002001 }, /* GL_T */ + { 32251, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 32266, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 32285, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 32301, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 32316, 0x00002A27 }, /* GL_T2F_V3F */ + { 32327, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 32346, 0x00002A28 }, /* GL_T4F_V4F */ + { 32357, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 32380, 0x00001702 }, /* GL_TEXTURE */ + { 32391, 0x000084C0 }, /* GL_TEXTURE0 */ + { 32403, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 32419, 0x000084C1 }, /* GL_TEXTURE1 */ + { 32431, 0x000084CA }, /* GL_TEXTURE10 */ + { 32444, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 32461, 0x000084CB }, /* GL_TEXTURE11 */ + { 32474, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 32491, 0x000084CC }, /* GL_TEXTURE12 */ + { 32504, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 32521, 0x000084CD }, /* GL_TEXTURE13 */ + { 32534, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 32551, 0x000084CE }, /* GL_TEXTURE14 */ + { 32564, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 32581, 0x000084CF }, /* GL_TEXTURE15 */ + { 32594, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 32611, 0x000084D0 }, /* GL_TEXTURE16 */ + { 32624, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 32641, 0x000084D1 }, /* GL_TEXTURE17 */ + { 32654, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 32671, 0x000084D2 }, /* GL_TEXTURE18 */ + { 32684, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 32701, 0x000084D3 }, /* GL_TEXTURE19 */ + { 32714, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 32731, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 32747, 0x000084C2 }, /* GL_TEXTURE2 */ + { 32759, 0x000084D4 }, /* GL_TEXTURE20 */ + { 32772, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 32789, 0x000084D5 }, /* GL_TEXTURE21 */ + { 32802, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 32819, 0x000084D6 }, /* GL_TEXTURE22 */ + { 32832, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 32849, 0x000084D7 }, /* GL_TEXTURE23 */ + { 32862, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 32879, 0x000084D8 }, /* GL_TEXTURE24 */ + { 32892, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 32909, 0x000084D9 }, /* GL_TEXTURE25 */ + { 32922, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 32939, 0x000084DA }, /* GL_TEXTURE26 */ + { 32952, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 32969, 0x000084DB }, /* GL_TEXTURE27 */ + { 32982, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 32999, 0x000084DC }, /* GL_TEXTURE28 */ + { 33012, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 33029, 0x000084DD }, /* GL_TEXTURE29 */ + { 33042, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 33059, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 33075, 0x000084C3 }, /* GL_TEXTURE3 */ + { 33087, 0x000084DE }, /* GL_TEXTURE30 */ + { 33100, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 33117, 0x000084DF }, /* GL_TEXTURE31 */ + { 33130, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 33147, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 33163, 0x000084C4 }, /* GL_TEXTURE4 */ + { 33175, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 33191, 0x000084C5 }, /* GL_TEXTURE5 */ + { 33203, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 33219, 0x000084C6 }, /* GL_TEXTURE6 */ + { 33231, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 33247, 0x000084C7 }, /* GL_TEXTURE7 */ + { 33259, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 33275, 0x000084C8 }, /* GL_TEXTURE8 */ + { 33287, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 33303, 0x000084C9 }, /* GL_TEXTURE9 */ + { 33315, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 33331, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 33345, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 33369, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 33383, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 33407, 0x0000806F }, /* GL_TEXTURE_3D */ + { 33421, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 33443, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 33469, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 33491, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 33513, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 33545, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 33567, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 33599, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 33621, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 33649, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 33681, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 33714, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 33746, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 33761, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 33782, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 33807, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 33825, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 33849, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 33880, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 33910, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 33940, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 33975, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 34006, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 34044, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 34071, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 34103, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 34137, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 34161, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 34189, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 34213, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 34241, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 34274, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 34298, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 34320, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 34342, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 34368, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 34402, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 34435, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 34472, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 34500, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 34532, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 34555, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 34593, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 34635, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 34666, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 34694, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 34724, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 34752, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 34772, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 34796, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 34827, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 34862, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 34893, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 34928, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 34959, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 34994, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 35025, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 35060, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 35091, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 35126, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 35157, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 35192, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 35209, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 35231, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 35257, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 35272, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 35293, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 35313, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 35339, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 35359, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 35376, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 35393, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 35410, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 35427, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 35452, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 35474, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 35500, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 35518, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 35544, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 35570, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 35600, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 35627, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 35652, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 35672, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 35696, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 35723, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 35750, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 35777, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 35803, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 35833, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 35855, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 35873, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 35903, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 35931, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 35959, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 35987, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 36008, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 36027, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 36049, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 36068, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 36088, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 36113, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 36137, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 36157, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 36181, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 36201, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 36224, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 36248, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 36273, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 36307, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 36324, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 36342, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 36360, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 36378, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 36398, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 36417, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 36446, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 36463, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 36489, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 36519, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 36551, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 36581, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 36615, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 36631, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 36662, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 36697, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 36725, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 36757, 0x00000004 }, /* GL_TRIANGLES */ + { 36770, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 36786, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 36807, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 36825, 0x00000001 }, /* GL_TRUE */ + { 36833, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 36853, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 36876, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 36896, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 36917, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 36939, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 36961, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 36981, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 37002, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 37019, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 37046, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 37069, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 37085, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 37112, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 37133, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 37157, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 37188, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 37212, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 37240, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 37263, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 37281, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 37311, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 37337, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 37367, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 37393, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 37417, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 37445, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 37473, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 37500, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 37532, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 37563, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 37577, 0x00002A20 }, /* GL_V2F */ + { 37584, 0x00002A21 }, /* GL_V3F */ + { 37591, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 37610, 0x00001F00 }, /* GL_VENDOR */ + { 37620, 0x00001F02 }, /* GL_VERSION */ + { 37631, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 37647, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 37677, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 37708, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 37743, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 37767, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 37788, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 37811, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 37832, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 37859, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 37887, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 37915, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 37943, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 37971, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 37999, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 38027, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 38054, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 38081, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 38108, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 38135, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 38162, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 38189, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 38216, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 38243, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 38270, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 38308, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 38350, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 38381, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 38416, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 38450, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 38488, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 38519, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 38554, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 38582, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 38614, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 38644, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 38678, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 38706, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 38738, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 38758, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 38780, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 38809, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 38830, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 38859, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 38892, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 38924, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 38951, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 38982, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 39012, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 39029, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 39050, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 39077, 0x00000BA2 }, /* GL_VIEWPORT */ + { 39089, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 39105, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 39125, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 39156, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 39191, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 39219, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 39244, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 39271, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 39296, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 39320, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 39339, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 39353, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 39371, 0x00001506 }, /* GL_XOR */ + { 39378, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 39397, 0x00008757 }, /* GL_YCBCR_MESA */ + { 39411, 0x00000000 }, /* GL_ZERO */ + { 39419, 0x00000D16 }, /* GL_ZOOM_X */ + { 39429, 0x00000D17 }, /* GL_ZOOM_Y */ }; -static const unsigned reduced_enums[1319] = +static const unsigned reduced_enums[1321] = { - 469, /* GL_FALSE */ - 683, /* GL_LINES */ - 685, /* GL_LINE_LOOP */ - 692, /* GL_LINE_STRIP */ - 1709, /* GL_TRIANGLES */ - 1712, /* GL_TRIANGLE_STRIP */ - 1710, /* GL_TRIANGLE_FAN */ - 1254, /* GL_QUADS */ - 1256, /* GL_QUAD_STRIP */ - 1142, /* GL_POLYGON */ - 1154, /* GL_POLYGON_STIPPLE_BIT */ - 1103, /* GL_PIXEL_MODE_BIT */ - 670, /* GL_LIGHTING_BIT */ - 497, /* GL_FOG_BIT */ + 471, /* GL_FALSE */ + 685, /* GL_LINES */ + 687, /* GL_LINE_LOOP */ + 694, /* GL_LINE_STRIP */ + 1711, /* GL_TRIANGLES */ + 1714, /* GL_TRIANGLE_STRIP */ + 1712, /* GL_TRIANGLE_FAN */ + 1256, /* GL_QUADS */ + 1258, /* GL_QUAD_STRIP */ + 1144, /* GL_POLYGON */ + 1156, /* GL_POLYGON_STIPPLE_BIT */ + 1105, /* GL_PIXEL_MODE_BIT */ + 672, /* GL_LIGHTING_BIT */ + 499, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 702, /* GL_LOAD */ - 1308, /* GL_RETURN */ - 976, /* GL_MULT */ + 704, /* GL_LOAD */ + 1310, /* GL_RETURN */ + 978, /* GL_MULT */ 23, /* GL_ADD */ - 992, /* GL_NEVER */ - 660, /* GL_LESS */ - 459, /* GL_EQUAL */ - 659, /* GL_LEQUAL */ - 583, /* GL_GREATER */ - 1007, /* GL_NOTEQUAL */ - 582, /* GL_GEQUAL */ + 994, /* GL_NEVER */ + 662, /* GL_LESS */ + 461, /* GL_EQUAL */ + 661, /* GL_LEQUAL */ + 585, /* GL_GREATER */ + 1009, /* GL_NOTEQUAL */ + 584, /* GL_GEQUAL */ 46, /* GL_ALWAYS */ - 1448, /* GL_SRC_COLOR */ - 1036, /* GL_ONE_MINUS_SRC_COLOR */ - 1446, /* GL_SRC_ALPHA */ - 1035, /* GL_ONE_MINUS_SRC_ALPHA */ - 438, /* GL_DST_ALPHA */ - 1033, /* GL_ONE_MINUS_DST_ALPHA */ - 439, /* GL_DST_COLOR */ - 1034, /* GL_ONE_MINUS_DST_COLOR */ - 1447, /* GL_SRC_ALPHA_SATURATE */ - 570, /* GL_FRONT_LEFT */ - 571, /* GL_FRONT_RIGHT */ + 1450, /* GL_SRC_COLOR */ + 1038, /* GL_ONE_MINUS_SRC_COLOR */ + 1448, /* GL_SRC_ALPHA */ + 1037, /* GL_ONE_MINUS_SRC_ALPHA */ + 440, /* GL_DST_ALPHA */ + 1035, /* GL_ONE_MINUS_DST_ALPHA */ + 441, /* GL_DST_COLOR */ + 1036, /* GL_ONE_MINUS_DST_COLOR */ + 1449, /* GL_SRC_ALPHA_SATURATE */ + 572, /* GL_FRONT_LEFT */ + 573, /* GL_FRONT_RIGHT */ 68, /* GL_BACK_LEFT */ 69, /* GL_BACK_RIGHT */ - 567, /* GL_FRONT */ + 569, /* GL_FRONT */ 67, /* GL_BACK */ - 658, /* GL_LEFT */ - 1350, /* GL_RIGHT */ - 568, /* GL_FRONT_AND_BACK */ + 660, /* GL_LEFT */ + 1352, /* GL_RIGHT */ + 570, /* GL_FRONT_AND_BACK */ 62, /* GL_AUX0 */ 63, /* GL_AUX1 */ 64, /* GL_AUX2 */ 65, /* GL_AUX3 */ - 649, /* GL_INVALID_ENUM */ - 653, /* GL_INVALID_VALUE */ - 652, /* GL_INVALID_OPERATION */ - 1453, /* GL_STACK_OVERFLOW */ - 1454, /* GL_STACK_UNDERFLOW */ - 1061, /* GL_OUT_OF_MEMORY */ - 650, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 651, /* GL_INVALID_ENUM */ + 655, /* GL_INVALID_VALUE */ + 654, /* GL_INVALID_OPERATION */ + 1455, /* GL_STACK_OVERFLOW */ + 1456, /* GL_STACK_UNDERFLOW */ + 1063, /* GL_OUT_OF_MEMORY */ + 652, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1081, /* GL_PASS_THROUGH_TOKEN */ - 1141, /* GL_POINT_TOKEN */ - 693, /* GL_LINE_TOKEN */ - 1155, /* GL_POLYGON_TOKEN */ + 1083, /* GL_PASS_THROUGH_TOKEN */ + 1143, /* GL_POINT_TOKEN */ + 695, /* GL_LINE_TOKEN */ + 1157, /* GL_POLYGON_TOKEN */ 73, /* GL_BITMAP_TOKEN */ - 437, /* GL_DRAW_PIXEL_TOKEN */ + 439, /* GL_DRAW_PIXEL_TOKEN */ 297, /* GL_COPY_PIXEL_TOKEN */ - 686, /* GL_LINE_RESET_TOKEN */ - 462, /* GL_EXP */ - 463, /* GL_EXP2 */ - 331, /* GL_CW */ + 688, /* GL_LINE_RESET_TOKEN */ + 464, /* GL_EXP */ + 465, /* GL_EXP2 */ + 333, /* GL_CW */ 122, /* GL_CCW */ 143, /* GL_COEFF */ - 1058, /* GL_ORDER */ - 375, /* GL_DOMAIN */ - 305, /* GL_CURRENT_COLOR */ - 308, /* GL_CURRENT_INDEX */ - 314, /* GL_CURRENT_NORMAL */ - 327, /* GL_CURRENT_TEXTURE_COORDS */ - 319, /* GL_CURRENT_RASTER_COLOR */ - 321, /* GL_CURRENT_RASTER_INDEX */ - 325, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - 322, /* GL_CURRENT_RASTER_POSITION */ - 323, /* GL_CURRENT_RASTER_POSITION_VALID */ - 320, /* GL_CURRENT_RASTER_DISTANCE */ - 1134, /* GL_POINT_SMOOTH */ - 1123, /* GL_POINT_SIZE */ - 1133, /* GL_POINT_SIZE_RANGE */ - 1124, /* GL_POINT_SIZE_GRANULARITY */ - 687, /* GL_LINE_SMOOTH */ - 694, /* GL_LINE_WIDTH */ - 696, /* GL_LINE_WIDTH_RANGE */ - 695, /* GL_LINE_WIDTH_GRANULARITY */ - 689, /* GL_LINE_STIPPLE */ - 690, /* GL_LINE_STIPPLE_PATTERN */ - 691, /* GL_LINE_STIPPLE_REPEAT */ - 701, /* GL_LIST_MODE */ - 860, /* GL_MAX_LIST_NESTING */ - 698, /* GL_LIST_BASE */ - 700, /* GL_LIST_INDEX */ - 1144, /* GL_POLYGON_MODE */ - 1151, /* GL_POLYGON_SMOOTH */ - 1153, /* GL_POLYGON_STIPPLE */ - 448, /* GL_EDGE_FLAG */ - 298, /* GL_CULL_FACE */ - 299, /* GL_CULL_FACE_MODE */ - 569, /* GL_FRONT_FACE */ - 669, /* GL_LIGHTING */ - 674, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 675, /* GL_LIGHT_MODEL_TWO_SIDE */ - 671, /* GL_LIGHT_MODEL_AMBIENT */ - 1396, /* GL_SHADE_MODEL */ + 1060, /* GL_ORDER */ + 377, /* GL_DOMAIN */ + 307, /* GL_CURRENT_COLOR */ + 310, /* GL_CURRENT_INDEX */ + 316, /* GL_CURRENT_NORMAL */ + 329, /* GL_CURRENT_TEXTURE_COORDS */ + 321, /* GL_CURRENT_RASTER_COLOR */ + 323, /* GL_CURRENT_RASTER_INDEX */ + 327, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + 324, /* GL_CURRENT_RASTER_POSITION */ + 325, /* GL_CURRENT_RASTER_POSITION_VALID */ + 322, /* GL_CURRENT_RASTER_DISTANCE */ + 1136, /* GL_POINT_SMOOTH */ + 1125, /* GL_POINT_SIZE */ + 1135, /* GL_POINT_SIZE_RANGE */ + 1126, /* GL_POINT_SIZE_GRANULARITY */ + 689, /* GL_LINE_SMOOTH */ + 696, /* GL_LINE_WIDTH */ + 698, /* GL_LINE_WIDTH_RANGE */ + 697, /* GL_LINE_WIDTH_GRANULARITY */ + 691, /* GL_LINE_STIPPLE */ + 692, /* GL_LINE_STIPPLE_PATTERN */ + 693, /* GL_LINE_STIPPLE_REPEAT */ + 703, /* GL_LIST_MODE */ + 862, /* GL_MAX_LIST_NESTING */ + 700, /* GL_LIST_BASE */ + 702, /* GL_LIST_INDEX */ + 1146, /* GL_POLYGON_MODE */ + 1153, /* GL_POLYGON_SMOOTH */ + 1155, /* GL_POLYGON_STIPPLE */ + 450, /* GL_EDGE_FLAG */ + 300, /* GL_CULL_FACE */ + 301, /* GL_CULL_FACE_MODE */ + 571, /* GL_FRONT_FACE */ + 671, /* GL_LIGHTING */ + 676, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 677, /* GL_LIGHT_MODEL_TWO_SIDE */ + 673, /* GL_LIGHT_MODEL_AMBIENT */ + 1398, /* GL_SHADE_MODEL */ 190, /* GL_COLOR_MATERIAL_FACE */ 191, /* GL_COLOR_MATERIAL_PARAMETER */ 189, /* GL_COLOR_MATERIAL */ - 496, /* GL_FOG */ - 518, /* GL_FOG_INDEX */ - 514, /* GL_FOG_DENSITY */ - 522, /* GL_FOG_START */ - 516, /* GL_FOG_END */ - 519, /* GL_FOG_MODE */ - 498, /* GL_FOG_COLOR */ - 362, /* GL_DEPTH_RANGE */ - 369, /* GL_DEPTH_TEST */ - 372, /* GL_DEPTH_WRITEMASK */ - 350, /* GL_DEPTH_CLEAR_VALUE */ - 361, /* GL_DEPTH_FUNC */ + 498, /* GL_FOG */ + 520, /* GL_FOG_INDEX */ + 516, /* GL_FOG_DENSITY */ + 524, /* GL_FOG_START */ + 518, /* GL_FOG_END */ + 521, /* GL_FOG_MODE */ + 500, /* GL_FOG_COLOR */ + 364, /* GL_DEPTH_RANGE */ + 371, /* GL_DEPTH_TEST */ + 374, /* GL_DEPTH_WRITEMASK */ + 352, /* GL_DEPTH_CLEAR_VALUE */ + 363, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1489, /* GL_STENCIL_TEST */ - 1477, /* GL_STENCIL_CLEAR_VALUE */ - 1479, /* GL_STENCIL_FUNC */ - 1491, /* GL_STENCIL_VALUE_MASK */ - 1478, /* GL_STENCIL_FAIL */ - 1486, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1487, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1488, /* GL_STENCIL_REF */ - 1492, /* GL_STENCIL_WRITEMASK */ - 829, /* GL_MATRIX_MODE */ - 997, /* GL_NORMALIZE */ - 1801, /* GL_VIEWPORT */ - 971, /* GL_MODELVIEW_STACK_DEPTH */ - 1234, /* GL_PROJECTION_STACK_DEPTH */ - 1687, /* GL_TEXTURE_STACK_DEPTH */ - 969, /* GL_MODELVIEW_MATRIX */ - 1233, /* GL_PROJECTION_MATRIX */ - 1672, /* GL_TEXTURE_MATRIX */ + 1491, /* GL_STENCIL_TEST */ + 1479, /* GL_STENCIL_CLEAR_VALUE */ + 1481, /* GL_STENCIL_FUNC */ + 1493, /* GL_STENCIL_VALUE_MASK */ + 1480, /* GL_STENCIL_FAIL */ + 1488, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1489, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1490, /* GL_STENCIL_REF */ + 1494, /* GL_STENCIL_WRITEMASK */ + 831, /* GL_MATRIX_MODE */ + 999, /* GL_NORMALIZE */ + 1803, /* GL_VIEWPORT */ + 973, /* GL_MODELVIEW_STACK_DEPTH */ + 1236, /* GL_PROJECTION_STACK_DEPTH */ + 1689, /* GL_TEXTURE_STACK_DEPTH */ + 971, /* GL_MODELVIEW_MATRIX */ + 1235, /* GL_PROJECTION_MATRIX */ + 1674, /* GL_TEXTURE_MATRIX */ 60, /* GL_ATTRIB_STACK_DEPTH */ 133, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ 44, /* GL_ALPHA_TEST_FUNC */ 45, /* GL_ALPHA_TEST_REF */ - 374, /* GL_DITHER */ + 376, /* GL_DITHER */ 77, /* GL_BLEND_DST */ 86, /* GL_BLEND_SRC */ 74, /* GL_BLEND */ - 704, /* GL_LOGIC_OP_MODE */ - 623, /* GL_INDEX_LOGIC_OP */ + 706, /* GL_LOGIC_OP_MODE */ + 625, /* GL_INDEX_LOGIC_OP */ 188, /* GL_COLOR_LOGIC_OP */ 66, /* GL_AUX_BUFFERS */ - 385, /* GL_DRAW_BUFFER */ - 1266, /* GL_READ_BUFFER */ - 1377, /* GL_SCISSOR_BOX */ - 1378, /* GL_SCISSOR_TEST */ - 622, /* GL_INDEX_CLEAR_VALUE */ - 627, /* GL_INDEX_WRITEMASK */ + 387, /* GL_DRAW_BUFFER */ + 1268, /* GL_READ_BUFFER */ + 1379, /* GL_SCISSOR_BOX */ + 1380, /* GL_SCISSOR_TEST */ + 624, /* GL_INDEX_CLEAR_VALUE */ + 629, /* GL_INDEX_WRITEMASK */ 185, /* GL_COLOR_CLEAR_VALUE */ 227, /* GL_COLOR_WRITEMASK */ - 624, /* GL_INDEX_MODE */ - 1343, /* GL_RGBA_MODE */ - 384, /* GL_DOUBLEBUFFER */ - 1493, /* GL_STEREO */ - 1301, /* GL_RENDER_MODE */ - 1082, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1135, /* GL_POINT_SMOOTH_HINT */ - 688, /* GL_LINE_SMOOTH_HINT */ - 1152, /* GL_POLYGON_SMOOTH_HINT */ - 517, /* GL_FOG_HINT */ - 1653, /* GL_TEXTURE_GEN_S */ - 1654, /* GL_TEXTURE_GEN_T */ - 1652, /* GL_TEXTURE_GEN_R */ - 1651, /* GL_TEXTURE_GEN_Q */ - 1095, /* GL_PIXEL_MAP_I_TO_I */ - 1101, /* GL_PIXEL_MAP_S_TO_S */ - 1097, /* GL_PIXEL_MAP_I_TO_R */ - 1093, /* GL_PIXEL_MAP_I_TO_G */ - 1091, /* GL_PIXEL_MAP_I_TO_B */ - 1089, /* GL_PIXEL_MAP_I_TO_A */ - 1099, /* GL_PIXEL_MAP_R_TO_R */ - 1087, /* GL_PIXEL_MAP_G_TO_G */ - 1085, /* GL_PIXEL_MAP_B_TO_B */ - 1083, /* GL_PIXEL_MAP_A_TO_A */ - 1096, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1102, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1098, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1094, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1092, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1090, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1100, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1088, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1086, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1084, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1721, /* GL_UNPACK_SWAP_BYTES */ - 1716, /* GL_UNPACK_LSB_FIRST */ - 1717, /* GL_UNPACK_ROW_LENGTH */ - 1720, /* GL_UNPACK_SKIP_ROWS */ - 1719, /* GL_UNPACK_SKIP_PIXELS */ - 1714, /* GL_UNPACK_ALIGNMENT */ - 1070, /* GL_PACK_SWAP_BYTES */ - 1065, /* GL_PACK_LSB_FIRST */ - 1066, /* GL_PACK_ROW_LENGTH */ - 1069, /* GL_PACK_SKIP_ROWS */ - 1068, /* GL_PACK_SKIP_PIXELS */ - 1062, /* GL_PACK_ALIGNMENT */ - 782, /* GL_MAP_COLOR */ - 783, /* GL_MAP_STENCIL */ - 626, /* GL_INDEX_SHIFT */ - 625, /* GL_INDEX_OFFSET */ - 1279, /* GL_RED_SCALE */ - 1277, /* GL_RED_BIAS */ - 1818, /* GL_ZOOM_X */ - 1819, /* GL_ZOOM_Y */ - 587, /* GL_GREEN_SCALE */ - 585, /* GL_GREEN_BIAS */ + 626, /* GL_INDEX_MODE */ + 1345, /* GL_RGBA_MODE */ + 386, /* GL_DOUBLEBUFFER */ + 1495, /* GL_STEREO */ + 1303, /* GL_RENDER_MODE */ + 1084, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1137, /* GL_POINT_SMOOTH_HINT */ + 690, /* GL_LINE_SMOOTH_HINT */ + 1154, /* GL_POLYGON_SMOOTH_HINT */ + 519, /* GL_FOG_HINT */ + 1655, /* GL_TEXTURE_GEN_S */ + 1656, /* GL_TEXTURE_GEN_T */ + 1654, /* GL_TEXTURE_GEN_R */ + 1653, /* GL_TEXTURE_GEN_Q */ + 1097, /* GL_PIXEL_MAP_I_TO_I */ + 1103, /* GL_PIXEL_MAP_S_TO_S */ + 1099, /* GL_PIXEL_MAP_I_TO_R */ + 1095, /* GL_PIXEL_MAP_I_TO_G */ + 1093, /* GL_PIXEL_MAP_I_TO_B */ + 1091, /* GL_PIXEL_MAP_I_TO_A */ + 1101, /* GL_PIXEL_MAP_R_TO_R */ + 1089, /* GL_PIXEL_MAP_G_TO_G */ + 1087, /* GL_PIXEL_MAP_B_TO_B */ + 1085, /* GL_PIXEL_MAP_A_TO_A */ + 1098, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1104, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1100, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1096, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1094, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1092, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1102, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1090, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1088, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1086, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1723, /* GL_UNPACK_SWAP_BYTES */ + 1718, /* GL_UNPACK_LSB_FIRST */ + 1719, /* GL_UNPACK_ROW_LENGTH */ + 1722, /* GL_UNPACK_SKIP_ROWS */ + 1721, /* GL_UNPACK_SKIP_PIXELS */ + 1716, /* GL_UNPACK_ALIGNMENT */ + 1072, /* GL_PACK_SWAP_BYTES */ + 1067, /* GL_PACK_LSB_FIRST */ + 1068, /* GL_PACK_ROW_LENGTH */ + 1071, /* GL_PACK_SKIP_ROWS */ + 1070, /* GL_PACK_SKIP_PIXELS */ + 1064, /* GL_PACK_ALIGNMENT */ + 784, /* GL_MAP_COLOR */ + 785, /* GL_MAP_STENCIL */ + 628, /* GL_INDEX_SHIFT */ + 627, /* GL_INDEX_OFFSET */ + 1281, /* GL_RED_SCALE */ + 1279, /* GL_RED_BIAS */ + 1820, /* GL_ZOOM_X */ + 1821, /* GL_ZOOM_Y */ + 589, /* GL_GREEN_SCALE */ + 587, /* GL_GREEN_BIAS */ 92, /* GL_BLUE_SCALE */ 90, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ - 363, /* GL_DEPTH_SCALE */ - 344, /* GL_DEPTH_BIAS */ - 855, /* GL_MAX_EVAL_ORDER */ - 859, /* GL_MAX_LIGHTS */ - 838, /* GL_MAX_CLIP_PLANES */ - 904, /* GL_MAX_TEXTURE_SIZE */ - 865, /* GL_MAX_PIXEL_MAP_TABLE */ - 834, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 862, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 863, /* GL_MAX_NAME_STACK_DEPTH */ - 891, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 905, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 919, /* GL_MAX_VIEWPORT_DIMS */ - 835, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1500, /* GL_SUBPIXEL_BITS */ - 621, /* GL_INDEX_BITS */ - 1278, /* GL_RED_BITS */ - 586, /* GL_GREEN_BITS */ + 365, /* GL_DEPTH_SCALE */ + 346, /* GL_DEPTH_BIAS */ + 857, /* GL_MAX_EVAL_ORDER */ + 861, /* GL_MAX_LIGHTS */ + 840, /* GL_MAX_CLIP_PLANES */ + 906, /* GL_MAX_TEXTURE_SIZE */ + 867, /* GL_MAX_PIXEL_MAP_TABLE */ + 836, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 864, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 865, /* GL_MAX_NAME_STACK_DEPTH */ + 893, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 907, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 921, /* GL_MAX_VIEWPORT_DIMS */ + 837, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1502, /* GL_SUBPIXEL_BITS */ + 623, /* GL_INDEX_BITS */ + 1280, /* GL_RED_BITS */ + 588, /* GL_GREEN_BITS */ 91, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ - 345, /* GL_DEPTH_BITS */ - 1475, /* GL_STENCIL_BITS */ + 347, /* GL_DEPTH_BITS */ + 1477, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 985, /* GL_NAME_STACK_DEPTH */ + 987, /* GL_NAME_STACK_DEPTH */ 61, /* GL_AUTO_NORMAL */ - 728, /* GL_MAP1_COLOR_4 */ - 731, /* GL_MAP1_INDEX */ - 732, /* GL_MAP1_NORMAL */ - 733, /* GL_MAP1_TEXTURE_COORD_1 */ - 734, /* GL_MAP1_TEXTURE_COORD_2 */ - 735, /* GL_MAP1_TEXTURE_COORD_3 */ - 736, /* GL_MAP1_TEXTURE_COORD_4 */ - 737, /* GL_MAP1_VERTEX_3 */ - 738, /* GL_MAP1_VERTEX_4 */ - 755, /* GL_MAP2_COLOR_4 */ - 758, /* GL_MAP2_INDEX */ - 759, /* GL_MAP2_NORMAL */ - 760, /* GL_MAP2_TEXTURE_COORD_1 */ - 761, /* GL_MAP2_TEXTURE_COORD_2 */ - 762, /* GL_MAP2_TEXTURE_COORD_3 */ - 763, /* GL_MAP2_TEXTURE_COORD_4 */ - 764, /* GL_MAP2_VERTEX_3 */ - 765, /* GL_MAP2_VERTEX_4 */ - 729, /* GL_MAP1_GRID_DOMAIN */ - 730, /* GL_MAP1_GRID_SEGMENTS */ - 756, /* GL_MAP2_GRID_DOMAIN */ - 757, /* GL_MAP2_GRID_SEGMENTS */ - 1577, /* GL_TEXTURE_1D */ - 1579, /* GL_TEXTURE_2D */ - 472, /* GL_FEEDBACK_BUFFER_POINTER */ - 473, /* GL_FEEDBACK_BUFFER_SIZE */ - 474, /* GL_FEEDBACK_BUFFER_TYPE */ - 1387, /* GL_SELECTION_BUFFER_POINTER */ - 1388, /* GL_SELECTION_BUFFER_SIZE */ - 1691, /* GL_TEXTURE_WIDTH */ - 1658, /* GL_TEXTURE_HEIGHT */ - 1614, /* GL_TEXTURE_COMPONENTS */ - 1598, /* GL_TEXTURE_BORDER_COLOR */ - 1597, /* GL_TEXTURE_BORDER */ - 376, /* GL_DONT_CARE */ - 470, /* GL_FASTEST */ - 993, /* GL_NICEST */ + 730, /* GL_MAP1_COLOR_4 */ + 733, /* GL_MAP1_INDEX */ + 734, /* GL_MAP1_NORMAL */ + 735, /* GL_MAP1_TEXTURE_COORD_1 */ + 736, /* GL_MAP1_TEXTURE_COORD_2 */ + 737, /* GL_MAP1_TEXTURE_COORD_3 */ + 738, /* GL_MAP1_TEXTURE_COORD_4 */ + 739, /* GL_MAP1_VERTEX_3 */ + 740, /* GL_MAP1_VERTEX_4 */ + 757, /* GL_MAP2_COLOR_4 */ + 760, /* GL_MAP2_INDEX */ + 761, /* GL_MAP2_NORMAL */ + 762, /* GL_MAP2_TEXTURE_COORD_1 */ + 763, /* GL_MAP2_TEXTURE_COORD_2 */ + 764, /* GL_MAP2_TEXTURE_COORD_3 */ + 765, /* GL_MAP2_TEXTURE_COORD_4 */ + 766, /* GL_MAP2_VERTEX_3 */ + 767, /* GL_MAP2_VERTEX_4 */ + 731, /* GL_MAP1_GRID_DOMAIN */ + 732, /* GL_MAP1_GRID_SEGMENTS */ + 758, /* GL_MAP2_GRID_DOMAIN */ + 759, /* GL_MAP2_GRID_SEGMENTS */ + 1579, /* GL_TEXTURE_1D */ + 1581, /* GL_TEXTURE_2D */ + 474, /* GL_FEEDBACK_BUFFER_POINTER */ + 475, /* GL_FEEDBACK_BUFFER_SIZE */ + 476, /* GL_FEEDBACK_BUFFER_TYPE */ + 1389, /* GL_SELECTION_BUFFER_POINTER */ + 1390, /* GL_SELECTION_BUFFER_SIZE */ + 1693, /* GL_TEXTURE_WIDTH */ + 1660, /* GL_TEXTURE_HEIGHT */ + 1616, /* GL_TEXTURE_COMPONENTS */ + 1600, /* GL_TEXTURE_BORDER_COLOR */ + 1599, /* GL_TEXTURE_BORDER */ + 378, /* GL_DONT_CARE */ + 472, /* GL_FASTEST */ + 995, /* GL_NICEST */ 47, /* GL_AMBIENT */ - 373, /* GL_DIFFUSE */ - 1435, /* GL_SPECULAR */ - 1156, /* GL_POSITION */ - 1438, /* GL_SPOT_DIRECTION */ - 1439, /* GL_SPOT_EXPONENT */ - 1437, /* GL_SPOT_CUTOFF */ + 375, /* GL_DIFFUSE */ + 1437, /* GL_SPECULAR */ + 1158, /* GL_POSITION */ + 1440, /* GL_SPOT_DIRECTION */ + 1441, /* GL_SPOT_EXPONENT */ + 1439, /* GL_SPOT_CUTOFF */ 271, /* GL_CONSTANT_ATTENUATION */ - 678, /* GL_LINEAR_ATTENUATION */ - 1253, /* GL_QUADRATIC_ATTENUATION */ + 680, /* GL_LINEAR_ATTENUATION */ + 1255, /* GL_QUADRATIC_ATTENUATION */ 241, /* GL_COMPILE */ 242, /* GL_COMPILE_AND_EXECUTE */ 117, /* GL_BYTE */ - 1722, /* GL_UNSIGNED_BYTE */ - 1401, /* GL_SHORT */ - 1733, /* GL_UNSIGNED_SHORT */ - 629, /* GL_INT */ - 1725, /* GL_UNSIGNED_INT */ - 477, /* GL_FLOAT */ + 1724, /* GL_UNSIGNED_BYTE */ + 1403, /* GL_SHORT */ + 1735, /* GL_UNSIGNED_SHORT */ + 631, /* GL_INT */ + 1727, /* GL_UNSIGNED_INT */ + 479, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ - 383, /* GL_DOUBLE */ + 385, /* GL_DOUBLE */ 129, /* GL_CLEAR */ 49, /* GL_AND */ 51, /* GL_AND_REVERSE */ 295, /* GL_COPY */ 50, /* GL_AND_INVERTED */ - 995, /* GL_NOOP */ - 1814, /* GL_XOR */ - 1057, /* GL_OR */ - 996, /* GL_NOR */ - 460, /* GL_EQUIV */ - 656, /* GL_INVERT */ - 1060, /* GL_OR_REVERSE */ + 997, /* GL_NOOP */ + 1816, /* GL_XOR */ + 1059, /* GL_OR */ + 998, /* GL_NOR */ + 462, /* GL_EQUIV */ + 658, /* GL_INVERT */ + 1062, /* GL_OR_REVERSE */ 296, /* GL_COPY_INVERTED */ - 1059, /* GL_OR_INVERTED */ - 986, /* GL_NAND */ - 1392, /* GL_SET */ - 457, /* GL_EMISSION */ - 1400, /* GL_SHININESS */ + 1061, /* GL_OR_INVERTED */ + 988, /* GL_NAND */ + 1394, /* GL_SET */ + 459, /* GL_EMISSION */ + 1402, /* GL_SHININESS */ 48, /* GL_AMBIENT_AND_DIFFUSE */ 187, /* GL_COLOR_INDEXES */ - 936, /* GL_MODELVIEW */ - 1232, /* GL_PROJECTION */ - 1512, /* GL_TEXTURE */ + 938, /* GL_MODELVIEW */ + 1234, /* GL_PROJECTION */ + 1514, /* GL_TEXTURE */ 144, /* GL_COLOR */ - 340, /* GL_DEPTH */ - 1461, /* GL_STENCIL */ + 342, /* GL_DEPTH */ + 1463, /* GL_STENCIL */ 186, /* GL_COLOR_INDEX */ - 1480, /* GL_STENCIL_INDEX */ - 351, /* GL_DEPTH_COMPONENT */ - 1274, /* GL_RED */ - 584, /* GL_GREEN */ + 1482, /* GL_STENCIL_INDEX */ + 353, /* GL_DEPTH_COMPONENT */ + 1276, /* GL_RED */ + 586, /* GL_GREEN */ 89, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1309, /* GL_RGB */ - 1328, /* GL_RGBA */ - 706, /* GL_LUMINANCE */ - 727, /* GL_LUMINANCE_ALPHA */ + 1311, /* GL_RGB */ + 1330, /* GL_RGBA */ + 708, /* GL_LUMINANCE */ + 729, /* GL_LUMINANCE_ALPHA */ 72, /* GL_BITMAP */ - 1112, /* GL_POINT */ - 676, /* GL_LINE */ - 475, /* GL_FILL */ - 1283, /* GL_RENDER */ - 471, /* GL_FEEDBACK */ - 1386, /* GL_SELECT */ - 476, /* GL_FLAT */ - 1410, /* GL_SMOOTH */ - 657, /* GL_KEEP */ - 1303, /* GL_REPLACE */ - 611, /* GL_INCR */ - 336, /* GL_DECR */ - 1748, /* GL_VENDOR */ - 1300, /* GL_RENDERER */ - 1749, /* GL_VERSION */ - 464, /* GL_EXTENSIONS */ - 1351, /* GL_S */ - 1503, /* GL_T */ - 1263, /* GL_R */ - 1252, /* GL_Q */ - 972, /* GL_MODULATE */ - 335, /* GL_DECAL */ - 1648, /* GL_TEXTURE_ENV_MODE */ - 1647, /* GL_TEXTURE_ENV_COLOR */ - 1646, /* GL_TEXTURE_ENV */ - 465, /* GL_EYE_LINEAR */ - 1019, /* GL_OBJECT_LINEAR */ - 1436, /* GL_SPHERE_MAP */ - 1650, /* GL_TEXTURE_GEN_MODE */ - 1021, /* GL_OBJECT_PLANE */ - 466, /* GL_EYE_PLANE */ - 987, /* GL_NEAREST */ - 677, /* GL_LINEAR */ - 991, /* GL_NEAREST_MIPMAP_NEAREST */ - 682, /* GL_LINEAR_MIPMAP_NEAREST */ - 990, /* GL_NEAREST_MIPMAP_LINEAR */ - 681, /* GL_LINEAR_MIPMAP_LINEAR */ - 1671, /* GL_TEXTURE_MAG_FILTER */ - 1679, /* GL_TEXTURE_MIN_FILTER */ - 1693, /* GL_TEXTURE_WRAP_S */ - 1694, /* GL_TEXTURE_WRAP_T */ + 1114, /* GL_POINT */ + 678, /* GL_LINE */ + 477, /* GL_FILL */ + 1285, /* GL_RENDER */ + 473, /* GL_FEEDBACK */ + 1388, /* GL_SELECT */ + 478, /* GL_FLAT */ + 1412, /* GL_SMOOTH */ + 659, /* GL_KEEP */ + 1305, /* GL_REPLACE */ + 613, /* GL_INCR */ + 338, /* GL_DECR */ + 1750, /* GL_VENDOR */ + 1302, /* GL_RENDERER */ + 1751, /* GL_VERSION */ + 466, /* GL_EXTENSIONS */ + 1353, /* GL_S */ + 1505, /* GL_T */ + 1265, /* GL_R */ + 1254, /* GL_Q */ + 974, /* GL_MODULATE */ + 337, /* GL_DECAL */ + 1650, /* GL_TEXTURE_ENV_MODE */ + 1649, /* GL_TEXTURE_ENV_COLOR */ + 1648, /* GL_TEXTURE_ENV */ + 467, /* GL_EYE_LINEAR */ + 1021, /* GL_OBJECT_LINEAR */ + 1438, /* GL_SPHERE_MAP */ + 1652, /* GL_TEXTURE_GEN_MODE */ + 1023, /* GL_OBJECT_PLANE */ + 468, /* GL_EYE_PLANE */ + 989, /* GL_NEAREST */ + 679, /* GL_LINEAR */ + 993, /* GL_NEAREST_MIPMAP_NEAREST */ + 684, /* GL_LINEAR_MIPMAP_NEAREST */ + 992, /* GL_NEAREST_MIPMAP_LINEAR */ + 683, /* GL_LINEAR_MIPMAP_LINEAR */ + 1673, /* GL_TEXTURE_MAG_FILTER */ + 1681, /* GL_TEXTURE_MIN_FILTER */ + 1695, /* GL_TEXTURE_WRAP_S */ + 1696, /* GL_TEXTURE_WRAP_T */ 123, /* GL_CLAMP */ - 1302, /* GL_REPEAT */ - 1150, /* GL_POLYGON_OFFSET_UNITS */ - 1149, /* GL_POLYGON_OFFSET_POINT */ - 1148, /* GL_POLYGON_OFFSET_LINE */ - 1264, /* GL_R3_G3_B2 */ - 1745, /* GL_V2F */ - 1746, /* GL_V3F */ + 1304, /* GL_REPEAT */ + 1152, /* GL_POLYGON_OFFSET_UNITS */ + 1151, /* GL_POLYGON_OFFSET_POINT */ + 1150, /* GL_POLYGON_OFFSET_LINE */ + 1266, /* GL_R3_G3_B2 */ + 1747, /* GL_V2F */ + 1748, /* GL_V3F */ 120, /* GL_C4UB_V2F */ 121, /* GL_C4UB_V3F */ 118, /* GL_C3F_V3F */ - 984, /* GL_N3F_V3F */ + 986, /* GL_N3F_V3F */ 119, /* GL_C4F_N3F_V3F */ - 1508, /* GL_T2F_V3F */ - 1510, /* GL_T4F_V4F */ - 1506, /* GL_T2F_C4UB_V3F */ - 1504, /* GL_T2F_C3F_V3F */ - 1507, /* GL_T2F_N3F_V3F */ - 1505, /* GL_T2F_C4F_N3F_V3F */ - 1509, /* GL_T4F_C4F_N3F_V4F */ + 1510, /* GL_T2F_V3F */ + 1512, /* GL_T4F_V4F */ + 1508, /* GL_T2F_C4UB_V3F */ + 1506, /* GL_T2F_C3F_V3F */ + 1509, /* GL_T2F_N3F_V3F */ + 1507, /* GL_T2F_C4F_N3F_V3F */ + 1511, /* GL_T4F_C4F_N3F_V4F */ 136, /* GL_CLIP_PLANE0 */ 137, /* GL_CLIP_PLANE1 */ 138, /* GL_CLIP_PLANE2 */ 139, /* GL_CLIP_PLANE3 */ 140, /* GL_CLIP_PLANE4 */ 141, /* GL_CLIP_PLANE5 */ - 661, /* GL_LIGHT0 */ - 662, /* GL_LIGHT1 */ - 663, /* GL_LIGHT2 */ - 664, /* GL_LIGHT3 */ - 665, /* GL_LIGHT4 */ - 666, /* GL_LIGHT5 */ - 667, /* GL_LIGHT6 */ - 668, /* GL_LIGHT7 */ - 588, /* GL_HINT_BIT */ + 663, /* GL_LIGHT0 */ + 664, /* GL_LIGHT1 */ + 665, /* GL_LIGHT2 */ + 666, /* GL_LIGHT3 */ + 667, /* GL_LIGHT4 */ + 668, /* GL_LIGHT5 */ + 669, /* GL_LIGHT6 */ + 670, /* GL_LIGHT7 */ + 590, /* GL_HINT_BIT */ 273, /* GL_CONSTANT_COLOR */ - 1031, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 1033, /* GL_ONE_MINUS_CONSTANT_COLOR */ 268, /* GL_CONSTANT_ALPHA */ - 1029, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 1031, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 75, /* GL_BLEND_COLOR */ - 572, /* GL_FUNC_ADD */ - 920, /* GL_MIN */ - 831, /* GL_MAX */ + 574, /* GL_FUNC_ADD */ + 922, /* GL_MIN */ + 833, /* GL_MAX */ 80, /* GL_BLEND_EQUATION */ - 576, /* GL_FUNC_SUBTRACT */ - 574, /* GL_FUNC_REVERSE_SUBTRACT */ + 578, /* GL_FUNC_SUBTRACT */ + 576, /* GL_FUNC_REVERSE_SUBTRACT */ 276, /* GL_CONVOLUTION_1D */ 277, /* GL_CONVOLUTION_2D */ - 1389, /* GL_SEPARABLE_2D */ + 1391, /* GL_SEPARABLE_2D */ 280, /* GL_CONVOLUTION_BORDER_MODE */ 284, /* GL_CONVOLUTION_FILTER_SCALE */ 282, /* GL_CONVOLUTION_FILTER_BIAS */ - 1275, /* GL_REDUCE */ + 1277, /* GL_REDUCE */ 286, /* GL_CONVOLUTION_FORMAT */ 290, /* GL_CONVOLUTION_WIDTH */ 288, /* GL_CONVOLUTION_HEIGHT */ - 846, /* GL_MAX_CONVOLUTION_WIDTH */ - 844, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1189, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1185, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1180, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1176, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1187, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1183, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1178, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1174, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 589, /* GL_HISTOGRAM */ - 1236, /* GL_PROXY_HISTOGRAM */ - 605, /* GL_HISTOGRAM_WIDTH */ - 595, /* GL_HISTOGRAM_FORMAT */ - 601, /* GL_HISTOGRAM_RED_SIZE */ - 597, /* GL_HISTOGRAM_GREEN_SIZE */ - 592, /* GL_HISTOGRAM_BLUE_SIZE */ - 590, /* GL_HISTOGRAM_ALPHA_SIZE */ - 599, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 603, /* GL_HISTOGRAM_SINK */ - 921, /* GL_MINMAX */ - 923, /* GL_MINMAX_FORMAT */ - 925, /* GL_MINMAX_SINK */ - 1511, /* GL_TABLE_TOO_LARGE_EXT */ - 1724, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1735, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1737, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1730, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1726, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1147, /* GL_POLYGON_OFFSET_FILL */ - 1146, /* GL_POLYGON_OFFSET_FACTOR */ - 1145, /* GL_POLYGON_OFFSET_BIAS */ - 1306, /* GL_RESCALE_NORMAL */ + 848, /* GL_MAX_CONVOLUTION_WIDTH */ + 846, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1191, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1187, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1182, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1178, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1189, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1185, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1180, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1176, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 591, /* GL_HISTOGRAM */ + 1238, /* GL_PROXY_HISTOGRAM */ + 607, /* GL_HISTOGRAM_WIDTH */ + 597, /* GL_HISTOGRAM_FORMAT */ + 603, /* GL_HISTOGRAM_RED_SIZE */ + 599, /* GL_HISTOGRAM_GREEN_SIZE */ + 594, /* GL_HISTOGRAM_BLUE_SIZE */ + 592, /* GL_HISTOGRAM_ALPHA_SIZE */ + 601, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 605, /* GL_HISTOGRAM_SINK */ + 923, /* GL_MINMAX */ + 925, /* GL_MINMAX_FORMAT */ + 927, /* GL_MINMAX_SINK */ + 1513, /* GL_TABLE_TOO_LARGE_EXT */ + 1726, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1737, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1739, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1732, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1728, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1149, /* GL_POLYGON_OFFSET_FILL */ + 1148, /* GL_POLYGON_OFFSET_FACTOR */ + 1147, /* GL_POLYGON_OFFSET_BIAS */ + 1308, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 717, /* GL_LUMINANCE4 */ - 723, /* GL_LUMINANCE8 */ - 707, /* GL_LUMINANCE12 */ - 713, /* GL_LUMINANCE16 */ - 718, /* GL_LUMINANCE4_ALPHA4 */ - 721, /* GL_LUMINANCE6_ALPHA2 */ - 724, /* GL_LUMINANCE8_ALPHA8 */ - 710, /* GL_LUMINANCE12_ALPHA4 */ - 708, /* GL_LUMINANCE12_ALPHA12 */ - 714, /* GL_LUMINANCE16_ALPHA16 */ - 630, /* GL_INTENSITY */ - 635, /* GL_INTENSITY4 */ - 637, /* GL_INTENSITY8 */ - 631, /* GL_INTENSITY12 */ - 633, /* GL_INTENSITY16 */ - 1318, /* GL_RGB2_EXT */ - 1319, /* GL_RGB4 */ - 1322, /* GL_RGB5 */ - 1326, /* GL_RGB8 */ - 1310, /* GL_RGB10 */ - 1314, /* GL_RGB12 */ - 1316, /* GL_RGB16 */ - 1333, /* GL_RGBA2 */ - 1335, /* GL_RGBA4 */ - 1323, /* GL_RGB5_A1 */ - 1339, /* GL_RGBA8 */ - 1311, /* GL_RGB10_A2 */ - 1329, /* GL_RGBA12 */ - 1331, /* GL_RGBA16 */ - 1684, /* GL_TEXTURE_RED_SIZE */ - 1656, /* GL_TEXTURE_GREEN_SIZE */ - 1595, /* GL_TEXTURE_BLUE_SIZE */ - 1582, /* GL_TEXTURE_ALPHA_SIZE */ - 1669, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1660, /* GL_TEXTURE_INTENSITY_SIZE */ - 1304, /* GL_REPLACE_EXT */ - 1240, /* GL_PROXY_TEXTURE_1D */ - 1243, /* GL_PROXY_TEXTURE_2D */ - 1689, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1681, /* GL_TEXTURE_PRIORITY */ - 1686, /* GL_TEXTURE_RESIDENT */ - 1585, /* GL_TEXTURE_BINDING_1D */ - 1587, /* GL_TEXTURE_BINDING_2D */ - 1589, /* GL_TEXTURE_BINDING_3D */ - 1067, /* GL_PACK_SKIP_IMAGES */ - 1063, /* GL_PACK_IMAGE_HEIGHT */ - 1718, /* GL_UNPACK_SKIP_IMAGES */ - 1715, /* GL_UNPACK_IMAGE_HEIGHT */ - 1581, /* GL_TEXTURE_3D */ - 1246, /* GL_PROXY_TEXTURE_3D */ - 1643, /* GL_TEXTURE_DEPTH */ - 1692, /* GL_TEXTURE_WRAP_R */ - 832, /* GL_MAX_3D_TEXTURE_SIZE */ - 1750, /* GL_VERTEX_ARRAY */ - 998, /* GL_NORMAL_ARRAY */ + 719, /* GL_LUMINANCE4 */ + 725, /* GL_LUMINANCE8 */ + 709, /* GL_LUMINANCE12 */ + 715, /* GL_LUMINANCE16 */ + 720, /* GL_LUMINANCE4_ALPHA4 */ + 723, /* GL_LUMINANCE6_ALPHA2 */ + 726, /* GL_LUMINANCE8_ALPHA8 */ + 712, /* GL_LUMINANCE12_ALPHA4 */ + 710, /* GL_LUMINANCE12_ALPHA12 */ + 716, /* GL_LUMINANCE16_ALPHA16 */ + 632, /* GL_INTENSITY */ + 637, /* GL_INTENSITY4 */ + 639, /* GL_INTENSITY8 */ + 633, /* GL_INTENSITY12 */ + 635, /* GL_INTENSITY16 */ + 1320, /* GL_RGB2_EXT */ + 1321, /* GL_RGB4 */ + 1324, /* GL_RGB5 */ + 1328, /* GL_RGB8 */ + 1312, /* GL_RGB10 */ + 1316, /* GL_RGB12 */ + 1318, /* GL_RGB16 */ + 1335, /* GL_RGBA2 */ + 1337, /* GL_RGBA4 */ + 1325, /* GL_RGB5_A1 */ + 1341, /* GL_RGBA8 */ + 1313, /* GL_RGB10_A2 */ + 1331, /* GL_RGBA12 */ + 1333, /* GL_RGBA16 */ + 1686, /* GL_TEXTURE_RED_SIZE */ + 1658, /* GL_TEXTURE_GREEN_SIZE */ + 1597, /* GL_TEXTURE_BLUE_SIZE */ + 1584, /* GL_TEXTURE_ALPHA_SIZE */ + 1671, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1662, /* GL_TEXTURE_INTENSITY_SIZE */ + 1306, /* GL_REPLACE_EXT */ + 1242, /* GL_PROXY_TEXTURE_1D */ + 1245, /* GL_PROXY_TEXTURE_2D */ + 1691, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1683, /* GL_TEXTURE_PRIORITY */ + 1688, /* GL_TEXTURE_RESIDENT */ + 1587, /* GL_TEXTURE_BINDING_1D */ + 1589, /* GL_TEXTURE_BINDING_2D */ + 1591, /* GL_TEXTURE_BINDING_3D */ + 1069, /* GL_PACK_SKIP_IMAGES */ + 1065, /* GL_PACK_IMAGE_HEIGHT */ + 1720, /* GL_UNPACK_SKIP_IMAGES */ + 1717, /* GL_UNPACK_IMAGE_HEIGHT */ + 1583, /* GL_TEXTURE_3D */ + 1248, /* GL_PROXY_TEXTURE_3D */ + 1645, /* GL_TEXTURE_DEPTH */ + 1694, /* GL_TEXTURE_WRAP_R */ + 834, /* GL_MAX_3D_TEXTURE_SIZE */ + 1752, /* GL_VERTEX_ARRAY */ + 1000, /* GL_NORMAL_ARRAY */ 145, /* GL_COLOR_ARRAY */ - 615, /* GL_INDEX_ARRAY */ - 1622, /* GL_TEXTURE_COORD_ARRAY */ - 449, /* GL_EDGE_FLAG_ARRAY */ - 1755, /* GL_VERTEX_ARRAY_SIZE */ - 1757, /* GL_VERTEX_ARRAY_TYPE */ - 1756, /* GL_VERTEX_ARRAY_STRIDE */ - 1003, /* GL_NORMAL_ARRAY_TYPE */ - 1002, /* GL_NORMAL_ARRAY_STRIDE */ + 617, /* GL_INDEX_ARRAY */ + 1624, /* GL_TEXTURE_COORD_ARRAY */ + 451, /* GL_EDGE_FLAG_ARRAY */ + 1757, /* GL_VERTEX_ARRAY_SIZE */ + 1759, /* GL_VERTEX_ARRAY_TYPE */ + 1758, /* GL_VERTEX_ARRAY_STRIDE */ + 1005, /* GL_NORMAL_ARRAY_TYPE */ + 1004, /* GL_NORMAL_ARRAY_STRIDE */ 149, /* GL_COLOR_ARRAY_SIZE */ 151, /* GL_COLOR_ARRAY_TYPE */ 150, /* GL_COLOR_ARRAY_STRIDE */ - 620, /* GL_INDEX_ARRAY_TYPE */ - 619, /* GL_INDEX_ARRAY_STRIDE */ - 1626, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1628, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1627, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - 453, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1754, /* GL_VERTEX_ARRAY_POINTER */ - 1001, /* GL_NORMAL_ARRAY_POINTER */ + 622, /* GL_INDEX_ARRAY_TYPE */ + 621, /* GL_INDEX_ARRAY_STRIDE */ + 1628, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1630, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1629, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 455, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 1756, /* GL_VERTEX_ARRAY_POINTER */ + 1003, /* GL_NORMAL_ARRAY_POINTER */ 148, /* GL_COLOR_ARRAY_POINTER */ - 618, /* GL_INDEX_ARRAY_POINTER */ - 1625, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - 452, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 977, /* GL_MULTISAMPLE */ - 1363, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1365, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1370, /* GL_SAMPLE_COVERAGE */ - 1367, /* GL_SAMPLE_BUFFERS */ - 1358, /* GL_SAMPLES */ - 1374, /* GL_SAMPLE_COVERAGE_VALUE */ - 1372, /* GL_SAMPLE_COVERAGE_INVERT */ + 620, /* GL_INDEX_ARRAY_POINTER */ + 1627, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 454, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 979, /* GL_MULTISAMPLE */ + 1365, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1367, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1372, /* GL_SAMPLE_COVERAGE */ + 1369, /* GL_SAMPLE_BUFFERS */ + 1360, /* GL_SAMPLES */ + 1376, /* GL_SAMPLE_COVERAGE_VALUE */ + 1374, /* GL_SAMPLE_COVERAGE_INVERT */ 192, /* GL_COLOR_MATRIX */ 194, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 840, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1172, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1168, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1163, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1159, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1170, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1166, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1161, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1157, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1605, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1247, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1607, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 842, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1174, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1170, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1165, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1161, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1172, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1168, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1163, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1159, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1607, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1249, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1609, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 79, /* GL_BLEND_DST_RGB */ 88, /* GL_BLEND_SRC_RGB */ 78, /* GL_BLEND_DST_ALPHA */ 87, /* GL_BLEND_SRC_ALPHA */ 198, /* GL_COLOR_TABLE */ - 1182, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1165, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1235, /* GL_PROXY_COLOR_TABLE */ - 1239, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1238, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 1184, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1167, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1237, /* GL_PROXY_COLOR_TABLE */ + 1241, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1240, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ 222, /* GL_COLOR_TABLE_SCALE */ 202, /* GL_COLOR_TABLE_BIAS */ 207, /* GL_COLOR_TABLE_FORMAT */ @@ -4295,667 +4299,667 @@ static const unsigned reduced_enums[1319] = 213, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 70, /* GL_BGR */ 71, /* GL_BGRA */ - 854, /* GL_MAX_ELEMENTS_VERTICES */ - 853, /* GL_MAX_ELEMENTS_INDICES */ - 1659, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 856, /* GL_MAX_ELEMENTS_VERTICES */ + 855, /* GL_MAX_ELEMENTS_INDICES */ + 1661, /* GL_TEXTURE_INDEX_SIZE_EXT */ 142, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1129, /* GL_POINT_SIZE_MIN */ - 1125, /* GL_POINT_SIZE_MAX */ - 1119, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1115, /* GL_POINT_DISTANCE_ATTENUATION */ + 1131, /* GL_POINT_SIZE_MIN */ + 1127, /* GL_POINT_SIZE_MAX */ + 1121, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1117, /* GL_POINT_DISTANCE_ATTENUATION */ 124, /* GL_CLAMP_TO_BORDER */ 127, /* GL_CLAMP_TO_EDGE */ - 1680, /* GL_TEXTURE_MIN_LOD */ - 1678, /* GL_TEXTURE_MAX_LOD */ - 1584, /* GL_TEXTURE_BASE_LEVEL */ - 1677, /* GL_TEXTURE_MAX_LEVEL */ - 608, /* GL_IGNORE_BORDER_HP */ + 1682, /* GL_TEXTURE_MIN_LOD */ + 1680, /* GL_TEXTURE_MAX_LOD */ + 1586, /* GL_TEXTURE_BASE_LEVEL */ + 1679, /* GL_TEXTURE_MAX_LEVEL */ + 610, /* GL_IGNORE_BORDER_HP */ 272, /* GL_CONSTANT_BORDER_HP */ - 1305, /* GL_REPLICATE_BORDER_HP */ + 1307, /* GL_REPLICATE_BORDER_HP */ 278, /* GL_CONVOLUTION_BORDER_COLOR */ - 1026, /* GL_OCCLUSION_TEST_HP */ - 1027, /* GL_OCCLUSION_TEST_RESULT_HP */ - 679, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1599, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1601, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1603, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1604, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1602, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1600, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 836, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 837, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1192, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1194, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1191, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1193, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1667, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1668, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1666, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 578, /* GL_GENERATE_MIPMAP */ - 579, /* GL_GENERATE_MIPMAP_HINT */ - 520, /* GL_FOG_OFFSET_SGIX */ - 521, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1613, /* GL_TEXTURE_COMPARE_SGIX */ - 1612, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1663, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1655, /* GL_TEXTURE_GEQUAL_R_SGIX */ - 352, /* GL_DEPTH_COMPONENT16 */ - 355, /* GL_DEPTH_COMPONENT24 */ - 358, /* GL_DEPTH_COMPONENT32 */ - 300, /* GL_CULL_VERTEX_EXT */ - 302, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - 301, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1811, /* GL_WRAP_BORDER_SUN */ - 1606, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 672, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1403, /* GL_SINGLE_COLOR */ - 1390, /* GL_SEPARATE_SPECULAR_COLOR */ - 1399, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 531, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 532, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 539, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 534, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 530, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 529, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 533, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 540, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 551, /* GL_FRAMEBUFFER_DEFAULT */ - 564, /* GL_FRAMEBUFFER_UNDEFINED */ - 365, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 614, /* GL_INDEX */ - 1723, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1738, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1739, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1736, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1734, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1731, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1729, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1675, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1676, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1674, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 928, /* GL_MIRRORED_REPEAT */ - 1346, /* GL_RGB_S3TC */ - 1321, /* GL_RGB4_S3TC */ - 1344, /* GL_RGBA_S3TC */ - 1338, /* GL_RGBA4_S3TC */ - 1342, /* GL_RGBA_DXT5_S3TC */ - 1336, /* GL_RGBA4_DXT5_S3TC */ + 1028, /* GL_OCCLUSION_TEST_HP */ + 1029, /* GL_OCCLUSION_TEST_RESULT_HP */ + 681, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1601, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1603, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1605, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1606, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1604, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1602, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 838, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 839, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1194, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1196, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1193, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1195, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1669, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1670, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1668, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 580, /* GL_GENERATE_MIPMAP */ + 581, /* GL_GENERATE_MIPMAP_HINT */ + 522, /* GL_FOG_OFFSET_SGIX */ + 523, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1615, /* GL_TEXTURE_COMPARE_SGIX */ + 1614, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1665, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1657, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 354, /* GL_DEPTH_COMPONENT16 */ + 357, /* GL_DEPTH_COMPONENT24 */ + 360, /* GL_DEPTH_COMPONENT32 */ + 302, /* GL_CULL_VERTEX_EXT */ + 304, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + 303, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + 1813, /* GL_WRAP_BORDER_SUN */ + 1608, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 674, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1405, /* GL_SINGLE_COLOR */ + 1392, /* GL_SEPARATE_SPECULAR_COLOR */ + 1401, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 533, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 534, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 541, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 536, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 532, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 531, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 535, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 542, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 553, /* GL_FRAMEBUFFER_DEFAULT */ + 566, /* GL_FRAMEBUFFER_UNDEFINED */ + 367, /* GL_DEPTH_STENCIL_ATTACHMENT */ + 616, /* GL_INDEX */ + 1725, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1740, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1741, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1738, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1736, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1733, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1731, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1677, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1678, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1676, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 930, /* GL_MIRRORED_REPEAT */ + 1348, /* GL_RGB_S3TC */ + 1323, /* GL_RGB4_S3TC */ + 1346, /* GL_RGBA_S3TC */ + 1340, /* GL_RGBA4_S3TC */ + 1344, /* GL_RGBA_DXT5_S3TC */ + 1338, /* GL_RGBA4_DXT5_S3TC */ 261, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ 256, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ 257, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ 258, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 989, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 988, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 680, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 507, /* GL_FOG_COORDINATE_SOURCE */ - 499, /* GL_FOG_COORD */ - 523, /* GL_FRAGMENT_DEPTH */ - 306, /* GL_CURRENT_FOG_COORD */ - 506, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 505, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 504, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 501, /* GL_FOG_COORDINATE_ARRAY */ + 991, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 990, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 682, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 509, /* GL_FOG_COORDINATE_SOURCE */ + 501, /* GL_FOG_COORD */ + 525, /* GL_FRAGMENT_DEPTH */ + 308, /* GL_CURRENT_FOG_COORD */ + 508, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 507, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 506, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 503, /* GL_FOG_COORDINATE_ARRAY */ 196, /* GL_COLOR_SUM */ - 326, /* GL_CURRENT_SECONDARY_COLOR */ - 1383, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1385, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1384, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1382, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1379, /* GL_SECONDARY_COLOR_ARRAY */ - 324, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + 328, /* GL_CURRENT_SECONDARY_COLOR */ + 1385, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1387, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1386, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1384, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1381, /* GL_SECONDARY_COLOR_ARRAY */ + 326, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1513, /* GL_TEXTURE0 */ - 1515, /* GL_TEXTURE1 */ - 1537, /* GL_TEXTURE2 */ - 1559, /* GL_TEXTURE3 */ - 1565, /* GL_TEXTURE4 */ - 1567, /* GL_TEXTURE5 */ - 1569, /* GL_TEXTURE6 */ - 1571, /* GL_TEXTURE7 */ - 1573, /* GL_TEXTURE8 */ - 1575, /* GL_TEXTURE9 */ - 1516, /* GL_TEXTURE10 */ - 1518, /* GL_TEXTURE11 */ - 1520, /* GL_TEXTURE12 */ - 1522, /* GL_TEXTURE13 */ - 1524, /* GL_TEXTURE14 */ - 1526, /* GL_TEXTURE15 */ - 1528, /* GL_TEXTURE16 */ - 1530, /* GL_TEXTURE17 */ - 1532, /* GL_TEXTURE18 */ - 1534, /* GL_TEXTURE19 */ - 1538, /* GL_TEXTURE20 */ - 1540, /* GL_TEXTURE21 */ - 1542, /* GL_TEXTURE22 */ - 1544, /* GL_TEXTURE23 */ - 1546, /* GL_TEXTURE24 */ - 1548, /* GL_TEXTURE25 */ - 1550, /* GL_TEXTURE26 */ - 1552, /* GL_TEXTURE27 */ - 1554, /* GL_TEXTURE28 */ - 1556, /* GL_TEXTURE29 */ - 1560, /* GL_TEXTURE30 */ - 1562, /* GL_TEXTURE31 */ + 1515, /* GL_TEXTURE0 */ + 1517, /* GL_TEXTURE1 */ + 1539, /* GL_TEXTURE2 */ + 1561, /* GL_TEXTURE3 */ + 1567, /* GL_TEXTURE4 */ + 1569, /* GL_TEXTURE5 */ + 1571, /* GL_TEXTURE6 */ + 1573, /* GL_TEXTURE7 */ + 1575, /* GL_TEXTURE8 */ + 1577, /* GL_TEXTURE9 */ + 1518, /* GL_TEXTURE10 */ + 1520, /* GL_TEXTURE11 */ + 1522, /* GL_TEXTURE12 */ + 1524, /* GL_TEXTURE13 */ + 1526, /* GL_TEXTURE14 */ + 1528, /* GL_TEXTURE15 */ + 1530, /* GL_TEXTURE16 */ + 1532, /* GL_TEXTURE17 */ + 1534, /* GL_TEXTURE18 */ + 1536, /* GL_TEXTURE19 */ + 1540, /* GL_TEXTURE20 */ + 1542, /* GL_TEXTURE21 */ + 1544, /* GL_TEXTURE22 */ + 1546, /* GL_TEXTURE23 */ + 1548, /* GL_TEXTURE24 */ + 1550, /* GL_TEXTURE25 */ + 1552, /* GL_TEXTURE26 */ + 1554, /* GL_TEXTURE27 */ + 1556, /* GL_TEXTURE28 */ + 1558, /* GL_TEXTURE29 */ + 1562, /* GL_TEXTURE30 */ + 1564, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 130, /* GL_CLIENT_ACTIVE_TEXTURE */ - 906, /* GL_MAX_TEXTURE_UNITS */ - 1702, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1705, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1707, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1699, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1501, /* GL_SUBTRACT */ - 894, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + 908, /* GL_MAX_TEXTURE_UNITS */ + 1704, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1707, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1709, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1701, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1503, /* GL_SUBTRACT */ + 896, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 244, /* GL_COMPRESSED_ALPHA */ 248, /* GL_COMPRESSED_LUMINANCE */ 249, /* GL_COMPRESSED_LUMINANCE_ALPHA */ 246, /* GL_COMPRESSED_INTENSITY */ 252, /* GL_COMPRESSED_RGB */ 253, /* GL_COMPRESSED_RGBA */ - 1620, /* GL_TEXTURE_COMPRESSION_HINT */ - 1682, /* GL_TEXTURE_RECTANGLE_ARB */ - 1592, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1250, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 892, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - 364, /* GL_DEPTH_STENCIL */ - 1727, /* GL_UNSIGNED_INT_24_8 */ - 902, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1673, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 903, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1649, /* GL_TEXTURE_FILTER_CONTROL */ - 1664, /* GL_TEXTURE_LOD_BIAS */ + 1622, /* GL_TEXTURE_COMPRESSION_HINT */ + 1684, /* GL_TEXTURE_RECTANGLE_ARB */ + 1594, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1252, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 894, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 366, /* GL_DEPTH_STENCIL */ + 1729, /* GL_UNSIGNED_INT_24_8 */ + 904, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1675, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 905, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1651, /* GL_TEXTURE_FILTER_CONTROL */ + 1666, /* GL_TEXTURE_LOD_BIAS */ 229, /* GL_COMBINE4 */ - 896, /* GL_MAX_SHININESS_NV */ - 897, /* GL_MAX_SPOT_EXPONENT_NV */ - 612, /* GL_INCR_WRAP */ - 337, /* GL_DECR_WRAP */ - 948, /* GL_MODELVIEW1_ARB */ - 1004, /* GL_NORMAL_MAP */ - 1280, /* GL_REFLECTION_MAP */ - 1629, /* GL_TEXTURE_CUBE_MAP */ - 1590, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1641, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1635, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1248, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 848, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 983, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 515, /* GL_FOG_DISTANCE_MODE_NV */ - 468, /* GL_EYE_RADIAL_NV */ - 467, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 898, /* GL_MAX_SHININESS_NV */ + 899, /* GL_MAX_SPOT_EXPONENT_NV */ + 614, /* GL_INCR_WRAP */ + 339, /* GL_DECR_WRAP */ + 950, /* GL_MODELVIEW1_ARB */ + 1006, /* GL_NORMAL_MAP */ + 1282, /* GL_REFLECTION_MAP */ + 1631, /* GL_TEXTURE_CUBE_MAP */ + 1592, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1641, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1635, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1643, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1637, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1250, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 850, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 985, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 517, /* GL_FOG_DISTANCE_MODE_NV */ + 470, /* GL_EYE_RADIAL_NV */ + 469, /* GL_EYE_PLANE_ABSOLUTE_NV */ 228, /* GL_COMBINE */ 235, /* GL_COMBINE_RGB */ 230, /* GL_COMBINE_ALPHA */ - 1347, /* GL_RGB_SCALE */ + 1349, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 640, /* GL_INTERPOLATE */ + 642, /* GL_INTERPOLATE */ 267, /* GL_CONSTANT */ - 1198, /* GL_PRIMARY_COLOR */ - 1195, /* GL_PREVIOUS */ - 1418, /* GL_SOURCE0_RGB */ - 1424, /* GL_SOURCE1_RGB */ - 1430, /* GL_SOURCE2_RGB */ - 1434, /* GL_SOURCE3_RGB_NV */ - 1415, /* GL_SOURCE0_ALPHA */ - 1421, /* GL_SOURCE1_ALPHA */ - 1427, /* GL_SOURCE2_ALPHA */ - 1433, /* GL_SOURCE3_ALPHA_NV */ - 1040, /* GL_OPERAND0_RGB */ - 1046, /* GL_OPERAND1_RGB */ - 1052, /* GL_OPERAND2_RGB */ - 1056, /* GL_OPERAND3_RGB_NV */ - 1037, /* GL_OPERAND0_ALPHA */ - 1043, /* GL_OPERAND1_ALPHA */ - 1049, /* GL_OPERAND2_ALPHA */ - 1055, /* GL_OPERAND3_ALPHA_NV */ - 1751, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - 1815, /* GL_YCBCR_422_APPLE */ - 1740, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1742, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1405, /* GL_SLICE_ACCUM_SUN */ - 1255, /* GL_QUAD_MESH_SUN */ - 1711, /* GL_TRIANGLE_MESH_SUN */ - 1789, /* GL_VERTEX_PROGRAM_ARB */ - 1800, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1776, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1782, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1784, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1786, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - 328, /* GL_CURRENT_VERTEX_ATTRIB */ - 1211, /* GL_PROGRAM_LENGTH_ARB */ - 1225, /* GL_PROGRAM_STRING_ARB */ - 970, /* GL_MODELVIEW_PROJECTION_NV */ - 607, /* GL_IDENTITY_NV */ - 654, /* GL_INVERSE_NV */ - 1704, /* GL_TRANSPOSE_NV */ - 655, /* GL_INVERSE_TRANSPOSE_NV */ - 878, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 877, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 785, /* GL_MATRIX0_NV */ - 797, /* GL_MATRIX1_NV */ - 809, /* GL_MATRIX2_NV */ - 813, /* GL_MATRIX3_NV */ - 815, /* GL_MATRIX4_NV */ - 817, /* GL_MATRIX5_NV */ - 819, /* GL_MATRIX6_NV */ - 821, /* GL_MATRIX7_NV */ - 312, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - 309, /* GL_CURRENT_MATRIX_ARB */ - 1792, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1795, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1223, /* GL_PROGRAM_PARAMETER_NV */ - 1780, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1227, /* GL_PROGRAM_TARGET_NV */ - 1224, /* GL_PROGRAM_RESIDENT_NV */ - 1696, /* GL_TRACK_MATRIX_NV */ - 1697, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1790, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1205, /* GL_PROGRAM_ERROR_POSITION_ARB */ - 349, /* GL_DEPTH_CLAMP_NV */ - 1758, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1765, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1766, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1767, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1768, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1769, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1770, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1771, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1772, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1773, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1759, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1760, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1761, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1762, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1763, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1764, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 739, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 746, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 747, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 748, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 749, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 750, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 751, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 752, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 753, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 754, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 740, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 741, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 742, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 743, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 744, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 745, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 766, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 773, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 774, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 775, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 776, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 777, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 778, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1204, /* GL_PROGRAM_BINDING_ARB */ - 780, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 781, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 767, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 768, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 769, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 770, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 771, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 772, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1618, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1615, /* GL_TEXTURE_COMPRESSED */ - 1009, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 1200, /* GL_PRIMARY_COLOR */ + 1197, /* GL_PREVIOUS */ + 1420, /* GL_SOURCE0_RGB */ + 1426, /* GL_SOURCE1_RGB */ + 1432, /* GL_SOURCE2_RGB */ + 1436, /* GL_SOURCE3_RGB_NV */ + 1417, /* GL_SOURCE0_ALPHA */ + 1423, /* GL_SOURCE1_ALPHA */ + 1429, /* GL_SOURCE2_ALPHA */ + 1435, /* GL_SOURCE3_ALPHA_NV */ + 1042, /* GL_OPERAND0_RGB */ + 1048, /* GL_OPERAND1_RGB */ + 1054, /* GL_OPERAND2_RGB */ + 1058, /* GL_OPERAND3_RGB_NV */ + 1039, /* GL_OPERAND0_ALPHA */ + 1045, /* GL_OPERAND1_ALPHA */ + 1051, /* GL_OPERAND2_ALPHA */ + 1057, /* GL_OPERAND3_ALPHA_NV */ + 1753, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + 1817, /* GL_YCBCR_422_APPLE */ + 1742, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1744, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1407, /* GL_SLICE_ACCUM_SUN */ + 1257, /* GL_QUAD_MESH_SUN */ + 1713, /* GL_TRIANGLE_MESH_SUN */ + 1791, /* GL_VERTEX_PROGRAM_ARB */ + 1802, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1778, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1784, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1786, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1788, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 330, /* GL_CURRENT_VERTEX_ATTRIB */ + 1213, /* GL_PROGRAM_LENGTH_ARB */ + 1227, /* GL_PROGRAM_STRING_ARB */ + 972, /* GL_MODELVIEW_PROJECTION_NV */ + 609, /* GL_IDENTITY_NV */ + 656, /* GL_INVERSE_NV */ + 1706, /* GL_TRANSPOSE_NV */ + 657, /* GL_INVERSE_TRANSPOSE_NV */ + 880, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 879, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 787, /* GL_MATRIX0_NV */ + 799, /* GL_MATRIX1_NV */ + 811, /* GL_MATRIX2_NV */ + 815, /* GL_MATRIX3_NV */ + 817, /* GL_MATRIX4_NV */ + 819, /* GL_MATRIX5_NV */ + 821, /* GL_MATRIX6_NV */ + 823, /* GL_MATRIX7_NV */ + 314, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + 311, /* GL_CURRENT_MATRIX_ARB */ + 1794, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1797, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1225, /* GL_PROGRAM_PARAMETER_NV */ + 1782, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1229, /* GL_PROGRAM_TARGET_NV */ + 1226, /* GL_PROGRAM_RESIDENT_NV */ + 1698, /* GL_TRACK_MATRIX_NV */ + 1699, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1792, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1207, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 351, /* GL_DEPTH_CLAMP_NV */ + 1760, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1767, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1768, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1769, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1770, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1771, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1772, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1773, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1774, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1775, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1761, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1762, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1763, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1764, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1765, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1766, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 741, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 748, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 749, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 750, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 751, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 752, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 753, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 754, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 755, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 756, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 742, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 743, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 744, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 745, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 746, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 747, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 768, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 775, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 776, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 777, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 778, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 779, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 780, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1206, /* GL_PROGRAM_BINDING_ARB */ + 782, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 783, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 769, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 770, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 771, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 772, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 773, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 774, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1620, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1617, /* GL_TEXTURE_COMPRESSED */ + 1011, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 266, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 918, /* GL_MAX_VERTEX_UNITS_ARB */ + 920, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1810, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1788, /* GL_VERTEX_BLEND_ARB */ - 330, /* GL_CURRENT_WEIGHT_ARB */ - 1809, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1808, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1807, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1806, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1803, /* GL_WEIGHT_ARRAY_ARB */ - 377, /* GL_DOT3_RGB */ - 378, /* GL_DOT3_RGBA */ + 1812, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1790, /* GL_VERTEX_BLEND_ARB */ + 332, /* GL_CURRENT_WEIGHT_ARB */ + 1811, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1810, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1809, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1808, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1805, /* GL_WEIGHT_ARRAY_ARB */ + 379, /* GL_DOT3_RGB */ + 380, /* GL_DOT3_RGBA */ 260, /* GL_COMPRESSED_RGB_FXT1_3DFX */ 255, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 978, /* GL_MULTISAMPLE_3DFX */ - 1368, /* GL_SAMPLE_BUFFERS_3DFX */ - 1359, /* GL_SAMPLES_3DFX */ - 959, /* GL_MODELVIEW2_ARB */ - 962, /* GL_MODELVIEW3_ARB */ - 963, /* GL_MODELVIEW4_ARB */ - 964, /* GL_MODELVIEW5_ARB */ - 965, /* GL_MODELVIEW6_ARB */ - 966, /* GL_MODELVIEW7_ARB */ - 967, /* GL_MODELVIEW8_ARB */ - 968, /* GL_MODELVIEW9_ARB */ - 938, /* GL_MODELVIEW10_ARB */ - 939, /* GL_MODELVIEW11_ARB */ - 940, /* GL_MODELVIEW12_ARB */ - 941, /* GL_MODELVIEW13_ARB */ - 942, /* GL_MODELVIEW14_ARB */ - 943, /* GL_MODELVIEW15_ARB */ - 944, /* GL_MODELVIEW16_ARB */ - 945, /* GL_MODELVIEW17_ARB */ - 946, /* GL_MODELVIEW18_ARB */ - 947, /* GL_MODELVIEW19_ARB */ - 949, /* GL_MODELVIEW20_ARB */ - 950, /* GL_MODELVIEW21_ARB */ - 951, /* GL_MODELVIEW22_ARB */ - 952, /* GL_MODELVIEW23_ARB */ - 953, /* GL_MODELVIEW24_ARB */ - 954, /* GL_MODELVIEW25_ARB */ - 955, /* GL_MODELVIEW26_ARB */ - 956, /* GL_MODELVIEW27_ARB */ - 957, /* GL_MODELVIEW28_ARB */ - 958, /* GL_MODELVIEW29_ARB */ - 960, /* GL_MODELVIEW30_ARB */ - 961, /* GL_MODELVIEW31_ARB */ - 382, /* GL_DOT3_RGB_EXT */ - 380, /* GL_DOT3_RGBA_EXT */ - 932, /* GL_MIRROR_CLAMP_EXT */ - 935, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 973, /* GL_MODULATE_ADD_ATI */ - 974, /* GL_MODULATE_SIGNED_ADD_ATI */ - 975, /* GL_MODULATE_SUBTRACT_ATI */ - 1816, /* GL_YCBCR_MESA */ - 1064, /* GL_PACK_INVERT_MESA */ - 333, /* GL_DEBUG_OBJECT_MESA */ - 334, /* GL_DEBUG_PRINT_MESA */ - 332, /* GL_DEBUG_ASSERT_MESA */ + 980, /* GL_MULTISAMPLE_3DFX */ + 1370, /* GL_SAMPLE_BUFFERS_3DFX */ + 1361, /* GL_SAMPLES_3DFX */ + 961, /* GL_MODELVIEW2_ARB */ + 964, /* GL_MODELVIEW3_ARB */ + 965, /* GL_MODELVIEW4_ARB */ + 966, /* GL_MODELVIEW5_ARB */ + 967, /* GL_MODELVIEW6_ARB */ + 968, /* GL_MODELVIEW7_ARB */ + 969, /* GL_MODELVIEW8_ARB */ + 970, /* GL_MODELVIEW9_ARB */ + 940, /* GL_MODELVIEW10_ARB */ + 941, /* GL_MODELVIEW11_ARB */ + 942, /* GL_MODELVIEW12_ARB */ + 943, /* GL_MODELVIEW13_ARB */ + 944, /* GL_MODELVIEW14_ARB */ + 945, /* GL_MODELVIEW15_ARB */ + 946, /* GL_MODELVIEW16_ARB */ + 947, /* GL_MODELVIEW17_ARB */ + 948, /* GL_MODELVIEW18_ARB */ + 949, /* GL_MODELVIEW19_ARB */ + 951, /* GL_MODELVIEW20_ARB */ + 952, /* GL_MODELVIEW21_ARB */ + 953, /* GL_MODELVIEW22_ARB */ + 954, /* GL_MODELVIEW23_ARB */ + 955, /* GL_MODELVIEW24_ARB */ + 956, /* GL_MODELVIEW25_ARB */ + 957, /* GL_MODELVIEW26_ARB */ + 958, /* GL_MODELVIEW27_ARB */ + 959, /* GL_MODELVIEW28_ARB */ + 960, /* GL_MODELVIEW29_ARB */ + 962, /* GL_MODELVIEW30_ARB */ + 963, /* GL_MODELVIEW31_ARB */ + 384, /* GL_DOT3_RGB_EXT */ + 382, /* GL_DOT3_RGBA_EXT */ + 934, /* GL_MIRROR_CLAMP_EXT */ + 937, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 975, /* GL_MODULATE_ADD_ATI */ + 976, /* GL_MODULATE_SIGNED_ADD_ATI */ + 977, /* GL_MODULATE_SUBTRACT_ATI */ + 1818, /* GL_YCBCR_MESA */ + 1066, /* GL_PACK_INVERT_MESA */ + 335, /* GL_DEBUG_OBJECT_MESA */ + 336, /* GL_DEBUG_PRINT_MESA */ + 334, /* GL_DEBUG_ASSERT_MESA */ 107, /* GL_BUFFER_SIZE */ 109, /* GL_BUFFER_USAGE */ 113, /* GL_BUMP_ROT_MATRIX_ATI */ 114, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ 112, /* GL_BUMP_NUM_TEX_UNITS_ATI */ 116, /* GL_BUMP_TEX_UNITS_ATI */ - 441, /* GL_DUDV_ATI */ - 440, /* GL_DU8DV8_ATI */ + 443, /* GL_DUDV_ATI */ + 442, /* GL_DU8DV8_ATI */ 111, /* GL_BUMP_ENVMAP_ATI */ 115, /* GL_BUMP_TARGET_ATI */ - 1466, /* GL_STENCIL_BACK_FUNC */ - 1464, /* GL_STENCIL_BACK_FAIL */ - 1468, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1470, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 524, /* GL_FRAGMENT_PROGRAM_ARB */ - 1202, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1230, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1229, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1214, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1220, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1219, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 867, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 890, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 889, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 880, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 886, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 885, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 850, /* GL_MAX_DRAW_BUFFERS */ - 386, /* GL_DRAW_BUFFER0 */ - 389, /* GL_DRAW_BUFFER1 */ - 410, /* GL_DRAW_BUFFER2 */ - 413, /* GL_DRAW_BUFFER3 */ - 416, /* GL_DRAW_BUFFER4 */ - 419, /* GL_DRAW_BUFFER5 */ - 422, /* GL_DRAW_BUFFER6 */ - 425, /* GL_DRAW_BUFFER7 */ - 428, /* GL_DRAW_BUFFER8 */ - 431, /* GL_DRAW_BUFFER9 */ - 390, /* GL_DRAW_BUFFER10 */ - 393, /* GL_DRAW_BUFFER11 */ - 396, /* GL_DRAW_BUFFER12 */ - 399, /* GL_DRAW_BUFFER13 */ - 402, /* GL_DRAW_BUFFER14 */ - 405, /* GL_DRAW_BUFFER15 */ + 1468, /* GL_STENCIL_BACK_FUNC */ + 1466, /* GL_STENCIL_BACK_FAIL */ + 1470, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1472, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 526, /* GL_FRAGMENT_PROGRAM_ARB */ + 1204, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1232, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1231, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1216, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1222, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1221, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 869, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 892, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 891, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 882, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 888, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 887, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 852, /* GL_MAX_DRAW_BUFFERS */ + 388, /* GL_DRAW_BUFFER0 */ + 391, /* GL_DRAW_BUFFER1 */ + 412, /* GL_DRAW_BUFFER2 */ + 415, /* GL_DRAW_BUFFER3 */ + 418, /* GL_DRAW_BUFFER4 */ + 421, /* GL_DRAW_BUFFER5 */ + 424, /* GL_DRAW_BUFFER6 */ + 427, /* GL_DRAW_BUFFER7 */ + 430, /* GL_DRAW_BUFFER8 */ + 433, /* GL_DRAW_BUFFER9 */ + 392, /* GL_DRAW_BUFFER10 */ + 395, /* GL_DRAW_BUFFER11 */ + 398, /* GL_DRAW_BUFFER12 */ + 401, /* GL_DRAW_BUFFER13 */ + 404, /* GL_DRAW_BUFFER14 */ + 407, /* GL_DRAW_BUFFER15 */ 81, /* GL_BLEND_EQUATION_ALPHA */ - 830, /* GL_MATRIX_PALETTE_ARB */ - 861, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 864, /* GL_MAX_PALETTE_MATRICES_ARB */ - 315, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 824, /* GL_MATRIX_INDEX_ARRAY_ARB */ - 310, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 826, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 828, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 827, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 825, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1644, /* GL_TEXTURE_DEPTH_SIZE */ - 370, /* GL_DEPTH_TEXTURE_MODE */ - 1610, /* GL_TEXTURE_COMPARE_MODE */ - 1608, /* GL_TEXTURE_COMPARE_FUNC */ + 832, /* GL_MATRIX_PALETTE_ARB */ + 863, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 866, /* GL_MAX_PALETTE_MATRICES_ARB */ + 317, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + 826, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 312, /* GL_CURRENT_MATRIX_INDEX_ARB */ + 828, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 830, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 829, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 827, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1646, /* GL_TEXTURE_DEPTH_SIZE */ + 372, /* GL_DEPTH_TEXTURE_MODE */ + 1612, /* GL_TEXTURE_COMPARE_MODE */ + 1610, /* GL_TEXTURE_COMPARE_FUNC */ 239, /* GL_COMPARE_R_TO_TEXTURE */ - 1136, /* GL_POINT_SPRITE */ + 1138, /* GL_POINT_SPRITE */ 292, /* GL_COORD_REPLACE */ - 1140, /* GL_POINT_SPRITE_R_MODE_NV */ - 1257, /* GL_QUERY_COUNTER_BITS */ - 317, /* GL_CURRENT_QUERY */ - 1259, /* GL_QUERY_RESULT */ - 1261, /* GL_QUERY_RESULT_AVAILABLE */ - 912, /* GL_MAX_VERTEX_GENERIC_ATTRIBS */ - 1778, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - 368, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - 367, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 898, /* GL_MAX_TEXTURE_COORDS */ - 900, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1207, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1209, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1208, /* GL_PROGRAM_FORMAT_ARB */ - 1690, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - 347, /* GL_DEPTH_BOUNDS_TEST_EXT */ - 346, /* GL_DEPTH_BOUNDS_EXT */ + 1142, /* GL_POINT_SPRITE_R_MODE_NV */ + 1259, /* GL_QUERY_COUNTER_BITS */ + 319, /* GL_CURRENT_QUERY */ + 1261, /* GL_QUERY_RESULT */ + 1263, /* GL_QUERY_RESULT_AVAILABLE */ + 914, /* GL_MAX_VERTEX_ATTRIBS */ + 1780, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 370, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 369, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 900, /* GL_MAX_TEXTURE_COORDS */ + 902, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1209, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1211, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1210, /* GL_PROGRAM_FORMAT_ARB */ + 1692, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 349, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 348, /* GL_DEPTH_BOUNDS_EXT */ 52, /* GL_ARRAY_BUFFER */ - 454, /* GL_ELEMENT_ARRAY_BUFFER */ + 456, /* GL_ELEMENT_ARRAY_BUFFER */ 53, /* GL_ARRAY_BUFFER_BINDING */ - 455, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1752, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 999, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 457, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 1754, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1001, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 146, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 616, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1623, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - 450, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1380, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 502, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1804, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1774, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1210, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 873, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1216, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 882, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1228, /* GL_PROGRAM_TEMPORARIES_ARB */ - 888, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1218, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 884, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1222, /* GL_PROGRAM_PARAMETERS_ARB */ - 887, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1217, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 883, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1203, /* GL_PROGRAM_ATTRIBS_ARB */ - 868, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1215, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 881, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1201, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 866, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1213, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 879, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 874, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 870, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1231, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1701, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1270, /* GL_READ_ONLY */ - 1812, /* GL_WRITE_ONLY */ - 1272, /* GL_READ_WRITE */ + 618, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1625, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 452, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1382, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 504, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1806, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1776, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1212, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 875, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1218, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 884, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1230, /* GL_PROGRAM_TEMPORARIES_ARB */ + 890, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1220, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 886, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1224, /* GL_PROGRAM_PARAMETERS_ARB */ + 889, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1219, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 885, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1205, /* GL_PROGRAM_ATTRIBS_ARB */ + 870, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1217, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 883, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1203, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 868, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1215, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 881, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 876, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 872, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1233, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1703, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1272, /* GL_READ_ONLY */ + 1814, /* GL_WRITE_ONLY */ + 1274, /* GL_READ_WRITE */ 101, /* GL_BUFFER_ACCESS */ 103, /* GL_BUFFER_MAPPED */ 105, /* GL_BUFFER_MAP_POINTER */ - 1695, /* GL_TIME_ELAPSED_EXT */ - 784, /* GL_MATRIX0_ARB */ - 796, /* GL_MATRIX1_ARB */ - 808, /* GL_MATRIX2_ARB */ - 812, /* GL_MATRIX3_ARB */ - 814, /* GL_MATRIX4_ARB */ - 816, /* GL_MATRIX5_ARB */ - 818, /* GL_MATRIX6_ARB */ - 820, /* GL_MATRIX7_ARB */ - 822, /* GL_MATRIX8_ARB */ - 823, /* GL_MATRIX9_ARB */ - 786, /* GL_MATRIX10_ARB */ - 787, /* GL_MATRIX11_ARB */ - 788, /* GL_MATRIX12_ARB */ - 789, /* GL_MATRIX13_ARB */ - 790, /* GL_MATRIX14_ARB */ - 791, /* GL_MATRIX15_ARB */ - 792, /* GL_MATRIX16_ARB */ - 793, /* GL_MATRIX17_ARB */ - 794, /* GL_MATRIX18_ARB */ - 795, /* GL_MATRIX19_ARB */ - 798, /* GL_MATRIX20_ARB */ - 799, /* GL_MATRIX21_ARB */ - 800, /* GL_MATRIX22_ARB */ - 801, /* GL_MATRIX23_ARB */ - 802, /* GL_MATRIX24_ARB */ - 803, /* GL_MATRIX25_ARB */ - 804, /* GL_MATRIX26_ARB */ - 805, /* GL_MATRIX27_ARB */ - 806, /* GL_MATRIX28_ARB */ - 807, /* GL_MATRIX29_ARB */ - 810, /* GL_MATRIX30_ARB */ - 811, /* GL_MATRIX31_ARB */ - 1496, /* GL_STREAM_DRAW */ - 1498, /* GL_STREAM_READ */ - 1494, /* GL_STREAM_COPY */ - 1457, /* GL_STATIC_DRAW */ - 1459, /* GL_STATIC_READ */ - 1455, /* GL_STATIC_COPY */ - 444, /* GL_DYNAMIC_DRAW */ - 446, /* GL_DYNAMIC_READ */ - 442, /* GL_DYNAMIC_COPY */ - 1104, /* GL_PIXEL_PACK_BUFFER */ - 1108, /* GL_PIXEL_UNPACK_BUFFER */ - 1105, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1109, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - 341, /* GL_DEPTH24_STENCIL8 */ - 1688, /* GL_TEXTURE_STENCIL_SIZE */ - 871, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - 869, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 872, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 876, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 875, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 833, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1490, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1697, /* GL_TIME_ELAPSED_EXT */ + 786, /* GL_MATRIX0_ARB */ + 798, /* GL_MATRIX1_ARB */ + 810, /* GL_MATRIX2_ARB */ + 814, /* GL_MATRIX3_ARB */ + 816, /* GL_MATRIX4_ARB */ + 818, /* GL_MATRIX5_ARB */ + 820, /* GL_MATRIX6_ARB */ + 822, /* GL_MATRIX7_ARB */ + 824, /* GL_MATRIX8_ARB */ + 825, /* GL_MATRIX9_ARB */ + 788, /* GL_MATRIX10_ARB */ + 789, /* GL_MATRIX11_ARB */ + 790, /* GL_MATRIX12_ARB */ + 791, /* GL_MATRIX13_ARB */ + 792, /* GL_MATRIX14_ARB */ + 793, /* GL_MATRIX15_ARB */ + 794, /* GL_MATRIX16_ARB */ + 795, /* GL_MATRIX17_ARB */ + 796, /* GL_MATRIX18_ARB */ + 797, /* GL_MATRIX19_ARB */ + 800, /* GL_MATRIX20_ARB */ + 801, /* GL_MATRIX21_ARB */ + 802, /* GL_MATRIX22_ARB */ + 803, /* GL_MATRIX23_ARB */ + 804, /* GL_MATRIX24_ARB */ + 805, /* GL_MATRIX25_ARB */ + 806, /* GL_MATRIX26_ARB */ + 807, /* GL_MATRIX27_ARB */ + 808, /* GL_MATRIX28_ARB */ + 809, /* GL_MATRIX29_ARB */ + 812, /* GL_MATRIX30_ARB */ + 813, /* GL_MATRIX31_ARB */ + 1498, /* GL_STREAM_DRAW */ + 1500, /* GL_STREAM_READ */ + 1496, /* GL_STREAM_COPY */ + 1459, /* GL_STATIC_DRAW */ + 1461, /* GL_STATIC_READ */ + 1457, /* GL_STATIC_COPY */ + 446, /* GL_DYNAMIC_DRAW */ + 448, /* GL_DYNAMIC_READ */ + 444, /* GL_DYNAMIC_COPY */ + 1106, /* GL_PIXEL_PACK_BUFFER */ + 1110, /* GL_PIXEL_UNPACK_BUFFER */ + 1107, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1111, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 343, /* GL_DEPTH24_STENCIL8 */ + 1690, /* GL_TEXTURE_STENCIL_SIZE */ + 873, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + 871, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 874, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 878, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 877, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 835, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1492, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 933, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1361, /* GL_SAMPLES_PASSED */ - 525, /* GL_FRAGMENT_SHADER */ - 1798, /* GL_VERTEX_SHADER */ - 1221, /* GL_PROGRAM_OBJECT_ARB */ - 1393, /* GL_SHADER_OBJECT_ARB */ - 857, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 916, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 910, /* GL_MAX_VARYING_FLOATS */ - 914, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 842, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1024, /* GL_OBJECT_TYPE_ARB */ - 1395, /* GL_SHADER_TYPE */ - 490, /* GL_FLOAT_VEC2 */ - 492, /* GL_FLOAT_VEC3 */ - 494, /* GL_FLOAT_VEC4 */ - 643, /* GL_INT_VEC2 */ - 645, /* GL_INT_VEC3 */ - 647, /* GL_INT_VEC4 */ + 935, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1363, /* GL_SAMPLES_PASSED */ + 527, /* GL_FRAGMENT_SHADER */ + 1800, /* GL_VERTEX_SHADER */ + 1223, /* GL_PROGRAM_OBJECT_ARB */ + 1395, /* GL_SHADER_OBJECT_ARB */ + 859, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 918, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 912, /* GL_MAX_VARYING_FLOATS */ + 916, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 844, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1026, /* GL_OBJECT_TYPE_ARB */ + 1397, /* GL_SHADER_TYPE */ + 492, /* GL_FLOAT_VEC2 */ + 494, /* GL_FLOAT_VEC3 */ + 496, /* GL_FLOAT_VEC4 */ + 645, /* GL_INT_VEC2 */ + 647, /* GL_INT_VEC3 */ + 649, /* GL_INT_VEC4 */ 93, /* GL_BOOL */ 95, /* GL_BOOL_VEC2 */ 97, /* GL_BOOL_VEC3 */ 99, /* GL_BOOL_VEC4 */ - 478, /* GL_FLOAT_MAT2 */ - 482, /* GL_FLOAT_MAT3 */ - 486, /* GL_FLOAT_MAT4 */ - 1352, /* GL_SAMPLER_1D */ - 1354, /* GL_SAMPLER_2D */ - 1356, /* GL_SAMPLER_3D */ - 1357, /* GL_SAMPLER_CUBE */ - 1353, /* GL_SAMPLER_1D_SHADOW */ - 1355, /* GL_SAMPLER_2D_SHADOW */ - 480, /* GL_FLOAT_MAT2x3 */ - 481, /* GL_FLOAT_MAT2x4 */ - 484, /* GL_FLOAT_MAT3x2 */ - 485, /* GL_FLOAT_MAT3x4 */ - 488, /* GL_FLOAT_MAT4x2 */ - 489, /* GL_FLOAT_MAT4x3 */ - 339, /* GL_DELETE_STATUS */ + 480, /* GL_FLOAT_MAT2 */ + 484, /* GL_FLOAT_MAT3 */ + 488, /* GL_FLOAT_MAT4 */ + 1354, /* GL_SAMPLER_1D */ + 1356, /* GL_SAMPLER_2D */ + 1358, /* GL_SAMPLER_3D */ + 1359, /* GL_SAMPLER_CUBE */ + 1355, /* GL_SAMPLER_1D_SHADOW */ + 1357, /* GL_SAMPLER_2D_SHADOW */ + 482, /* GL_FLOAT_MAT2x3 */ + 483, /* GL_FLOAT_MAT2x4 */ + 486, /* GL_FLOAT_MAT3x2 */ + 487, /* GL_FLOAT_MAT3x4 */ + 490, /* GL_FLOAT_MAT4x2 */ + 491, /* GL_FLOAT_MAT4x3 */ + 341, /* GL_DELETE_STATUS */ 243, /* GL_COMPILE_STATUS */ - 697, /* GL_LINK_STATUS */ - 1747, /* GL_VALIDATE_STATUS */ - 628, /* GL_INFO_LOG_LENGTH */ + 699, /* GL_LINK_STATUS */ + 1749, /* GL_VALIDATE_STATUS */ + 630, /* GL_INFO_LOG_LENGTH */ 55, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1394, /* GL_SHADER_SOURCE_LENGTH */ + 1396, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 527, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1397, /* GL_SHADING_LANGUAGE_VERSION */ - 316, /* GL_CURRENT_PROGRAM */ - 1073, /* GL_PALETTE4_RGB8_OES */ - 1075, /* GL_PALETTE4_RGBA8_OES */ - 1071, /* GL_PALETTE4_R5_G6_B5_OES */ - 1074, /* GL_PALETTE4_RGBA4_OES */ - 1072, /* GL_PALETTE4_RGB5_A1_OES */ - 1078, /* GL_PALETTE8_RGB8_OES */ - 1080, /* GL_PALETTE8_RGBA8_OES */ - 1076, /* GL_PALETTE8_R5_G6_B5_OES */ - 1079, /* GL_PALETTE8_RGBA4_OES */ - 1077, /* GL_PALETTE8_RGB5_A1_OES */ - 610, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 609, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1732, /* GL_UNSIGNED_NORMALIZED */ - 1578, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1241, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1580, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1244, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1586, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1588, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 1449, /* GL_SRGB */ - 1450, /* GL_SRGB8 */ - 1452, /* GL_SRGB_ALPHA */ - 1451, /* GL_SRGB8_ALPHA8 */ - 1409, /* GL_SLUMINANCE_ALPHA */ - 1408, /* GL_SLUMINANCE8_ALPHA8 */ - 1406, /* GL_SLUMINANCE */ - 1407, /* GL_SLUMINANCE8 */ + 529, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1399, /* GL_SHADING_LANGUAGE_VERSION */ + 318, /* GL_CURRENT_PROGRAM */ + 1075, /* GL_PALETTE4_RGB8_OES */ + 1077, /* GL_PALETTE4_RGBA8_OES */ + 1073, /* GL_PALETTE4_R5_G6_B5_OES */ + 1076, /* GL_PALETTE4_RGBA4_OES */ + 1074, /* GL_PALETTE4_RGB5_A1_OES */ + 1080, /* GL_PALETTE8_RGB8_OES */ + 1082, /* GL_PALETTE8_RGBA8_OES */ + 1078, /* GL_PALETTE8_R5_G6_B5_OES */ + 1081, /* GL_PALETTE8_RGBA4_OES */ + 1079, /* GL_PALETTE8_RGB5_A1_OES */ + 612, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 611, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1734, /* GL_UNSIGNED_NORMALIZED */ + 1580, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1243, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1582, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1246, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1588, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1590, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1451, /* GL_SRGB */ + 1452, /* GL_SRGB8 */ + 1454, /* GL_SRGB_ALPHA */ + 1453, /* GL_SRGB8_ALPHA8 */ + 1411, /* GL_SLUMINANCE_ALPHA */ + 1410, /* GL_SLUMINANCE8_ALPHA8 */ + 1408, /* GL_SLUMINANCE */ + 1409, /* GL_SLUMINANCE8 */ 264, /* GL_COMPRESSED_SRGB */ 265, /* GL_COMPRESSED_SRGB_ALPHA */ 262, /* GL_COMPRESSED_SLUMINANCE */ 263, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1138, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 705, /* GL_LOWER_LEFT */ - 1744, /* GL_UPPER_LEFT */ - 1472, /* GL_STENCIL_BACK_REF */ - 1473, /* GL_STENCIL_BACK_VALUE_MASK */ - 1474, /* GL_STENCIL_BACK_WRITEMASK */ - 435, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - 1286, /* GL_RENDERBUFFER_BINDING_EXT */ - 1267, /* GL_READ_FRAMEBUFFER */ - 434, /* GL_DRAW_FRAMEBUFFER */ - 1268, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - 1296, /* GL_RENDERBUFFER_SAMPLES */ - 537, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 535, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 546, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 542, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 544, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 549, /* GL_FRAMEBUFFER_COMPLETE */ - 553, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 559, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 557, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 555, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 558, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 556, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - 562, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - 565, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 563, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 839, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 1140, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 707, /* GL_LOWER_LEFT */ + 1746, /* GL_UPPER_LEFT */ + 1474, /* GL_STENCIL_BACK_REF */ + 1475, /* GL_STENCIL_BACK_VALUE_MASK */ + 1476, /* GL_STENCIL_BACK_WRITEMASK */ + 437, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + 1288, /* GL_RENDERBUFFER_BINDING_EXT */ + 1269, /* GL_READ_FRAMEBUFFER */ + 436, /* GL_DRAW_FRAMEBUFFER */ + 1270, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + 1298, /* GL_RENDERBUFFER_SAMPLES */ + 539, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 537, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 548, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 544, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 546, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 551, /* GL_FRAMEBUFFER_COMPLETE */ + 555, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 561, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 559, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 557, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 560, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 558, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + 564, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + 567, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 565, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 841, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ 152, /* GL_COLOR_ATTACHMENT0 */ 154, /* GL_COLOR_ATTACHMENT1 */ 168, /* GL_COLOR_ATTACHMENT2 */ @@ -4972,36 +4976,38 @@ static const unsigned reduced_enums[1319] = 161, /* GL_COLOR_ATTACHMENT13 */ 163, /* GL_COLOR_ATTACHMENT14 */ 165, /* GL_COLOR_ATTACHMENT15 */ - 342, /* GL_DEPTH_ATTACHMENT */ - 1462, /* GL_STENCIL_ATTACHMENT */ - 528, /* GL_FRAMEBUFFER */ - 1284, /* GL_RENDERBUFFER */ - 1298, /* GL_RENDERBUFFER_WIDTH */ - 1291, /* GL_RENDERBUFFER_HEIGHT */ - 1293, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1485, /* GL_STENCIL_INDEX_EXT */ - 1482, /* GL_STENCIL_INDEX1_EXT */ - 1483, /* GL_STENCIL_INDEX4_EXT */ - 1484, /* GL_STENCIL_INDEX8_EXT */ - 1481, /* GL_STENCIL_INDEX16_EXT */ - 1295, /* GL_RENDERBUFFER_RED_SIZE */ - 1290, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1287, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1285, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1288, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1297, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 561, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 895, /* GL_MAX_SAMPLES */ - 1345, /* GL_RGBA_SNORM */ - 1341, /* GL_RGBA8_SNORM */ - 1402, /* GL_SIGNED_NORMALIZED */ - 461, /* GL_EVAL_BIT */ - 1265, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 699, /* GL_LIST_BIT */ - 1594, /* GL_TEXTURE_BIT */ - 1376, /* GL_SCISSOR_BIT */ + 344, /* GL_DEPTH_ATTACHMENT */ + 1464, /* GL_STENCIL_ATTACHMENT */ + 530, /* GL_FRAMEBUFFER */ + 1286, /* GL_RENDERBUFFER */ + 1300, /* GL_RENDERBUFFER_WIDTH */ + 1293, /* GL_RENDERBUFFER_HEIGHT */ + 1295, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1487, /* GL_STENCIL_INDEX_EXT */ + 1484, /* GL_STENCIL_INDEX1_EXT */ + 1485, /* GL_STENCIL_INDEX4_EXT */ + 1486, /* GL_STENCIL_INDEX8_EXT */ + 1483, /* GL_STENCIL_INDEX16_EXT */ + 1297, /* GL_RENDERBUFFER_RED_SIZE */ + 1292, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1289, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1287, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1290, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1299, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 563, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 897, /* GL_MAX_SAMPLES */ + 298, /* GL_COPY_READ_BUFFER */ + 299, /* GL_COPY_WRITE_BUFFER */ + 1347, /* GL_RGBA_SNORM */ + 1343, /* GL_RGBA8_SNORM */ + 1404, /* GL_SIGNED_NORMALIZED */ + 463, /* GL_EVAL_BIT */ + 1267, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 701, /* GL_LIST_BIT */ + 1596, /* GL_TEXTURE_BIT */ + 1378, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 980, /* GL_MULTISAMPLE_BIT */ + 982, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ }; diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 493e094cde..bbc6f6e0ca 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -759,23 +759,24 @@ gl_dispatch_functions_start: GL_STUB(glGetAttribLocationARB, _gloffset_GetAttribLocationARB) GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB) GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample) + GL_STUB(glCopyBufferSubData, _gloffset_CopyBufferSubData) GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT) - GL_STUB(gl_dispatch_stub_563, _gloffset_GetPixelTexGenParameterfvSGIS) - HIDDEN(gl_dispatch_stub_563) - GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterivSGIS) + GL_STUB(gl_dispatch_stub_564, _gloffset_GetPixelTexGenParameterfvSGIS) HIDDEN(gl_dispatch_stub_564) - GL_STUB(gl_dispatch_stub_565, _gloffset_PixelTexGenParameterfSGIS) + GL_STUB(gl_dispatch_stub_565, _gloffset_GetPixelTexGenParameterivSGIS) HIDDEN(gl_dispatch_stub_565) - GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfvSGIS) + GL_STUB(gl_dispatch_stub_566, _gloffset_PixelTexGenParameterfSGIS) HIDDEN(gl_dispatch_stub_566) - GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameteriSGIS) + GL_STUB(gl_dispatch_stub_567, _gloffset_PixelTexGenParameterfvSGIS) HIDDEN(gl_dispatch_stub_567) - GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameterivSGIS) + GL_STUB(gl_dispatch_stub_568, _gloffset_PixelTexGenParameteriSGIS) HIDDEN(gl_dispatch_stub_568) - GL_STUB(gl_dispatch_stub_569, _gloffset_SampleMaskSGIS) + GL_STUB(gl_dispatch_stub_569, _gloffset_PixelTexGenParameterivSGIS) HIDDEN(gl_dispatch_stub_569) - GL_STUB(gl_dispatch_stub_570, _gloffset_SamplePatternSGIS) + GL_STUB(gl_dispatch_stub_570, _gloffset_SampleMaskSGIS) HIDDEN(gl_dispatch_stub_570) + GL_STUB(gl_dispatch_stub_571, _gloffset_SamplePatternSGIS) + HIDDEN(gl_dispatch_stub_571) GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT) GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT) GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT) @@ -786,10 +787,10 @@ gl_dispatch_functions_start: GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) - GL_STUB(gl_dispatch_stub_581, _gloffset_CullParameterdvEXT) - HIDDEN(gl_dispatch_stub_581) - GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterfvEXT) + GL_STUB(gl_dispatch_stub_582, _gloffset_CullParameterdvEXT) HIDDEN(gl_dispatch_stub_582) + GL_STUB(gl_dispatch_stub_583, _gloffset_CullParameterfvEXT) + HIDDEN(gl_dispatch_stub_583) GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) @@ -814,8 +815,8 @@ gl_dispatch_functions_start: GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) - GL_STUB(gl_dispatch_stub_607, _gloffset_PixelTexGenSGIX) - HIDDEN(gl_dispatch_stub_607) + GL_STUB(gl_dispatch_stub_608, _gloffset_PixelTexGenSGIX) + HIDDEN(gl_dispatch_stub_608) GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) @@ -857,24 +858,24 @@ gl_dispatch_functions_start: GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) - GL_STUB(gl_dispatch_stub_649, _gloffset_MultiModeDrawArraysIBM) - HIDDEN(gl_dispatch_stub_649) - GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawElementsIBM) + GL_STUB(gl_dispatch_stub_650, _gloffset_MultiModeDrawArraysIBM) HIDDEN(gl_dispatch_stub_650) - GL_STUB(gl_dispatch_stub_651, _gloffset_DeleteFencesNV) + GL_STUB(gl_dispatch_stub_651, _gloffset_MultiModeDrawElementsIBM) HIDDEN(gl_dispatch_stub_651) - GL_STUB(gl_dispatch_stub_652, _gloffset_FinishFenceNV) + GL_STUB(gl_dispatch_stub_652, _gloffset_DeleteFencesNV) HIDDEN(gl_dispatch_stub_652) - GL_STUB(gl_dispatch_stub_653, _gloffset_GenFencesNV) + GL_STUB(gl_dispatch_stub_653, _gloffset_FinishFenceNV) HIDDEN(gl_dispatch_stub_653) - GL_STUB(gl_dispatch_stub_654, _gloffset_GetFenceivNV) + GL_STUB(gl_dispatch_stub_654, _gloffset_GenFencesNV) HIDDEN(gl_dispatch_stub_654) - GL_STUB(gl_dispatch_stub_655, _gloffset_IsFenceNV) + GL_STUB(gl_dispatch_stub_655, _gloffset_GetFenceivNV) HIDDEN(gl_dispatch_stub_655) - GL_STUB(gl_dispatch_stub_656, _gloffset_SetFenceNV) + GL_STUB(gl_dispatch_stub_656, _gloffset_IsFenceNV) HIDDEN(gl_dispatch_stub_656) - GL_STUB(gl_dispatch_stub_657, _gloffset_TestFenceNV) + GL_STUB(gl_dispatch_stub_657, _gloffset_SetFenceNV) HIDDEN(gl_dispatch_stub_657) + GL_STUB(gl_dispatch_stub_658, _gloffset_TestFenceNV) + HIDDEN(gl_dispatch_stub_658) GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) @@ -955,26 +956,26 @@ gl_dispatch_functions_start: GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) - GL_STUB(gl_dispatch_stub_738, _gloffset_ActiveStencilFaceEXT) - HIDDEN(gl_dispatch_stub_738) - GL_STUB(gl_dispatch_stub_739, _gloffset_BindVertexArrayAPPLE) + GL_STUB(gl_dispatch_stub_739, _gloffset_ActiveStencilFaceEXT) HIDDEN(gl_dispatch_stub_739) - GL_STUB(gl_dispatch_stub_740, _gloffset_DeleteVertexArraysAPPLE) + GL_STUB(gl_dispatch_stub_740, _gloffset_BindVertexArrayAPPLE) HIDDEN(gl_dispatch_stub_740) - GL_STUB(gl_dispatch_stub_741, _gloffset_GenVertexArraysAPPLE) + GL_STUB(gl_dispatch_stub_741, _gloffset_DeleteVertexArraysAPPLE) HIDDEN(gl_dispatch_stub_741) - GL_STUB(gl_dispatch_stub_742, _gloffset_IsVertexArrayAPPLE) + GL_STUB(gl_dispatch_stub_742, _gloffset_GenVertexArraysAPPLE) HIDDEN(gl_dispatch_stub_742) + GL_STUB(gl_dispatch_stub_743, _gloffset_IsVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_743) GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) - GL_STUB(gl_dispatch_stub_749, _gloffset_DepthBoundsEXT) - HIDDEN(gl_dispatch_stub_749) - GL_STUB(gl_dispatch_stub_750, _gloffset_BlendEquationSeparateEXT) + GL_STUB(gl_dispatch_stub_750, _gloffset_DepthBoundsEXT) HIDDEN(gl_dispatch_stub_750) + GL_STUB(gl_dispatch_stub_751, _gloffset_BlendEquationSeparateEXT) + HIDDEN(gl_dispatch_stub_751) GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) @@ -992,19 +993,19 @@ gl_dispatch_functions_start: GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) - GL_STUB(gl_dispatch_stub_768, _gloffset_BlitFramebufferEXT) - HIDDEN(gl_dispatch_stub_768) + GL_STUB(gl_dispatch_stub_769, _gloffset_BlitFramebufferEXT) + HIDDEN(gl_dispatch_stub_769) GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) - GL_STUB(gl_dispatch_stub_770, _gloffset_StencilFuncSeparateATI) - HIDDEN(gl_dispatch_stub_770) - GL_STUB(gl_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT) + GL_STUB(gl_dispatch_stub_771, _gloffset_StencilFuncSeparateATI) HIDDEN(gl_dispatch_stub_771) - GL_STUB(gl_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT) + GL_STUB(gl_dispatch_stub_772, _gloffset_ProgramEnvParameters4fvEXT) HIDDEN(gl_dispatch_stub_772) - GL_STUB(gl_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT) + GL_STUB(gl_dispatch_stub_773, _gloffset_ProgramLocalParameters4fvEXT) HIDDEN(gl_dispatch_stub_773) - GL_STUB(gl_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT) + GL_STUB(gl_dispatch_stub_774, _gloffset_GetQueryObjecti64vEXT) HIDDEN(gl_dispatch_stub_774) + GL_STUB(gl_dispatch_stub_775, _gloffset_GetQueryObjectui64vEXT) + HIDDEN(gl_dispatch_stub_775) GL_STUB_ALIAS(glArrayElementEXT, glArrayElement) GL_STUB_ALIAS(glBindTextureEXT, glBindTexture) GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays) diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index fe05549c1d..8f66ef96e6 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -21157,21 +21157,25 @@ GL_PREFIX(RenderbufferStorageMultisample): .size GL_PREFIX(RenderbufferStorageMultisample), .-GL_PREFIX(RenderbufferStorageMultisample) .p2align 4,,15 - .globl GL_PREFIX(PolygonOffsetEXT) - .type GL_PREFIX(PolygonOffsetEXT), @function -GL_PREFIX(PolygonOffsetEXT): + .globl GL_PREFIX(CopyBufferSubData) + .type GL_PREFIX(CopyBufferSubData), @function +GL_PREFIX(CopyBufferSubData): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT movq 4496(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) - subq $24, %rsp - movq %xmm0, (%rsp) - movq %xmm1, 8(%rsp) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 call _x86_64_get_dispatch@PLT - movq 8(%rsp), %xmm1 - movq (%rsp), %xmm0 - addq $24, %rsp + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi movq 4496(%rax), %r11 jmp *%r11 #else @@ -21181,35 +21185,38 @@ GL_PREFIX(PolygonOffsetEXT): movq 4496(%rax), %r11 jmp *%r11 1: - subq $24, %rsp - movq %xmm0, (%rsp) - movq %xmm1, 8(%rsp) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 call _glapi_get_dispatch - movq 8(%rsp), %xmm1 - movq (%rsp), %xmm0 - addq $24, %rsp + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi movq 4496(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT) + .size GL_PREFIX(CopyBufferSubData), .-GL_PREFIX(CopyBufferSubData) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_563) - .type GL_PREFIX(_dispatch_stub_563), @function - HIDDEN(GL_PREFIX(_dispatch_stub_563)) -GL_PREFIX(_dispatch_stub_563): + .globl GL_PREFIX(PolygonOffsetEXT) + .type GL_PREFIX(PolygonOffsetEXT), @function +GL_PREFIX(PolygonOffsetEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT movq 4504(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rbp + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi - popq %rdi + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp movq 4504(%rax), %r11 jmp *%r11 #else @@ -21219,17 +21226,17 @@ GL_PREFIX(_dispatch_stub_563): movq 4504(%rax), %r11 jmp *%r11 1: - pushq %rdi - pushq %rsi - pushq %rbp + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) call _glapi_get_dispatch - popq %rbp - popq %rsi - popq %rdi + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp movq 4504(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_563), .-GL_PREFIX(_dispatch_stub_563) + .size GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT) .p2align 4,,15 .globl GL_PREFIX(_dispatch_stub_564) @@ -21279,13 +21286,13 @@ GL_PREFIX(_dispatch_stub_565): movq 4520(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) - subq $24, %rsp - movq %rdi, (%rsp) - movq %xmm0, 8(%rsp) + pushq %rdi + pushq %rsi + pushq %rbp call _x86_64_get_dispatch@PLT - movq 8(%rsp), %xmm0 - movq (%rsp), %rdi - addq $24, %rsp + popq %rbp + popq %rsi + popq %rdi movq 4520(%rax), %r11 jmp *%r11 #else @@ -21295,13 +21302,13 @@ GL_PREFIX(_dispatch_stub_565): movq 4520(%rax), %r11 jmp *%r11 1: - subq $24, %rsp - movq %rdi, (%rsp) - movq %xmm0, 8(%rsp) + pushq %rdi + pushq %rsi + pushq %rbp call _glapi_get_dispatch - movq 8(%rsp), %xmm0 - movq (%rsp), %rdi - addq $24, %rsp + popq %rbp + popq %rsi + popq %rdi movq 4520(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ @@ -21317,13 +21324,13 @@ GL_PREFIX(_dispatch_stub_566): movq 4528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rbp + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi - popq %rdi + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp movq 4528(%rax), %r11 jmp *%r11 #else @@ -21333,13 +21340,13 @@ GL_PREFIX(_dispatch_stub_566): movq 4528(%rax), %r11 jmp *%r11 1: - pushq %rdi - pushq %rsi - pushq %rbp + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) call _glapi_get_dispatch - popq %rbp - popq %rsi - popq %rdi + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp movq 4528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ @@ -21470,7 +21477,11 @@ GL_PREFIX(_dispatch_stub_570): jmp *%r11 #elif defined(PTHREADS) pushq %rdi + pushq %rsi + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi popq %rdi movq 4560(%rax), %r11 jmp *%r11 @@ -21482,20 +21493,54 @@ GL_PREFIX(_dispatch_stub_570): jmp *%r11 1: pushq %rdi + pushq %rsi + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rsi popq %rdi movq 4560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_570), .-GL_PREFIX(_dispatch_stub_570) + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_571) + .type GL_PREFIX(_dispatch_stub_571), @function + HIDDEN(GL_PREFIX(_dispatch_stub_571)) +GL_PREFIX(_dispatch_stub_571): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_571), .-GL_PREFIX(_dispatch_stub_571) + .p2align 4,,15 .globl GL_PREFIX(ColorPointerEXT) .type GL_PREFIX(ColorPointerEXT), @function GL_PREFIX(ColorPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4568(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21509,13 +21554,13 @@ GL_PREFIX(ColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4568(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4568(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21529,7 +21574,7 @@ GL_PREFIX(ColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4568(%rax), %r11 + movq 4576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorPointerEXT), .-GL_PREFIX(ColorPointerEXT) @@ -21540,7 +21585,7 @@ GL_PREFIX(ColorPointerEXT): GL_PREFIX(EdgeFlagPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4576(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21550,13 +21595,13 @@ GL_PREFIX(EdgeFlagPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4576(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4576(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21566,7 +21611,7 @@ GL_PREFIX(EdgeFlagPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4576(%rax), %r11 + movq 4584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EdgeFlagPointerEXT), .-GL_PREFIX(EdgeFlagPointerEXT) @@ -21577,7 +21622,7 @@ GL_PREFIX(EdgeFlagPointerEXT): GL_PREFIX(IndexPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4584(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21591,13 +21636,13 @@ GL_PREFIX(IndexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4584(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4584(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21611,7 +21656,7 @@ GL_PREFIX(IndexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4584(%rax), %r11 + movq 4592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IndexPointerEXT), .-GL_PREFIX(IndexPointerEXT) @@ -21622,7 +21667,7 @@ GL_PREFIX(IndexPointerEXT): GL_PREFIX(NormalPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4592(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21636,13 +21681,13 @@ GL_PREFIX(NormalPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4592(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4592(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21656,7 +21701,7 @@ GL_PREFIX(NormalPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4592(%rax), %r11 + movq 4600(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(NormalPointerEXT), .-GL_PREFIX(NormalPointerEXT) @@ -21667,7 +21712,7 @@ GL_PREFIX(NormalPointerEXT): GL_PREFIX(TexCoordPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4600(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21681,13 +21726,13 @@ GL_PREFIX(TexCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4600(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4600(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21701,7 +21746,7 @@ GL_PREFIX(TexCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4600(%rax), %r11 + movq 4608(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexCoordPointerEXT), .-GL_PREFIX(TexCoordPointerEXT) @@ -21712,7 +21757,7 @@ GL_PREFIX(TexCoordPointerEXT): GL_PREFIX(VertexPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4608(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21726,13 +21771,13 @@ GL_PREFIX(VertexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4608(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4608(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21746,7 +21791,7 @@ GL_PREFIX(VertexPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4608(%rax), %r11 + movq 4616(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexPointerEXT), .-GL_PREFIX(VertexPointerEXT) @@ -21757,7 +21802,7 @@ GL_PREFIX(VertexPointerEXT): GL_PREFIX(PointParameterfEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4616(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -21767,13 +21812,13 @@ GL_PREFIX(PointParameterfEXT): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4616(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4616(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -21783,7 +21828,7 @@ GL_PREFIX(PointParameterfEXT): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4616(%rax), %r11 + movq 4624(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterfEXT), .-GL_PREFIX(PointParameterfEXT) @@ -21794,7 +21839,7 @@ GL_PREFIX(PointParameterfEXT): GL_PREFIX(PointParameterfvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4624(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21804,13 +21849,13 @@ GL_PREFIX(PointParameterfvEXT): popq %rbp popq %rsi popq %rdi - movq 4624(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4624(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21820,7 +21865,7 @@ GL_PREFIX(PointParameterfvEXT): popq %rbp popq %rsi popq %rdi - movq 4624(%rax), %r11 + movq 4632(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameterfvEXT), .-GL_PREFIX(PointParameterfvEXT) @@ -21831,7 +21876,7 @@ GL_PREFIX(PointParameterfvEXT): GL_PREFIX(LockArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4632(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21841,13 +21886,13 @@ GL_PREFIX(LockArraysEXT): popq %rbp popq %rsi popq %rdi - movq 4632(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4632(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21857,7 +21902,7 @@ GL_PREFIX(LockArraysEXT): popq %rbp popq %rsi popq %rdi - movq 4632(%rax), %r11 + movq 4640(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(LockArraysEXT), .-GL_PREFIX(LockArraysEXT) @@ -21868,37 +21913,37 @@ GL_PREFIX(LockArraysEXT): GL_PREFIX(UnlockArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4640(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 4640(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4640(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 4640(%rax), %r11 + movq 4648(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_581) - .type GL_PREFIX(_dispatch_stub_581), @function - HIDDEN(GL_PREFIX(_dispatch_stub_581)) -GL_PREFIX(_dispatch_stub_581): + .globl GL_PREFIX(_dispatch_stub_582) + .type GL_PREFIX(_dispatch_stub_582), @function + HIDDEN(GL_PREFIX(_dispatch_stub_582)) +GL_PREFIX(_dispatch_stub_582): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4648(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21908,13 +21953,13 @@ GL_PREFIX(_dispatch_stub_581): popq %rbp popq %rsi popq %rdi - movq 4648(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4648(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21924,19 +21969,19 @@ GL_PREFIX(_dispatch_stub_581): popq %rbp popq %rsi popq %rdi - movq 4648(%rax), %r11 + movq 4656(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_581), .-GL_PREFIX(_dispatch_stub_581) + .size GL_PREFIX(_dispatch_stub_582), .-GL_PREFIX(_dispatch_stub_582) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_582) - .type GL_PREFIX(_dispatch_stub_582), @function - HIDDEN(GL_PREFIX(_dispatch_stub_582)) -GL_PREFIX(_dispatch_stub_582): + .globl GL_PREFIX(_dispatch_stub_583) + .type GL_PREFIX(_dispatch_stub_583), @function + HIDDEN(GL_PREFIX(_dispatch_stub_583)) +GL_PREFIX(_dispatch_stub_583): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4656(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21946,13 +21991,13 @@ GL_PREFIX(_dispatch_stub_582): popq %rbp popq %rsi popq %rdi - movq 4656(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4656(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21962,10 +22007,10 @@ GL_PREFIX(_dispatch_stub_582): popq %rbp popq %rsi popq %rdi - movq 4656(%rax), %r11 + movq 4664(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_582), .-GL_PREFIX(_dispatch_stub_582) + .size GL_PREFIX(_dispatch_stub_583), .-GL_PREFIX(_dispatch_stub_583) .p2align 4,,15 .globl GL_PREFIX(SecondaryColor3bEXT) @@ -21973,7 +22018,7 @@ GL_PREFIX(_dispatch_stub_582): GL_PREFIX(SecondaryColor3bEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4664(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -21983,13 +22028,13 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4664(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4664(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -21999,7 +22044,7 @@ GL_PREFIX(SecondaryColor3bEXT): popq %rdx popq %rsi popq %rdi - movq 4664(%rax), %r11 + movq 4672(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT) @@ -22010,25 +22055,25 @@ GL_PREFIX(SecondaryColor3bEXT): GL_PREFIX(SecondaryColor3bvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4672(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4672(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4672(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4672(%rax), %r11 + movq 4680(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT) @@ -22039,7 +22084,7 @@ GL_PREFIX(SecondaryColor3bvEXT): GL_PREFIX(SecondaryColor3dEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4680(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -22051,13 +22096,13 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4680(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4680(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -22069,7 +22114,7 @@ GL_PREFIX(SecondaryColor3dEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4680(%rax), %r11 + movq 4688(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT) @@ -22080,25 +22125,25 @@ GL_PREFIX(SecondaryColor3dEXT): GL_PREFIX(SecondaryColor3dvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4688(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4688(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4688(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4688(%rax), %r11 + movq 4696(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT) @@ -22109,7 +22154,7 @@ GL_PREFIX(SecondaryColor3dvEXT): GL_PREFIX(SecondaryColor3fEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4696(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -22121,13 +22166,13 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4696(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4696(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -22139,7 +22184,7 @@ GL_PREFIX(SecondaryColor3fEXT): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 4696(%rax), %r11 + movq 4704(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT) @@ -22150,25 +22195,25 @@ GL_PREFIX(SecondaryColor3fEXT): GL_PREFIX(SecondaryColor3fvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4704(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4704(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4704(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4704(%rax), %r11 + movq 4712(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT) @@ -22179,7 +22224,7 @@ GL_PREFIX(SecondaryColor3fvEXT): GL_PREFIX(SecondaryColor3iEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4712(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22189,13 +22234,13 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4712(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4712(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22205,7 +22250,7 @@ GL_PREFIX(SecondaryColor3iEXT): popq %rdx popq %rsi popq %rdi - movq 4712(%rax), %r11 + movq 4720(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT) @@ -22216,25 +22261,25 @@ GL_PREFIX(SecondaryColor3iEXT): GL_PREFIX(SecondaryColor3ivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4720(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4720(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4720(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4720(%rax), %r11 + movq 4728(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT) @@ -22245,7 +22290,7 @@ GL_PREFIX(SecondaryColor3ivEXT): GL_PREFIX(SecondaryColor3sEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4728(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22255,13 +22300,13 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4728(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4728(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22271,7 +22316,7 @@ GL_PREFIX(SecondaryColor3sEXT): popq %rdx popq %rsi popq %rdi - movq 4728(%rax), %r11 + movq 4736(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT) @@ -22282,25 +22327,25 @@ GL_PREFIX(SecondaryColor3sEXT): GL_PREFIX(SecondaryColor3svEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4736(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4736(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4736(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4736(%rax), %r11 + movq 4744(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT) @@ -22311,7 +22356,7 @@ GL_PREFIX(SecondaryColor3svEXT): GL_PREFIX(SecondaryColor3ubEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4744(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22321,13 +22366,13 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4744(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4744(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22337,7 +22382,7 @@ GL_PREFIX(SecondaryColor3ubEXT): popq %rdx popq %rsi popq %rdi - movq 4744(%rax), %r11 + movq 4752(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT) @@ -22348,25 +22393,25 @@ GL_PREFIX(SecondaryColor3ubEXT): GL_PREFIX(SecondaryColor3ubvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4752(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4752(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4752(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4752(%rax), %r11 + movq 4760(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT) @@ -22377,7 +22422,7 @@ GL_PREFIX(SecondaryColor3ubvEXT): GL_PREFIX(SecondaryColor3uiEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4760(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22387,13 +22432,13 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4760(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4760(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22403,7 +22448,7 @@ GL_PREFIX(SecondaryColor3uiEXT): popq %rdx popq %rsi popq %rdi - movq 4760(%rax), %r11 + movq 4768(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT) @@ -22414,25 +22459,25 @@ GL_PREFIX(SecondaryColor3uiEXT): GL_PREFIX(SecondaryColor3uivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4768(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4768(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4768(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4768(%rax), %r11 + movq 4776(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT) @@ -22443,7 +22488,7 @@ GL_PREFIX(SecondaryColor3uivEXT): GL_PREFIX(SecondaryColor3usEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4776(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22453,13 +22498,13 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4776(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4776(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22469,7 +22514,7 @@ GL_PREFIX(SecondaryColor3usEXT): popq %rdx popq %rsi popq %rdi - movq 4776(%rax), %r11 + movq 4784(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT) @@ -22480,25 +22525,25 @@ GL_PREFIX(SecondaryColor3usEXT): GL_PREFIX(SecondaryColor3usvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4784(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4784(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4784(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4784(%rax), %r11 + movq 4792(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT) @@ -22509,7 +22554,7 @@ GL_PREFIX(SecondaryColor3usvEXT): GL_PREFIX(SecondaryColorPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4792(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22523,13 +22568,13 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4792(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4792(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22543,7 +22588,7 @@ GL_PREFIX(SecondaryColorPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4792(%rax), %r11 + movq 4800(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT) @@ -22554,7 +22599,7 @@ GL_PREFIX(SecondaryColorPointerEXT): GL_PREFIX(MultiDrawArraysEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4800(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22568,13 +22613,13 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 4800(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4800(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22588,7 +22633,7 @@ GL_PREFIX(MultiDrawArraysEXT): popq %rdx popq %rsi popq %rdi - movq 4800(%rax), %r11 + movq 4808(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT) @@ -22599,7 +22644,7 @@ GL_PREFIX(MultiDrawArraysEXT): GL_PREFIX(MultiDrawElementsEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4808(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22613,13 +22658,13 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 4808(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4808(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22633,7 +22678,7 @@ GL_PREFIX(MultiDrawElementsEXT): popq %rdx popq %rsi popq %rdi - movq 4808(%rax), %r11 + movq 4816(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT) @@ -22644,7 +22689,7 @@ GL_PREFIX(MultiDrawElementsEXT): GL_PREFIX(FogCoordPointerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4816(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22654,13 +22699,13 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4816(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4816(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22670,7 +22715,7 @@ GL_PREFIX(FogCoordPointerEXT): popq %rdx popq %rsi popq %rdi - movq 4816(%rax), %r11 + movq 4824(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT) @@ -22681,7 +22726,7 @@ GL_PREFIX(FogCoordPointerEXT): GL_PREFIX(FogCoorddEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4824(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -22689,13 +22734,13 @@ GL_PREFIX(FogCoorddEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 4824(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4824(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -22703,7 +22748,7 @@ GL_PREFIX(FogCoorddEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 4824(%rax), %r11 + movq 4832(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT) @@ -22714,25 +22759,25 @@ GL_PREFIX(FogCoorddEXT): GL_PREFIX(FogCoorddvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4832(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4832(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4832(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4832(%rax), %r11 + movq 4840(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT) @@ -22743,7 +22788,7 @@ GL_PREFIX(FogCoorddvEXT): GL_PREFIX(FogCoordfEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4840(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $8, %rsp @@ -22751,13 +22796,13 @@ GL_PREFIX(FogCoordfEXT): call _x86_64_get_dispatch@PLT movq (%rsp), %xmm0 addq $8, %rsp - movq 4840(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4840(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 1: subq $8, %rsp @@ -22765,7 +22810,7 @@ GL_PREFIX(FogCoordfEXT): call _glapi_get_dispatch movq (%rsp), %xmm0 addq $8, %rsp - movq 4840(%rax), %r11 + movq 4848(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT) @@ -22776,58 +22821,58 @@ GL_PREFIX(FogCoordfEXT): GL_PREFIX(FogCoordfvEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4848(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4848(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4848(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4848(%rax), %r11 + movq 4856(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_607) - .type GL_PREFIX(_dispatch_stub_607), @function - HIDDEN(GL_PREFIX(_dispatch_stub_607)) -GL_PREFIX(_dispatch_stub_607): + .globl GL_PREFIX(_dispatch_stub_608) + .type GL_PREFIX(_dispatch_stub_608), @function + HIDDEN(GL_PREFIX(_dispatch_stub_608)) +GL_PREFIX(_dispatch_stub_608): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4856(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 4856(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4856(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 4856(%rax), %r11 + movq 4864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_607), .-GL_PREFIX(_dispatch_stub_607) + .size GL_PREFIX(_dispatch_stub_608), .-GL_PREFIX(_dispatch_stub_608) .p2align 4,,15 .globl GL_PREFIX(BlendFuncSeparateEXT) @@ -22835,7 +22880,7 @@ GL_PREFIX(_dispatch_stub_607): GL_PREFIX(BlendFuncSeparateEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4864(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22849,13 +22894,13 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 4864(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4864(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22869,7 +22914,7 @@ GL_PREFIX(BlendFuncSeparateEXT): popq %rdx popq %rsi popq %rdi - movq 4864(%rax), %r11 + movq 4872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT) @@ -22880,25 +22925,25 @@ GL_PREFIX(BlendFuncSeparateEXT): GL_PREFIX(FlushVertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4872(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 4872(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4872(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 4872(%rax), %r11 + movq 4880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV) @@ -22909,7 +22954,7 @@ GL_PREFIX(FlushVertexArrayRangeNV): GL_PREFIX(VertexArrayRangeNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4880(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22919,13 +22964,13 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 4880(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4880(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22935,7 +22980,7 @@ GL_PREFIX(VertexArrayRangeNV): popq %rbp popq %rsi popq %rdi - movq 4880(%rax), %r11 + movq 4888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV) @@ -22946,7 +22991,7 @@ GL_PREFIX(VertexArrayRangeNV): GL_PREFIX(CombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4888(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -22964,13 +23009,13 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4888(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4888(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -22988,7 +23033,7 @@ GL_PREFIX(CombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4888(%rax), %r11 + movq 4896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV) @@ -22999,7 +23044,7 @@ GL_PREFIX(CombinerInputNV): GL_PREFIX(CombinerOutputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4896(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23017,13 +23062,13 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 4896(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4896(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23041,7 +23086,7 @@ GL_PREFIX(CombinerOutputNV): popq %rdx popq %rsi popq %rdi - movq 4896(%rax), %r11 + movq 4904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV) @@ -23052,7 +23097,7 @@ GL_PREFIX(CombinerOutputNV): GL_PREFIX(CombinerParameterfNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4904(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23062,13 +23107,13 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4904(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4904(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23078,7 +23123,7 @@ GL_PREFIX(CombinerParameterfNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 4904(%rax), %r11 + movq 4912(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV) @@ -23089,7 +23134,7 @@ GL_PREFIX(CombinerParameterfNV): GL_PREFIX(CombinerParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4912(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23099,13 +23144,13 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 4912(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4912(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23115,7 +23160,7 @@ GL_PREFIX(CombinerParameterfvNV): popq %rbp popq %rsi popq %rdi - movq 4912(%rax), %r11 + movq 4920(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV) @@ -23126,7 +23171,7 @@ GL_PREFIX(CombinerParameterfvNV): GL_PREFIX(CombinerParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4920(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23136,13 +23181,13 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 4920(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4920(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23152,7 +23197,7 @@ GL_PREFIX(CombinerParameteriNV): popq %rbp popq %rsi popq %rdi - movq 4920(%rax), %r11 + movq 4928(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV) @@ -23163,7 +23208,7 @@ GL_PREFIX(CombinerParameteriNV): GL_PREFIX(CombinerParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4928(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23173,13 +23218,13 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4928(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23189,7 +23234,7 @@ GL_PREFIX(CombinerParameterivNV): popq %rbp popq %rsi popq %rdi - movq 4928(%rax), %r11 + movq 4936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV) @@ -23200,7 +23245,7 @@ GL_PREFIX(CombinerParameterivNV): GL_PREFIX(FinalCombinerInputNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4936(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23214,13 +23259,13 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4936(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4936(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23234,7 +23279,7 @@ GL_PREFIX(FinalCombinerInputNV): popq %rdx popq %rsi popq %rdi - movq 4936(%rax), %r11 + movq 4944(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV) @@ -23245,7 +23290,7 @@ GL_PREFIX(FinalCombinerInputNV): GL_PREFIX(GetCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4944(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23259,13 +23304,13 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4944(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23279,7 +23324,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4944(%rax), %r11 + movq 4952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV) @@ -23290,7 +23335,7 @@ GL_PREFIX(GetCombinerInputParameterfvNV): GL_PREFIX(GetCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4952(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23304,13 +23349,13 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4952(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4952(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23324,7 +23369,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4952(%rax), %r11 + movq 4960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV) @@ -23335,7 +23380,7 @@ GL_PREFIX(GetCombinerInputParameterivNV): GL_PREFIX(GetCombinerOutputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4960(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23349,13 +23394,13 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4960(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23369,7 +23414,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4960(%rax), %r11 + movq 4968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV) @@ -23380,7 +23425,7 @@ GL_PREFIX(GetCombinerOutputParameterfvNV): GL_PREFIX(GetCombinerOutputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4968(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23394,13 +23439,13 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4968(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4968(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23414,7 +23459,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4968(%rax), %r11 + movq 4976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV) @@ -23425,7 +23470,7 @@ GL_PREFIX(GetCombinerOutputParameterivNV): GL_PREFIX(GetFinalCombinerInputParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4976(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23435,13 +23480,13 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4976(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23451,7 +23496,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 4976(%rax), %r11 + movq 4984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV) @@ -23462,7 +23507,7 @@ GL_PREFIX(GetFinalCombinerInputParameterfvNV): GL_PREFIX(GetFinalCombinerInputParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4984(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23472,13 +23517,13 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4984(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4984(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23488,7 +23533,7 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): popq %rdx popq %rsi popq %rdi - movq 4984(%rax), %r11 + movq 4992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV) @@ -23499,25 +23544,25 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): GL_PREFIX(ResizeBuffersMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 4992(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 4992(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 4992(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 4992(%rax), %r11 + movq 5000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA) @@ -23528,7 +23573,7 @@ GL_PREFIX(ResizeBuffersMESA): GL_PREFIX(WindowPos2dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5000(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23538,13 +23583,13 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5000(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5000(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23554,7 +23599,7 @@ GL_PREFIX(WindowPos2dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5000(%rax), %r11 + movq 5008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA) @@ -23565,25 +23610,25 @@ GL_PREFIX(WindowPos2dMESA): GL_PREFIX(WindowPos2dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5008(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5008(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5008(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5008(%rax), %r11 + movq 5016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA) @@ -23594,7 +23639,7 @@ GL_PREFIX(WindowPos2dvMESA): GL_PREFIX(WindowPos2fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5016(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23604,13 +23649,13 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5016(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5016(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23620,7 +23665,7 @@ GL_PREFIX(WindowPos2fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5016(%rax), %r11 + movq 5024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA) @@ -23631,25 +23676,25 @@ GL_PREFIX(WindowPos2fMESA): GL_PREFIX(WindowPos2fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5024(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5024(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5024(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5024(%rax), %r11 + movq 5032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA) @@ -23660,7 +23705,7 @@ GL_PREFIX(WindowPos2fvMESA): GL_PREFIX(WindowPos2iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5032(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23670,13 +23715,13 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5032(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5032(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23686,7 +23731,7 @@ GL_PREFIX(WindowPos2iMESA): popq %rbp popq %rsi popq %rdi - movq 5032(%rax), %r11 + movq 5040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA) @@ -23697,25 +23742,25 @@ GL_PREFIX(WindowPos2iMESA): GL_PREFIX(WindowPos2ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5040(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5040(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5040(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5040(%rax), %r11 + movq 5048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA) @@ -23726,7 +23771,7 @@ GL_PREFIX(WindowPos2ivMESA): GL_PREFIX(WindowPos2sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5048(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23736,13 +23781,13 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5048(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5048(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23752,7 +23797,7 @@ GL_PREFIX(WindowPos2sMESA): popq %rbp popq %rsi popq %rdi - movq 5048(%rax), %r11 + movq 5056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA) @@ -23763,25 +23808,25 @@ GL_PREFIX(WindowPos2sMESA): GL_PREFIX(WindowPos2svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5056(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5056(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5056(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5056(%rax), %r11 + movq 5064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA) @@ -23792,7 +23837,7 @@ GL_PREFIX(WindowPos2svMESA): GL_PREFIX(WindowPos3dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5064(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23804,13 +23849,13 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5064(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5064(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23822,7 +23867,7 @@ GL_PREFIX(WindowPos3dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5064(%rax), %r11 + movq 5072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA) @@ -23833,25 +23878,25 @@ GL_PREFIX(WindowPos3dMESA): GL_PREFIX(WindowPos3dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5072(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5072(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5072(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5072(%rax), %r11 + movq 5080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA) @@ -23862,7 +23907,7 @@ GL_PREFIX(WindowPos3dvMESA): GL_PREFIX(WindowPos3fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5080(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -23874,13 +23919,13 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5080(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5080(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -23892,7 +23937,7 @@ GL_PREFIX(WindowPos3fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $24, %rsp - movq 5080(%rax), %r11 + movq 5088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA) @@ -23903,25 +23948,25 @@ GL_PREFIX(WindowPos3fMESA): GL_PREFIX(WindowPos3fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5088(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5088(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5088(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5088(%rax), %r11 + movq 5096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA) @@ -23932,7 +23977,7 @@ GL_PREFIX(WindowPos3fvMESA): GL_PREFIX(WindowPos3iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5096(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -23942,13 +23987,13 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5096(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5096(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -23958,7 +24003,7 @@ GL_PREFIX(WindowPos3iMESA): popq %rdx popq %rsi popq %rdi - movq 5096(%rax), %r11 + movq 5104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA) @@ -23969,25 +24014,25 @@ GL_PREFIX(WindowPos3iMESA): GL_PREFIX(WindowPos3ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5104(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5104(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5104(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5104(%rax), %r11 + movq 5112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA) @@ -23998,7 +24043,7 @@ GL_PREFIX(WindowPos3ivMESA): GL_PREFIX(WindowPos3sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5112(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24008,13 +24053,13 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5112(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5112(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24024,7 +24069,7 @@ GL_PREFIX(WindowPos3sMESA): popq %rdx popq %rsi popq %rdi - movq 5112(%rax), %r11 + movq 5120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA) @@ -24035,25 +24080,25 @@ GL_PREFIX(WindowPos3sMESA): GL_PREFIX(WindowPos3svMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5120(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5120(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5120(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5120(%rax), %r11 + movq 5128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA) @@ -24064,7 +24109,7 @@ GL_PREFIX(WindowPos3svMESA): GL_PREFIX(WindowPos4dMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5128(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -24078,13 +24123,13 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5128(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5128(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -24098,7 +24143,7 @@ GL_PREFIX(WindowPos4dMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5128(%rax), %r11 + movq 5136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA) @@ -24109,25 +24154,25 @@ GL_PREFIX(WindowPos4dMESA): GL_PREFIX(WindowPos4dvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5136(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5136(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5136(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5136(%rax), %r11 + movq 5144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA) @@ -24138,7 +24183,7 @@ GL_PREFIX(WindowPos4dvMESA): GL_PREFIX(WindowPos4fMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5144(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -24152,13 +24197,13 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5144(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5144(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -24172,7 +24217,7 @@ GL_PREFIX(WindowPos4fMESA): movq 8(%rsp), %xmm1 movq (%rsp), %xmm0 addq $40, %rsp - movq 5144(%rax), %r11 + movq 5152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA) @@ -24183,25 +24228,25 @@ GL_PREFIX(WindowPos4fMESA): GL_PREFIX(WindowPos4fvMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5152(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5152(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5152(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5152(%rax), %r11 + movq 5160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA) @@ -24212,7 +24257,7 @@ GL_PREFIX(WindowPos4fvMESA): GL_PREFIX(WindowPos4iMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5160(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24226,13 +24271,13 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5160(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5160(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24246,7 +24291,7 @@ GL_PREFIX(WindowPos4iMESA): popq %rdx popq %rsi popq %rdi - movq 5160(%rax), %r11 + movq 5168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA) @@ -24257,25 +24302,25 @@ GL_PREFIX(WindowPos4iMESA): GL_PREFIX(WindowPos4ivMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5168(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5168(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5168(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5168(%rax), %r11 + movq 5176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA) @@ -24286,7 +24331,7 @@ GL_PREFIX(WindowPos4ivMESA): GL_PREFIX(WindowPos4sMESA): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5176(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24300,13 +24345,13 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5176(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5176(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24320,7 +24365,7 @@ GL_PREFIX(WindowPos4sMESA): popq %rdx popq %rsi popq %rdi - movq 5176(%rax), %r11 + movq 5184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA) @@ -24329,51 +24374,13 @@ GL_PREFIX(WindowPos4sMESA): .globl GL_PREFIX(WindowPos4svMESA) .type GL_PREFIX(WindowPos4svMESA), @function GL_PREFIX(WindowPos4svMESA): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 5184(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - call _x86_64_get_dispatch@PLT - popq %rdi - movq 5184(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 5184(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - call _glapi_get_dispatch - popq %rdi - movq 5184(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA) - - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_649) - .type GL_PREFIX(_dispatch_stub_649), @function - HIDDEN(GL_PREFIX(_dispatch_stub_649)) -GL_PREFIX(_dispatch_stub_649): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT movq 5192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi - pushq %rsi - pushq %rdx - pushq %rcx - pushq %r8 call _x86_64_get_dispatch@PLT - popq %r8 - popq %rcx - popq %rdx - popq %rsi popq %rdi movq 5192(%rax), %r11 jmp *%r11 @@ -24385,20 +24392,12 @@ GL_PREFIX(_dispatch_stub_649): jmp *%r11 1: pushq %rdi - pushq %rsi - pushq %rdx - pushq %rcx - pushq %r8 call _glapi_get_dispatch - popq %r8 - popq %rcx - popq %rdx - popq %rsi popq %rdi movq 5192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_649), .-GL_PREFIX(_dispatch_stub_649) + .size GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA) .p2align 4,,15 .globl GL_PREFIX(_dispatch_stub_650) @@ -24415,11 +24414,7 @@ GL_PREFIX(_dispatch_stub_650): pushq %rdx pushq %rcx pushq %r8 - pushq %r9 - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %r9 popq %r8 popq %rcx popq %rdx @@ -24439,11 +24434,7 @@ GL_PREFIX(_dispatch_stub_650): pushq %rdx pushq %rcx pushq %r8 - pushq %r9 - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %r9 popq %r8 popq %rcx popq %rdx @@ -24466,9 +24457,17 @@ GL_PREFIX(_dispatch_stub_651): #elif defined(PTHREADS) pushq %rdi pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx popq %rsi popq %rdi movq 5208(%rax), %r11 @@ -24482,9 +24481,17 @@ GL_PREFIX(_dispatch_stub_651): 1: pushq %rdi pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 pushq %rbp call _glapi_get_dispatch popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx popq %rsi popq %rdi movq 5208(%rax), %r11 @@ -24503,7 +24510,11 @@ GL_PREFIX(_dispatch_stub_652): jmp *%r11 #elif defined(PTHREADS) pushq %rdi + pushq %rsi + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi popq %rdi movq 5216(%rax), %r11 jmp *%r11 @@ -24515,7 +24526,11 @@ GL_PREFIX(_dispatch_stub_652): jmp *%r11 1: pushq %rdi + pushq %rsi + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rsi popq %rdi movq 5216(%rax), %r11 jmp *%r11 @@ -24533,11 +24548,7 @@ GL_PREFIX(_dispatch_stub_653): jmp *%r11 #elif defined(PTHREADS) pushq %rdi - pushq %rsi - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi popq %rdi movq 5224(%rax), %r11 jmp *%r11 @@ -24549,11 +24560,7 @@ GL_PREFIX(_dispatch_stub_653): jmp *%r11 1: pushq %rdi - pushq %rsi - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %rsi popq %rdi movq 5224(%rax), %r11 jmp *%r11 @@ -24572,9 +24579,9 @@ GL_PREFIX(_dispatch_stub_654): #elif defined(PTHREADS) pushq %rdi pushq %rsi - pushq %rdx + pushq %rbp call _x86_64_get_dispatch@PLT - popq %rdx + popq %rbp popq %rsi popq %rdi movq 5232(%rax), %r11 @@ -24588,9 +24595,9 @@ GL_PREFIX(_dispatch_stub_654): 1: pushq %rdi pushq %rsi - pushq %rdx + pushq %rbp call _glapi_get_dispatch - popq %rdx + popq %rbp popq %rsi popq %rdi movq 5232(%rax), %r11 @@ -24609,7 +24616,11 @@ GL_PREFIX(_dispatch_stub_655): jmp *%r11 #elif defined(PTHREADS) pushq %rdi + pushq %rsi + pushq %rdx call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi popq %rdi movq 5240(%rax), %r11 jmp *%r11 @@ -24621,7 +24632,11 @@ GL_PREFIX(_dispatch_stub_655): jmp *%r11 1: pushq %rdi + pushq %rsi + pushq %rdx call _glapi_get_dispatch + popq %rdx + popq %rsi popq %rdi movq 5240(%rax), %r11 jmp *%r11 @@ -24637,6 +24652,36 @@ GL_PREFIX(_dispatch_stub_656): call _x86_64_get_dispatch@PLT movq 5248(%rax), %r11 jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_656), .-GL_PREFIX(_dispatch_stub_656) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_657) + .type GL_PREFIX(_dispatch_stub_657), @function + HIDDEN(GL_PREFIX(_dispatch_stub_657)) +GL_PREFIX(_dispatch_stub_657): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5256(%rax), %r11 + jmp *%r11 #elif defined(PTHREADS) pushq %rdi pushq %rsi @@ -24645,13 +24690,13 @@ GL_PREFIX(_dispatch_stub_656): popq %rbp popq %rsi popq %rdi - movq 5248(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5248(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24661,40 +24706,40 @@ GL_PREFIX(_dispatch_stub_656): popq %rbp popq %rsi popq %rdi - movq 5248(%rax), %r11 + movq 5256(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_656), .-GL_PREFIX(_dispatch_stub_656) + .size GL_PREFIX(_dispatch_stub_657), .-GL_PREFIX(_dispatch_stub_657) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_657) - .type GL_PREFIX(_dispatch_stub_657), @function - HIDDEN(GL_PREFIX(_dispatch_stub_657)) -GL_PREFIX(_dispatch_stub_657): + .globl GL_PREFIX(_dispatch_stub_658) + .type GL_PREFIX(_dispatch_stub_658), @function + HIDDEN(GL_PREFIX(_dispatch_stub_658)) +GL_PREFIX(_dispatch_stub_658): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5256(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5256(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5256(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5256(%rax), %r11 + movq 5264(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_657), .-GL_PREFIX(_dispatch_stub_657) + .size GL_PREFIX(_dispatch_stub_658), .-GL_PREFIX(_dispatch_stub_658) .p2align 4,,15 .globl GL_PREFIX(AreProgramsResidentNV) @@ -24702,7 +24747,7 @@ GL_PREFIX(_dispatch_stub_657): GL_PREFIX(AreProgramsResidentNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5264(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24712,13 +24757,13 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5264(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5264(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24728,7 +24773,7 @@ GL_PREFIX(AreProgramsResidentNV): popq %rdx popq %rsi popq %rdi - movq 5264(%rax), %r11 + movq 5272(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV) @@ -24739,7 +24784,7 @@ GL_PREFIX(AreProgramsResidentNV): GL_PREFIX(BindProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5272(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24749,13 +24794,13 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5272(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5272(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24765,7 +24810,7 @@ GL_PREFIX(BindProgramNV): popq %rbp popq %rsi popq %rdi - movq 5272(%rax), %r11 + movq 5280(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV) @@ -24776,7 +24821,7 @@ GL_PREFIX(BindProgramNV): GL_PREFIX(DeleteProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5280(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24786,13 +24831,13 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5280(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5280(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24802,7 +24847,7 @@ GL_PREFIX(DeleteProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5280(%rax), %r11 + movq 5288(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV) @@ -24813,7 +24858,7 @@ GL_PREFIX(DeleteProgramsNV): GL_PREFIX(ExecuteProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5288(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24823,13 +24868,13 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5288(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5288(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24839,7 +24884,7 @@ GL_PREFIX(ExecuteProgramNV): popq %rdx popq %rsi popq %rdi - movq 5288(%rax), %r11 + movq 5296(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV) @@ -24850,7 +24895,7 @@ GL_PREFIX(ExecuteProgramNV): GL_PREFIX(GenProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5296(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24860,13 +24905,13 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5296(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5296(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24876,7 +24921,7 @@ GL_PREFIX(GenProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5296(%rax), %r11 + movq 5304(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV) @@ -24887,7 +24932,7 @@ GL_PREFIX(GenProgramsNV): GL_PREFIX(GetProgramParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5304(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24901,13 +24946,13 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5304(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5304(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24921,7 +24966,7 @@ GL_PREFIX(GetProgramParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5304(%rax), %r11 + movq 5312(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV) @@ -24932,7 +24977,7 @@ GL_PREFIX(GetProgramParameterdvNV): GL_PREFIX(GetProgramParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5312(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24946,13 +24991,13 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5312(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -24966,7 +25011,7 @@ GL_PREFIX(GetProgramParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5312(%rax), %r11 + movq 5320(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV) @@ -24977,7 +25022,7 @@ GL_PREFIX(GetProgramParameterfvNV): GL_PREFIX(GetProgramStringNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5320(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -24987,13 +25032,13 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5320(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5320(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25003,7 +25048,7 @@ GL_PREFIX(GetProgramStringNV): popq %rdx popq %rsi popq %rdi - movq 5320(%rax), %r11 + movq 5328(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV) @@ -25014,7 +25059,7 @@ GL_PREFIX(GetProgramStringNV): GL_PREFIX(GetProgramivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5328(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25024,13 +25069,13 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5328(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25040,7 +25085,7 @@ GL_PREFIX(GetProgramivNV): popq %rdx popq %rsi popq %rdi - movq 5328(%rax), %r11 + movq 5336(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV) @@ -25051,7 +25096,7 @@ GL_PREFIX(GetProgramivNV): GL_PREFIX(GetTrackMatrixivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5336(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25065,13 +25110,13 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5336(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5336(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25085,7 +25130,7 @@ GL_PREFIX(GetTrackMatrixivNV): popq %rdx popq %rsi popq %rdi - movq 5336(%rax), %r11 + movq 5344(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV) @@ -25096,7 +25141,7 @@ GL_PREFIX(GetTrackMatrixivNV): GL_PREFIX(GetVertexAttribPointervNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5344(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25106,13 +25151,13 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5344(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5344(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25122,7 +25167,7 @@ GL_PREFIX(GetVertexAttribPointervNV): popq %rdx popq %rsi popq %rdi - movq 5344(%rax), %r11 + movq 5352(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV) @@ -25133,7 +25178,7 @@ GL_PREFIX(GetVertexAttribPointervNV): GL_PREFIX(GetVertexAttribdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5352(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25143,13 +25188,13 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5352(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5352(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25159,7 +25204,7 @@ GL_PREFIX(GetVertexAttribdvNV): popq %rdx popq %rsi popq %rdi - movq 5352(%rax), %r11 + movq 5360(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV) @@ -25170,7 +25215,7 @@ GL_PREFIX(GetVertexAttribdvNV): GL_PREFIX(GetVertexAttribfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5360(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25180,13 +25225,13 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5360(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5360(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25196,7 +25241,7 @@ GL_PREFIX(GetVertexAttribfvNV): popq %rdx popq %rsi popq %rdi - movq 5360(%rax), %r11 + movq 5368(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV) @@ -25207,7 +25252,7 @@ GL_PREFIX(GetVertexAttribfvNV): GL_PREFIX(GetVertexAttribivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5368(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25217,13 +25262,13 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5368(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5368(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25233,7 +25278,7 @@ GL_PREFIX(GetVertexAttribivNV): popq %rdx popq %rsi popq %rdi - movq 5368(%rax), %r11 + movq 5376(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV) @@ -25244,25 +25289,25 @@ GL_PREFIX(GetVertexAttribivNV): GL_PREFIX(IsProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5376(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5376(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5376(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5376(%rax), %r11 + movq 5384(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV) @@ -25273,7 +25318,7 @@ GL_PREFIX(IsProgramNV): GL_PREFIX(LoadProgramNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5384(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25287,13 +25332,13 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5384(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5384(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25307,7 +25352,7 @@ GL_PREFIX(LoadProgramNV): popq %rdx popq %rsi popq %rdi - movq 5384(%rax), %r11 + movq 5392(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV) @@ -25318,7 +25363,7 @@ GL_PREFIX(LoadProgramNV): GL_PREFIX(ProgramParameters4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5392(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25332,13 +25377,13 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5392(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25352,7 +25397,7 @@ GL_PREFIX(ProgramParameters4dvNV): popq %rdx popq %rsi popq %rdi - movq 5392(%rax), %r11 + movq 5400(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV) @@ -25363,7 +25408,7 @@ GL_PREFIX(ProgramParameters4dvNV): GL_PREFIX(ProgramParameters4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5400(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25377,13 +25422,13 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5400(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5400(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25397,7 +25442,7 @@ GL_PREFIX(ProgramParameters4fvNV): popq %rdx popq %rsi popq %rdi - movq 5400(%rax), %r11 + movq 5408(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV) @@ -25408,7 +25453,7 @@ GL_PREFIX(ProgramParameters4fvNV): GL_PREFIX(RequestResidentProgramsNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5408(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25418,13 +25463,13 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5408(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25434,7 +25479,7 @@ GL_PREFIX(RequestResidentProgramsNV): popq %rbp popq %rsi popq %rdi - movq 5408(%rax), %r11 + movq 5416(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV) @@ -25445,7 +25490,7 @@ GL_PREFIX(RequestResidentProgramsNV): GL_PREFIX(TrackMatrixNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5416(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25459,13 +25504,13 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5416(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5416(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25479,7 +25524,7 @@ GL_PREFIX(TrackMatrixNV): popq %rdx popq %rsi popq %rdi - movq 5416(%rax), %r11 + movq 5424(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV) @@ -25490,7 +25535,7 @@ GL_PREFIX(TrackMatrixNV): GL_PREFIX(VertexAttrib1dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5424(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25500,13 +25545,13 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5424(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5424(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25516,7 +25561,7 @@ GL_PREFIX(VertexAttrib1dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5424(%rax), %r11 + movq 5432(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV) @@ -25527,7 +25572,7 @@ GL_PREFIX(VertexAttrib1dNV): GL_PREFIX(VertexAttrib1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5432(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25537,13 +25582,13 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5432(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5432(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25553,7 +25598,7 @@ GL_PREFIX(VertexAttrib1dvNV): popq %rbp popq %rsi popq %rdi - movq 5432(%rax), %r11 + movq 5440(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV) @@ -25564,7 +25609,7 @@ GL_PREFIX(VertexAttrib1dvNV): GL_PREFIX(VertexAttrib1fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5440(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25574,13 +25619,13 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5440(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5440(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25590,7 +25635,7 @@ GL_PREFIX(VertexAttrib1fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5440(%rax), %r11 + movq 5448(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV) @@ -25601,7 +25646,7 @@ GL_PREFIX(VertexAttrib1fNV): GL_PREFIX(VertexAttrib1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5448(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25611,13 +25656,13 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5448(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5448(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25627,7 +25672,7 @@ GL_PREFIX(VertexAttrib1fvNV): popq %rbp popq %rsi popq %rdi - movq 5448(%rax), %r11 + movq 5456(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV) @@ -25638,7 +25683,7 @@ GL_PREFIX(VertexAttrib1fvNV): GL_PREFIX(VertexAttrib1sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5456(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25648,13 +25693,13 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5456(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5456(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25664,7 +25709,7 @@ GL_PREFIX(VertexAttrib1sNV): popq %rbp popq %rsi popq %rdi - movq 5456(%rax), %r11 + movq 5464(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV) @@ -25675,7 +25720,7 @@ GL_PREFIX(VertexAttrib1sNV): GL_PREFIX(VertexAttrib1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5464(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25685,13 +25730,13 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5464(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5464(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25701,7 +25746,7 @@ GL_PREFIX(VertexAttrib1svNV): popq %rbp popq %rsi popq %rdi - movq 5464(%rax), %r11 + movq 5472(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV) @@ -25712,7 +25757,7 @@ GL_PREFIX(VertexAttrib1svNV): GL_PREFIX(VertexAttrib2dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5472(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25724,13 +25769,13 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5472(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5472(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25742,7 +25787,7 @@ GL_PREFIX(VertexAttrib2dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5472(%rax), %r11 + movq 5480(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV) @@ -25753,7 +25798,7 @@ GL_PREFIX(VertexAttrib2dNV): GL_PREFIX(VertexAttrib2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5480(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25763,13 +25808,13 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5480(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5480(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25779,7 +25824,7 @@ GL_PREFIX(VertexAttrib2dvNV): popq %rbp popq %rsi popq %rdi - movq 5480(%rax), %r11 + movq 5488(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV) @@ -25790,7 +25835,7 @@ GL_PREFIX(VertexAttrib2dvNV): GL_PREFIX(VertexAttrib2fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5488(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $24, %rsp @@ -25802,13 +25847,13 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5488(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5488(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 1: subq $24, %rsp @@ -25820,7 +25865,7 @@ GL_PREFIX(VertexAttrib2fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $24, %rsp - movq 5488(%rax), %r11 + movq 5496(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV) @@ -25831,7 +25876,7 @@ GL_PREFIX(VertexAttrib2fNV): GL_PREFIX(VertexAttrib2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5496(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25841,13 +25886,13 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5496(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5496(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25857,7 +25902,7 @@ GL_PREFIX(VertexAttrib2fvNV): popq %rbp popq %rsi popq %rdi - movq 5496(%rax), %r11 + movq 5504(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV) @@ -25868,7 +25913,7 @@ GL_PREFIX(VertexAttrib2fvNV): GL_PREFIX(VertexAttrib2sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5504(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25878,13 +25923,13 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5504(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25894,7 +25939,7 @@ GL_PREFIX(VertexAttrib2sNV): popq %rdx popq %rsi popq %rdi - movq 5504(%rax), %r11 + movq 5512(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV) @@ -25905,7 +25950,7 @@ GL_PREFIX(VertexAttrib2sNV): GL_PREFIX(VertexAttrib2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5512(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25915,13 +25960,13 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5512(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -25931,7 +25976,7 @@ GL_PREFIX(VertexAttrib2svNV): popq %rbp popq %rsi popq %rdi - movq 5512(%rax), %r11 + movq 5520(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV) @@ -25942,7 +25987,7 @@ GL_PREFIX(VertexAttrib2svNV): GL_PREFIX(VertexAttrib3dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5520(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -25956,13 +26001,13 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5520(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5520(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -25976,7 +26021,7 @@ GL_PREFIX(VertexAttrib3dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5520(%rax), %r11 + movq 5528(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV) @@ -25987,7 +26032,7 @@ GL_PREFIX(VertexAttrib3dNV): GL_PREFIX(VertexAttrib3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5528(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -25997,13 +26042,13 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5528(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5528(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26013,7 +26058,7 @@ GL_PREFIX(VertexAttrib3dvNV): popq %rbp popq %rsi popq %rdi - movq 5528(%rax), %r11 + movq 5536(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV) @@ -26024,7 +26069,7 @@ GL_PREFIX(VertexAttrib3dvNV): GL_PREFIX(VertexAttrib3fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5536(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26038,13 +26083,13 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5536(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5536(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26058,7 +26103,7 @@ GL_PREFIX(VertexAttrib3fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5536(%rax), %r11 + movq 5544(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV) @@ -26069,7 +26114,7 @@ GL_PREFIX(VertexAttrib3fNV): GL_PREFIX(VertexAttrib3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5544(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26079,13 +26124,13 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5544(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5544(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26095,7 +26140,7 @@ GL_PREFIX(VertexAttrib3fvNV): popq %rbp popq %rsi popq %rdi - movq 5544(%rax), %r11 + movq 5552(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV) @@ -26106,7 +26151,7 @@ GL_PREFIX(VertexAttrib3fvNV): GL_PREFIX(VertexAttrib3sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5552(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26120,13 +26165,13 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5552(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26140,7 +26185,7 @@ GL_PREFIX(VertexAttrib3sNV): popq %rdx popq %rsi popq %rdi - movq 5552(%rax), %r11 + movq 5560(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV) @@ -26151,7 +26196,7 @@ GL_PREFIX(VertexAttrib3sNV): GL_PREFIX(VertexAttrib3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5560(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26161,13 +26206,13 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5560(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26177,7 +26222,7 @@ GL_PREFIX(VertexAttrib3svNV): popq %rbp popq %rsi popq %rdi - movq 5560(%rax), %r11 + movq 5568(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV) @@ -26188,7 +26233,7 @@ GL_PREFIX(VertexAttrib3svNV): GL_PREFIX(VertexAttrib4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5568(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26204,13 +26249,13 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5568(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5568(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26226,7 +26271,7 @@ GL_PREFIX(VertexAttrib4dNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5568(%rax), %r11 + movq 5576(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV) @@ -26237,7 +26282,7 @@ GL_PREFIX(VertexAttrib4dNV): GL_PREFIX(VertexAttrib4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5576(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26247,13 +26292,13 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5576(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5576(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26263,7 +26308,7 @@ GL_PREFIX(VertexAttrib4dvNV): popq %rbp popq %rsi popq %rdi - movq 5576(%rax), %r11 + movq 5584(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV) @@ -26274,7 +26319,7 @@ GL_PREFIX(VertexAttrib4dvNV): GL_PREFIX(VertexAttrib4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5584(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $40, %rsp @@ -26290,13 +26335,13 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5584(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5584(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 1: subq $40, %rsp @@ -26312,7 +26357,7 @@ GL_PREFIX(VertexAttrib4fNV): movq 8(%rsp), %xmm0 movq (%rsp), %rdi addq $40, %rsp - movq 5584(%rax), %r11 + movq 5592(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV) @@ -26323,7 +26368,7 @@ GL_PREFIX(VertexAttrib4fNV): GL_PREFIX(VertexAttrib4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5592(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26333,13 +26378,13 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5592(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5592(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26349,7 +26394,7 @@ GL_PREFIX(VertexAttrib4fvNV): popq %rbp popq %rsi popq %rdi - movq 5592(%rax), %r11 + movq 5600(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV) @@ -26360,7 +26405,7 @@ GL_PREFIX(VertexAttrib4fvNV): GL_PREFIX(VertexAttrib4sNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5600(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26374,13 +26419,13 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5600(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26394,7 +26439,7 @@ GL_PREFIX(VertexAttrib4sNV): popq %rdx popq %rsi popq %rdi - movq 5600(%rax), %r11 + movq 5608(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV) @@ -26405,7 +26450,7 @@ GL_PREFIX(VertexAttrib4sNV): GL_PREFIX(VertexAttrib4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5608(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26415,13 +26460,13 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5608(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26431,7 +26476,7 @@ GL_PREFIX(VertexAttrib4svNV): popq %rbp popq %rsi popq %rdi - movq 5608(%rax), %r11 + movq 5616(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV) @@ -26442,7 +26487,7 @@ GL_PREFIX(VertexAttrib4svNV): GL_PREFIX(VertexAttrib4ubNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5616(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26456,13 +26501,13 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5616(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26476,7 +26521,7 @@ GL_PREFIX(VertexAttrib4ubNV): popq %rdx popq %rsi popq %rdi - movq 5616(%rax), %r11 + movq 5624(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV) @@ -26487,7 +26532,7 @@ GL_PREFIX(VertexAttrib4ubNV): GL_PREFIX(VertexAttrib4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5624(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26497,13 +26542,13 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5624(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26513,7 +26558,7 @@ GL_PREFIX(VertexAttrib4ubvNV): popq %rbp popq %rsi popq %rdi - movq 5624(%rax), %r11 + movq 5632(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV) @@ -26524,7 +26569,7 @@ GL_PREFIX(VertexAttrib4ubvNV): GL_PREFIX(VertexAttribPointerNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5632(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26538,13 +26583,13 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5632(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26558,7 +26603,7 @@ GL_PREFIX(VertexAttribPointerNV): popq %rdx popq %rsi popq %rdi - movq 5632(%rax), %r11 + movq 5640(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV) @@ -26569,7 +26614,7 @@ GL_PREFIX(VertexAttribPointerNV): GL_PREFIX(VertexAttribs1dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5640(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26579,13 +26624,13 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5640(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5640(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26595,7 +26640,7 @@ GL_PREFIX(VertexAttribs1dvNV): popq %rdx popq %rsi popq %rdi - movq 5640(%rax), %r11 + movq 5648(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV) @@ -26606,7 +26651,7 @@ GL_PREFIX(VertexAttribs1dvNV): GL_PREFIX(VertexAttribs1fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5648(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26616,13 +26661,13 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5648(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26632,7 +26677,7 @@ GL_PREFIX(VertexAttribs1fvNV): popq %rdx popq %rsi popq %rdi - movq 5648(%rax), %r11 + movq 5656(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV) @@ -26643,7 +26688,7 @@ GL_PREFIX(VertexAttribs1fvNV): GL_PREFIX(VertexAttribs1svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5656(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26653,13 +26698,13 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5656(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5656(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26669,7 +26714,7 @@ GL_PREFIX(VertexAttribs1svNV): popq %rdx popq %rsi popq %rdi - movq 5656(%rax), %r11 + movq 5664(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV) @@ -26680,7 +26725,7 @@ GL_PREFIX(VertexAttribs1svNV): GL_PREFIX(VertexAttribs2dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5664(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26690,13 +26735,13 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5664(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26706,7 +26751,7 @@ GL_PREFIX(VertexAttribs2dvNV): popq %rdx popq %rsi popq %rdi - movq 5664(%rax), %r11 + movq 5672(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV) @@ -26717,7 +26762,7 @@ GL_PREFIX(VertexAttribs2dvNV): GL_PREFIX(VertexAttribs2fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5672(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26727,13 +26772,13 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5672(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26743,7 +26788,7 @@ GL_PREFIX(VertexAttribs2fvNV): popq %rdx popq %rsi popq %rdi - movq 5672(%rax), %r11 + movq 5680(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV) @@ -26754,7 +26799,7 @@ GL_PREFIX(VertexAttribs2fvNV): GL_PREFIX(VertexAttribs2svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5680(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26764,13 +26809,13 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5680(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26780,7 +26825,7 @@ GL_PREFIX(VertexAttribs2svNV): popq %rdx popq %rsi popq %rdi - movq 5680(%rax), %r11 + movq 5688(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV) @@ -26791,7 +26836,7 @@ GL_PREFIX(VertexAttribs2svNV): GL_PREFIX(VertexAttribs3dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5688(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26801,13 +26846,13 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5688(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5688(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26817,7 +26862,7 @@ GL_PREFIX(VertexAttribs3dvNV): popq %rdx popq %rsi popq %rdi - movq 5688(%rax), %r11 + movq 5696(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV) @@ -26828,7 +26873,7 @@ GL_PREFIX(VertexAttribs3dvNV): GL_PREFIX(VertexAttribs3fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5696(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26838,13 +26883,13 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5696(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26854,7 +26899,7 @@ GL_PREFIX(VertexAttribs3fvNV): popq %rdx popq %rsi popq %rdi - movq 5696(%rax), %r11 + movq 5704(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV) @@ -26865,7 +26910,7 @@ GL_PREFIX(VertexAttribs3fvNV): GL_PREFIX(VertexAttribs3svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5704(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26875,13 +26920,13 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5704(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5704(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26891,7 +26936,7 @@ GL_PREFIX(VertexAttribs3svNV): popq %rdx popq %rsi popq %rdi - movq 5704(%rax), %r11 + movq 5712(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV) @@ -26902,7 +26947,7 @@ GL_PREFIX(VertexAttribs3svNV): GL_PREFIX(VertexAttribs4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5712(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26912,13 +26957,13 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5712(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26928,7 +26973,7 @@ GL_PREFIX(VertexAttribs4dvNV): popq %rdx popq %rsi popq %rdi - movq 5712(%rax), %r11 + movq 5720(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV) @@ -26939,7 +26984,7 @@ GL_PREFIX(VertexAttribs4dvNV): GL_PREFIX(VertexAttribs4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5720(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26949,13 +26994,13 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5720(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -26965,7 +27010,7 @@ GL_PREFIX(VertexAttribs4fvNV): popq %rdx popq %rsi popq %rdi - movq 5720(%rax), %r11 + movq 5728(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV) @@ -26976,7 +27021,7 @@ GL_PREFIX(VertexAttribs4fvNV): GL_PREFIX(VertexAttribs4svNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5728(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -26986,13 +27031,13 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5728(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27002,7 +27047,7 @@ GL_PREFIX(VertexAttribs4svNV): popq %rdx popq %rsi popq %rdi - movq 5728(%rax), %r11 + movq 5736(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV) @@ -27013,7 +27058,7 @@ GL_PREFIX(VertexAttribs4svNV): GL_PREFIX(VertexAttribs4ubvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5736(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27023,13 +27068,13 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5736(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5736(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27039,7 +27084,7 @@ GL_PREFIX(VertexAttribs4ubvNV): popq %rdx popq %rsi popq %rdi - movq 5736(%rax), %r11 + movq 5744(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV) @@ -27050,7 +27095,7 @@ GL_PREFIX(VertexAttribs4ubvNV): GL_PREFIX(GetTexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5744(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27060,13 +27105,13 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5744(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27076,7 +27121,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5744(%rax), %r11 + movq 5752(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI) @@ -27087,7 +27132,7 @@ GL_PREFIX(GetTexBumpParameterfvATI): GL_PREFIX(GetTexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5752(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27097,13 +27142,13 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5752(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5752(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27113,7 +27158,7 @@ GL_PREFIX(GetTexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5752(%rax), %r11 + movq 5760(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI) @@ -27124,7 +27169,7 @@ GL_PREFIX(GetTexBumpParameterivATI): GL_PREFIX(TexBumpParameterfvATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5760(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27134,13 +27179,13 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5760(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27150,7 +27195,7 @@ GL_PREFIX(TexBumpParameterfvATI): popq %rbp popq %rsi popq %rdi - movq 5760(%rax), %r11 + movq 5768(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI) @@ -27161,7 +27206,7 @@ GL_PREFIX(TexBumpParameterfvATI): GL_PREFIX(TexBumpParameterivATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5768(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27171,13 +27216,13 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5768(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27187,7 +27232,7 @@ GL_PREFIX(TexBumpParameterivATI): popq %rbp popq %rsi popq %rdi - movq 5768(%rax), %r11 + movq 5776(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI) @@ -27198,7 +27243,7 @@ GL_PREFIX(TexBumpParameterivATI): GL_PREFIX(AlphaFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5776(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27216,13 +27261,13 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5776(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27240,7 +27285,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5776(%rax), %r11 + movq 5784(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI) @@ -27251,7 +27296,7 @@ GL_PREFIX(AlphaFragmentOp1ATI): GL_PREFIX(AlphaFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5784(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27269,13 +27314,13 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5784(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5784(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27293,7 +27338,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5784(%rax), %r11 + movq 5792(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI) @@ -27304,7 +27349,7 @@ GL_PREFIX(AlphaFragmentOp2ATI): GL_PREFIX(AlphaFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5792(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27322,13 +27367,13 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5792(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27346,7 +27391,7 @@ GL_PREFIX(AlphaFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5792(%rax), %r11 + movq 5800(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI) @@ -27357,25 +27402,25 @@ GL_PREFIX(AlphaFragmentOp3ATI): GL_PREFIX(BeginFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5800(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5800(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5800(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5800(%rax), %r11 + movq 5808(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI) @@ -27386,25 +27431,25 @@ GL_PREFIX(BeginFragmentShaderATI): GL_PREFIX(BindFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5808(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5808(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5808(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5808(%rax), %r11 + movq 5816(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI) @@ -27415,7 +27460,7 @@ GL_PREFIX(BindFragmentShaderATI): GL_PREFIX(ColorFragmentOp1ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5816(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27433,13 +27478,13 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5816(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5816(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27457,7 +27502,7 @@ GL_PREFIX(ColorFragmentOp1ATI): popq %rdx popq %rsi popq %rdi - movq 5816(%rax), %r11 + movq 5824(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI) @@ -27468,7 +27513,7 @@ GL_PREFIX(ColorFragmentOp1ATI): GL_PREFIX(ColorFragmentOp2ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5824(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27486,13 +27531,13 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5824(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27510,7 +27555,7 @@ GL_PREFIX(ColorFragmentOp2ATI): popq %rdx popq %rsi popq %rdi - movq 5824(%rax), %r11 + movq 5832(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI) @@ -27521,7 +27566,7 @@ GL_PREFIX(ColorFragmentOp2ATI): GL_PREFIX(ColorFragmentOp3ATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5832(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27539,13 +27584,13 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5832(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27563,7 +27608,7 @@ GL_PREFIX(ColorFragmentOp3ATI): popq %rdx popq %rsi popq %rdi - movq 5832(%rax), %r11 + movq 5840(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI) @@ -27574,25 +27619,25 @@ GL_PREFIX(ColorFragmentOp3ATI): GL_PREFIX(DeleteFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5840(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5840(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5840(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5840(%rax), %r11 + movq 5848(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI) @@ -27603,25 +27648,25 @@ GL_PREFIX(DeleteFragmentShaderATI): GL_PREFIX(EndFragmentShaderATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5848(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rbp call _x86_64_get_dispatch@PLT popq %rbp - movq 5848(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5848(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 1: pushq %rbp call _glapi_get_dispatch popq %rbp - movq 5848(%rax), %r11 + movq 5856(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI) @@ -27632,25 +27677,25 @@ GL_PREFIX(EndFragmentShaderATI): GL_PREFIX(GenFragmentShadersATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5856(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 5856(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5856(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 5856(%rax), %r11 + movq 5864(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI) @@ -27661,7 +27706,7 @@ GL_PREFIX(GenFragmentShadersATI): GL_PREFIX(PassTexCoordATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5864(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27671,13 +27716,13 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 5864(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5864(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27687,7 +27732,7 @@ GL_PREFIX(PassTexCoordATI): popq %rdx popq %rsi popq %rdi - movq 5864(%rax), %r11 + movq 5872(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI) @@ -27698,7 +27743,7 @@ GL_PREFIX(PassTexCoordATI): GL_PREFIX(SampleMapATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5872(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27708,13 +27753,13 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5872(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27724,7 +27769,7 @@ GL_PREFIX(SampleMapATI): popq %rdx popq %rsi popq %rdi - movq 5872(%rax), %r11 + movq 5880(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI) @@ -27735,7 +27780,7 @@ GL_PREFIX(SampleMapATI): GL_PREFIX(SetFragmentShaderConstantATI): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5880(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27745,13 +27790,13 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5880(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27761,7 +27806,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): popq %rbp popq %rsi popq %rdi - movq 5880(%rax), %r11 + movq 5888(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI) @@ -27772,7 +27817,7 @@ GL_PREFIX(SetFragmentShaderConstantATI): GL_PREFIX(PointParameteriNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5888(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27782,13 +27827,13 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5888(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27798,7 +27843,7 @@ GL_PREFIX(PointParameteriNV): popq %rbp popq %rsi popq %rdi - movq 5888(%rax), %r11 + movq 5896(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV) @@ -27809,7 +27854,7 @@ GL_PREFIX(PointParameteriNV): GL_PREFIX(PointParameterivNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5896(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -27819,13 +27864,13 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5896(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5896(%rax), %r11 + movq 5904(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -27835,40 +27880,10 @@ GL_PREFIX(PointParameterivNV): popq %rbp popq %rsi popq %rdi - movq 5896(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV) - - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_738) - .type GL_PREFIX(_dispatch_stub_738), @function - HIDDEN(GL_PREFIX(_dispatch_stub_738)) -GL_PREFIX(_dispatch_stub_738): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 5904(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - call _x86_64_get_dispatch@PLT - popq %rdi - movq 5904(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 5904(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - call _glapi_get_dispatch - popq %rdi movq 5904(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_738), .-GL_PREFIX(_dispatch_stub_738) + .size GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV) .p2align 4,,15 .globl GL_PREFIX(_dispatch_stub_739) @@ -27911,11 +27926,7 @@ GL_PREFIX(_dispatch_stub_740): jmp *%r11 #elif defined(PTHREADS) pushq %rdi - pushq %rsi - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %rsi popq %rdi movq 5920(%rax), %r11 jmp *%r11 @@ -27927,11 +27938,7 @@ GL_PREFIX(_dispatch_stub_740): jmp *%r11 1: pushq %rdi - pushq %rsi - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %rsi popq %rdi movq 5920(%rax), %r11 jmp *%r11 @@ -27987,7 +27994,11 @@ GL_PREFIX(_dispatch_stub_742): jmp *%r11 #elif defined(PTHREADS) pushq %rdi + pushq %rsi + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi popq %rdi movq 5936(%rax), %r11 jmp *%r11 @@ -27999,20 +28010,54 @@ GL_PREFIX(_dispatch_stub_742): jmp *%r11 1: pushq %rdi + pushq %rsi + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rsi popq %rdi movq 5936(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_742), .-GL_PREFIX(_dispatch_stub_742) + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_743) + .type GL_PREFIX(_dispatch_stub_743), @function + HIDDEN(GL_PREFIX(_dispatch_stub_743)) +GL_PREFIX(_dispatch_stub_743): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_743), .-GL_PREFIX(_dispatch_stub_743) + .p2align 4,,15 .globl GL_PREFIX(GetProgramNamedParameterdvNV) .type GL_PREFIX(GetProgramNamedParameterdvNV), @function GL_PREFIX(GetProgramNamedParameterdvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5944(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28026,13 +28071,13 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5944(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5944(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28046,7 +28091,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): popq %rdx popq %rsi popq %rdi - movq 5944(%rax), %r11 + movq 5952(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV) @@ -28057,7 +28102,7 @@ GL_PREFIX(GetProgramNamedParameterdvNV): GL_PREFIX(GetProgramNamedParameterfvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5952(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28071,13 +28116,13 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5952(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28091,7 +28136,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): popq %rdx popq %rsi popq %rdi - movq 5952(%rax), %r11 + movq 5960(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV) @@ -28102,7 +28147,7 @@ GL_PREFIX(GetProgramNamedParameterfvNV): GL_PREFIX(ProgramNamedParameter4dNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5960(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -28122,13 +28167,13 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5960(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5960(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -28148,7 +28193,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5960(%rax), %r11 + movq 5968(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV) @@ -28159,7 +28204,7 @@ GL_PREFIX(ProgramNamedParameter4dNV): GL_PREFIX(ProgramNamedParameter4dvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5968(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28173,13 +28218,13 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 5968(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5968(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28193,7 +28238,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): popq %rdx popq %rsi popq %rdi - movq 5968(%rax), %r11 + movq 5976(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV) @@ -28204,7 +28249,7 @@ GL_PREFIX(ProgramNamedParameter4dvNV): GL_PREFIX(ProgramNamedParameter4fNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5976(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) subq $56, %rsp @@ -28224,13 +28269,13 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5976(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5976(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 1: subq $56, %rsp @@ -28250,7 +28295,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): movq 8(%rsp), %rsi movq (%rsp), %rdi addq $56, %rsp - movq 5976(%rax), %r11 + movq 5984(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV) @@ -28261,7 +28306,7 @@ GL_PREFIX(ProgramNamedParameter4fNV): GL_PREFIX(ProgramNamedParameter4fvNV): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5984(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28275,13 +28320,13 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 5984(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5984(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28295,19 +28340,19 @@ GL_PREFIX(ProgramNamedParameter4fvNV): popq %rdx popq %rsi popq %rdi - movq 5984(%rax), %r11 + movq 5992(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_749) - .type GL_PREFIX(_dispatch_stub_749), @function - HIDDEN(GL_PREFIX(_dispatch_stub_749)) -GL_PREFIX(_dispatch_stub_749): + .globl GL_PREFIX(_dispatch_stub_750) + .type GL_PREFIX(_dispatch_stub_750), @function + HIDDEN(GL_PREFIX(_dispatch_stub_750)) +GL_PREFIX(_dispatch_stub_750): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 5992(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28317,13 +28362,13 @@ GL_PREFIX(_dispatch_stub_749): popq %rbp popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 5992(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28333,19 +28378,19 @@ GL_PREFIX(_dispatch_stub_749): popq %rbp popq %rsi popq %rdi - movq 5992(%rax), %r11 + movq 6000(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_749), .-GL_PREFIX(_dispatch_stub_749) + .size GL_PREFIX(_dispatch_stub_750), .-GL_PREFIX(_dispatch_stub_750) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_750) - .type GL_PREFIX(_dispatch_stub_750), @function - HIDDEN(GL_PREFIX(_dispatch_stub_750)) -GL_PREFIX(_dispatch_stub_750): + .globl GL_PREFIX(_dispatch_stub_751) + .type GL_PREFIX(_dispatch_stub_751), @function + HIDDEN(GL_PREFIX(_dispatch_stub_751)) +GL_PREFIX(_dispatch_stub_751): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6000(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28355,13 +28400,13 @@ GL_PREFIX(_dispatch_stub_750): popq %rbp popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6000(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28371,10 +28416,10 @@ GL_PREFIX(_dispatch_stub_750): popq %rbp popq %rsi popq %rdi - movq 6000(%rax), %r11 + movq 6008(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_750), .-GL_PREFIX(_dispatch_stub_750) + .size GL_PREFIX(_dispatch_stub_751), .-GL_PREFIX(_dispatch_stub_751) .p2align 4,,15 .globl GL_PREFIX(BindFramebufferEXT) @@ -28382,7 +28427,7 @@ GL_PREFIX(_dispatch_stub_750): GL_PREFIX(BindFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6008(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28392,13 +28437,13 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6008(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28408,7 +28453,7 @@ GL_PREFIX(BindFramebufferEXT): popq %rbp popq %rsi popq %rdi - movq 6008(%rax), %r11 + movq 6016(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT) @@ -28419,7 +28464,7 @@ GL_PREFIX(BindFramebufferEXT): GL_PREFIX(BindRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6016(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28429,13 +28474,13 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6016(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6016(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28445,7 +28490,7 @@ GL_PREFIX(BindRenderbufferEXT): popq %rbp popq %rsi popq %rdi - movq 6016(%rax), %r11 + movq 6024(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT) @@ -28456,25 +28501,25 @@ GL_PREFIX(BindRenderbufferEXT): GL_PREFIX(CheckFramebufferStatusEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6024(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6024(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6024(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6024(%rax), %r11 + movq 6032(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT) @@ -28485,7 +28530,7 @@ GL_PREFIX(CheckFramebufferStatusEXT): GL_PREFIX(DeleteFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6032(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28495,13 +28540,13 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6032(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6032(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28511,7 +28556,7 @@ GL_PREFIX(DeleteFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6032(%rax), %r11 + movq 6040(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT) @@ -28522,7 +28567,7 @@ GL_PREFIX(DeleteFramebuffersEXT): GL_PREFIX(DeleteRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6040(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28532,13 +28577,13 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6040(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28548,7 +28593,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6040(%rax), %r11 + movq 6048(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT) @@ -28559,7 +28604,7 @@ GL_PREFIX(DeleteRenderbuffersEXT): GL_PREFIX(FramebufferRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6048(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28573,13 +28618,13 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6048(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28593,7 +28638,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): popq %rdx popq %rsi popq %rdi - movq 6048(%rax), %r11 + movq 6056(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT) @@ -28604,7 +28649,7 @@ GL_PREFIX(FramebufferRenderbufferEXT): GL_PREFIX(FramebufferTexture1DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6056(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28618,13 +28663,13 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6056(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6056(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28638,7 +28683,7 @@ GL_PREFIX(FramebufferTexture1DEXT): popq %rdx popq %rsi popq %rdi - movq 6056(%rax), %r11 + movq 6064(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT) @@ -28649,7 +28694,7 @@ GL_PREFIX(FramebufferTexture1DEXT): GL_PREFIX(FramebufferTexture2DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6064(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28663,13 +28708,13 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6064(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6064(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28683,7 +28728,7 @@ GL_PREFIX(FramebufferTexture2DEXT): popq %rdx popq %rsi popq %rdi - movq 6064(%rax), %r11 + movq 6072(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT) @@ -28694,7 +28739,7 @@ GL_PREFIX(FramebufferTexture2DEXT): GL_PREFIX(FramebufferTexture3DEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6072(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28712,13 +28757,13 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6072(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6072(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28736,7 +28781,7 @@ GL_PREFIX(FramebufferTexture3DEXT): popq %rdx popq %rsi popq %rdi - movq 6072(%rax), %r11 + movq 6080(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT) @@ -28747,7 +28792,7 @@ GL_PREFIX(FramebufferTexture3DEXT): GL_PREFIX(GenFramebuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6080(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28757,13 +28802,13 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6080(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28773,7 +28818,7 @@ GL_PREFIX(GenFramebuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6080(%rax), %r11 + movq 6088(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT) @@ -28784,7 +28829,7 @@ GL_PREFIX(GenFramebuffersEXT): GL_PREFIX(GenRenderbuffersEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6088(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28794,13 +28839,13 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6088(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28810,7 +28855,7 @@ GL_PREFIX(GenRenderbuffersEXT): popq %rbp popq %rsi popq %rdi - movq 6088(%rax), %r11 + movq 6096(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT) @@ -28821,25 +28866,25 @@ GL_PREFIX(GenRenderbuffersEXT): GL_PREFIX(GenerateMipmapEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6096(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6096(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6096(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6096(%rax), %r11 + movq 6104(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT) @@ -28850,7 +28895,7 @@ GL_PREFIX(GenerateMipmapEXT): GL_PREFIX(GetFramebufferAttachmentParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6104(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28864,13 +28909,13 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6104(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6104(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28884,7 +28929,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6104(%rax), %r11 + movq 6112(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT) @@ -28895,7 +28940,7 @@ GL_PREFIX(GetFramebufferAttachmentParameterivEXT): GL_PREFIX(GetRenderbufferParameterivEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6112(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -28905,13 +28950,13 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6112(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -28921,7 +28966,7 @@ GL_PREFIX(GetRenderbufferParameterivEXT): popq %rdx popq %rsi popq %rdi - movq 6112(%rax), %r11 + movq 6120(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT) @@ -28932,25 +28977,25 @@ GL_PREFIX(GetRenderbufferParameterivEXT): GL_PREFIX(IsFramebufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6120(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6120(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6120(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6120(%rax), %r11 + movq 6128(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT) @@ -28961,25 +29006,25 @@ GL_PREFIX(IsFramebufferEXT): GL_PREFIX(IsRenderbufferEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6128(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi call _x86_64_get_dispatch@PLT popq %rdi - movq 6128(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6128(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 1: pushq %rdi call _glapi_get_dispatch popq %rdi - movq 6128(%rax), %r11 + movq 6136(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT) @@ -28990,7 +29035,7 @@ GL_PREFIX(IsRenderbufferEXT): GL_PREFIX(RenderbufferStorageEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6136(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29004,13 +29049,13 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6136(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6136(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29024,19 +29069,19 @@ GL_PREFIX(RenderbufferStorageEXT): popq %rdx popq %rsi popq %rdi - movq 6136(%rax), %r11 + movq 6144(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_768) - .type GL_PREFIX(_dispatch_stub_768), @function - HIDDEN(GL_PREFIX(_dispatch_stub_768)) -GL_PREFIX(_dispatch_stub_768): + .globl GL_PREFIX(_dispatch_stub_769) + .type GL_PREFIX(_dispatch_stub_769), @function + HIDDEN(GL_PREFIX(_dispatch_stub_769)) +GL_PREFIX(_dispatch_stub_769): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6144(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29054,13 +29099,13 @@ GL_PREFIX(_dispatch_stub_768): popq %rdx popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6144(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29078,10 +29123,10 @@ GL_PREFIX(_dispatch_stub_768): popq %rdx popq %rsi popq %rdi - movq 6144(%rax), %r11 + movq 6152(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_768), .-GL_PREFIX(_dispatch_stub_768) + .size GL_PREFIX(_dispatch_stub_769), .-GL_PREFIX(_dispatch_stub_769) .p2align 4,,15 .globl GL_PREFIX(FramebufferTextureLayerEXT) @@ -29089,7 +29134,7 @@ GL_PREFIX(_dispatch_stub_768): GL_PREFIX(FramebufferTextureLayerEXT): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6152(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29103,13 +29148,13 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6152(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6152(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29123,19 +29168,19 @@ GL_PREFIX(FramebufferTextureLayerEXT): popq %rdx popq %rsi popq %rdi - movq 6152(%rax), %r11 + movq 6160(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_770) - .type GL_PREFIX(_dispatch_stub_770), @function - HIDDEN(GL_PREFIX(_dispatch_stub_770)) -GL_PREFIX(_dispatch_stub_770): + .globl GL_PREFIX(_dispatch_stub_771) + .type GL_PREFIX(_dispatch_stub_771), @function + HIDDEN(GL_PREFIX(_dispatch_stub_771)) +GL_PREFIX(_dispatch_stub_771): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6160(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29149,13 +29194,13 @@ GL_PREFIX(_dispatch_stub_770): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6160(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29169,19 +29214,19 @@ GL_PREFIX(_dispatch_stub_770): popq %rdx popq %rsi popq %rdi - movq 6160(%rax), %r11 + movq 6168(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_770), .-GL_PREFIX(_dispatch_stub_770) + .size GL_PREFIX(_dispatch_stub_771), .-GL_PREFIX(_dispatch_stub_771) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_771) - .type GL_PREFIX(_dispatch_stub_771), @function - HIDDEN(GL_PREFIX(_dispatch_stub_771)) -GL_PREFIX(_dispatch_stub_771): + .globl GL_PREFIX(_dispatch_stub_772) + .type GL_PREFIX(_dispatch_stub_772), @function + HIDDEN(GL_PREFIX(_dispatch_stub_772)) +GL_PREFIX(_dispatch_stub_772): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6168(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29195,13 +29240,13 @@ GL_PREFIX(_dispatch_stub_771): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6168(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29215,19 +29260,19 @@ GL_PREFIX(_dispatch_stub_771): popq %rdx popq %rsi popq %rdi - movq 6168(%rax), %r11 + movq 6176(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_771), .-GL_PREFIX(_dispatch_stub_771) + .size GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_772) - .type GL_PREFIX(_dispatch_stub_772), @function - HIDDEN(GL_PREFIX(_dispatch_stub_772)) -GL_PREFIX(_dispatch_stub_772): + .globl GL_PREFIX(_dispatch_stub_773) + .type GL_PREFIX(_dispatch_stub_773), @function + HIDDEN(GL_PREFIX(_dispatch_stub_773)) +GL_PREFIX(_dispatch_stub_773): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6176(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29241,13 +29286,13 @@ GL_PREFIX(_dispatch_stub_772): popq %rdx popq %rsi popq %rdi - movq 6176(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6176(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29261,19 +29306,19 @@ GL_PREFIX(_dispatch_stub_772): popq %rdx popq %rsi popq %rdi - movq 6176(%rax), %r11 + movq 6184(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772) + .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_773) - .type GL_PREFIX(_dispatch_stub_773), @function - HIDDEN(GL_PREFIX(_dispatch_stub_773)) -GL_PREFIX(_dispatch_stub_773): + .globl GL_PREFIX(_dispatch_stub_774) + .type GL_PREFIX(_dispatch_stub_774), @function + HIDDEN(GL_PREFIX(_dispatch_stub_774)) +GL_PREFIX(_dispatch_stub_774): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6184(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29283,13 +29328,13 @@ GL_PREFIX(_dispatch_stub_773): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6184(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29299,19 +29344,19 @@ GL_PREFIX(_dispatch_stub_773): popq %rdx popq %rsi popq %rdi - movq 6184(%rax), %r11 + movq 6192(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) + .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_774) - .type GL_PREFIX(_dispatch_stub_774), @function - HIDDEN(GL_PREFIX(_dispatch_stub_774)) -GL_PREFIX(_dispatch_stub_774): + .globl GL_PREFIX(_dispatch_stub_775) + .type GL_PREFIX(_dispatch_stub_775), @function + HIDDEN(GL_PREFIX(_dispatch_stub_775)) +GL_PREFIX(_dispatch_stub_775): #if defined(GLX_USE_TLS) call _x86_64_get_dispatch@PLT - movq 6192(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #elif defined(PTHREADS) pushq %rdi @@ -29321,13 +29366,13 @@ GL_PREFIX(_dispatch_stub_774): popq %rdx popq %rsi popq %rdi - movq 6192(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #else movq _glapi_Dispatch(%rip), %rax testq %rax, %rax je 1f - movq 6192(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 1: pushq %rdi @@ -29337,10 +29382,10 @@ GL_PREFIX(_dispatch_stub_774): popq %rdx popq %rsi popq %rdi - movq 6192(%rax), %r11 + movq 6200(%rax), %r11 jmp *%r11 #endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) + .size GL_PREFIX(_dispatch_stub_775), .-GL_PREFIX(_dispatch_stub_775) .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) @@ -29595,7 +29640,7 @@ GL_PREFIX(_dispatch_stub_774): .globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV) .globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV) .globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV) - .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_750) + .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_751) .globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT) .globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT) .globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT) @@ -29613,7 +29658,7 @@ GL_PREFIX(_dispatch_stub_774): .globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT) .globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT) .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT) - .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_768) + .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_769) .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT) #if defined(GLX_USE_TLS) && defined(__linux__) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 7aa344f214..85eb955413 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -713,23 +713,24 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(GetAttribLocationARB, _gloffset_GetAttribLocationARB, GetAttribLocationARB@8) GL_STUB(DrawBuffersARB, _gloffset_DrawBuffersARB, DrawBuffersARB@8) GL_STUB(RenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisample@20) + GL_STUB(CopyBufferSubData, _gloffset_CopyBufferSubData, CopyBufferSubData@20) GL_STUB(PolygonOffsetEXT, _gloffset_PolygonOffsetEXT, PolygonOffsetEXT@8) - GL_STUB(_dispatch_stub_563, _gloffset_GetPixelTexGenParameterfvSGIS, _dispatch_stub_563@8) - HIDDEN(GL_PREFIX(_dispatch_stub_563, _dispatch_stub_563@8)) - GL_STUB(_dispatch_stub_564, _gloffset_GetPixelTexGenParameterivSGIS, _dispatch_stub_564@8) + GL_STUB(_dispatch_stub_564, _gloffset_GetPixelTexGenParameterfvSGIS, _dispatch_stub_564@8) HIDDEN(GL_PREFIX(_dispatch_stub_564, _dispatch_stub_564@8)) - GL_STUB(_dispatch_stub_565, _gloffset_PixelTexGenParameterfSGIS, _dispatch_stub_565@8) + GL_STUB(_dispatch_stub_565, _gloffset_GetPixelTexGenParameterivSGIS, _dispatch_stub_565@8) HIDDEN(GL_PREFIX(_dispatch_stub_565, _dispatch_stub_565@8)) - GL_STUB(_dispatch_stub_566, _gloffset_PixelTexGenParameterfvSGIS, _dispatch_stub_566@8) + GL_STUB(_dispatch_stub_566, _gloffset_PixelTexGenParameterfSGIS, _dispatch_stub_566@8) HIDDEN(GL_PREFIX(_dispatch_stub_566, _dispatch_stub_566@8)) - GL_STUB(_dispatch_stub_567, _gloffset_PixelTexGenParameteriSGIS, _dispatch_stub_567@8) + GL_STUB(_dispatch_stub_567, _gloffset_PixelTexGenParameterfvSGIS, _dispatch_stub_567@8) HIDDEN(GL_PREFIX(_dispatch_stub_567, _dispatch_stub_567@8)) - GL_STUB(_dispatch_stub_568, _gloffset_PixelTexGenParameterivSGIS, _dispatch_stub_568@8) + GL_STUB(_dispatch_stub_568, _gloffset_PixelTexGenParameteriSGIS, _dispatch_stub_568@8) HIDDEN(GL_PREFIX(_dispatch_stub_568, _dispatch_stub_568@8)) - GL_STUB(_dispatch_stub_569, _gloffset_SampleMaskSGIS, _dispatch_stub_569@8) + GL_STUB(_dispatch_stub_569, _gloffset_PixelTexGenParameterivSGIS, _dispatch_stub_569@8) HIDDEN(GL_PREFIX(_dispatch_stub_569, _dispatch_stub_569@8)) - GL_STUB(_dispatch_stub_570, _gloffset_SamplePatternSGIS, _dispatch_stub_570@4) - HIDDEN(GL_PREFIX(_dispatch_stub_570, _dispatch_stub_570@4)) + GL_STUB(_dispatch_stub_570, _gloffset_SampleMaskSGIS, _dispatch_stub_570@8) + HIDDEN(GL_PREFIX(_dispatch_stub_570, _dispatch_stub_570@8)) + GL_STUB(_dispatch_stub_571, _gloffset_SamplePatternSGIS, _dispatch_stub_571@4) + HIDDEN(GL_PREFIX(_dispatch_stub_571, _dispatch_stub_571@4)) GL_STUB(ColorPointerEXT, _gloffset_ColorPointerEXT, ColorPointerEXT@20) GL_STUB(EdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT, EdgeFlagPointerEXT@12) GL_STUB(IndexPointerEXT, _gloffset_IndexPointerEXT, IndexPointerEXT@16) @@ -740,10 +741,10 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(PointParameterfvEXT, _gloffset_PointParameterfvEXT, PointParameterfvEXT@8) GL_STUB(LockArraysEXT, _gloffset_LockArraysEXT, LockArraysEXT@8) GL_STUB(UnlockArraysEXT, _gloffset_UnlockArraysEXT, UnlockArraysEXT@0) - GL_STUB(_dispatch_stub_581, _gloffset_CullParameterdvEXT, _dispatch_stub_581@8) - HIDDEN(GL_PREFIX(_dispatch_stub_581, _dispatch_stub_581@8)) - GL_STUB(_dispatch_stub_582, _gloffset_CullParameterfvEXT, _dispatch_stub_582@8) + GL_STUB(_dispatch_stub_582, _gloffset_CullParameterdvEXT, _dispatch_stub_582@8) HIDDEN(GL_PREFIX(_dispatch_stub_582, _dispatch_stub_582@8)) + GL_STUB(_dispatch_stub_583, _gloffset_CullParameterfvEXT, _dispatch_stub_583@8) + HIDDEN(GL_PREFIX(_dispatch_stub_583, _dispatch_stub_583@8)) GL_STUB(SecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT, SecondaryColor3bEXT@12) GL_STUB(SecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) GL_STUB(SecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT, SecondaryColor3dEXT@24) @@ -768,8 +769,8 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(FogCoorddvEXT, _gloffset_FogCoorddvEXT, FogCoorddvEXT@4) GL_STUB(FogCoordfEXT, _gloffset_FogCoordfEXT, FogCoordfEXT@4) GL_STUB(FogCoordfvEXT, _gloffset_FogCoordfvEXT, FogCoordfvEXT@4) - GL_STUB(_dispatch_stub_607, _gloffset_PixelTexGenSGIX, _dispatch_stub_607@4) - HIDDEN(GL_PREFIX(_dispatch_stub_607, _dispatch_stub_607@4)) + GL_STUB(_dispatch_stub_608, _gloffset_PixelTexGenSGIX, _dispatch_stub_608@4) + HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@4)) GL_STUB(BlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) GL_STUB(FlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV, FlushVertexArrayRangeNV@0) GL_STUB(VertexArrayRangeNV, _gloffset_VertexArrayRangeNV, VertexArrayRangeNV@8) @@ -811,24 +812,24 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(WindowPos4ivMESA, _gloffset_WindowPos4ivMESA, WindowPos4ivMESA@4) GL_STUB(WindowPos4sMESA, _gloffset_WindowPos4sMESA, WindowPos4sMESA@16) GL_STUB(WindowPos4svMESA, _gloffset_WindowPos4svMESA, WindowPos4svMESA@4) - GL_STUB(_dispatch_stub_649, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_649@20) - HIDDEN(GL_PREFIX(_dispatch_stub_649, _dispatch_stub_649@20)) - GL_STUB(_dispatch_stub_650, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_650@24) - HIDDEN(GL_PREFIX(_dispatch_stub_650, _dispatch_stub_650@24)) - GL_STUB(_dispatch_stub_651, _gloffset_DeleteFencesNV, _dispatch_stub_651@8) - HIDDEN(GL_PREFIX(_dispatch_stub_651, _dispatch_stub_651@8)) - GL_STUB(_dispatch_stub_652, _gloffset_FinishFenceNV, _dispatch_stub_652@4) - HIDDEN(GL_PREFIX(_dispatch_stub_652, _dispatch_stub_652@4)) - GL_STUB(_dispatch_stub_653, _gloffset_GenFencesNV, _dispatch_stub_653@8) - HIDDEN(GL_PREFIX(_dispatch_stub_653, _dispatch_stub_653@8)) - GL_STUB(_dispatch_stub_654, _gloffset_GetFenceivNV, _dispatch_stub_654@12) - HIDDEN(GL_PREFIX(_dispatch_stub_654, _dispatch_stub_654@12)) - GL_STUB(_dispatch_stub_655, _gloffset_IsFenceNV, _dispatch_stub_655@4) - HIDDEN(GL_PREFIX(_dispatch_stub_655, _dispatch_stub_655@4)) - GL_STUB(_dispatch_stub_656, _gloffset_SetFenceNV, _dispatch_stub_656@8) - HIDDEN(GL_PREFIX(_dispatch_stub_656, _dispatch_stub_656@8)) - GL_STUB(_dispatch_stub_657, _gloffset_TestFenceNV, _dispatch_stub_657@4) - HIDDEN(GL_PREFIX(_dispatch_stub_657, _dispatch_stub_657@4)) + GL_STUB(_dispatch_stub_650, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_650@20) + HIDDEN(GL_PREFIX(_dispatch_stub_650, _dispatch_stub_650@20)) + GL_STUB(_dispatch_stub_651, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_651@24) + HIDDEN(GL_PREFIX(_dispatch_stub_651, _dispatch_stub_651@24)) + GL_STUB(_dispatch_stub_652, _gloffset_DeleteFencesNV, _dispatch_stub_652@8) + HIDDEN(GL_PREFIX(_dispatch_stub_652, _dispatch_stub_652@8)) + GL_STUB(_dispatch_stub_653, _gloffset_FinishFenceNV, _dispatch_stub_653@4) + HIDDEN(GL_PREFIX(_dispatch_stub_653, _dispatch_stub_653@4)) + GL_STUB(_dispatch_stub_654, _gloffset_GenFencesNV, _dispatch_stub_654@8) + HIDDEN(GL_PREFIX(_dispatch_stub_654, _dispatch_stub_654@8)) + GL_STUB(_dispatch_stub_655, _gloffset_GetFenceivNV, _dispatch_stub_655@12) + HIDDEN(GL_PREFIX(_dispatch_stub_655, _dispatch_stub_655@12)) + GL_STUB(_dispatch_stub_656, _gloffset_IsFenceNV, _dispatch_stub_656@4) + HIDDEN(GL_PREFIX(_dispatch_stub_656, _dispatch_stub_656@4)) + GL_STUB(_dispatch_stub_657, _gloffset_SetFenceNV, _dispatch_stub_657@8) + HIDDEN(GL_PREFIX(_dispatch_stub_657, _dispatch_stub_657@8)) + GL_STUB(_dispatch_stub_658, _gloffset_TestFenceNV, _dispatch_stub_658@4) + HIDDEN(GL_PREFIX(_dispatch_stub_658, _dispatch_stub_658@4)) GL_STUB(AreProgramsResidentNV, _gloffset_AreProgramsResidentNV, AreProgramsResidentNV@12) GL_STUB(BindProgramNV, _gloffset_BindProgramNV, BindProgramNV@8) GL_STUB(DeleteProgramsNV, _gloffset_DeleteProgramsNV, DeleteProgramsNV@8) @@ -909,26 +910,26 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8) GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8) GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8) - GL_STUB(_dispatch_stub_738, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_738@4) - HIDDEN(GL_PREFIX(_dispatch_stub_738, _dispatch_stub_738@4)) - GL_STUB(_dispatch_stub_739, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_739@4) + GL_STUB(_dispatch_stub_739, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_739@4) HIDDEN(GL_PREFIX(_dispatch_stub_739, _dispatch_stub_739@4)) - GL_STUB(_dispatch_stub_740, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_740@8) - HIDDEN(GL_PREFIX(_dispatch_stub_740, _dispatch_stub_740@8)) - GL_STUB(_dispatch_stub_741, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_741@8) + GL_STUB(_dispatch_stub_740, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_740@4) + HIDDEN(GL_PREFIX(_dispatch_stub_740, _dispatch_stub_740@4)) + GL_STUB(_dispatch_stub_741, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_741@8) HIDDEN(GL_PREFIX(_dispatch_stub_741, _dispatch_stub_741@8)) - GL_STUB(_dispatch_stub_742, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_742@4) - HIDDEN(GL_PREFIX(_dispatch_stub_742, _dispatch_stub_742@4)) + GL_STUB(_dispatch_stub_742, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_742@8) + HIDDEN(GL_PREFIX(_dispatch_stub_742, _dispatch_stub_742@8)) + GL_STUB(_dispatch_stub_743, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_743@4) + HIDDEN(GL_PREFIX(_dispatch_stub_743, _dispatch_stub_743@4)) GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16) GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16) GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44) GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16) GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28) GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16) - GL_STUB(_dispatch_stub_749, _gloffset_DepthBoundsEXT, _dispatch_stub_749@16) - HIDDEN(GL_PREFIX(_dispatch_stub_749, _dispatch_stub_749@16)) - GL_STUB(_dispatch_stub_750, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_750@8) - HIDDEN(GL_PREFIX(_dispatch_stub_750, _dispatch_stub_750@8)) + GL_STUB(_dispatch_stub_750, _gloffset_DepthBoundsEXT, _dispatch_stub_750@16) + HIDDEN(GL_PREFIX(_dispatch_stub_750, _dispatch_stub_750@16)) + GL_STUB(_dispatch_stub_751, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_751@8) + HIDDEN(GL_PREFIX(_dispatch_stub_751, _dispatch_stub_751@8)) GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8) GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8) GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) @@ -946,19 +947,19 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4) GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4) GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16) - GL_STUB(_dispatch_stub_768, _gloffset_BlitFramebufferEXT, _dispatch_stub_768@40) - HIDDEN(GL_PREFIX(_dispatch_stub_768, _dispatch_stub_768@40)) + GL_STUB(_dispatch_stub_769, _gloffset_BlitFramebufferEXT, _dispatch_stub_769@40) + HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@40)) GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) - GL_STUB(_dispatch_stub_770, _gloffset_StencilFuncSeparateATI, _dispatch_stub_770@16) - HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16)) - GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16) + GL_STUB(_dispatch_stub_771, _gloffset_StencilFuncSeparateATI, _dispatch_stub_771@16) HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) - GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16) + GL_STUB(_dispatch_stub_772, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_772@16) HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) - GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12) - HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12)) - GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12) + GL_STUB(_dispatch_stub_773, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_773@16) + HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@16)) + GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_774@12) HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) + GL_STUB(_dispatch_stub_775, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_775@12) + HIDDEN(GL_PREFIX(_dispatch_stub_775, _dispatch_stub_775@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) -- cgit v1.2.3 From 76b438878e4ab504d68efb8800111e4c41ddeadc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:31:02 -0600 Subject: mesa: new CopyBufferSubData() driver hook --- src/mesa/main/dd.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 32b1d4e9fa..1d92e510a4 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -798,6 +798,12 @@ struct dd_function_table { void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj ); + void (*CopyBufferSubData)( GLcontext *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size ); + /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access: */ void * (*MapBufferRange)( GLcontext *ctx, GLenum target, -- cgit v1.2.3 From 96a30b06dbc60ff63392cf8ae9dcb3d245b41c27 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:31:41 -0600 Subject: mesa: new state for GL_ARB_copy_buffer --- src/mesa/main/mtypes.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e3471123c6..26ec8d5595 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2431,6 +2431,7 @@ struct gl_constants struct gl_extensions { GLboolean dummy; /* don't remove this! */ + GLboolean ARB_copy_buffer; GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; GLboolean ARB_fragment_program; @@ -2956,6 +2957,9 @@ struct __GLcontextRec struct gl_shader_state Shader; /**< GLSL shader object state */ struct gl_query_state Query; /**< occlusion, timer queries */ + + struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */ + struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */ /*@}*/ #if FEATURE_EXT_framebuffer_object -- cgit v1.2.3 From dc0b71f00d2fc8ba9b2f1966510bcca942d35e15 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:29:57 -0600 Subject: mesa: _mesa_CopyBufferSubData() function, and driver fall-back --- src/mesa/main/bufferobj.c | 145 +++++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/bufferobj.h | 15 ++++- 2 files changed, 156 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 90daa2e5b8..88b51fe60f 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.5 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -73,6 +73,16 @@ get_buffer(GLcontext *ctx, GLenum target) case GL_PIXEL_UNPACK_BUFFER_EXT: bufObj = ctx->Unpack.BufferObj; break; + case GL_COPY_READ_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + bufObj = ctx->CopyReadBuffer; + } + break; + case GL_COPY_WRITE_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + bufObj = ctx->CopyWriteBuffer; + } + break; default: /* error must be recorded by caller */ return NULL; @@ -418,6 +428,37 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target, } +/** + * Default fallback for \c dd_function_table::CopyBufferSubData(). + * Called via glCopyBuffserSubData(). + */ +void +_mesa_copy_buffer_subdata(GLcontext *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size) +{ + GLubyte *srcPtr, *dstPtr; + + /* buffer should not already be mapped */ + assert(!src->Pointer); + assert(!dst->Pointer); + + srcPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_READ_BUFFER, + GL_READ_ONLY, src); + dstPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_WRITE_BUFFER, + GL_WRITE_ONLY, dst); + + if (srcPtr && dstPtr) + _mesa_memcpy(dstPtr + writeOffset, srcPtr + readOffset, size); + + ctx->Driver.UnmapBuffer(ctx, GL_COPY_READ_BUFFER, src); + ctx->Driver.UnmapBuffer(ctx, GL_COPY_WRITE_BUFFER, dst); +} + + + /** * Initialize the state associated with buffer objects */ @@ -426,6 +467,9 @@ _mesa_init_buffer_objects( GLcontext *ctx ) { ctx->Array.ArrayBufferObj = ctx->Shared->NullBufferObj; ctx->Array.ElementArrayBufferObj = ctx->Shared->NullBufferObj; + + ctx->CopyReadBuffer = ctx->Shared->NullBufferObj; + ctx->CopyWriteBuffer = ctx->Shared->NullBufferObj; } @@ -452,8 +496,22 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) case GL_PIXEL_UNPACK_BUFFER_EXT: bindTarget = &ctx->Unpack.BufferObj; break; + case GL_COPY_READ_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + bindTarget = &ctx->CopyReadBuffer; + } + break; + case GL_COPY_WRITE_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + bindTarget = &ctx->CopyWriteBuffer; + } + break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target)"); + ; /* no-op / we'll hit the follow error test next */ + } + + if (!bindTarget) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)"); return; } @@ -1140,3 +1198,84 @@ _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) *params = bufObj->Pointer; } + + +void GLAPIENTRY +_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_buffer_object *src, *dst; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + src = get_buffer(ctx, readTarget); + if (!src || src->Name == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyBuffserSubData(readTarget = 0x%x)", readTarget); + return; + } + + dst = get_buffer(ctx, writeTarget); + if (!dst || dst->Name == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyBuffserSubData(writeTarget = 0x%x)", writeTarget); + return; + } + + if (src->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyBuffserSubData(readBuffer is mapped)"); + return; + } + + if (dst->Pointer) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyBuffserSubData(writeBuffer is mapped)"); + return; + } + + if (readOffset < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBuffserSubData(readOffset = %d)", readOffset); + return; + } + + if (writeOffset < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBuffserSubData(writeOffset = %d)", writeOffset); + return; + } + + if (readOffset + size > src->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBuffserSubData(readOffset + size = %d)", + readOffset, size); + return; + } + + if (writeOffset + size > src->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBuffserSubData(writeOffset + size = %d)", + writeOffset, size); + return; + } + + if (src == dst) { + if (readOffset + size <= writeOffset) { + /* OK */ + } + else if (writeOffset + size <= readOffset) { + /* OK */ + } + else { + /* overlapping src/dst is illegal */ + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyBuffserSubData(overlapping src/dst)"); + return; + } + } + + ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset, size); +} + diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 3c08f0083c..79c027aa4d 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.6 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -82,6 +83,13 @@ extern GLboolean _mesa_buffer_unmap( GLcontext *ctx, GLenum target, struct gl_buffer_object * bufObj ); +extern void +_mesa_copy_buffer_subdata(GLcontext *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size); + extern GLboolean _mesa_validate_pbo_access(GLuint dimensions, const struct gl_pixelstore_attrib *pack, @@ -154,4 +162,9 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params); +extern void GLAPIENTRY +_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size); + #endif -- cgit v1.2.3 From 08e43ebfb216284818925e899419af03e28d2360 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:32:15 -0600 Subject: mesa: plug in new _mesa_CopyBufferSubData() functions --- src/mesa/drivers/common/driverfuncs.c | 3 +++ src/mesa/main/api_exec.c | 3 +++ src/mesa/main/dlist.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 276da41f4e..56abdbdfcb 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -237,6 +237,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->DeleteArrayObject = _mesa_delete_array_object; driver->BindArrayObject = NULL; + /* GL_ARB_copy_buffer */ + driver->CopyBufferSubData = _mesa_copy_buffer_subdata; + /* T&L stuff */ driver->NeedValidate = GL_FALSE; driver->ValidateTnlModule = NULL; diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 6f66ff47a0..c714d177a2 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -894,5 +894,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) */ SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample); #endif + + /* GL_ARB_copy_buffer */ + SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData); } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index dd73a1906b..d3c1717a50 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -8238,6 +8238,9 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); #endif + + /* ARB 59. GL_ARB_copy_buffer */ + SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ } -- cgit v1.2.3 From 3a7399e2c4a5fc46f871ad030d6198a16e52d356 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:32:34 -0600 Subject: mesa: enable GL_ARB_copy_buffer for software drivers --- src/mesa/main/extensions.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 5c4bea9cf6..aa9513a550 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -44,6 +44,7 @@ static const struct { const char *name; int flag_offset; } default_extensions[] = { + { OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, @@ -183,6 +184,7 @@ static const struct { void _mesa_enable_sw_extensions(GLcontext *ctx) { + ctx->Extensions.ARB_copy_buffer = GL_TRUE; ctx->Extensions.ARB_depth_texture = GL_TRUE; /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/ #if FEATURE_ARB_fragment_program -- cgit v1.2.3 From 2e708fa9094a2eb54f7399060183118652ef1825 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 20:33:09 -0600 Subject: docs: added GL_ARB_copy_buffer extension --- docs/relnotes-7.6.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html index 82c0c2e947..c552b43457 100644 --- a/docs/relnotes-7.6.html +++ b/docs/relnotes-7.6.html @@ -44,6 +44,7 @@ tbd
          • OpenVG front-end (state tracker for Gallium). This was written by Zack Rusin at Tungsten Graphics.
          • GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers. +
          • GL_ARB_copy_buffer extension
          -- cgit v1.2.3 From 2813c08b35aa1b4fafa47f4421c9822ff8f6f85c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 21:23:28 -0600 Subject: mesa: fix error test mistake in _mesa_CopyBufferSubData() --- src/mesa/main/bufferobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 88b51fe60f..5fa13d9b54 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1254,7 +1254,7 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, return; } - if (writeOffset + size > src->Size) { + if (writeOffset + size > dst->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(writeOffset + size = %d)", writeOffset, size); -- cgit v1.2.3 From dd174ea2155ded567494448ffc5de7e022eabc5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 21:24:28 -0600 Subject: st/mesa: implement/enable GL_ARB_copy_buffer extension --- src/mesa/state_tracker/st_cb_bufferobjects.c | 38 ++++++++++++++++++++++++++++ src/mesa/state_tracker/st_extensions.c | 1 + 2 files changed, 39 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index f5d802055f..340fbd9aba 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -296,6 +296,43 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj) } +/** + * Called via glCopyBufferSubData(). + */ +static void +st_copy_buffer_subdata(GLcontext *ctx, + struct gl_buffer_object *src, + struct gl_buffer_object *dst, + GLintptr readOffset, GLintptr writeOffset, + GLsizeiptr size) +{ + struct pipe_context *pipe = st_context(ctx)->pipe; + struct st_buffer_object *srcObj = st_buffer_object(src); + struct st_buffer_object *dstObj = st_buffer_object(dst); + ubyte *srcPtr, *dstPtr; + + /* buffer should not already be mapped */ + assert(!src->Pointer); + assert(!dst->Pointer); + + srcPtr = (ubyte *) pipe_buffer_map_range(pipe->screen, + srcObj->buffer, + readOffset, size, + PIPE_BUFFER_USAGE_CPU_READ); + + dstPtr = (ubyte *) pipe_buffer_map_range(pipe->screen, + dstObj->buffer, + writeOffset, size, + PIPE_BUFFER_USAGE_CPU_WRITE); + + if (srcPtr && dstPtr) + _mesa_memcpy(dstPtr + writeOffset, srcPtr + readOffset, size); + + pipe_buffer_unmap(pipe->screen, srcObj->buffer); + pipe_buffer_unmap(pipe->screen, dstObj->buffer); +} + + void st_init_bufferobject_functions(struct dd_function_table *functions) { @@ -308,6 +345,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions->MapBufferRange = st_bufferobj_map_range; functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range; functions->UnmapBuffer = st_bufferobj_unmap; + functions->CopyBufferSubData = st_copy_buffer_subdata; /* For GL_APPLE_vertex_array_object */ functions->NewArrayObject = _mesa_new_array_object; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index efa88c2481..8ed1211db6 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -138,6 +138,7 @@ void st_init_extensions(struct st_context *st) /* * Extensions that are supported by all Gallium drivers: */ + ctx->Extensions.ARB_copy_buffer = GL_TRUE; ctx->Extensions.ARB_multisample = GL_TRUE; ctx->Extensions.ARB_fragment_program = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ -- cgit v1.2.3 From 8086352fef94c52c4174257e91e5d45b68410fae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 21:30:22 -0600 Subject: docs: clarify GL_ARB_copy_buffer driver support --- docs/relnotes-7.6.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html index c552b43457..be8da998a8 100644 --- a/docs/relnotes-7.6.html +++ b/docs/relnotes-7.6.html @@ -44,7 +44,7 @@ tbd
        • OpenVG front-end (state tracker for Gallium). This was written by Zack Rusin at Tungsten Graphics.
        • GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers. -
        • GL_ARB_copy_buffer extension +
        • GL_ARB_copy_buffer extension (supported in Gallium and swrast drivers)
        -- cgit v1.2.3 From 5cd47e0361ed0fc8ddd6c4cee12a274173c9b25b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 21:41:03 -0600 Subject: docs: remove version info carried over from 7.5 --- docs/relnotes-7.6.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/relnotes-7.6.html b/docs/relnotes-7.6.html index be8da998a8..f0e15f5024 100644 --- a/docs/relnotes-7.6.html +++ b/docs/relnotes-7.6.html @@ -24,13 +24,6 @@ Some drivers don't support all the features required in OpenGL 2.1. See the Compiling/Installing page for prerequisites for DRI hardware acceleration.

        -

        -Note that the Mesa project is no longer using odd/even version numbers -to indicate development/stable releases. -The so-called development releases have been fairly stable. -If you're especially concerned with stability you should probably look for -"point" releases such as 7.5.1 which will be a bug-fix release. -

        MD5 checksums

        -- cgit v1.2.3 From 54576130a88fe93a64367f882cd680e37f0ec0ac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 21:46:17 -0600 Subject: st/mesa: minor clean-ups, reformatting, etc --- src/mesa/state_tracker/st_cb_bufferobjects.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 340fbd9aba..f140641d7e 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -26,6 +26,11 @@ **************************************************************************/ +/** + * Functions for pixel buffer objects and vertex/element buffer objects. + */ + + #include "main/imports.h" #include "main/mtypes.h" #include "main/arrayobj.h" @@ -40,14 +45,6 @@ #include "pipe/p_inlines.h" - -/* Pixel buffers and Vertex/index buffers are handled through these - * mesa callbacks. Framebuffer/Renderbuffer objects are - * created/managed elsewhere. - */ - - - /** * There is some duplication between mesa's bufferobjects and our * bufmgr buffers. Both have an integer handle and a hashtable to @@ -191,7 +188,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj) { struct st_buffer_object *st_obj = st_buffer_object(obj); - GLuint flags; + uint flags; switch (access) { case GL_WRITE_ONLY: @@ -210,7 +207,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, obj->Pointer = st_cond_flush_pipe_buffer_map(st_context(ctx), st_obj->buffer, flags); - if(obj->Pointer) { + if (obj->Pointer) { obj->Offset = 0; obj->Length = obj->Size; } @@ -218,7 +215,6 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access, } - /** * Called via glMapBufferRange(). */ @@ -229,7 +225,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, { struct pipe_context *pipe = st_context(ctx)->pipe; struct st_buffer_object *st_obj = st_buffer_object(obj); - GLuint flags = 0; + uint flags = 0x0; char *map; if (access & GL_MAP_WRITE_BIT) @@ -249,8 +245,9 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, assert(offset < obj->Size); assert(offset + length <= obj->Size); - map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); - if(obj->Pointer) { + map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, + offset, length, flags); + if (obj->Pointer) { obj->Offset = 0; obj->Length = obj->Size; map += offset; -- cgit v1.2.3 From 7f8000db8bd45bb95bda4a4f8535c49b8ef74254 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 3 Jun 2009 17:49:05 +0100 Subject: Fast path when rebinding the same texture in single context environment If there is no shared context, there is no purpose in rebinding the same texture. In some artificial tests this improves performance 10% - 30%. --- src/mesa/main/texobj.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d51e7b76ec..2082f945f1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -945,6 +945,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL; GLint targetIndex; + GLboolean early_out = GL_FALSE; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) @@ -998,6 +999,17 @@ _mesa_BindTexture( GLenum target, GLuint texName ) assert(valid_texture_object(newTexObj)); + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + if ((ctx->Shared->RefCount == 1) + && (newTexObj == texUnit->CurrentTex[targetIndex])) { + early_out = GL_TRUE; + } + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + if (early_out) { + return; + } + /* flush before changing binding */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); -- cgit v1.2.3 From c428f467b65f1b79f77103db249936273d645fec Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 2 Jun 2009 18:33:55 +0100 Subject: Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined DO NOT HAND-EDIT GLX PROTOCOL FILES. Seriously. How can you miss the giant comment at the top of the file? --- src/glx/x11/indirect.c | 138 +++++++++++++++++++++++++++++++++++++++ src/mesa/glapi/glX_proto_send.py | 6 +- 2 files changed, 143 insertions(+), 1 deletion(-) diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index 08d52aeea3..b7459821e5 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -5200,7 +5200,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) if (gc->driContext) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); +<<<<<<< HEAD:src/glx/x11/indirect.c } else { +======= + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); @@ -5266,9 +5272,18 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GenTextures(GET_DISPATCH(), (n, textures)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4; @@ -5328,9 +5343,18 @@ glIsTextureEXT(GLuint texture) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + return CALL_IsTexture(GET_DISPATCH(), (texture)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; @@ -5641,9 +5665,18 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -5714,10 +5747,20 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetColorTableParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetColorTableParameterfv(GET_DISPATCH(), + (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -5784,10 +5827,20 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetColorTableParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetColorTableParameteriv(GET_DISPATCH(), + (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6107,10 +6160,20 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetConvolutionFilter(GET_DISPATCH(), (target, format, type, image)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetConvolutionFilter(GET_DISPATCH(), + (target, format, type, image)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6182,10 +6245,20 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetConvolutionParameterfv(GET_DISPATCH(), + (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6252,10 +6325,20 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetConvolutionParameteriv(GET_DISPATCH(), + (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6329,10 +6412,20 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, values)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetHistogram(GET_DISPATCH(), + (target, reset, format, type, values)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6403,9 +6496,18 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6471,9 +6573,18 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6543,9 +6654,18 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6614,9 +6734,18 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6679,9 +6808,18 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); +<<<<<<< HEAD:src/glx/x11/indirect.c if (gc->driContext) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else { +======= +#ifdef GLX_DIRECT_RENDERING + if (gc->driContext) { + CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); + } else +#endif + { +>>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index 501706acc7..daca1b767a 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -373,9 +373,13 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; print '{' print ' __GLXcontext * const gc = __glXGetCurrentContext();' print '' + print '#ifdef GLX_DIRECT_RENDERING' print ' if (gc->driContext) {' print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string()) - print ' } else {' + print ' } else' + print '#endif' + print ' {' + footer = '}\n}\n' else: print '#define %s %d' % (func.opcode_name(), func.opcode_value()) -- cgit v1.2.3 From 1ad15768365617e6795155723843fc440593d7c4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 3 Jun 2009 17:55:42 +0100 Subject: Thank you git for doing the right thing. --- src/glx/x11/indirect.c | 95 +------------------------------------------------- 1 file changed, 1 insertion(+), 94 deletions(-) diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index b7459821e5..e0cafd43bc 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -5198,15 +5198,12 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); +#ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_DeleteTextures(GET_DISPATCH(), (n, textures)); -<<<<<<< HEAD:src/glx/x11/indirect.c - } else { -======= } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); @@ -5272,18 +5269,12 @@ glGenTexturesEXT(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GenTextures(GET_DISPATCH(), (n, textures)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GenTextures(GET_DISPATCH(), (n, textures)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 4; @@ -5343,18 +5334,12 @@ glIsTextureEXT(GLuint texture) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - return CALL_IsTexture(GET_DISPATCH(), (texture)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { return CALL_IsTexture(GET_DISPATCH(), (texture)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; @@ -5665,18 +5650,12 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -5747,12 +5726,6 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetColorTableParameterfv(GET_DISPATCH(), - (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameterfv(GET_DISPATCH(), @@ -5760,7 +5733,6 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params) } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -5827,12 +5799,6 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetColorTableParameteriv(GET_DISPATCH(), - (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetColorTableParameteriv(GET_DISPATCH(), @@ -5840,7 +5806,6 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params) } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6160,12 +6125,6 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetConvolutionFilter(GET_DISPATCH(), - (target, format, type, image)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionFilter(GET_DISPATCH(), @@ -6173,7 +6132,6 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type, } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6245,12 +6203,6 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetConvolutionParameterfv(GET_DISPATCH(), - (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameterfv(GET_DISPATCH(), @@ -6258,7 +6210,6 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params) } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6325,12 +6276,6 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetConvolutionParameteriv(GET_DISPATCH(), - (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetConvolutionParameteriv(GET_DISPATCH(), @@ -6338,7 +6283,6 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params) } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6412,12 +6356,6 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetHistogram(GET_DISPATCH(), - (target, reset, format, type, values)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogram(GET_DISPATCH(), @@ -6425,7 +6363,6 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format, } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6496,18 +6433,12 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6573,18 +6504,12 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6654,18 +6579,12 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; @@ -6734,18 +6653,12 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; @@ -6808,18 +6721,12 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); -<<<<<<< HEAD:src/glx/x11/indirect.c - if (gc->driContext) { - CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); - } else { -======= #ifdef GLX_DIRECT_RENDERING if (gc->driContext) { CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params)); } else #endif { ->>>>>>> ee2bc53... Fix compiling indirect.c when GLX_DIRECT_RENDERING is not defined:src/glx/x11/indirect.c __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; const GLuint cmdlen = 8; -- cgit v1.2.3 From ab4fd185843033cde0c58e8e0da932dbac7b8df2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Jun 2009 09:16:33 -0600 Subject: vbo: tweak out-of-bounds VBO access error message Subtract 1 from _MaxElement to be clearer. --- src/mesa/vbo/vbo_exec_array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 2815ba3cc9..cd0397ab4c 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -366,7 +366,7 @@ vbo_exec_DrawRangeElements(GLenum mode, _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " "type 0x%x) index=%u is out of bounds (max=%u)", start, end, count, type, end, - ctx->Array.ArrayObj->_MaxElement); + ctx->Array.ArrayObj->_MaxElement - 1); if (0) _mesa_print_arrays(ctx); return; -- cgit v1.2.3 From 4f4280b4356210e503aa5756db0a13dfb8253661 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:36:24 -0600 Subject: tnl: add some floating point sanity checks (disabled) --- src/mesa/tnl/t_vb_program.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index c35eaf1538..66c5e13729 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.6 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -46,6 +47,16 @@ #include "tnl/t_pipeline.h" +#ifdef NAN_CHECK +/** Check for NaNs and very large values */ +static INLINE void +check_float(float x) +{ + assert(!IS_INF_OR_NAN(x)); + assert(1.0e-15 <= x && x <= 1.0e15); +} +#endif + /*! * Private storage for the vertex program pipeline stage. @@ -351,6 +362,12 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) const GLuint size = VB->AttribPtr[attr]->size; const GLuint stride = VB->AttribPtr[attr]->stride; const GLfloat *data = (GLfloat *) (ptr + stride * i); +#ifdef NAN_CHECK + check_float(data[0]); + check_float(data[1]); + check_float(data[2]); + check_float(data[3]); +#endif COPY_CLEAN_4V(machine.VertAttribs[attr], size, data); } } @@ -361,6 +378,12 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) /* copy the output registers into the VB->attribs arrays */ for (j = 0; j < numOutputs; j++) { const GLuint attr = outputs[j]; +#ifdef NAN_CHECK + check_float(machine.Outputs[attr][0]); + check_float(machine.Outputs[attr][1]); + check_float(machine.Outputs[attr][2]); + check_float(machine.Outputs[attr][3]); +#endif COPY_4V(store->results[attr].data[i], machine.Outputs[attr]); } #if 0 -- cgit v1.2.3 From e7927626c13b8cd3743ba52a407b8f3736eae8a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:38:57 -0600 Subject: mesa: added buffer object debug code (disabled) --- src/mesa/main/bufferobj.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 5fa13d9b54..3e011ef5b2 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1014,6 +1014,11 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, bufObj->Written = GL_TRUE; +#ifdef VBO_DEBUG + _mesa_printf("glBufferDataARB(%u, sz %ld, from %p, usage 0x%x)\n", + bufObj->Name, size, data, usage); +#endif + /* Give the buffer object to the driver! may be null! */ ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj ); } @@ -1103,6 +1108,17 @@ _mesa_MapBufferARB(GLenum target, GLenum access) if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB) bufObj->Written = GL_TRUE; +#ifdef VBO_DEBUG + _mesa_printf("glMapBufferARB(%u, sz %ld, access 0x%x)\n", + bufObj->Name, bufObj->Size, access); + if (access == GL_WRITE_ONLY_ARB) { + GLuint i; + GLubyte *b = (GLubyte *) bufObj->Pointer; + for (i = 0; i < bufObj->Size; i++) + b[i] = i & 0xff; + } +#endif + return bufObj->Pointer; } @@ -1129,6 +1145,26 @@ _mesa_UnmapBufferARB(GLenum target) return GL_FALSE; } +#ifdef VBO_DEBUG + if (bufObj->Access == GL_WRITE_ONLY_ARB) { + GLuint i, unchanged = 0; + GLubyte *b = (GLubyte *) bufObj->Pointer; + GLint pos = -1; + /* check which bytes changed */ + for (i = 0; i < bufObj->Size - 1; i++) { + if (b[i] == (i & 0xff) && b[i+1] == ((i+1) & 0xff)) { + unchanged++; + if (pos == -1) + pos = i; + } + } + if (unchanged) { + _mesa_printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n", + bufObj->Name, unchanged, bufObj->Size, pos); + } + } +#endif + status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; -- cgit v1.2.3 From 87b2db988e25506ecf476386a8b9792d459a2fde Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:40:05 -0600 Subject: tnl: updated clip debug code (disabled) --- src/mesa/tnl/t_vb_cliptmp.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 61b0a89554..618b8b3130 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -199,6 +199,23 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ + if (0) { + /* print pre-clip vertex coords */ + GLuint i, j; + _mesa_printf("pre clip:\n"); + for (i = 0; i < n; i++) { + j = inlist[i]; + _mesa_printf(" %u: %u: %f, %f, %f, %f\n", + i, j, + coord[j][0], coord[j][1], coord[j][2], coord[j][3]); + assert(!IS_INF_OR_NAN(coord[j][0])); + assert(!IS_INF_OR_NAN(coord[j][1])); + assert(!IS_INF_OR_NAN(coord[j][2])); + assert(!IS_INF_OR_NAN(coord[j][3])); + } + } + + if (mask & CLIP_FRUSTUM_BITS) { POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); @@ -228,16 +245,9 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) } if (0) { - /* print pre/post-clip vertex coords */ + /* print post-clip vertex coords */ GLuint i, j; - _mesa_printf("pre clip\n"); - for (i = 0; i < 3; i++) { - j = outlist[i]; - _mesa_printf(" %u: %u: %f, %f, %f, %f\n", - i, j, - coord[j][0], coord[j][1], coord[j][2], coord[j][3]); - } - _mesa_printf("post clip\n"); + _mesa_printf("post clip:\n"); for (i = 0; i < n; i++) { j = inlist[i]; _mesa_printf(" %u: %u: %f, %f, %f, %f\n", -- cgit v1.2.3 From 035de6a82b6c911a81ca9c678aac59772eaff8d3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:42:52 -0600 Subject: mesa: check/prevent NaN for EX2/LG2 --- src/mesa/shader/prog_execute.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 68a59350a1..2b7237ef31 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -832,10 +832,14 @@ _mesa_execute_program(GLcontext * ctx, break; case OPCODE_EX2: /* Exponential base 2 */ { - GLfloat a[4], result[4]; + GLfloat a[4], result[4], val; fetch_vector1(&inst->SrcReg[0], machine, a); - result[0] = result[1] = result[2] = result[3] = - (GLfloat) _mesa_pow(2.0, a[0]); + val = (GLfloat) _mesa_pow(2.0, a[0]); + /* + if (IS_INF_OR_NAN(val)) + val = 1.0e10; + */ + result[0] = result[1] = result[2] = result[3] = val; store_vector4(inst, machine, result); } break; @@ -911,12 +915,17 @@ _mesa_execute_program(GLcontext * ctx, break; case OPCODE_LG2: /* log base 2 */ { - GLfloat a[4], result[4]; + GLfloat a[4], result[4], val; fetch_vector1(&inst->SrcReg[0], machine, a); /* The fast LOG2 macro doesn't meet the precision requirements. */ - result[0] = result[1] = result[2] = result[3] = - (log(a[0]) * 1.442695F); + if (a[0] == 0.0F) { + val = 0.0F; + } + else { + val = log(a[0]) * 1.442695F; + } + result[0] = result[1] = result[2] = result[3] = val; store_vector4(inst, machine, result); } break; -- cgit v1.2.3 From 92009543705918760df92abb0cbb8cad68875e72 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:43:53 -0600 Subject: mesa: added NaN checking code (disabled) --- src/mesa/shader/prog_execute.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 2b7237ef31..f4beb9a78b 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -225,6 +225,13 @@ fetch_vector4(const struct prog_src_register *source, result[2] = -result[2]; result[3] = -result[3]; } + +#ifdef NAN_CHECK + assert(!IS_INF_OR_NAN(result[0])); + assert(!IS_INF_OR_NAN(result[0])); + assert(!IS_INF_OR_NAN(result[0])); + assert(!IS_INF_OR_NAN(result[0])); +#endif } @@ -479,6 +486,13 @@ store_vector4(const struct prog_instruction *inst, } } +#ifdef NAN_CHECK + assert(!IS_INF_OR_NAN(value[0])); + assert(!IS_INF_OR_NAN(value[0])); + assert(!IS_INF_OR_NAN(value[0])); + assert(!IS_INF_OR_NAN(value[0])); +#endif + if (writeMask & WRITEMASK_X) dst[0] = value[0]; if (writeMask & WRITEMASK_Y) -- cgit v1.2.3 From e446ef50eb8bbc2e3505c4d52e971d24c37785d6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 15:46:56 -0600 Subject: vbo: new debug/dump code (disabled) --- src/mesa/vbo/vbo_split_copy.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index 2f6a1998ea..dcb14c868b 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -133,6 +133,41 @@ check_flush( struct copy_context *copy ) } +/** + * Dump the parameters/info for a vbo->draw() call. + */ +static void +dump_draw_info(GLcontext *ctx, + const struct gl_client_array **arrays, + const struct _mesa_prim *prims, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index) +{ + GLuint i, j; + + _mesa_printf("VBO Draw:\n"); + for (i = 0; i < nr_prims; i++) { + _mesa_printf("Prim %u of %u\n", i, nr_prims); + _mesa_printf(" Prim mode 0x%x\n", prims[i].mode); + _mesa_printf(" IB: %p\n", (void*) ib); + for (j = 0; j < VERT_ATTRIB_MAX; j++) { + _mesa_printf(" array %d at %p:\n", j, (void*) arrays[j]); + _mesa_printf(" enabled %d, ptr %p, size %d, type 0x%x, stride %d\n", + arrays[j]->Enabled, arrays[j]->Ptr, + arrays[j]->Size, arrays[j]->Type, arrays[j]->StrideB); + if (0) { + GLint k = prims[i].start + prims[i].count - 1; + GLfloat *last = (GLfloat *) (arrays[j]->Ptr + arrays[j]->Stride * k); + _mesa_printf(" last: %f %f %f\n", + last[0], last[1], last[2]); + } + } + } +} + + static void flush( struct copy_context *copy ) { @@ -142,6 +177,18 @@ flush( struct copy_context *copy ) */ copy->dstib.count = copy->dstelt_nr; +#if 0 + dump_draw_info(copy->ctx, + copy->dstarray_ptr, + copy->dstprim, + copy->dstprim_nr, + ©->dstib, + 0, + copy->dstbuf_nr); +#else + (void) dump_draw_info; +#endif + copy->draw( copy->ctx, copy->dstarray_ptr, copy->dstprim, @@ -207,6 +254,17 @@ elt(struct copy_context *copy, GLuint elt_idx) memcpy(csr, srcptr, copy->varying[i].size); csr += copy->varying[i].size; +#ifdef NAN_CHECK + if (srcarray->Type == GL_FLOAT) { + GLuint k; + GLfloat *f = (GLfloat *) srcptr; + for (k = 0; k < srcarray->Size; k++) { + assert(!IS_INF_OR_NAN(f[k])); + assert(f[k] <= 1.0e20 && f[k] >= -1.0e20); + } + } +#endif + if (0) { const GLuint *f = (const GLuint *)srcptr; -- cgit v1.2.3 From 13f6d07521119afc4b6d9e6daa94d5091f4b9c65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 16:59:44 -0600 Subject: vbo: added debug code to check array data validity (disabled) --- src/mesa/vbo/vbo_exec_array.c | 156 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index cd0397ab4c..74d3e19baf 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -90,6 +91,148 @@ static void get_minmax_index( GLuint count, GLuint type, } +/** + * Check that element 'j' of the array has reasonable data. + * Map VBO if needed. + */ +static void +check_array_data(GLcontext *ctx, struct gl_client_array *array, + GLuint attrib, GLuint j) +{ + if (array->Enabled) { + const void *data = array->Ptr; + if (array->BufferObj->Name) { + if (!array->BufferObj->Pointer) { + /* need to map now */ + array->BufferObj->Pointer = ctx->Driver.MapBuffer(ctx, + GL_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + array->BufferObj); + } + data = ADD_POINTERS(data, array->BufferObj->Pointer); + } + switch (array->Type) { + case GL_FLOAT: + { + GLfloat *f = (GLfloat *) ((GLubyte *) data + array->StrideB * j); + GLuint k; + for (k = 0; k < array->Size; k++) { + if (IS_INF_OR_NAN(f[k]) || + f[k] >= 1.0e20 || f[k] <= -1.0e10) { + _mesa_printf("Bad array data:\n"); + _mesa_printf(" Element[%u].%u = %f\n", j, k, f[k]); + _mesa_printf(" Array %u at %p\n", attrib, (void* ) array); + _mesa_printf(" Type 0x%x, Size %d, Stride %d\n", + array->Type, array->Size, array->Stride); + _mesa_printf(" Address/offset %p in Buffer Object %u\n", + array->Ptr, array->BufferObj->Name); + f[k] = 1.0; /* XXX replace the bad value! */ + } + //assert(!IS_INF_OR_NAN(f[k])); + } + } + break; + default: + ; + } + } +} + + +/** + * Unmap the buffer object referenced by given array, if mapped. + */ +static void +unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) +{ + if (array->Enabled && + array->BufferObj->Name && + array->BufferObj->Pointer) { + ctx->Driver.UnmapBuffer(ctx, + GL_ARRAY_BUFFER_ARB, + array->BufferObj); + } +} + + +/** + * Examine the array's data for NaNs, etc. + */ +static void +check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, + const void *elements) +{ + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + const void *elemMap; + GLint i, k; + + if (ctx->Array.ElementArrayBufferObj->Name) { + elemMap = ctx->Driver.MapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + ctx->Array.ElementArrayBufferObj); + elements = ADD_POINTERS(elements, elemMap); + } + + for (i = 0; i < count; i++) { + GLuint j; + + /* j = element[i] */ + switch (elemType) { + case GL_UNSIGNED_BYTE: + j = ((const GLubyte *) elements)[i]; + break; + case GL_UNSIGNED_SHORT: + j = ((const GLushort *) elements)[i]; + break; + case GL_UNSIGNED_INT: + j = ((const GLuint *) elements)[i]; + break; + default: + assert(0); + } + + /* check element j of each enabled array */ + check_array_data(ctx, &arrayObj->Vertex, VERT_ATTRIB_POS, j); + check_array_data(ctx, &arrayObj->Normal, VERT_ATTRIB_NORMAL, j); + check_array_data(ctx, &arrayObj->Color, VERT_ATTRIB_COLOR0, j); + check_array_data(ctx, &arrayObj->SecondaryColor, VERT_ATTRIB_COLOR1, j); + for (k = 0; k < Elements(arrayObj->TexCoord); k++) { + check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j); + } + for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { + check_array_data(ctx, &arrayObj->VertexAttrib[k], VERT_ATTRIB_GENERIC0 + k, j); + } + } + + if (ctx->Array.ElementArrayBufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + ctx->Array.ElementArrayBufferObj); + } + + unmap_array_buffer(ctx, &arrayObj->Vertex); + unmap_array_buffer(ctx, &arrayObj->Normal); + unmap_array_buffer(ctx, &arrayObj->Color); + for (k = 0; k < Elements(arrayObj->TexCoord); k++) { + unmap_array_buffer(ctx, &arrayObj->TexCoord[k]); + } + for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { + unmap_array_buffer(ctx, &arrayObj->VertexAttrib[k]); + } +} + + +/** + * Check array data, looking for NaNs, etc. + */ +static void +check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) +{ + /* TO DO */ +} + + /** * Just translate the arrayobj into a sane layout. */ @@ -282,6 +425,13 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) return; } +#if 0 + check_draw_arrays_data(ctx, start, count); +#else + (void) check_draw_arrays_data; +#endif + + bind_arrays( ctx ); /* Again... because we may have changed the bitmask of per-vertex varying @@ -372,6 +522,12 @@ vbo_exec_DrawRangeElements(GLenum mode, return; } +#if 0 + check_draw_elements_data(ctx, count, type, indices); +#else + (void) check_draw_elements_data; +#endif + FLUSH_CURRENT( ctx, 0 ); if (ctx->NewState) -- cgit v1.2.3 From aa18e54ac9a70883a98f803c097d45f8ee84e717 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 17:03:11 -0600 Subject: vbo: move/refactor debug code --- src/mesa/vbo/vbo_exec_array.c | 87 ++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 74d3e19baf..ca24fb443f 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -233,6 +233,52 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) } +/** + * Print info/data for glDrawArrays(). + */ +static void +print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, + GLenum mode, GLint start, GLsizei count) +{ + int i; + + _mesa_printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", + mode, start, count); + + for (i = 0; i < 32; i++) { + GLuint bufName = exec->array.inputs[i]->BufferObj->Name; + GLint stride = exec->array.inputs[i]->Stride; + _mesa_printf("attr %2d: size %d stride %d enabled %d " + "ptr %p Bufobj %u\n", + i, + exec->array.inputs[i]->Size, + stride, + /*exec->array.inputs[i]->Enabled,*/ + exec->array.legacy_array[i]->Enabled, + exec->array.inputs[i]->Ptr, + bufName); + + if (bufName) { + struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName); + GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, + GL_READ_ONLY_ARB, buf); + int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr; + float *f = (float *) (p + offset); + int *k = (int *) f; + int i; + int n = (count * stride) / 4; + if (n > 32) + n = 32; + _mesa_printf(" Data at offset %d:\n", offset); + for (i = 0; i < n; i++) { + _mesa_printf(" float[%d] = 0x%08x %f\n", i, k[i], f[i]); + } + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf); + } + } +} + + /** * Just translate the arrayobj into a sane layout. */ @@ -455,44 +501,9 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) start, start + count - 1 ); #if 0 - { - int i; - - _mesa_printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", - mode, start, count); - - for (i = 0; i < 32; i++) { - GLuint bufName = exec->array.inputs[i]->BufferObj->Name; - GLint stride = exec->array.inputs[i]->Stride; - _mesa_printf("attr %2d: size %d stride %d enabled %d " - "ptr %p Bufobj %u\n", - i, - exec->array.inputs[i]->Size, - stride, - /*exec->array.inputs[i]->Enabled,*/ - exec->array.legacy_array[i]->Enabled, - exec->array.inputs[i]->Ptr, - bufName); - - if (bufName) { - struct gl_buffer_object *buf = _mesa_lookup_bufferobj(ctx, bufName); - GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, - GL_READ_ONLY_ARB, buf); - int offset = (int) exec->array.inputs[i]->Ptr; - float *f = (float *) (p + offset); - int *k = (int *) f; - int i; - int n = (count * stride) / 4; - if (n > 32) - n = 32; - _mesa_printf(" Data at offset %d:\n", offset); - for (i = 0; i < n; i++) { - _mesa_printf(" float[%d] = 0x%08x %f\n", i, k[i], f[i]); - } - ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, buf); - } - } - } + print_draw_arrays(ctx, exec, mode, start, count); +#else + (void) print_draw_arrays; #endif } -- cgit v1.2.3 From 0b6a0b367fdb575048b69d80ad4202d164a61f1e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 17:05:37 -0600 Subject: vbo: minor reformatting --- src/mesa/vbo/vbo_exec_array.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index ca24fb443f..4109fbbb3c 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -37,13 +37,13 @@ #include "vbo_context.h" + /** * Compute min and max elements for glDraw[Range]Elements() calls. */ -static void get_minmax_index( GLuint count, GLuint type, - const GLvoid *indices, - GLuint *min_index, - GLuint *max_index) +static void +get_minmax_index(GLuint count, GLuint type, const GLvoid *indices, + GLuint *min_index, GLuint *max_index) { GLuint i; @@ -282,7 +282,8 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, /** * Just translate the arrayobj into a sane layout. */ -static void bind_array_obj( GLcontext *ctx ) +static void +bind_array_obj(GLcontext *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -318,7 +319,8 @@ static void bind_array_obj( GLcontext *ctx ) } -static void recalculate_input_bindings( GLcontext *ctx ) +static void +recalculate_input_bindings(GLcontext *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -426,7 +428,8 @@ static void recalculate_input_bindings( GLcontext *ctx ) } -static void bind_arrays( GLcontext *ctx ) +static void +bind_arrays(GLcontext *ctx) { #if 0 if (ctx->Array.ArrayObj.Name != exec->array.array_obj) { @@ -477,7 +480,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) (void) check_draw_arrays_data; #endif - bind_arrays( ctx ); /* Again... because we may have changed the bitmask of per-vertex varying @@ -519,7 +521,8 @@ vbo_exec_DrawRangeElements(GLenum mode, struct _mesa_index_buffer ib; struct _mesa_prim prim[1]; - if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) + if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, + type, indices )) return; if (end >= ctx->Array.ArrayObj->_MaxElement) { @@ -604,7 +607,8 @@ vbo_exec_DrawRangeElements(GLenum mode, static void GLAPIENTRY -vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) +vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLuint min_index = 0; @@ -620,11 +624,12 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *ind if (ctx->Array.ElementArrayBufferObj->Name) { const GLvoid *map = ctx->Driver.MapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, - GL_READ_ONLY, - ctx->Array.ElementArrayBufferObj); + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + ctx->Array.ElementArrayBufferObj); - get_minmax_index(count, type, ADD_POINTERS(map, indices), &min_index, &max_index); + get_minmax_index(count, type, ADD_POINTERS(map, indices), + &min_index, &max_index); ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, @@ -642,7 +647,8 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *ind * Initialization */ -void vbo_exec_array_init( struct vbo_exec_context *exec ) +void +vbo_exec_array_init( struct vbo_exec_context *exec ) { #if 1 exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays; @@ -656,7 +662,8 @@ void vbo_exec_array_init( struct vbo_exec_context *exec ) } -void vbo_exec_array_destroy( struct vbo_exec_context *exec ) +void +vbo_exec_array_destroy( struct vbo_exec_context *exec ) { /* nothing to do */ } -- cgit v1.2.3 From f25e1007c2da21dc529811e9e1f4b4da6bda8be4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 17:09:03 -0600 Subject: swrast: always do span clipping in _swrast_write_rgba_span() It's possible for mis-behaving vertex programs to produce vertex data with very large/NaN values. This doesn't get handled reliably by the clipper code so we may try to rasterize triangles that extend beyond the viewport/window. Always clip spans to avoid invalid memory accesses later. --- src/mesa/swrast/s_span.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index fa8ca1d0e2..0e2793b474 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1297,7 +1297,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) span->primitive == GL_LINE || span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); - ASSERT(span->end <= MAX_WIDTH); /* Fragment write masks */ if (span->arrayMask & SPAN_MASK) { @@ -1310,12 +1309,12 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) } /* Clip to window/scissor box */ - if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { - if (!clip_span(ctx, span)) { - return; - } + if (!clip_span(ctx, span)) { + return; } + ASSERT(span->end <= MAX_WIDTH); + #ifdef DEBUG /* Make sure all fragments are within window bounds */ if (span->arrayMask & SPAN_XY) { @@ -1356,15 +1355,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) if (ctx->Stencil._Enabled || ctx->Depth.Test) { if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); - - if ((span->arrayMask & SPAN_XY) == 0) { - if (span->x < fb->_Xmin || span->x + span->end > fb->_Xmax || - span->y < fb->_Ymin || span->y >= fb->_Ymax) { - printf("Bad span clipping at %d, %d\n", span->x, span->y); - return; - } - } - if (ctx->Stencil._Enabled) { /* Combined Z/stencil tests */ if (!_swrast_stencil_and_ztest_span(ctx, span)) { -- cgit v1.2.3 From a64bbdaa3e0b036a880d6db65ceb4a66205062f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 18:31:55 -0600 Subject: softpipe: fix incorrect tri vertex order for PIPE_PRIM_POLYGON rendering This fixes incorrect front/back-face orientation. --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 329c92b8da..56f12b9810 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -420,8 +420,8 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) */ for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, - get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, 0, stride)); } break; -- cgit v1.2.3 From 086ecea179ed572c89aa77c5f465671a5cef87a7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 3 Jun 2009 18:33:07 -0600 Subject: softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw() Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN. This is a follow-on to commit a59575d8fbe8b0ca053cc8366ce7a42bc660158a. --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 56f12b9810..06725fd09b 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -236,7 +236,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, @@ -256,7 +255,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[0], stride), @@ -264,6 +262,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + case PIPE_PRIM_QUADS: for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, @@ -277,6 +276,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + case PIPE_PRIM_QUAD_STRIP: for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, @@ -290,6 +290,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + + case PIPE_PRIM_POLYGON: + for (i = 2; i < nr; i += 1) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[0-1], stride), + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[0], stride)); + } + break; + default: assert(0); } -- cgit v1.2.3 From 1b6f7fb7d5a9756c97e2ac2f5390b0d2333acf55 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2009 09:40:44 +0000 Subject: i915: Remove some long-dead i830 code. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 3bf02de61f..a725c7afa8 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -718,26 +718,6 @@ i830_set_draw_region(struct intel_context *intel, i830_state_draw_region(intel, &i830->state, color_regions[0], depth_region); } -#if 0 -static void -i830_update_color_z_regions(intelContextPtr intel, - const intelRegion * colorRegion, - const intelRegion * depthRegion) -{ - i830ContextPtr i830 = I830_CONTEXT(intel); - - i830->state.Buffer[I830_DESTREG_CBUFADDR1] = - (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(colorRegion->pitch) | - BUF_3D_USE_FENCE); - i830->state.Buffer[I830_DESTREG_CBUFADDR2] = colorRegion->offset; - - i830->state.Buffer[I830_DESTREG_DBUFADDR1] = - (BUF_3D_ID_DEPTH | BUF_3D_PITCH(depthRegion->pitch) | BUF_3D_USE_FENCE); - i830->state.Buffer[I830_DESTREG_DBUFADDR2] = depthRegion->offset; -} -#endif - - /* This isn't really handled at the moment. */ static void -- cgit v1.2.3 From 165ae5e2fb57bdb64b4cf01271b4effeb811f675 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2009 10:21:29 +0000 Subject: i915: Don't rely on fence regs when we don't have to. We're on the way to telling the kernel about when we need fence regs on our objects or not, and this will cut the number of places needing them. --- src/mesa/drivers/dri/i915/i830_reg.h | 13 ----------- src/mesa/drivers/dri/i915/i830_texstate.c | 10 +++++---- src/mesa/drivers/dri/i915/i830_vtbl.c | 20 +++++------------ src/mesa/drivers/dri/i915/i915_reg.h | 14 ------------ src/mesa/drivers/dri/i915/i915_texstate.c | 9 ++++++-- src/mesa/drivers/dri/i915/i915_vtbl.c | 35 ++++++++++++++++++------------ src/mesa/drivers/dri/intel/intel_context.h | 3 +++ src/mesa/drivers/dri/intel/intel_reg.h | 13 +++++++++++ 8 files changed, 55 insertions(+), 62 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_reg.h b/src/mesa/drivers/dri/i915/i830_reg.h index d210c2d08e..db16871001 100644 --- a/src/mesa/drivers/dri/i915/i830_reg.h +++ b/src/mesa/drivers/dri/i915/i830_reg.h @@ -48,19 +48,6 @@ #define AA_LINE_ENABLE ((1<<1) | 1) #define AA_LINE_DISABLE (1<<1) -#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) -/* Dword 1 */ -#define BUF_3D_ID_COLOR_BACK (0x3<<24) -#define BUF_3D_ID_DEPTH (0x7<<24) -#define BUF_3D_USE_FENCE (1<<23) -#define BUF_3D_TILED_SURFACE (1<<22) -#define BUF_3D_TILE_WALK_X 0 -#define BUF_3D_TILE_WALK_Y (1<<21) -#define BUF_3D_PITCH(x) (((x)/4)<<2) -/* Dword 2 */ -#define BUF_3D_ADDR(x) ((x) & ~0x3) - - #define _3DSTATE_COLOR_FACTOR_CMD (CMD_3D | (0x1d<<24) | (0x1<<16)) #define _3DSTATE_COLOR_FACTOR_N_CMD(stage) (CMD_3D | (0x1d<<24) | \ diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 753c25b57e..6f998fa6f7 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -174,14 +174,16 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 | (LOAD_TEXTURE_MAP0 << unit) | 4); -/* state[I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE | */ -/* t->intel.TextureOffset); */ - - state[I830_TEXREG_TM0S1] = (((firstImage->Height - 1) << TM0S1_HEIGHT_SHIFT) | ((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) | format); + if (intelObj->mt->region->tiling != I915_TILING_NONE) { + state[I830_TEXREG_TM0S1] |= TM0S1_TILED_SURFACE; + if (intelObj->mt->region->tiling == I915_TILING_Y) + state[I830_TEXREG_TM0S1] |= TM0S1_TILE_WALK; + } + state[I830_TEXREG_TM0S2] = ((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT) | TM0S2_CUBE_FACE_ENA_MASK); diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index a725c7afa8..cbee9f9efe 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -552,7 +552,7 @@ i830_emit_state(struct intel_context *intel) if (state->tex_buffer[i]) { OUT_RELOC(state->tex_buffer[i], I915_GEM_DOMAIN_SAMPLER, 0, - state->tex_offset[i] | TM0S0_USE_FENCE); + state->tex_offset[i]); } else if (state == &i830->meta) { assert(i == 0); @@ -634,21 +634,11 @@ i830_state_draw_region(struct intel_context *intel, /* * Set stride/cpp values */ - if (color_region) { - state->Buffer[I830_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD; - state->Buffer[I830_DESTREG_CBUFADDR1] = - (BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(color_region->pitch * color_region->cpp) | - BUF_3D_USE_FENCE); - } + i915_set_buf_info_for_region(&state->Buffer[I830_DESTREG_CBUFADDR0], + color_region, BUF_3D_ID_COLOR_BACK); - if (depth_region) { - state->Buffer[I830_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD; - state->Buffer[I830_DESTREG_DBUFADDR1] = - (BUF_3D_ID_DEPTH | - BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) | - BUF_3D_USE_FENCE); - } + i915_set_buf_info_for_region(&state->Buffer[I830_DESTREG_DBUFADDR0], + depth_region, BUF_3D_ID_DEPTH); /* * Compute/set I830_DESTREG_DV1 value diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h index 8891e11c6f..b02e2c7628 100644 --- a/src/mesa/drivers/dri/i915/i915_reg.h +++ b/src/mesa/drivers/dri/i915/i915_reg.h @@ -93,20 +93,6 @@ /* 3DSTATE_BIN_CONTROL p141 */ -/* p143 */ -#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) -/* Dword 1 */ -#define BUF_3D_ID_COLOR_BACK (0x3<<24) -#define BUF_3D_ID_DEPTH (0x7<<24) -#define BUF_3D_USE_FENCE (1<<23) -#define BUF_3D_TILED_SURFACE (1<<22) -#define BUF_3D_TILE_WALK_X 0 -#define BUF_3D_TILE_WALK_Y (1<<21) -#define BUF_3D_PITCH(x) (((x)/4)<<2) -/* Dword 2 */ -#define BUF_3D_ADDR(x) ((x) & ~0x3) - - /* 3DSTATE_CHROMA_KEY */ /* 3DSTATE_CLEAR_PARAMETERS, p150 */ diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index a37dd7f4fb..32d4b30cf9 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -185,8 +185,13 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) state[I915_TEXREG_MS3] = (((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) | - ((firstImage->Width - 1) << MS3_WIDTH_SHIFT) | format | - MS3_USE_FENCE_REGS); + ((firstImage->Width - 1) << MS3_WIDTH_SHIFT) | format); + + if (intelObj->mt->region->tiling != I915_TILING_NONE) { + state[I915_TEXREG_MS3] |= MS3_TILED_SURFACE; + if (intelObj->mt->region->tiling == I915_TILING_Y) + state[I915_TEXREG_MS3] |= MS3_TILE_WALK; + } state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 115004616f..6ecbc4709b 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -529,6 +529,23 @@ i915_destroy_context(struct intel_context *intel) _tnl_free_vertices(&intel->ctx); } +void +i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region, + uint32_t buffer_id) +{ + state[0] = _3DSTATE_BUF_INFO_CMD; + state[1] = buffer_id; + + if (region != NULL) { + state[1] |= BUF_3D_PITCH(region->pitch * region->cpp); + + if (region->tiling != I915_TILING_NONE) { + state[1] |= BUF_3D_TILED_SURFACE; + if (region->tiling == I915_TILING_Y) + state[1] |= BUF_3D_TILE_WALK_Y; + } + } +} /** * Set the drawing regions for the color and depth/stencil buffers. @@ -562,21 +579,11 @@ i915_state_draw_region(struct intel_context *intel, /* * Set stride/cpp values */ - if (color_region) { - state->Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD; - state->Buffer[I915_DESTREG_CBUFADDR1] = - (BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(color_region->pitch * color_region->cpp) | - BUF_3D_USE_FENCE); - } + i915_set_buf_info_for_region(&state->Buffer[I915_DESTREG_CBUFADDR0], + color_region, BUF_3D_ID_COLOR_BACK); - if (depth_region) { - state->Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD; - state->Buffer[I915_DESTREG_DBUFADDR1] = - (BUF_3D_ID_DEPTH | - BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) | - BUF_3D_USE_FENCE); - } + i915_set_buf_info_for_region(&state->Buffer[I915_DESTREG_DBUFADDR0], + depth_region, BUF_3D_ID_DEPTH); /* * Compute/set I915_DESTREG_DV1 value diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 8b68cc3f04..810f3e62d9 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -559,6 +559,9 @@ void intel_viewport(GLcontext * ctx, GLint x, GLint y, void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable); +void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region, + uint32_t buffer_id); + /*====================================================================== * Inline conversion functions. * These are better-typed than the macros used previously: diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h index 57ac8f0cc1..d19f1bae34 100644 --- a/src/mesa/drivers/dri/intel/intel_reg.h +++ b/src/mesa/drivers/dri/intel/intel_reg.h @@ -189,6 +189,19 @@ #define S7_DEPTH_OFFSET_CONST_MASK ~0 +/* p143 */ +#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) +/* Dword 1 */ +#define BUF_3D_ID_COLOR_BACK (0x3<<24) +#define BUF_3D_ID_DEPTH (0x7<<24) +#define BUF_3D_USE_FENCE (1<<23) +#define BUF_3D_TILED_SURFACE (1<<22) +#define BUF_3D_TILE_WALK_X 0 +#define BUF_3D_TILE_WALK_Y (1<<21) +#define BUF_3D_PITCH(x) (((x)/4)<<2) +/* Dword 2 */ +#define BUF_3D_ADDR(x) ((x) & ~0x3) + /* Primitive dispatch on 830-945 */ #define _3DPRIMITIVE (CMD_3D | (0x1f << 24)) #define PRIM_INDIRECT (1<<23) -- cgit v1.2.3 From 1ba96651e12b3c74fb9c8f5a61b183ef36a27b1e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Jun 2009 16:40:20 +0000 Subject: intel: Add support for tiled textures. This is about a 30% performance win in OA with high settings on my GM45, and experiments with 915GM indicate that it'll be around a 20% win there. Currently, 915-class hardware is seriously hurt by the fact that we use fence regs to control the tiling even for 3D instructions that could live without them, so we spend a bunch of time waiting on previous rendering in order to pull fences off. Thus, the texture_tiling driconf option defaults off there for now. --- src/mesa/drivers/dri/i915/i915_tex_layout.c | 47 +++++++++++++++----------- src/mesa/drivers/dri/i965/brw_tex_layout.c | 9 ++--- src/mesa/drivers/dri/intel/intel_context.c | 2 ++ src/mesa/drivers/dri/intel/intel_context.h | 2 ++ src/mesa/drivers/dri/intel/intel_fbo.c | 3 +- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 29 ++++++++++++---- src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 10 ++++-- src/mesa/drivers/dri/intel/intel_regions.c | 23 +++++++++++-- src/mesa/drivers/dri/intel/intel_regions.h | 3 +- src/mesa/drivers/dri/intel/intel_screen.c | 13 ++++++- src/mesa/drivers/dri/intel/intel_tex_copy.c | 8 +++-- src/mesa/drivers/dri/intel/intel_tex_layout.c | 11 ++++-- src/mesa/drivers/dri/intel/intel_tex_layout.h | 4 ++- 13 files changed, 120 insertions(+), 44 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c index 40bcf7a9af..d9588e5b56 100644 --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c @@ -112,7 +112,8 @@ static GLint bottom_offsets[6] = { */ static void i915_miptree_layout_cube(struct intel_context *intel, - struct intel_mipmap_tree * mt) + struct intel_mipmap_tree * mt, + uint32_t tiling) { const GLuint dim = mt->width0; GLuint face; @@ -122,7 +123,7 @@ i915_miptree_layout_cube(struct intel_context *intel, assert(lvlWidth == lvlHeight); /* cubemap images are square */ /* double pitch for cube layouts */ - mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, dim * 2); mt->total_height = dim * 4; for (level = mt->first_level; level <= mt->last_level; level++) { @@ -156,7 +157,8 @@ i915_miptree_layout_cube(struct intel_context *intel, static void i915_miptree_layout_3d(struct intel_context *intel, - struct intel_mipmap_tree * mt) + struct intel_mipmap_tree * mt, + uint32_t tiling) { GLuint width = mt->width0; GLuint height = mt->height0; @@ -165,7 +167,7 @@ i915_miptree_layout_3d(struct intel_context *intel, GLint level; /* Calculate the size of a single slice. */ - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0); /* XXX: hardware expects/requires 9 levels at minimum. */ for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) { @@ -200,14 +202,15 @@ i915_miptree_layout_3d(struct intel_context *intel, static void i915_miptree_layout_2d(struct intel_context *intel, - struct intel_mipmap_tree * mt) + struct intel_mipmap_tree * mt, + uint32_t tiling) { GLuint width = mt->width0; GLuint height = mt->height0; GLuint img_height; GLint level; - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0); mt->total_height = 0; for (level = mt->first_level; level <= mt->last_level; level++) { @@ -228,19 +231,20 @@ i915_miptree_layout_2d(struct intel_context *intel, } GLboolean -i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt, + uint32_t tiling) { switch (mt->target) { case GL_TEXTURE_CUBE_MAP: - i915_miptree_layout_cube(intel, mt); + i915_miptree_layout_cube(intel, mt, tiling); break; case GL_TEXTURE_3D: - i915_miptree_layout_3d(intel, mt); + i915_miptree_layout_3d(intel, mt, tiling); break; case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE_ARB: - i915_miptree_layout_2d(intel, mt); + i915_miptree_layout_2d(intel, mt, tiling); break; default: _mesa_problem(NULL, "Unexpected tex target in i915_miptree_layout()"); @@ -317,7 +321,8 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) static void i945_miptree_layout_cube(struct intel_context *intel, - struct intel_mipmap_tree * mt) + struct intel_mipmap_tree * mt, + uint32_t tiling) { const GLuint dim = mt->width0; GLuint face; @@ -331,9 +336,9 @@ i945_miptree_layout_cube(struct intel_context *intel, * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (dim > 32) - mt->pitch = intel_miptree_pitch_align (intel, mt, dim * 2); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, dim * 2); else - mt->pitch = intel_miptree_pitch_align (intel, mt, 14 * 8); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, 14 * 8); if (dim >= 4) mt->total_height = dim * 4 + 4; @@ -408,7 +413,8 @@ i945_miptree_layout_cube(struct intel_context *intel, static void i945_miptree_layout_3d(struct intel_context *intel, - struct intel_mipmap_tree * mt) + struct intel_mipmap_tree * mt, + uint32_t tiling) { GLuint width = mt->width0; GLuint height = mt->height0; @@ -417,7 +423,7 @@ i945_miptree_layout_3d(struct intel_context *intel, GLuint pack_y_pitch; GLuint level; - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0); mt->total_height = 0; pack_y_pitch = MAX2(mt->height0, 2); @@ -462,22 +468,23 @@ i945_miptree_layout_3d(struct intel_context *intel, } GLboolean -i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt) +i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt, + uint32_t tiling) { switch (mt->target) { case GL_TEXTURE_CUBE_MAP: if (mt->compressed) - i945_miptree_layout_cube(intel, mt); + i945_miptree_layout_cube(intel, mt, tiling); else - i915_miptree_layout_cube(intel, mt); + i915_miptree_layout_cube(intel, mt, tiling); break; case GL_TEXTURE_3D: - i945_miptree_layout_3d(intel, mt); + i945_miptree_layout_3d(intel, mt, tiling); break; case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE_ARB: - i945_miptree_layout_2d(intel, mt); + i945_miptree_layout_2d(intel, mt, tiling); break; default: _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()"); diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index be8ce546a9..5c5455813a 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -40,7 +40,8 @@ #define FILE_DEBUG_FLAG DEBUG_MIPTREE GLboolean brw_miptree_layout(struct intel_context *intel, - struct intel_mipmap_tree *mt) + struct intel_mipmap_tree *mt, + uint32_t tiling) { /* XXX: these vary depending on image format: */ /* GLint align_w = 4; */ @@ -64,8 +65,8 @@ GLboolean brw_miptree_layout(struct intel_context *intel, mt->pitch = ALIGN(width, align_w); pack_y_pitch = (height + 3) / 4; } else { - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->width0); - pack_y_pitch = ALIGN(mt->height0, align_h); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0); + pack_y_pitch = ALIGN(mt->height0, align_h); } pack_x_pitch = mt->pitch; @@ -122,7 +123,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel, } default: - i945_miptree_layout_2d(intel, mt); + i945_miptree_layout_2d(intel, mt, tiling); break; } DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index ea43009f4c..fa931d7f62 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -724,6 +724,8 @@ intelInitContext(struct intel_context *intel, else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } + intel->use_texture_tiling = driQueryOptionb(&intel->optionCache, + "texture_tiling"); intel->prim.primitive = ~0; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 810f3e62d9..4e45f1a91f 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -305,6 +305,8 @@ struct intel_context */ GLboolean is_front_buffer_rendering; + GLboolean use_texture_tiling; + drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */ int perf_boxes; diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 04723a2f91..0ea413aee1 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -217,7 +217,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width, height, pitch); - irb->region = intel_region_alloc(intel, cpp, width, height, pitch, + irb->region = intel_region_alloc(intel, I915_TILING_NONE, + cpp, width, height, pitch, GL_TRUE); if (!irb->region) return GL_FALSE; /* out of memory? */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index f3652720ec..0d34f28311 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -57,7 +57,8 @@ intel_miptree_create_internal(struct intel_context *intel, GLuint last_level, GLuint width0, GLuint height0, - GLuint depth0, GLuint cpp, GLuint compress_byte) + GLuint depth0, GLuint cpp, GLuint compress_byte, + uint32_t tiling) { GLboolean ok; struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1); @@ -81,11 +82,11 @@ intel_miptree_create_internal(struct intel_context *intel, #ifdef I915 if (IS_945(intel->intelScreen->deviceID)) - ok = i945_miptree_layout(intel, mt); + ok = i945_miptree_layout(intel, mt, tiling); else - ok = i915_miptree_layout(intel, mt); + ok = i915_miptree_layout(intel, mt, tiling); #else - ok = brw_miptree_layout(intel, mt); + ok = brw_miptree_layout(intel, mt, tiling); #endif if (!ok) { @@ -109,10 +110,18 @@ intel_miptree_create(struct intel_context *intel, GLboolean expect_accelerated_upload) { struct intel_mipmap_tree *mt; + uint32_t tiling; + + if (intel->use_texture_tiling && compress_byte == 0 && + intel->intelScreen->kernel_exec_fencing) + tiling = I915_TILING_X; + else + tiling = I915_TILING_NONE; mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, width0, - height0, depth0, cpp, compress_byte); + height0, depth0, cpp, compress_byte, + tiling); /* * pitch == 0 || height == 0 indicates the null texture */ @@ -120,6 +129,7 @@ intel_miptree_create(struct intel_context *intel, return NULL; mt->region = intel_region_alloc(intel, + tiling, mt->cpp, mt->pitch, mt->total_height, @@ -149,7 +159,8 @@ intel_miptree_create_for_region(struct intel_context *intel, mt = intel_miptree_create_internal(intel, target, internal_format, first_level, last_level, region->width, region->height, 1, - region->cpp, compress_byte); + region->cpp, compress_byte, + I915_TILING_NONE); if (!mt) return mt; #if 0 @@ -187,6 +198,7 @@ intel_miptree_create_for_region(struct intel_context *intel, int intel_miptree_pitch_align (struct intel_context *intel, struct intel_mipmap_tree *mt, + uint32_t tiling, int pitch) { #ifdef I915 @@ -207,6 +219,11 @@ int intel_miptree_pitch_align (struct intel_context *intel, pitch_align = 4; } + if (tiling == I915_TILING_X) + pitch_align = 512; + else if (tiling == I915_TILING_Y) + pitch_align = 128; + pitch = ALIGN(pitch * mt->cpp, pitch_align); #ifdef I915 diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index 4060b9df78..3af9966827 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -148,6 +148,7 @@ intel_miptree_create_for_region(struct intel_context *intel, int intel_miptree_pitch_align (struct intel_context *intel, struct intel_mipmap_tree *mt, + uint32_t tiling, int pitch); void intel_miptree_reference(struct intel_mipmap_tree **dst, @@ -218,10 +219,13 @@ void intel_miptree_image_copy(struct intel_context *intel, /* i915_mipmap_tree.c: */ GLboolean i915_miptree_layout(struct intel_context *intel, - struct intel_mipmap_tree *mt); + struct intel_mipmap_tree *mt, + uint32_t tiling); GLboolean i945_miptree_layout(struct intel_context *intel, - struct intel_mipmap_tree *mt); + struct intel_mipmap_tree *mt, + uint32_t tiling); GLboolean brw_miptree_layout(struct intel_context *intel, - struct intel_mipmap_tree *mt); + struct intel_mipmap_tree *mt, + uint32_t tiling); #endif diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 534e75efe1..fd9bf7b174 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -116,7 +116,10 @@ intel_region_map(struct intel_context *intel, struct intel_region *region) if (region->pbo) intel_region_cow(intel, region); - dri_bo_map(region->buffer, GL_TRUE); + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_map_gtt(region->buffer); + else + dri_bo_map(region->buffer, GL_TRUE); region->map = region->buffer->virtual; } @@ -128,7 +131,10 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region) { _DBG("%s %p\n", __FUNCTION__, region); if (!--region->map_refcount) { - dri_bo_unmap(region->buffer); + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_map_gtt(region->buffer); + else + dri_bo_unmap(region->buffer); region->map = NULL; } } @@ -164,10 +170,12 @@ intel_region_alloc_internal(struct intel_context *intel, struct intel_region * intel_region_alloc(struct intel_context *intel, + uint32_t tiling, GLuint cpp, GLuint width, GLuint height, GLuint pitch, GLboolean expect_accelerated_upload) { dri_bo *buffer; + struct intel_region *region; if (expect_accelerated_upload) { buffer = drm_intel_bo_alloc_for_render(intel->bufmgr, "region", @@ -177,7 +185,16 @@ intel_region_alloc(struct intel_context *intel, pitch * cpp * height, 64); } - return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer); + region = intel_region_alloc_internal(intel, cpp, width, height, + pitch, buffer); + + if (tiling != I915_TILING_NONE) { + assert(((pitch * cpp) & 511) == 0); + drm_intel_bo_set_tiling(buffer, &tiling, pitch * cpp); + drm_intel_bo_get_tiling(buffer, ®ion->tiling, ®ion->bit_6_swizzle); + } + + return region; } struct intel_region * diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 45e2bf4e77..bd3c8e7325 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -73,7 +73,8 @@ struct intel_region * copied by calling intel_reference_region(). */ struct intel_region *intel_region_alloc(struct intel_context *intel, - GLuint cpp, GLuint width, + uint32_t tiling, + GLuint cpp, GLuint width, GLuint height, GLuint pitch, GLboolean expect_accelerated_upload); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 2728823142..6521b4ef31 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -49,6 +49,10 @@ #include "i915_drm.h" #include "i830_dri.h" +#define DRI_CONF_TEXTURE_TILING(def) \ + DRI_CONF_OPT_BEGIN(texture_tiling, bool, def) \ + DRI_CONF_DESC(en, "Enable texture tiling") \ + DRI_CONF_OPT_END \ PUBLIC const char __driConfigOptions[] = DRI_CONF_BEGIN @@ -64,6 +68,13 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_ENUM(1, "Enable reuse of all sizes of buffer objects") DRI_CONF_DESC_END DRI_CONF_OPT_END + +#ifdef I915 + DRI_CONF_TEXTURE_TILING(false) +#else + DRI_CONF_TEXTURE_TILING(true) +#endif + DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_FORCE_S3TC_ENABLE(false) @@ -76,7 +87,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 8; +const GLuint __driNConfigOptions = 9; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index a25626ae28..673b8fa6a1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -118,8 +118,12 @@ do_copy_texsubimage(struct intel_context *intel, dstx += x - orig_x; dsty += y - orig_y; - /* image_offset may be non-page-aligned, but that's illegal for tiling. */ - assert(intelImage->mt->region->tiling == I915_TILING_NONE); + /* Can't blit to tiled buffers with non-tile-aligned offset. */ + if (intelImage->mt->region->tiling != I915_TILING_NONE && + (image_offset & 4095) != 0) { + UNLOCK_HARDWARE(intel); + return GL_FALSE; + } if (ctx->ReadBuffer->Name == 0) { /* reading from a window, adjust x, y */ diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index e6f9a41779..b8be7ef41a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -52,7 +52,9 @@ GLuint intel_compressed_alignment(GLenum internalFormat) return alignment; } -void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt ) +void i945_miptree_layout_2d( struct intel_context *intel, + struct intel_mipmap_tree *mt, + uint32_t tiling ) { GLint align_h = 2, align_w = 4; GLuint level; @@ -86,13 +88,18 @@ void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tr if (mip1_width > mt->pitch) { mt->pitch = mip1_width; + + if (tiling == I915_TILING_X) + mt->pitch = ALIGN(mt->pitch * mt->cpp, 512) / mt->cpp; + if (tiling == I915_TILING_Y) + mt->pitch = ALIGN(mt->pitch * mt->cpp, 128) / mt->cpp; } } /* Pitch must be a whole number of dwords, even though we * express it in texels. */ - mt->pitch = intel_miptree_pitch_align (intel, mt, mt->pitch); + mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->pitch); mt->total_height = 0; for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.h b/src/mesa/drivers/dri/intel/intel_tex_layout.h index dbc90e6f9b..7bc25b6bcb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -38,5 +38,7 @@ static GLuint minify( GLuint d ) return MAX2(1, d>>1); } -extern void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt ); +extern void i945_miptree_layout_2d(struct intel_context *intel, + struct intel_mipmap_tree *mt, + uint32_t tiling); extern GLuint intel_compressed_alignment(GLenum); -- cgit v1.2.3 From 73a48a8af3c7fa820ba6850e6bfc51dac4ef9488 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 10:27:47 -0600 Subject: mesa: upgrade glext.h to version 52 A number of the PFNGL* function typedefs are now in glext.h and must be omitted from the gl.h file. gl.h will be pruned in the next commit. --- include/GL/gl.h | 6 +- include/GL/glext.h | 488 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 312 insertions(+), 182 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index aad51214fb..abc777f4e1 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -1739,6 +1739,7 @@ GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); +#if 0 typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); @@ -1773,7 +1774,7 @@ typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenu typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); - +#endif /* @@ -1978,6 +1979,7 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); +#if 0 typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); @@ -2024,7 +2026,7 @@ typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); - +#endif /* * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) diff --git a/include/GL/glext.h b/include/GL/glext.h index 41149c935a..5429287d3f 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2007 The Khronos Group Inc. +** Copyright (c) 2007-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -28,6 +28,13 @@ extern "C" { ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated $Date: 2009-05-05 15:27:42 -0700 (Tue, 05 May 2009) $ */ +/* Current version at http://www.opengl.org/registry/ */ +#define GL_GLEXT_VERSION 52 + +/* Function declaration macros - to move into glplatform.h */ + #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) #define WIN32_LEAN_AND_MEAN 1 #include @@ -45,18 +52,12 @@ extern "C" { /*************************************************************/ -/* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2009/03/19 */ -/* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 48 - #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_RESCALE_NORMAL 0x803A #define GL_TEXTURE_BINDING_3D 0x806A #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C @@ -83,17 +84,21 @@ extern "C" { #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #endif +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif + #ifndef GL_ARB_imaging #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 @@ -106,6 +111,9 @@ extern "C" { #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif + +#ifndef GL_ARB_imaging_DEPRECATED #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 @@ -206,12 +214,6 @@ extern "C" { #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F @@ -220,9 +222,6 @@ extern "C" { #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 @@ -233,10 +232,6 @@ extern "C" { #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF @@ -245,6 +240,22 @@ extern "C" { #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 @@ -276,16 +287,26 @@ extern "C" { #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_FOG_COORDINATE_SOURCE 0x8450 #define GL_FOG_COORDINATE 0x8451 #define GL_FRAGMENT_DEPTH 0x8452 @@ -301,15 +322,8 @@ extern "C" { #define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D #define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_R_TO_TEXTURE 0x884E #endif @@ -324,15 +338,6 @@ extern "C" { #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F #define GL_READ_ONLY 0x88B8 #define GL_WRITE_ONLY 0x88B9 @@ -350,31 +355,42 @@ extern "C" { #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 -#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE -#define GL_FOG_COORD GL_FOG_COORDINATE -#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE -#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE -#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE -#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER -#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#define GL_SRC0_RGB GL_SOURCE0_RGB -#define GL_SRC1_RGB GL_SOURCE1_RGB -#define GL_SRC2_RGB GL_SOURCE2_RGB -#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA -#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA -#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_1_5_DEPRECATED +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A #endif #ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_RGB 0x8009 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 @@ -398,11 +414,8 @@ extern "C" { #define GL_DRAW_BUFFER14 0x8833 #define GL_DRAW_BUFFER15 0x8834 #define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_COORDS 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 @@ -453,8 +466,14 @@ extern "C" { #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #endif +#ifndef GL_VERSION_2_0_DEPRECATED +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#endif + #ifndef GL_VERSION_2_1 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED @@ -469,25 +488,29 @@ extern "C" { #define GL_SRGB8 0x8C41 #define GL_SRGB_ALPHA 0x8C42 #define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#endif + +#ifndef GL_VERSION_2_1_DEPRECATED +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_SLUMINANCE_ALPHA 0x8C44 #define GL_SLUMINANCE8_ALPHA8 0x8C45 #define GL_SLUMINANCE 0x8C46 #define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 #define GL_COMPRESSED_SLUMINANCE 0x8C4A #define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B #endif #ifndef GL_VERSION_3_0 -#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB -#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0 -#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1 -#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2 -#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3 -#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4 -#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5 -#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_MAX_CLIP_DISTANCES 0x0D32 #define GL_MAJOR_VERSION 0x821B #define GL_MINOR_VERSION 0x821C #define GL_NUM_EXTENSIONS 0x821D @@ -505,19 +528,9 @@ extern "C" { #define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF #define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_CLAMP_READ_COLOR 0x891C #define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_MAX_VARYING_COMPONENTS 0x8B4B #define GL_TEXTURE_1D_ARRAY 0x8C18 #define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 #define GL_TEXTURE_2D_ARRAY 0x8C1A @@ -559,7 +572,6 @@ extern "C" { #define GL_RED_INTEGER 0x8D94 #define GL_GREEN_INTEGER 0x8D95 #define GL_BLUE_INTEGER 0x8D96 -#define GL_ALPHA_INTEGER 0x8D97 #define GL_RGB_INTEGER 0x8D98 #define GL_RGBA_INTEGER 0x8D99 #define GL_BGR_INTEGER 0x8D9A @@ -615,8 +627,6 @@ extern "C" { /* reuse GL_TEXTURE_GREEN_TYPE */ /* reuse GL_TEXTURE_BLUE_TYPE */ /* reuse GL_TEXTURE_ALPHA_TYPE */ -/* reuse GL_TEXTURE_LUMINANCE_TYPE */ -/* reuse GL_TEXTURE_INTENSITY_TYPE */ /* reuse GL_TEXTURE_DEPTH_TYPE */ /* reuse GL_UNSIGNED_NORMALIZED */ /* reuse GL_FRAMEBUFFER_BINDING */ @@ -716,7 +726,32 @@ extern "C" { /* reuse GL_VERTEX_ARRAY_BINDING */ #endif +#ifndef GL_VERSION_3_0_DEPRECATED +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +/* Reuse tokens from ARB_framebuffer_object */ +/* reuse GL_TEXTURE_LUMINANCE_TYPE */ +/* reuse GL_TEXTURE_INTENSITY_TYPE */ +#endif + #ifndef GL_VERSION_3_1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 #define GL_RED_SNORM 0x8F90 #define GL_RG_SNORM 0x8F91 #define GL_RGB_SNORM 0x8F92 @@ -732,6 +767,41 @@ extern "C" { #define GL_SIGNED_NORMALIZED 0x8F9C #define GL_PRIMITIVE_RESTART 0x8F9D #define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +/* Reuse tokens from ARB_copy_buffer */ +/* reuse GL_COPY_READ_BUFFER */ +/* reuse GL_COPY_WRITE_BUFFER */ +/* Would reuse tokens from ARB_draw_instanced, but it has none */ +/* Reuse tokens from ARB_uniform_buffer_object */ +/* reuse GL_UNIFORM_BUFFER */ +/* reuse GL_UNIFORM_BUFFER_BINDING */ +/* reuse GL_UNIFORM_BUFFER_START */ +/* reuse GL_UNIFORM_BUFFER_SIZE */ +/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */ +/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */ +/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */ +/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */ +/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */ +/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */ +/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */ +/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */ +/* reuse GL_ACTIVE_UNIFORM_BLOCKS */ +/* reuse GL_UNIFORM_TYPE */ +/* reuse GL_UNIFORM_SIZE */ +/* reuse GL_UNIFORM_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_INDEX */ +/* reuse GL_UNIFORM_OFFSET */ +/* reuse GL_UNIFORM_ARRAY_STRIDE */ +/* reuse GL_UNIFORM_MATRIX_STRIDE */ +/* reuse GL_UNIFORM_IS_ROW_MAJOR */ +/* reuse GL_UNIFORM_BLOCK_BINDING */ +/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */ +/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_INVALID_INDEX */ #endif #ifndef GL_ARB_multitexture @@ -1251,12 +1321,17 @@ extern "C" { #define GL_FRAMEBUFFER_DEFAULT 0x8218 #define GL_FRAMEBUFFER_UNDEFINED 0x8219 #define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_INDEX 0x8222 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 #define GL_DEPTH_STENCIL 0x84F9 #define GL_UNSIGNED_INT_24_8 0x84FA #define GL_DEPTH24_STENCIL8 0x88F0 #define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING #define GL_RENDERBUFFER_BINDING 0x8CA7 @@ -1313,6 +1388,12 @@ extern "C" { #define GL_MAX_SAMPLES 0x8D57 #endif +#ifndef GL_ARB_framebuffer_object_DEPRECATED +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#endif + #ifndef GL_ARB_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif @@ -1434,7 +1515,7 @@ extern "C" { #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 #define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX_ARB 0xFFFFFFFFu +#define GL_INVALID_INDEX 0xFFFFFFFFu #endif #ifndef GL_ARB_compatibility @@ -1446,6 +1527,9 @@ extern "C" { #define GL_COPY_WRITE_BUFFER 0x8F37 #endif +#ifndef GL_ARB_shader_texture_lod +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -3431,7 +3515,7 @@ extern "C" { #endif #ifndef GL_EXT_blend_equation_separate -#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 #define GL_BLEND_EQUATION_ALPHA_EXT 0x883D #endif @@ -3968,7 +4052,7 @@ extern "C" { #include #ifndef GL_VERSION_2_0 /* GL type for program/shader text */ -typedef char GLchar; /* native character */ +typedef char GLchar; #endif #ifndef GL_VERSION_1_5 @@ -3984,12 +4068,12 @@ typedef ptrdiff_t GLsizeiptrARB; #endif #ifndef GL_ARB_shader_objects -/* GL types for handling shader object handles and program/shader text */ -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ +/* GL types for program/shader text and shader object handles */ +typedef char GLcharARB; +typedef unsigned int GLhandleARB; #endif -/* GL types for "half" precision (s10e5) float data in host memory */ +/* GL type for "half" precision (s10e5) float data in host memory */ #ifndef GL_ARB_half_float_pixel typedef unsigned short GLhalfARB; #endif @@ -4031,7 +4115,8 @@ typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #else -#include /* Fallback option */ +/* Fallback if nothing above works */ +#include #endif #endif @@ -4046,6 +4131,21 @@ typedef uint64_t GLuint64EXT; GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); GLAPI void APIENTRY glBlendEquation (GLenum); GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_VERSION_1_2_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); @@ -4078,13 +4178,7 @@ GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); GLAPI void APIENTRY glResetHistogram (GLenum); GLAPI void APIENTRY glResetMinmax (GLenum); -GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); @@ -4117,15 +4211,35 @@ typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenu typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #endif #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_VERSION_1_3_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glClientActiveTexture (GLenum); GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); @@ -4163,16 +4277,7 @@ GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); @@ -4210,31 +4315,36 @@ typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); #endif #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glFogCoordf (GLfloat); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *); -GLAPI void APIENTRY glFogCoordd (GLdouble); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); GLAPI void APIENTRY glPointParameteri (GLenum, GLint); GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_VERSION_1_4_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); @@ -4269,18 +4379,11 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *); GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); GLAPI void APIENTRY glWindowPos3sv (const GLshort *); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); @@ -4592,26 +4695,6 @@ GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsi GLAPI void APIENTRY glClampColor (GLenum, GLenum); GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum); GLAPI void APIENTRY glEndConditionalRender (void); -GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint); -GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *); GLAPI void APIENTRY glVertexAttribIPointer (GLuint, GLint, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glGetVertexAttribIiv (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint, GLenum, GLuint *); @@ -4651,26 +4734,6 @@ typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, G typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); @@ -4696,6 +4759,69 @@ typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); #endif +#ifndef GL_VERSION_3_0_DEPRECATED +#define GL_VERSION_3_0_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint); +GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +#endif + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +/* OpenGL 3.1 also reuses entry points from these extensions: */ +/* ARB_copy_buffer */ +/* ARB_uniform_buffer_object */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +GLAPI void APIENTRY glTexBuffer (GLenum, GLenum, GLuint); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +#endif + #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifdef GL_GLEXT_PROTOTYPES @@ -5360,9 +5486,9 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLen #ifndef GL_ARB_instanced_arrays #define GL_ARB_instanced_arrays 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribDivisor (GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint, GLuint); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); #endif #ifndef GL_ARB_map_buffer_range @@ -5437,6 +5563,10 @@ GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLs typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); #endif +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -8150,7 +8280,6 @@ GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *); GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *); GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *); -GLAPI void APIENTRY glVideoParameterivNV (GLuint, GLenum, const GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); @@ -8158,7 +8287,6 @@ typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); -typedef void (APIENTRYP PFNGLVIDEOPARAMETERIVNVPROC) (GLuint video_slot, GLenum pname, const GLint *params); #endif #ifndef GL_EXT_transform_feedback -- cgit v1.2.3 From d33c315d9e32584dea12cea683795b498a9f5eca Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 10:29:44 -0600 Subject: mesa: remove PFNGL typedefs that are in glext.h --- include/GL/gl.h | 87 ++------------------------------------------------------- 1 file changed, 2 insertions(+), 85 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index abc777f4e1..05362b9776 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.5 + * Version: 7.6 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1739,42 +1740,6 @@ GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); -#if 0 -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -#endif /* @@ -1979,54 +1944,6 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); -#if 0 -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); -#endif /* * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) -- cgit v1.2.3 From 81a0ef3f2068448a8b544826eaa7d3382b9c769b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 10:30:25 -0600 Subject: mesa: update wglext.h to latest version --- include/GL/wglext.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/GL/wglext.h b/include/GL/wglext.h index d54e0a4d50..dffef25178 100644 --- a/include/GL/wglext.h +++ b/include/GL/wglext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2007 The Khronos Group Inc. +** Copyright (c) 2007-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -28,6 +28,8 @@ extern "C" { ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ +/* Function declaration macros - to move into glplatform.h */ + #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) #define WIN32_LEAN_AND_MEAN 1 #include @@ -709,6 +711,14 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWO #define WGL_NV_float_buffer 1 #endif +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSetStereoEmitterState3DL (, HDC, , UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) ( HDC, HDC hDC, UINT, UINT uState); +#endif + #ifndef WGL_EXT_pixel_format_packed_float #define WGL_EXT_pixel_format_packed_float 1 #endif -- cgit v1.2.3 From 45e744dddc8a8f3b42610bfa512bc296bd5264bc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 13:08:52 -0600 Subject: tgsi: increase MAX_LABELS to 4096 --- src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 0b4b2a6fb6..da22baad3e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -34,7 +34,7 @@ extern "C" { #endif -#define MAX_LABELS 1024 +#define MAX_LABELS (4 * 1024) /**< basically, max instructions */ #define NUM_CHANNELS 4 /* R,G,B,A */ #define QUAD_SIZE 4 /* 4 pixel/quad */ -- cgit v1.2.3 From d37795c45334010c70b2e1c23fca0e49ff607a6e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 13:10:19 -0600 Subject: st/mesa: increase ST_MAX_SHADER_TOKENS to 8k --- src/mesa/state_tracker/st_program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6ec633c0b4..34926101ed 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -49,7 +49,7 @@ #include "cso_cache/cso_context.h" -#define ST_MAX_SHADER_TOKENS 4096 +#define ST_MAX_SHADER_TOKENS (8 * 1024) #define TGSI_DEBUG 0 -- cgit v1.2.3 From 6907650211d136ee7cb5a8914c32196d35a75bf3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 13:12:13 -0600 Subject: softpipe: fix incorrect tri vertex order for PIPE_PRIM_POLYGON rendering This fixes incorrect front/back-face orientation. (cherry picked from commit a64bbdaa3e0b036a880d6db65ceb4a66205062f1) --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 329c92b8da..56f12b9810 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -420,8 +420,8 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) */ for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, - get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-1, stride), + get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, 0, stride)); } break; -- cgit v1.2.3 From 9424d81d18770f0c436f0876dffe07cf7c094db4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 13:13:14 -0600 Subject: softpipe: separate case for PIPE_PRIM_POLYGON in sp_vbuf_draw() Because of flat shading, we can't use same code as PIPE_PRIM_TRIANGLE_FAN. This is a follow-on to commit a59575d8fbe8b0ca053cc8366ce7a42bc660158a. (cherry picked from commit 086ecea179ed572c89aa77c5f465671a5cef87a7) --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 56f12b9810..06725fd09b 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -236,7 +236,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } break; - case PIPE_PRIM_TRIANGLES: for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, @@ -256,7 +255,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[0], stride), @@ -264,6 +262,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + case PIPE_PRIM_QUADS: for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, @@ -277,6 +276,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + case PIPE_PRIM_QUAD_STRIP: for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, @@ -290,6 +290,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride)); } break; + + case PIPE_PRIM_POLYGON: + for (i = 2; i < nr; i += 1) { + setup_tri( setup_ctx, + get_vert(vertex_buffer, indices[0-1], stride), + get_vert(vertex_buffer, indices[i-0], stride), + get_vert(vertex_buffer, indices[0], stride)); + } + break; + default: assert(0); } -- cgit v1.2.3 From 185fbcce3644ff861c60cd73923ef7187c623564 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Jun 2009 14:26:51 -0600 Subject: mesa: call _mesa_ funcs, not gl funcs for debugging --- src/mesa/main/debug.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 80bc6afc4c..7276c22742 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -24,12 +24,15 @@ */ #include "mtypes.h" +#include "attrib.h" #include "colormac.h" #include "context.h" #include "hash.h" #include "imports.h" #include "debug.h" #include "get.h" +#include "pixelstore.h" +#include "readpix.h" #include "texobj.h" #include "texformat.h" @@ -353,11 +356,11 @@ _mesa_dump_color_buffer(const char *filename) buf = (GLubyte *) _mesa_malloc(w * h * 4); - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); + _mesa_ReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buf); _mesa_printf("ReadBuffer %p 0x%x DrawBuffer %p 0x%x\n", ctx->ReadBuffer->_ColorReadBuffer, @@ -367,7 +370,7 @@ _mesa_dump_color_buffer(const char *filename) _mesa_printf("Writing %d x %d color buffer to %s\n", w, h, filename); write_ppm(filename, buf, w, h, 4, 0, 1, 2); - glPopClientAttrib(); + _mesa_PopClientAttrib(); _mesa_free(buf); } @@ -386,11 +389,11 @@ _mesa_dump_depth_buffer(const char *filename) buf = (GLuint *) _mesa_malloc(w * h * 4); /* 4 bpp */ buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - glReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buf); + _mesa_ReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buf); /* spread 24 bits of Z across R, G, B */ for (i = 0; i < w * h; i++) { @@ -402,7 +405,7 @@ _mesa_dump_depth_buffer(const char *filename) _mesa_printf("Writing %d x %d depth buffer to %s\n", w, h, filename); write_ppm(filename, buf2, w, h, 3, 0, 1, 2); - glPopClientAttrib(); + _mesa_PopClientAttrib(); _mesa_free(buf); _mesa_free(buf2); @@ -422,11 +425,11 @@ _mesa_dump_stencil_buffer(const char *filename) buf = (GLubyte *) _mesa_malloc(w * h); /* 1 bpp */ buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */ - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); + _mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + _mesa_PixelStorei(GL_PACK_ALIGNMENT, 1); + _mesa_PixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); - glReadPixels(0, 0, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); + _mesa_ReadPixels(0, 0, w, h, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); for (i = 0; i < w * h; i++) { buf2[i*3+0] = buf[i]; @@ -437,7 +440,7 @@ _mesa_dump_stencil_buffer(const char *filename) _mesa_printf("Writing %d x %d stencil buffer to %s\n", w, h, filename); write_ppm(filename, buf2, w, h, 3, 0, 1, 2); - glPopClientAttrib(); + _mesa_PopClientAttrib(); _mesa_free(buf); _mesa_free(buf2); -- cgit v1.2.3 From 384bbe278d7e634cf1af5f786bfbde651c14df62 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 4 Jun 2009 14:36:10 +0100 Subject: rbug: Update rbug protocol with new context calls --- src/gallium/auxiliary/rbug/rbug_context.c | 267 +++++++++++++++++++++++++--- src/gallium/auxiliary/rbug/rbug_context.h | 80 +++++++-- src/gallium/auxiliary/rbug/rbug_core.h | 4 + src/gallium/auxiliary/rbug/rbug_demarshal.c | 14 +- src/gallium/auxiliary/rbug/rbug_proto.h | 7 +- src/gallium/auxiliary/rbug/rbug_shader.h | 4 +- src/gallium/auxiliary/rbug/rbug_texture.h | 3 +- 7 files changed, 336 insertions(+), 43 deletions(-) diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index b4fad5300d..787f650f71 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.c +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -110,8 +110,9 @@ int rbug_send_context_info(struct rbug_connection *__con, return __ret; } -int rbug_send_context_block_draw(struct rbug_connection *__con, +int rbug_send_context_draw_block(struct rbug_connection *__con, rbug_context_t context, + rbug_block_t block, uint32_t *__serial) { uint32_t __len = 0; @@ -121,6 +122,7 @@ int rbug_send_context_block_draw(struct rbug_connection *__con, LEN(8); /* header */ LEN(8); /* context */ + LEN(4); /* block */ /* align */ PAD(__len, 8); @@ -129,9 +131,10 @@ int rbug_send_context_block_draw(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_BLOCK_DRAW)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_BLOCK)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ + WRITE(4, rbug_block_t, block); /* block */ /* final pad */ PAD(__pos, 8); @@ -139,7 +142,7 @@ int rbug_send_context_block_draw(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_BLOCK_DRAW, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_BLOCK, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -148,8 +151,50 @@ int rbug_send_context_block_draw(struct rbug_connection *__con, return __ret; } -int rbug_send_context_unblock_draw(struct rbug_connection *__con, +int rbug_send_context_draw_step(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_t step, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(4); /* step */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_STEP)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(4, rbug_block_t, step); /* step */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_STEP, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_draw_unblock(struct rbug_connection *__con, rbug_context_t context, + rbug_block_t unblock, uint32_t *__serial) { uint32_t __len = 0; @@ -159,6 +204,7 @@ int rbug_send_context_unblock_draw(struct rbug_connection *__con, LEN(8); /* header */ LEN(8); /* context */ + LEN(4); /* unblock */ /* align */ PAD(__len, 8); @@ -167,9 +213,10 @@ int rbug_send_context_unblock_draw(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ + WRITE(4, rbug_block_t, unblock); /* unblock */ /* final pad */ PAD(__pos, 8); @@ -177,7 +224,48 @@ int rbug_send_context_unblock_draw(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_UNBLOCK_DRAW, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_UNBLOCK, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_flush(struct rbug_connection *__con, + rbug_context_t context, + int32_t flags, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(4); /* flags */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(4, int32_t, flags); /* flags */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -230,10 +318,13 @@ int rbug_send_context_list_reply(struct rbug_connection *__con, int rbug_send_context_info_reply(struct rbug_connection *__con, uint32_t serial, + rbug_shader_t vertex, + rbug_shader_t fragment, rbug_texture_t *cbufs, uint32_t cbufs_len, - rbug_texture_t zdbuf, - uint8_t blocked, + rbug_texture_t zsbuf, + rbug_block_t blocker, + rbug_block_t blocked, uint32_t *__serial) { uint32_t __len = 0; @@ -243,9 +334,12 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, LEN(8); /* header */ LEN(4); /* serial */ + LEN(8); /* vertex */ + LEN(8); /* fragment */ LEN_ARRAY(8, cbufs); /* cbufs */ - LEN(8); /* zdbuf */ - LEN(1); /* blocked */ + LEN(8); /* zsbuf */ + LEN(4); /* blocker */ + LEN(4); /* blocked */ /* align */ PAD(__len, 8); @@ -257,9 +351,12 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO_REPLY)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(4, uint32_t, serial); /* serial */ + WRITE(8, rbug_shader_t, vertex); /* vertex */ + WRITE(8, rbug_shader_t, fragment); /* fragment */ WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ - WRITE(8, rbug_texture_t, zdbuf); /* zdbuf */ - WRITE(1, uint8_t, blocked); /* blocked */ + WRITE(8, rbug_texture_t, zsbuf); /* zsbuf */ + WRITE(4, rbug_block_t, blocker); /* blocker */ + WRITE(4, rbug_block_t, blocked); /* blocked */ /* final pad */ PAD(__pos, 8); @@ -276,6 +373,47 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, return __ret; } +int rbug_send_context_draw_blocked(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_t block, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(4); /* block */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_BLOCKED)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(4, rbug_block_t, block); /* block */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_BLOCKED, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header) { uint32_t len = 0; @@ -329,16 +467,72 @@ struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_h return ret; } -struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header) +struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_draw_block *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCK) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(4, rbug_block_t, block); /* block */ + + return ret; +} + +struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_draw_step *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_STEP) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(4, rbug_block_t, step); /* step */ + + return ret; +} + +struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_block_draw *ret; + struct rbug_proto_context_draw_unblock *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_BLOCK_DRAW) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK) return NULL; pos = 0; @@ -352,20 +546,21 @@ struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct ret->header.opcode = header->opcode; READ(8, rbug_context_t, context); /* context */ + READ(4, rbug_block_t, unblock); /* unblock */ return ret; } -struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header) +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_unblock_draw *ret; + struct rbug_proto_context_flush *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_UNBLOCK_DRAW) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) return NULL; pos = 0; @@ -379,6 +574,7 @@ struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(str ret->header.opcode = header->opcode; READ(8, rbug_context_t, context); /* context */ + READ(4, int32_t, flags); /* flags */ return ret; } @@ -434,9 +630,40 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct ret->header.opcode = header->opcode; READ(4, uint32_t, serial); /* serial */ + READ(8, rbug_shader_t, vertex); /* vertex */ + READ(8, rbug_shader_t, fragment); /* fragment */ READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ - READ(8, rbug_texture_t, zdbuf); /* zdbuf */ - READ(1, uint8_t, blocked); /* blocked */ + READ(8, rbug_texture_t, zsbuf); /* zsbuf */ + READ(4, rbug_block_t, blocker); /* blocker */ + READ(4, rbug_block_t, blocked); /* blocked */ + + return ret; +} + +struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_draw_blocked *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCKED) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(4, rbug_block_t, block); /* block */ return ret; } diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h index bcd2a826a7..9f1726d64d 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.h +++ b/src/gallium/auxiliary/rbug/rbug_context.h @@ -39,9 +39,13 @@ #define _RBUG_PROTO_CONTEXT_H_ #include "rbug/rbug_proto.h" -#include "rbug/rbug_texture.h" +#include "rbug/rbug_core.h" -typedef uint64_t rbug_context_t; +typedef enum +{ + RBUG_BLOCK_BEFORE = 1, + RBUG_BLOCK_AFTER = 2, +} rbug_block_t; struct rbug_proto_context_list { @@ -54,16 +58,32 @@ struct rbug_proto_context_info rbug_context_t context; }; -struct rbug_proto_context_block_draw +struct rbug_proto_context_draw_block +{ + struct rbug_header header; + rbug_context_t context; + rbug_block_t block; +}; + +struct rbug_proto_context_draw_step { struct rbug_header header; rbug_context_t context; + rbug_block_t step; }; -struct rbug_proto_context_unblock_draw +struct rbug_proto_context_draw_unblock { struct rbug_header header; rbug_context_t context; + rbug_block_t unblock; +}; + +struct rbug_proto_context_flush +{ + struct rbug_header header; + rbug_context_t context; + int32_t flags; }; struct rbug_proto_context_list_reply @@ -78,10 +98,20 @@ struct rbug_proto_context_info_reply { struct rbug_header header; uint32_t serial; + rbug_shader_t vertex; + rbug_shader_t fragment; rbug_texture_t *cbufs; uint32_t cbufs_len; - rbug_texture_t zdbuf; - uint8_t blocked; + rbug_texture_t zsbuf; + rbug_block_t blocker; + rbug_block_t blocked; +}; + +struct rbug_proto_context_draw_blocked +{ + struct rbug_header header; + rbug_context_t context; + rbug_block_t block; }; int rbug_send_context_list(struct rbug_connection *__con, @@ -91,14 +121,26 @@ int rbug_send_context_info(struct rbug_connection *__con, rbug_context_t context, uint32_t *__serial); -int rbug_send_context_block_draw(struct rbug_connection *__con, +int rbug_send_context_draw_block(struct rbug_connection *__con, rbug_context_t context, + rbug_block_t block, uint32_t *__serial); -int rbug_send_context_unblock_draw(struct rbug_connection *__con, +int rbug_send_context_draw_step(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_t step, + uint32_t *__serial); + +int rbug_send_context_draw_unblock(struct rbug_connection *__con, rbug_context_t context, + rbug_block_t unblock, uint32_t *__serial); +int rbug_send_context_flush(struct rbug_connection *__con, + rbug_context_t context, + int32_t flags, + uint32_t *__serial); + int rbug_send_context_list_reply(struct rbug_connection *__con, uint32_t serial, rbug_context_t *contexts, @@ -107,22 +149,36 @@ int rbug_send_context_list_reply(struct rbug_connection *__con, int rbug_send_context_info_reply(struct rbug_connection *__con, uint32_t serial, + rbug_shader_t vertex, + rbug_shader_t fragment, rbug_texture_t *cbufs, uint32_t cbufs_len, - rbug_texture_t zdbuf, - uint8_t blocked, + rbug_texture_t zsbuf, + rbug_block_t blocker, + rbug_block_t blocked, uint32_t *__serial); +int rbug_send_context_draw_blocked(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_t block, + uint32_t *__serial); + struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header); struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header); -struct rbug_proto_context_block_draw * rbug_demarshal_context_block_draw(struct rbug_proto_header *header); +struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header); -struct rbug_proto_context_unblock_draw * rbug_demarshal_context_unblock_draw(struct rbug_proto_header *header); +struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header); + +struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header); + +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); +struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header); + #endif diff --git a/src/gallium/auxiliary/rbug/rbug_core.h b/src/gallium/auxiliary/rbug/rbug_core.h index d63a8c8076..99a36a0163 100644 --- a/src/gallium/auxiliary/rbug/rbug_core.h +++ b/src/gallium/auxiliary/rbug/rbug_core.h @@ -40,6 +40,10 @@ #include "rbug/rbug_proto.h" +typedef uint64_t rbug_shader_t; +typedef uint64_t rbug_context_t; +typedef uint64_t rbug_texture_t; + struct rbug_proto_noop { struct rbug_header header; diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index e3c0954f9e..80894f4a64 100644 --- a/src/gallium/auxiliary/rbug/rbug_demarshal.c +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -59,14 +59,20 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) return (struct rbug_header *)rbug_demarshal_context_list(header); case RBUG_OP_CONTEXT_INFO: return (struct rbug_header *)rbug_demarshal_context_info(header); - case RBUG_OP_CONTEXT_BLOCK_DRAW: - return (struct rbug_header *)rbug_demarshal_context_block_draw(header); - case RBUG_OP_CONTEXT_UNBLOCK_DRAW: - return (struct rbug_header *)rbug_demarshal_context_unblock_draw(header); + case RBUG_OP_CONTEXT_DRAW_BLOCK: + return (struct rbug_header *)rbug_demarshal_context_draw_block(header); + case RBUG_OP_CONTEXT_DRAW_STEP: + return (struct rbug_header *)rbug_demarshal_context_draw_step(header); + case RBUG_OP_CONTEXT_DRAW_UNBLOCK: + return (struct rbug_header *)rbug_demarshal_context_draw_unblock(header); + case RBUG_OP_CONTEXT_FLUSH: + return (struct rbug_header *)rbug_demarshal_context_flush(header); case RBUG_OP_CONTEXT_LIST_REPLY: return (struct rbug_header *)rbug_demarshal_context_list_reply(header); case RBUG_OP_CONTEXT_INFO_REPLY: return (struct rbug_header *)rbug_demarshal_context_info_reply(header); + case RBUG_OP_CONTEXT_DRAW_BLOCKED: + return (struct rbug_header *)rbug_demarshal_context_draw_blocked(header); case RBUG_OP_SHADER_LIST: return (struct rbug_header *)rbug_demarshal_shader_list(header); case RBUG_OP_SHADER_INFO: diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h index 8fa1836771..db9fa68500 100644 --- a/src/gallium/auxiliary/rbug/rbug_proto.h +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -52,10 +52,13 @@ enum rbug_opcode RBUG_OP_TEXTURE_READ_REPLY = -259, RBUG_OP_CONTEXT_LIST = 512, RBUG_OP_CONTEXT_INFO = 513, - RBUG_OP_CONTEXT_BLOCK_DRAW = 514, - RBUG_OP_CONTEXT_UNBLOCK_DRAW = 515, + RBUG_OP_CONTEXT_DRAW_BLOCK = 514, + RBUG_OP_CONTEXT_DRAW_STEP = 515, + RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516, + RBUG_OP_CONTEXT_FLUSH = 518, RBUG_OP_CONTEXT_LIST_REPLY = -512, RBUG_OP_CONTEXT_INFO_REPLY = -513, + RBUG_OP_CONTEXT_DRAW_BLOCKED = 517, RBUG_OP_SHADER_LIST = 768, RBUG_OP_SHADER_INFO = 769, RBUG_OP_SHADER_DISABLE = 770, diff --git a/src/gallium/auxiliary/rbug/rbug_shader.h b/src/gallium/auxiliary/rbug/rbug_shader.h index fe1b9ac0f7..b5d886781d 100644 --- a/src/gallium/auxiliary/rbug/rbug_shader.h +++ b/src/gallium/auxiliary/rbug/rbug_shader.h @@ -39,9 +39,7 @@ #define _RBUG_PROTO_SHADER_H_ #include "rbug/rbug_proto.h" -#include "rbug/rbug_context.h" - -typedef uint64_t rbug_shader_t; +#include "rbug/rbug_core.h" struct rbug_proto_shader_list { diff --git a/src/gallium/auxiliary/rbug/rbug_texture.h b/src/gallium/auxiliary/rbug/rbug_texture.h index 2bcc3566f3..fbb247e1d4 100644 --- a/src/gallium/auxiliary/rbug/rbug_texture.h +++ b/src/gallium/auxiliary/rbug/rbug_texture.h @@ -39,8 +39,7 @@ #define _RBUG_PROTO_TEXTURE_H_ #include "rbug/rbug_proto.h" - -typedef uint64_t rbug_texture_t; +#include "rbug/rbug_core.h" struct rbug_proto_texture_list { -- cgit v1.2.3 From 76b3072e9b7b8f98e926d531c0d63a0cb294e56d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 4 Jun 2009 23:40:10 +0100 Subject: trace/rbug: Add new contexts functions to trace rbug --- src/gallium/drivers/trace/tr_context.c | 57 +++++++++++ src/gallium/drivers/trace/tr_context.h | 11 +++ src/gallium/drivers/trace/tr_rbug.c | 169 ++++++++++++++++++++++++++++++++- 3 files changed, 236 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 2ad5ca4998..b04cc2ce56 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -113,6 +113,28 @@ trace_context_set_edgeflags(struct pipe_context *_pipe, } +static INLINE void +trace_context_draw_block(struct trace_context *tr_ctx, int flag) +{ + pipe_mutex_lock(tr_ctx->draw_mutex); + + if (tr_ctx->draw_blocker & flag) { + tr_ctx->draw_blocked |= flag; + + trace_rbug_notify_draw_blocked(tr_ctx); + } + + /* wait for rbug to clear the blocked flag */ + while (tr_ctx->draw_blocked & flag) { + tr_ctx->draw_blocked |= flag; + pipe_mutex_unlock(tr_ctx->draw_mutex); + /* TODO sleep or use conditional */ + pipe_mutex_lock(tr_ctx->draw_mutex); + } + + pipe_mutex_unlock(tr_ctx->draw_mutex); +} + static INLINE boolean trace_context_draw_arrays(struct pipe_context *_pipe, unsigned mode, unsigned start, unsigned count) @@ -124,6 +146,8 @@ trace_context_draw_arrays(struct pipe_context *_pipe, if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) return 0; + trace_context_draw_block(tr_ctx, 1); + trace_dump_call_begin("pipe_context", "draw_arrays"); trace_dump_arg(ptr, pipe); @@ -137,6 +161,8 @@ trace_context_draw_arrays(struct pipe_context *_pipe, trace_dump_call_end(); + trace_context_draw_block(tr_ctx, 2); + return result; } @@ -156,6 +182,8 @@ trace_context_draw_elements(struct pipe_context *_pipe, if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) return 0; + trace_context_draw_block(tr_ctx, 1); + trace_screen_user_buffer_update(_pipe->screen, indexBuffer); trace_dump_call_begin("pipe_context", "draw_elements"); @@ -173,6 +201,8 @@ trace_context_draw_elements(struct pipe_context *_pipe, trace_dump_call_end(); + trace_context_draw_block(tr_ctx, 2); + return result; } @@ -196,6 +226,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled) return 0; + trace_context_draw_block(tr_ctx, 1); + trace_screen_user_buffer_update(_pipe->screen, indexBuffer); trace_dump_call_begin("pipe_context", "draw_range_elements"); @@ -218,6 +250,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, trace_dump_call_end(); + trace_context_draw_block(tr_ctx, 2); + return result; } @@ -782,6 +816,19 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe, struct pipe_framebuffer_state unwrapped_state; unsigned i; + { + tr_ctx->curr.nr_cbufs = state->nr_cbufs; + for (i = 0; i < state->nr_cbufs; i++) + if (state->cbufs[i]) + tr_ctx->curr.cbufs[i] = trace_texture(state->cbufs[i]->texture); + else + tr_ctx->curr.cbufs[i] = NULL; + if (state->zsbuf) + tr_ctx->curr.zsbuf = trace_texture(state->zsbuf->texture); + else + tr_ctx->curr.zsbuf = NULL; + } + /* Unwrap the input state */ memcpy(&unwrapped_state, state, sizeof(unwrapped_state)); for(i = 0; i < state->nr_cbufs; ++i) @@ -1113,6 +1160,12 @@ trace_is_buffer_referenced( struct pipe_context *_pipe, return referenced; } +static const struct debug_named_value rbug_blocker_flags[] = { + {"before", 1}, + {"after", 2}, + {NULL, 0}, +}; + struct pipe_context * trace_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) @@ -1134,6 +1187,10 @@ trace_context_create(struct pipe_screen *_screen, if(!tr_ctx) goto error1; + tr_ctx->draw_blocker = debug_get_flags_option("RBUG_BLOCK", + rbug_blocker_flags, + 0); + pipe_mutex_init(tr_ctx->draw_mutex); pipe_mutex_init(tr_ctx->list_mutex); make_empty_list(&tr_ctx->shaders); diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 86827f97b2..770e975a14 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -50,8 +50,16 @@ struct trace_context struct { struct trace_shader *fs; struct trace_shader *vs; + + unsigned nr_cbufs; + struct trace_texture *cbufs[PIPE_MAX_COLOR_BUFS]; + struct trace_texture *zsbuf; } curr; + pipe_mutex draw_mutex; + int draw_blocker; + int draw_blocked; + /* for list on screen */ struct tr_list list; @@ -75,6 +83,9 @@ struct pipe_context * trace_context_create(struct pipe_screen *screen, struct pipe_context *pipe); +void +trace_rbug_notify_draw_blocked(struct trace_context *tr_ctx); + #ifdef __cplusplus } diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index 1b26f60da4..db9de8f3c4 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -288,6 +288,147 @@ trace_rbug_context_list(struct trace_rbug *tr_rbug, struct rbug_header *header, return 0; } +static int +trace_rbug_context_info(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_info *info = (struct rbug_proto_context_info *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + rbug_texture_t cbufs[PIPE_MAX_COLOR_BUFS]; + int i; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, info->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + /* protect the pipe context */ + pipe_mutex_lock(tr_ctx->draw_mutex); + trace_dump_call_lock(); + + for (i = 0; i < tr_ctx->curr.nr_cbufs; i++) + cbufs[i] = VOID2U64(tr_ctx->curr.cbufs[i]); + + rbug_send_context_info_reply(tr_rbug->con, serial, + VOID2U64(tr_ctx->curr.vs), VOID2U64(tr_ctx->curr.fs), + cbufs, tr_ctx->curr.nr_cbufs, VOID2U64(tr_ctx->curr.zsbuf), + tr_ctx->draw_blocker, tr_ctx->draw_blocked, NULL); + + trace_dump_call_unlock(); + pipe_mutex_unlock(tr_ctx->draw_mutex); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_context_draw_block(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_draw_block *block = (struct rbug_proto_context_draw_block *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, block->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->draw_mutex); + tr_ctx->draw_blocker |= block->block; + pipe_mutex_unlock(tr_ctx->draw_mutex); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_context_draw_step(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_draw_step *step = (struct rbug_proto_context_draw_step *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, step->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->draw_mutex); + tr_ctx->draw_blocked &= ~step->step; + pipe_mutex_unlock(tr_ctx->draw_mutex); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_context_draw_unblock(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_draw_unblock *unblock = (struct rbug_proto_context_draw_unblock *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, unblock->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->draw_mutex); + tr_ctx->draw_blocked &= ~unblock->unblock; + tr_ctx->draw_blocker &= ~unblock->unblock; + pipe_mutex_unlock(tr_ctx->draw_mutex); + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + +static int +trace_rbug_context_flush(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_flush *flush = (struct rbug_proto_context_flush *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, flush->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + /* protect the pipe context */ + trace_dump_call_lock(); + + tr_ctx->pipe->flush(tr_ctx->pipe, flush->flags, NULL); + + trace_dump_call_unlock(); + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + static int trace_rbug_shader_list(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) { @@ -512,6 +653,21 @@ trace_rbug_header(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32 case RBUG_OP_CONTEXT_LIST: ret = trace_rbug_context_list(tr_rbug, header, serial); break; + case RBUG_OP_CONTEXT_INFO: + ret = trace_rbug_context_info(tr_rbug, header, serial); + break; + case RBUG_OP_CONTEXT_DRAW_BLOCK: + ret = trace_rbug_context_draw_block(tr_rbug, header, serial); + break; + case RBUG_OP_CONTEXT_DRAW_STEP: + ret = trace_rbug_context_draw_step(tr_rbug, header, serial); + break; + case RBUG_OP_CONTEXT_DRAW_UNBLOCK: + ret = trace_rbug_context_draw_unblock(tr_rbug, header, serial); + break; + case RBUG_OP_CONTEXT_FLUSH: + ret = trace_rbug_context_flush(tr_rbug, header, serial); + break; case RBUG_OP_SHADER_LIST: ret = trace_rbug_shader_list(tr_rbug, header, serial); break; @@ -610,7 +766,7 @@ PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug) struct trace_rbug * trace_rbug_start(struct trace_screen *tr_scr) { - struct trace_rbug *tr_rbug = MALLOC_STRUCT(trace_rbug); + struct trace_rbug *tr_rbug = CALLOC_STRUCT(trace_rbug); if (!tr_rbug) return NULL; @@ -634,3 +790,14 @@ trace_rbug_stop(struct trace_rbug *tr_rbug) return; } + +void +trace_rbug_notify_draw_blocked(struct trace_context *tr_ctx) +{ + struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); + struct trace_rbug *tr_rbug = tr_scr->rbug; + + if (tr_rbug && tr_rbug->con) + rbug_send_context_draw_blocked(tr_rbug->con, + VOID2U64(tr_ctx), tr_ctx->draw_blocked, NULL); +} -- cgit v1.2.3 From d4c578ae415623bdbc12885f93405b43141cc09a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 5 Jun 2009 02:57:19 +0100 Subject: gallium: Make pipe thread say if it has condvars or not --- src/gallium/include/pipe/p_thread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/include/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h index de55e99ed4..df6d38904a 100644 --- a/src/gallium/include/pipe/p_thread.h +++ b/src/gallium/include/pipe/p_thread.h @@ -43,6 +43,8 @@ #include /* POSIX threads headers */ #include /* for perror() */ +#define PIPE_THREAD_HAVE_CONDVAR + typedef pthread_t pipe_thread; #define PIPE_THREAD_ROUTINE( name, param ) \ -- cgit v1.2.3 From 61ffba44fd70abefd22366aa296b7afb04c6767a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 5 Jun 2009 03:01:34 +0100 Subject: trace/rbug: Use condvar on system that has it for blocking --- src/gallium/drivers/trace/tr_context.c | 5 +++++ src/gallium/drivers/trace/tr_context.h | 1 + src/gallium/drivers/trace/tr_rbug.c | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index b04cc2ce56..dd5cca58dd 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -127,9 +127,13 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) /* wait for rbug to clear the blocked flag */ while (tr_ctx->draw_blocked & flag) { tr_ctx->draw_blocked |= flag; +#ifdef PIPE_THREAD_HAVE_CONDVAR + pipe_condvar_wait(tr_ctx->draw_cond, tr_ctx->draw_mutex); +#else pipe_mutex_unlock(tr_ctx->draw_mutex); /* TODO sleep or use conditional */ pipe_mutex_lock(tr_ctx->draw_mutex); +#endif } pipe_mutex_unlock(tr_ctx->draw_mutex); @@ -1191,6 +1195,7 @@ trace_context_create(struct pipe_screen *_screen, rbug_blocker_flags, 0); pipe_mutex_init(tr_ctx->draw_mutex); + pipe_condvar_init(tr_ctx->draw_cond); pipe_mutex_init(tr_ctx->list_mutex); make_empty_list(&tr_ctx->shaders); diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 770e975a14..0c2bf27689 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -56,6 +56,7 @@ struct trace_context struct trace_texture *zsbuf; } curr; + pipe_condvar draw_cond; pipe_mutex draw_mutex; int draw_blocker; int draw_blocked; diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index db9de8f3c4..e2de108009 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -371,6 +371,10 @@ trace_rbug_context_draw_step(struct trace_rbug *tr_rbug, struct rbug_header *hea tr_ctx->draw_blocked &= ~step->step; pipe_mutex_unlock(tr_ctx->draw_mutex); +#ifdef PIPE_THREAD_HAVE_CONDVAR + pipe_condvar_broadcast(tr_ctx->draw_cond); +#endif + pipe_mutex_unlock(tr_scr->list_mutex); return 0; @@ -397,6 +401,10 @@ trace_rbug_context_draw_unblock(struct trace_rbug *tr_rbug, struct rbug_header * tr_ctx->draw_blocker &= ~unblock->unblock; pipe_mutex_unlock(tr_ctx->draw_mutex); +#ifdef PIPE_THREAD_HAVE_CONDVAR + pipe_condvar_broadcast(tr_ctx->draw_cond); +#endif + pipe_mutex_unlock(tr_scr->list_mutex); return 0; -- cgit v1.2.3 From 7441dcd90b01df8351026af8bbb50e11bb86071a Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 06:21:10 -0700 Subject: osmesa: Allow building standalone in all three channel widths autoconf had been designating the 8 bit libOSMesa as the default standalone osmesa, but the Makefile expected it to be linked to libGL. Fix up the osmesa Makefile so that it allows any of the combinations of standalone and channel width to be built. Fixes bug #21980. --- src/mesa/drivers/osmesa/Makefile | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile index 3b3984200a..92d4149466 100644 --- a/src/mesa/drivers/osmesa/Makefile +++ b/src/mesa/drivers/osmesa/Makefile @@ -19,11 +19,12 @@ INCLUDE_DIRS = \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main +# Standalone osmesa needs to be linked with core Mesa APIs +ifeq ($(DRIVER_DIRS), osmesa) CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a - - -.PHONY: osmesa8 -.PHONY: osmesa16 +else +CORE_MESA = +endif .c.o: @@ -31,31 +32,12 @@ CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a default: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ - $(MAKE) osmesa16 ; \ - else \ - $(MAKE) osmesa8 ; \ - fi - - - - -# The normal libOSMesa is used in conjuction with libGL -osmesa8: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - -$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) - $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ - -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ - -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ - $(OSMESA_LIB_DEPS) $(OBJECTS) - - -# The libOSMesa16/libOSMesa32 libraries do not use libGL but rather are built -# with all the other Mesa sources (compiled with -DCHAN_BITS=16/32 -osmesa16: $(OBJECTS) $(CORE_MESA) +# libOSMesa can be used in conjuction with libGL or with all other Mesa +# sources. We can also build libOSMesa16/libOSMesa32 by setting +# -DCHAN_BITS=16/32. +$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA) $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ -- cgit v1.2.3 From 4795dd5950d4dcd7c8d421c8fb4851c193297ba1 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 19:42:08 -0700 Subject: osmesa: Link with -ldl for dlopen code Now that the dlopen wrappers are built into libmesa.a, we need to link standalone libOSMesa with libdl to resolve dlopen and friends on platforms that need it. --- configure.ac | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 772fb29973..6f0f1f681d 100644 --- a/configure.ac +++ b/configure.ac @@ -831,12 +831,12 @@ case "$mesa_driver" in osmesa) # only link libraries with osmesa if shared if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS" + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" else OSMESA_LIB_DEPS="" fi OSMESA_MESA_DEPS="" - OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" ;; *) # Link OSMesa to libGL otherwise @@ -850,9 +850,6 @@ osmesa) OSMESA_PC_REQ="gl" ;; esac -if test "$enable_static" = no; then - OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS" -fi OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" AC_SUBST([OSMESA_LIB_DEPS]) AC_SUBST([OSMESA_MESA_DEPS]) -- cgit v1.2.3 From 5df64685892aea4dabee377352888d8eb58e9446 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 06:21:10 -0700 Subject: osmesa: Allow building standalone in all three channel widths autoconf had been designating the 8 bit libOSMesa as the default standalone osmesa, but the Makefile expected it to be linked to libGL. Fix up the osmesa Makefile so that it allows any of the combinations of standalone and channel width to be built. Fixes bug #21980. (cherry picked from commit 7441dcd90b01df8351026af8bbb50e11bb86071a) --- src/mesa/drivers/osmesa/Makefile | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile index 3b3984200a..92d4149466 100644 --- a/src/mesa/drivers/osmesa/Makefile +++ b/src/mesa/drivers/osmesa/Makefile @@ -19,11 +19,12 @@ INCLUDE_DIRS = \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main +# Standalone osmesa needs to be linked with core Mesa APIs +ifeq ($(DRIVER_DIRS), osmesa) CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a - - -.PHONY: osmesa8 -.PHONY: osmesa16 +else +CORE_MESA = +endif .c.o: @@ -31,31 +32,12 @@ CORE_MESA = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a default: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - @ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \ - $(MAKE) osmesa16 ; \ - else \ - $(MAKE) osmesa8 ; \ - fi - - - - -# The normal libOSMesa is used in conjuction with libGL -osmesa8: $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) - -$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) - $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ - -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ - -id $(INSTALL_LIB_DIR)/lib$(OSMESA_LIB).$(MESA_MAJOR).dylib \ - $(OSMESA_LIB_DEPS) $(OBJECTS) - - -# The libOSMesa16/libOSMesa32 libraries do not use libGL but rather are built -# with all the other Mesa sources (compiled with -DCHAN_BITS=16/32 -osmesa16: $(OBJECTS) $(CORE_MESA) +# libOSMesa can be used in conjuction with libGL or with all other Mesa +# sources. We can also build libOSMesa16/libOSMesa32 by setting +# -DCHAN_BITS=16/32. +$(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OBJECTS) $(CORE_MESA) $(MKLIB) -o $(OSMESA_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \ -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ -- cgit v1.2.3 From 6453605785a3036c7e633400e4bd35bf2297b000 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 4 Jun 2009 19:42:08 -0700 Subject: osmesa: Link with -ldl for dlopen code Now that the dlopen wrappers are built into libmesa.a, we need to link standalone libOSMesa with libdl to resolve dlopen and friends on platforms that need it. (cherry picked from commit 4795dd5950d4dcd7c8d421c8fb4851c193297ba1) --- configure.ac | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8110e0f869..48b8022736 100644 --- a/configure.ac +++ b/configure.ac @@ -826,12 +826,12 @@ case "$mesa_driver" in osmesa) # only link libraries with osmesa if shared if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS" + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" else OSMESA_LIB_DEPS="" fi OSMESA_MESA_DEPS="" - OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" ;; *) # Link OSMesa to libGL otherwise @@ -845,9 +845,6 @@ osmesa) OSMESA_PC_REQ="gl" ;; esac -if test "$enable_static" = no; then - OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS" -fi OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" AC_SUBST([OSMESA_LIB_DEPS]) AC_SUBST([OSMESA_MESA_DEPS]) -- cgit v1.2.3 From 04cef8a03799aa88ebfa1c391e29f8d2ea020d95 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 15:26:07 +1000 Subject: nouveau: call nouveau_pushbuf directly rather than going through nvws --- src/gallium/drivers/nouveau/nouveau_push.h | 30 +++++++++++++++------- src/gallium/drivers/nouveau/nouveau_stateobj.h | 26 +++++++++++-------- src/gallium/drivers/nouveau/nouveau_winsys.h | 6 ----- src/gallium/drivers/nv30/nv30_screen.c | 2 +- src/gallium/drivers/nv40/nv40_screen.c | 2 +- src/gallium/drivers/nv50/nv50_screen.c | 2 +- .../winsys/drm/nouveau/drm/nouveau_winsys.c | 24 ----------------- 7 files changed, 39 insertions(+), 53 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h index 54ef1c1291..afe4668fcd 100644 --- a/src/gallium/drivers/nouveau/nouveau_push.h +++ b/src/gallium/drivers/nouveau/nouveau_push.h @@ -26,25 +26,36 @@ #define BEGIN_RING(obj,mthd,size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \ - pc->nvws->push_flush(pc->nvws, ((size) + 1), NULL); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + if (chan->pushbuf->remaining < ((size) + 1)) \ + nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \ - pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \ + chan->pushbuf->remaining -= ((size) + 1); \ } while(0) #define BEGIN_RING_NI(obj,mthd,size) do { \ BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \ } while(0) +static inline void +DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) +{ + nouveau_pushbuf_flush(chan, 0); + if (fence) + *fence = NULL; +} + #define FIRE_RING(fence) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - pc->nvws->push_flush(pc->nvws, 0, fence); \ + DO_FIRE_RING(pc->nvws->channel, fence); \ } while(0) #define OUT_RELOC(bo,data,flags,vor,tor) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \ - (bo), (data), (flags), (vor), (tor)); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, \ + pc->nvws->get_bo(bo), \ + (data), (flags), (vor), (tor)); \ } while(0) /* Raw data + flags depending on FB/TT buffer */ @@ -72,11 +83,12 @@ /* A reloc which'll recombine into a NV_DMA_METHOD packet header */ #define OUT_RELOCm(bo, flags, obj, mthd, size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \ - pc->nvws->push_flush(pc->nvws->channel, ((size) + 1), NULL); \ + struct nouveau_channel *chan = pc->nvws->channel; \ + if (chan->pushbuf->remaining < ((size) + 1)) \ + nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \ (flags), 0, 0); \ - pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \ + chan->pushbuf->remaining -= ((size) + 1); \ } while(0) #endif diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index a54820e851..fbb05db7df 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -114,15 +114,16 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) nr = so->cur - so->push; if (pb->remaining < nr) - nvws->push_flush(nvws, nr, NULL); + nouveau_pushbuf_flush(nvws->channel, nr); pb->remaining -= nr; memcpy(pb->cur, so->push, nr * 4); for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nvws->push_reloc(nvws, pb->cur + r->offset, r->bo, - r->data, r->flags, r->vor, r->tor); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur + r->offset, + nvws->get_bo(r->bo), r->data, + r->flags, r->vor, r->tor); } pb->cur += nr; } @@ -138,19 +139,22 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) i = so->cur_reloc << 1; if (nvws->channel->pushbuf->remaining < i) - nvws->push_flush(nvws, i, NULL); + nouveau_pushbuf_flush(nvws->channel, i); nvws->channel->pushbuf->remaining -= i; for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nvws->push_reloc(nvws, pb->cur++, r->bo, r->packet, - (r->flags & (NOUVEAU_BO_VRAM | - NOUVEAU_BO_GART | - NOUVEAU_BO_RDWR)) | - NOUVEAU_BO_DUMMY, 0, 0); - nvws->push_reloc(nvws, pb->cur++, r->bo, r->data, - r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, + nvws->get_bo(r->bo), r->packet, + (r->flags & (NOUVEAU_BO_VRAM | + NOUVEAU_BO_GART | + NOUVEAU_BO_RDWR)) | + NOUVEAU_BO_DUMMY, 0, 0); + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, + nvws->get_bo(r->bo), r->data, + r->flags | NOUVEAU_BO_DUMMY, + r->vor, r->tor); } } diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index ff7dd1c51c..762c3a2a21 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -34,12 +34,6 @@ struct nouveau_winsys { struct nouveau_resource **); void (*res_free)(struct nouveau_resource **); - int (*push_reloc)(struct nouveau_winsys *, void *ptr, - struct pipe_buffer *, uint32_t data, - uint32_t flags, uint32_t vor, uint32_t tor); - int (*push_flush)(struct nouveau_winsys *, unsigned size, - struct pipe_fence_handle **fence); - int (*grobj_alloc)(struct nouveau_winsys *, int grclass, struct nouveau_grobj **); void (*grobj_free)(struct nouveau_grobj **); diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index d395c5e1b7..772eb78566 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -303,7 +303,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_emit(nvws, so); so_ref(NULL, &so); - nvws->push_flush(nvws, 0, NULL); + nouveau_pushbuf_flush(nvws->channel, 0); screen->pipe.winsys = ws; screen->pipe.destroy = nv30_screen_destroy; diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 0d4baefaea..5030c3ecbc 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -283,7 +283,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_emit(nvws, so); so_ref(NULL, &so); - nvws->push_flush(nvws, 0, NULL); + nouveau_pushbuf_flush(nvws->channel, 0); screen->pipe.winsys = ws; screen->pipe.destroy = nv40_screen_destroy; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index a7981a3615..425ac92d9f 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -400,7 +400,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_emit(nvws, so); so_ref (so, &screen->static_init); so_ref (NULL, &so); - nvws->push_flush(nvws, 0, NULL); + nouveau_pushbuf_flush(nvws->channel, 0); return &screen->pipe; } diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c index e3175fd775..2e0148543d 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c @@ -30,27 +30,6 @@ nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass, return 0; } -static int -nouveau_pipe_push_reloc(struct nouveau_winsys *nvws, void *ptr, - struct pipe_buffer *buf, uint32_t data, - uint32_t flags, uint32_t vor, uint32_t tor) -{ - struct nouveau_bo *bo = nouveau_pipe_buffer(buf)->bo; - - return nouveau_pushbuf_emit_reloc(nvws->channel, ptr, bo, - data, flags, vor, tor); -} - -static int -nouveau_pipe_push_flush(struct nouveau_winsys *nvws, unsigned size, - struct pipe_fence_handle **fence) -{ - if (fence) - *fence = NULL; - - return nouveau_pushbuf_flush(nvws->channel, size); -} - static struct nouveau_bo * nouveau_pipe_get_bo(struct pipe_buffer *pb) { @@ -74,9 +53,6 @@ nouveau_winsys_new(struct pipe_winsys *ws) nvws->res_alloc = nouveau_resource_alloc; nvws->res_free = nouveau_resource_free; - nvws->push_reloc = nouveau_pipe_push_reloc; - nvws->push_flush = nouveau_pipe_push_flush; - nvws->grobj_alloc = nouveau_pipe_grobj_alloc; nvws->grobj_free = nouveau_grobj_free; -- cgit v1.2.3 From 072fdc1fd325256d87b182d4f55c8a5838119cf0 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 16:13:56 +1000 Subject: nouveau: pass nouveau_bo instead of pipe_buffer to so_ calls --- src/gallium/drivers/nouveau/nouveau_stateobj.h | 21 ++++++------- src/gallium/drivers/nv30/nv30_context.h | 2 ++ src/gallium/drivers/nv30/nv30_fragprog.c | 7 +++-- src/gallium/drivers/nv30/nv30_fragtex.c | 7 +++-- src/gallium/drivers/nv30/nv30_state_fb.c | 30 +++++++++--------- src/gallium/drivers/nv30/nv30_vbo.c | 14 +++++---- src/gallium/drivers/nv40/nv40_context.h | 2 ++ src/gallium/drivers/nv40/nv40_fragprog.c | 7 +++-- src/gallium/drivers/nv40/nv40_fragtex.c | 7 +++-- src/gallium/drivers/nv40/nv40_state_fb.c | 4 ++- src/gallium/drivers/nv40/nv40_vbo.c | 13 +++++--- src/gallium/drivers/nv50/nv50_context.h | 2 ++ src/gallium/drivers/nv50/nv50_program.c | 31 +++++++++---------- src/gallium/drivers/nv50/nv50_program.h | 2 +- src/gallium/drivers/nv50/nv50_screen.c | 42 ++++++++++++++++++-------- src/gallium/drivers/nv50/nv50_screen.h | 8 ++--- src/gallium/drivers/nv50/nv50_state_validate.c | 24 +++++++-------- src/gallium/drivers/nv50/nv50_tex.c | 9 ++++-- src/gallium/drivers/nv50/nv50_vbo.c | 5 +-- 19 files changed, 136 insertions(+), 101 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index fbb05db7df..de3ba9cf14 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -4,7 +4,7 @@ #include "util/u_debug.h" struct nouveau_stateobj_reloc { - struct pipe_buffer *bo; + struct nouveau_bo *bo; unsigned offset; unsigned packet; @@ -51,7 +51,7 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso) if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) { free(so->push); for (i = 0; i < so->cur_reloc; i++) - pipe_buffer_reference(&so->reloc[i].bo, NULL); + nouveau_bo_ref(NULL, &so->reloc[i].bo); free(so->reloc); free(so); } @@ -81,13 +81,13 @@ so_method(struct nouveau_stateobj *so, struct nouveau_grobj *gr, } static INLINE void -so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo, +so_reloc(struct nouveau_stateobj *so, struct nouveau_bo *bo, unsigned data, unsigned flags, unsigned vor, unsigned tor) { struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++]; r->bo = NULL; - pipe_buffer_reference(&r->bo, bo); + nouveau_bo_ref(bo, &r->bo); r->offset = so->cur - so->push; r->packet = so->cur_packet; r->data = data; @@ -122,8 +122,8 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) struct nouveau_stateobj_reloc *r = &so->reloc[i]; nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur + r->offset, - nvws->get_bo(r->bo), r->data, - r->flags, r->vor, r->tor); + r->bo, r->data, r->flags, r->vor, + r->tor); } pb->cur += nr; } @@ -145,15 +145,14 @@ so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, - nvws->get_bo(r->bo), r->packet, + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, r->bo, + r->packet, (r->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RDWR)) | NOUVEAU_BO_DUMMY, 0, 0); - nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, - nvws->get_bo(r->bo), r->data, - r->flags | NOUVEAU_BO_DUMMY, + nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, r->bo, + r->data, r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor); } } diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 4229c0a0e1..5ba474cc33 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -19,6 +19,8 @@ #include "nouveau/nouveau_push.h" #include "nouveau/nouveau_stateobj.h" +#define nouveau_bo(pb) nv30->screen->nvws->get_bo(pb) + #include "nv30_state.h" #define NOUVEAU_ERR(fmt, args...) \ diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index bdfe1425d2..956b450726 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -855,9 +855,10 @@ nv30_fragprog_validate(struct nv30_context *nv30) so = so_new(8, 1); so_method(so, nv30->screen->rankine, NV34TCL_FP_ACTIVE_PROGRAM, 1); - so_reloc (so, fp->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | - NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - NV34TCL_FP_ACTIVE_PROGRAM_DMA0, NV34TCL_FP_ACTIVE_PROGRAM_DMA1); + so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW | + NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0, + NV34TCL_FP_ACTIVE_PROGRAM_DMA1); so_method(so, nv30->screen->rankine, NV34TCL_FP_CONTROL, 1); so_data (so, fp->fp_control); so_method(so, nv30->screen->rankine, NV34TCL_FP_REG_CONTROL, 1); diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index 8b6ab992d1..822e1d8def 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -61,6 +61,7 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) struct nv30_sampler_state *ps = nv30->tex_sampler[unit]; struct nv30_miptree *nv30mt = nv30->tex_miptree[unit]; struct pipe_texture *pt = &nv30mt->base; + struct nouveau_bo *bo = nouveau_bo(nv30mt->buffer); struct nv30_texture_format *tf; struct nouveau_stateobj *so; uint32_t txf, txs , txp; @@ -106,9 +107,9 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) so = so_new(16, 2); so_method(so, nv30->screen->rankine, NV34TCL_TX_OFFSET(unit), 8); - so_reloc (so, nv30mt->buffer, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); - so_reloc (so, nv30mt->buffer, txf, tex_flags | NOUVEAU_BO_OR, - NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); + so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR, + NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1); so_data (so, ps->wrap); so_data (so, NV34TCL_TX_ENABLE_ENABLE | ps->en); so_data (so, txs); diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index fdc1cade90..1be916872f 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -80,36 +80,36 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) nv30mt = (struct nv30_miptree *)rt[0]->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1); - so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); + so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, + nv30->nvws->channel->vram->handle, + nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2); so_data (so, pitch); - so_reloc (so, nv30mt->buffer, rt[0]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, nouveau_bo(nv30mt->buffer), rt[0]->base.offset, + rt_flags | NOUVEAU_BO_LOW, 0, 0); } if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) { nv30mt = (struct nv30_miptree *)rt[1]->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1); - so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); + so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, + nv30->nvws->channel->vram->handle, + nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2); - so_reloc (so, nv30mt->buffer, rt[1]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, nouveau_bo(nv30mt->buffer), rt[1]->base.offset, + rt_flags | NOUVEAU_BO_LOW, 0, 0); so_data (so, rt[1]->pitch); } if (zeta_format) { nv30mt = (struct nv30_miptree *)zeta->base.texture; so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1); - so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); + so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, + nv30->nvws->channel->vram->handle, + nv30->nvws->channel->gart->handle); so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1); - so_reloc (so, nv30mt->buffer, zeta->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, nouveau_bo(nv30mt->buffer), zeta->base.offset, + rt_flags | NOUVEAU_BO_LOW, 0, 0); /* TODO: allocate LMA depth buffer */ } diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index 990a876382..b7d8c2e008 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -521,18 +521,20 @@ nv30_vbo_validate(struct nv30_context *nv30) return FALSE; } - so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset, - vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - 0, NV34TCL_VTXBUF_ADDRESS_DMA1); + so_reloc(vtxbuf, nouveau_bo(vb->buffer), vb->buffer_offset + + ve->src_offset, vb_flags | NOUVEAU_BO_LOW | + NOUVEAU_BO_OR, 0, NV34TCL_VTXBUF_ADDRESS_DMA1); so_data (vtxfmt, ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) | (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type)); } if (ib) { + struct nouveau_bo *bo = nouveau_bo(ib); + so_method(vtxbuf, rankine, NV34TCL_IDXBUF_ADDRESS, 2); - so_reloc (vtxbuf, ib, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0); - so_reloc (vtxbuf, ib, ib_format, vb_flags | NOUVEAU_BO_OR, - 0, NV34TCL_IDXBUF_FORMAT_DMA1); + so_reloc (vtxbuf, bo, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0); + so_reloc (vtxbuf, bo, ib_format, vb_flags | NOUVEAU_BO_OR, + 0, NV34TCL_IDXBUF_FORMAT_DMA1); } so_method(vtxbuf, rankine, 0x1710, 1); diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 97bc83292d..393b31c5f0 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -21,6 +21,8 @@ #include "nv40_state.h" +#define nouveau_bo(pb) nv40->screen->nvws->get_bo(pb) + #define NOUVEAU_ERR(fmt, args...) \ fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args); #define NOUVEAU_MSG(fmt, args...) \ diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 16e40889ec..b45dfaa913 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -938,9 +938,10 @@ nv40_fragprog_validate(struct nv40_context *nv40) so = so_new(4, 1); so_method(so, nv40->screen->curie, NV40TCL_FP_ADDRESS, 1); - so_reloc (so, fp->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | - NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - NV40TCL_FP_ADDRESS_DMA0, NV40TCL_FP_ADDRESS_DMA1); + so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM | + NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW | + NOUVEAU_BO_OR, NV40TCL_FP_ADDRESS_DMA0, + NV40TCL_FP_ADDRESS_DMA1); so_method(so, nv40->screen->curie, NV40TCL_FP_CONTROL, 1); so_data (so, fp->fp_control); so_ref(so, &fp->so); diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c index eb3002dc05..f6cdf31dfe 100644 --- a/src/gallium/drivers/nv40/nv40_fragtex.c +++ b/src/gallium/drivers/nv40/nv40_fragtex.c @@ -62,6 +62,7 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) { struct nv40_sampler_state *ps = nv40->tex_sampler[unit]; struct nv40_miptree *nv40mt = nv40->tex_miptree[unit]; + struct nouveau_bo *bo = nouveau_bo(nv40mt->buffer); struct pipe_texture *pt = &nv40mt->base; struct nv40_texture_format *tf; struct nouveau_stateobj *so; @@ -108,9 +109,9 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) so = so_new(16, 2); so_method(so, nv40->screen->curie, NV40TCL_TEX_OFFSET(unit), 8); - so_reloc (so, nv40mt->buffer, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); - so_reloc (so, nv40mt->buffer, txf, tex_flags | NOUVEAU_BO_OR, - NV40TCL_TEX_FORMAT_DMA0, NV40TCL_TEX_FORMAT_DMA1); + so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR, + NV40TCL_TEX_FORMAT_DMA0, NV40TCL_TEX_FORMAT_DMA1); so_data (so, ps->wrap); so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en); so_data (so, txs); diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index be618a306b..d8364ff993 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -2,12 +2,14 @@ #include "nouveau/nouveau_util.h" static struct pipe_buffer * -nv40_surface_buffer(struct pipe_surface *surface) +nv40_do_surface_buffer(struct pipe_surface *surface) { struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture; return mt->buffer; } +#define nv40_surface_buffer(ps) nouveau_bo(nv40_do_surface_buffer(ps)) + static boolean nv40_state_framebuffer_validate(struct nv40_context *nv40) { diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index f3518b2e4f..7add803df7 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -519,17 +519,20 @@ nv40_vbo_validate(struct nv40_context *nv40) return FALSE; } - so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset, - vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, - 0, NV40TCL_VTXBUF_ADDRESS_DMA1); + so_reloc(vtxbuf, nouveau_bo(vb->buffer), + vb->buffer_offset + ve->src_offset, + vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR, + 0, NV40TCL_VTXBUF_ADDRESS_DMA1); so_data (vtxfmt, ((vb->stride << NV40TCL_VTXFMT_STRIDE_SHIFT) | (ncomp << NV40TCL_VTXFMT_SIZE_SHIFT) | type)); } if (ib) { + struct nouveau_bo *bo = nouveau_bo(ib); + so_method(vtxbuf, curie, NV40TCL_IDXBUF_ADDRESS, 2); - so_reloc (vtxbuf, ib, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0); - so_reloc (vtxbuf, ib, ib_format, vb_flags | NOUVEAU_BO_OR, + so_reloc (vtxbuf, bo, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0); + so_reloc (vtxbuf, bo, ib_format, vb_flags | NOUVEAU_BO_OR, 0, NV40TCL_IDXBUF_FORMAT_DMA1); } diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 7b67a75439..d960657066 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -23,6 +23,8 @@ #define NOUVEAU_MSG(fmt, args...) \ fprintf(stderr, "nouveau: "fmt, ##args); +#define nouveau_bo(pb) nv50->screen->nvws->get_bo(pb) + /* Constant buffer assignment */ #define NV50_CB_PMISC 0 #define NV50_CB_PVP 1 diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index aada285f2c..1576d4295e 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2288,15 +2288,15 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) { struct nouveau_channel *chan = nv50->screen->nvws->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; - struct pipe_screen *screen = nv50->pipe.screen; struct nv50_program_exec *e; struct nouveau_stateobj *so; const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR; unsigned start, count, *up, *ptr; boolean upload = FALSE; - if (!p->buffer) { - p->buffer = screen->buffer_create(screen, 0x100, 0, p->exec_size * 4); + if (!p->bo) { + nouveau_bo_new(chan->device, NOUVEAU_BO_VRAM, 0x100, + p->exec_size * 4, &p->bo); upload = TRUE; } @@ -2345,8 +2345,8 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) so = so_new(4,2); so_method(so, nv50->screen->tesla, 0x1280, 3); - so_reloc (so, p->buffer, 0, flags | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, p->buffer, 0, flags | NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_LOW, 0, 0); so_data (so, (NV50_CB_PUPLOAD << 16) | 0x0800); //(p->exec_size * 4)); start = 0; count = p->exec_size; @@ -2394,10 +2394,10 @@ nv50_vertprog_validate(struct nv50_context *nv50) so = so_new(13, 2); so_method(so, tesla, NV50TCL_VP_ADDRESS_HIGH, 2); - so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | - NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_LOW, 0, 0); so_method(so, tesla, 0x1650, 2); so_data (so, p->cfg.vp.attr[0]); so_data (so, p->cfg.vp.attr[1]); @@ -2431,10 +2431,10 @@ nv50_fragprog_validate(struct nv50_context *nv50) so = so_new(64, 2); so_method(so, tesla, NV50TCL_FP_ADDRESS_HIGH, 2); - so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | - NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, p->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | + NOUVEAU_BO_LOW, 0, 0); so_method(so, tesla, 0x1904, 4); so_data (so, p->cfg.fp.regs[0]); /* 0x01000404 / 0x00040404 */ so_data (so, 0x00000004); @@ -2461,8 +2461,6 @@ nv50_fragprog_validate(struct nv50_context *nv50) void nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p) { - struct pipe_screen *pscreen = nv50->pipe.screen; - while (p->exec_head) { struct nv50_program_exec *e = p->exec_head; @@ -2472,8 +2470,7 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p) p->exec_tail = NULL; p->exec_size = 0; - if (p->buffer) - pipe_buffer_reference(&p->buffer, NULL); + nouveau_bo_ref(NULL, &p->bo); nv50->screen->nvws->res_free(&p->data[0]); nv50->screen->nvws->res_free(&p->data[1]); diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index c650ecfc81..096e0476aa 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -27,7 +27,7 @@ struct nv50_program { struct nouveau_resource *data[2]; unsigned data_start[2]; - struct pipe_buffer *buffer; + struct nouveau_bo *bo; float *immd; unsigned immd_nr; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 425ac92d9f..b7e9df77db 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -160,10 +160,11 @@ struct pipe_screen * nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen); + struct nouveau_device *dev = nvws->channel->device; struct nouveau_stateobj *so; - unsigned tesla_class = 0, ret; - unsigned chipset = nvws->channel->device->chipset; - int i; + unsigned chipset = dev->chipset; + unsigned tesla_class = 0; + int ret, i; if (!screen) return NULL; @@ -291,14 +292,21 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_data (so, 8); /* constant buffers for immediates and VP/FP parameters */ - screen->constbuf_misc[0] = - screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); - - screen->constbuf_parm[0] = - screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, + &screen->constbuf_misc[0]); + if (ret) { + nv50_screen_destroy(&screen->pipe); + return NULL; + } - screen->constbuf_parm[1] = - screen->pipe.buffer_create(&screen->pipe, 0, 0, 128 * 4 * 4); + for (i = 0; i < 2; i++) { + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, + &screen->constbuf_parm[i]); + if (ret) { + nv50_screen_destroy(&screen->pipe); + return NULL; + } + } if (nvws->res_init(&screen->immd_heap[0], 0, 128) || nvws->res_init(&screen->parm_heap[0], 0, 128) || @@ -352,7 +360,12 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) * blocks. At some point we *may* want to go the NVIDIA way of doing * things? */ - screen->tic = screen->pipe.buffer_create(&screen->pipe, 0, 0, 32 * 8 * 4); + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tic); + if (ret) { + nv50_screen_destroy(&screen->pipe); + return NULL; + } + so_method(so, screen->tesla, 0x1280, 3); so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); @@ -366,7 +379,12 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); so_data (so, 0x00000800); - screen->tsc = screen->pipe.buffer_create(&screen->pipe, 0, 0, 32 * 8 * 4); + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tsc); + if (ret) { + nv50_screen_destroy(&screen->pipe); + return NULL; + } + so_method(so, screen->tesla, 0x1280, 3); so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h index 31b8ef29c9..fa7d8d0f0d 100644 --- a/src/gallium/drivers/nv50/nv50_screen.h +++ b/src/gallium/drivers/nv50/nv50_screen.h @@ -15,14 +15,14 @@ struct nv50_screen { struct nouveau_grobj *m2mf; struct nouveau_notifier *sync; - struct pipe_buffer *constbuf_misc[1]; - struct pipe_buffer *constbuf_parm[2]; + struct nouveau_bo *constbuf_misc[1]; + struct nouveau_bo *constbuf_parm[2]; struct nouveau_resource *immd_heap[1]; struct nouveau_resource *parm_heap[2]; - struct pipe_buffer *tic; - struct pipe_buffer *tsc; + struct nouveau_bo *tic; + struct nouveau_bo *tsc; struct nouveau_stateobj *static_init; }; diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index c13d3de1cb..d1f0ccdd8a 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -32,6 +32,8 @@ nv50_state_validate_fb(struct nv50_context *nv50) unsigned i, w, h, gw = 0; for (i = 0; i < fb->nr_cbufs; i++) { + struct nouveau_bo *bo = nouveau_bo(nv50_surface_buffer(fb->cbufs[i])); + if (!gw) { w = fb->cbufs[i]->width; h = fb->cbufs[i]->height; @@ -46,12 +48,10 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_data (so, fb->cbufs[i]->height); so_method(so, tesla, NV50TCL_RT_ADDRESS_HIGH(i), 5); - so_reloc (so, nv50_surface_buffer(fb->cbufs[i]), fb->cbufs[i]->offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH | - NOUVEAU_BO_RDWR, 0, 0); - so_reloc (so, nv50_surface_buffer(fb->cbufs[i]), fb->cbufs[i]->offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | - NOUVEAU_BO_RDWR, 0, 0); + so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM | + NOUVEAU_BO_HIGH | NOUVEAU_BO_RDWR, 0, 0); + so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM | + NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0); switch (fb->cbufs[i]->format) { case PIPE_FORMAT_A8R8G8B8_UNORM: so_data(so, 0xcf); @@ -73,6 +73,8 @@ nv50_state_validate_fb(struct nv50_context *nv50) } if (fb->zsbuf) { + struct nouveau_bo *bo = nouveau_bo(nv50_surface_buffer(fb->zsbuf)); + if (!gw) { w = fb->zsbuf->width; h = fb->zsbuf->height; @@ -83,12 +85,10 @@ nv50_state_validate_fb(struct nv50_context *nv50) } so_method(so, tesla, NV50TCL_ZETA_ADDRESS_HIGH, 5); - so_reloc (so, nv50_surface_buffer(fb->zsbuf), fb->zsbuf->offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_HIGH | - NOUVEAU_BO_RDWR, 0, 0); - so_reloc (so, nv50_surface_buffer(fb->zsbuf), fb->zsbuf->offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | - NOUVEAU_BO_RDWR, 0, 0); + so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM | + NOUVEAU_BO_HIGH | NOUVEAU_BO_RDWR, 0, 0); + so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM | + NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0); switch (fb->zsbuf->format) { case PIPE_FORMAT_Z24S8_UNORM: so_data(so, 0x16); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 775e9f30ef..86947faee3 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -26,8 +26,11 @@ #include "nouveau/nouveau_stateobj.h" static int -nv50_tex_construct(struct nouveau_stateobj *so, struct nv50_miptree *mt) +nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, + struct nv50_miptree *mt) { + struct nouveau_bo *bo = nouveau_bo(mt->buffer); + switch (mt->base.format) { case PIPE_FORMAT_A8R8G8B8_UNORM: so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | @@ -117,7 +120,7 @@ nv50_tex_construct(struct nouveau_stateobj *so, struct nv50_miptree *mt) return 1; } - so_reloc(so, mt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | + so_reloc(so, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); so_data (so, 0xd0005000); so_data (so, 0x00300000); @@ -144,7 +147,7 @@ nv50_tex_validate(struct nv50_context *nv50) for (unit = 0; unit < nv50->miptree_nr; unit++) { struct nv50_miptree *mt = nv50->miptree[unit]; - if (nv50_tex_construct(so, mt)) { + if (nv50_tex_construct(nv50, so, mt)) { NOUVEAU_ERR("failed tex validate\n"); so_ref(NULL, &so); return; diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index 0749c90691..6f4981d1ff 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -212,6 +212,7 @@ nv50_vbo_validate(struct nv50_context *nv50) struct pipe_vertex_element *ve = &nv50->vtxelt[i]; struct pipe_vertex_buffer *vb = &nv50->vtxbuf[ve->vertex_buffer_index]; + struct nouveau_bo *bo = nouveau_bo(vb->buffer); switch (ve->src_format) { case PIPE_FORMAT_R32G32B32A32_FLOAT: @@ -240,10 +241,10 @@ nv50_vbo_validate(struct nv50_context *nv50) so_method(vtxbuf, tesla, 0x900 + (i * 16), 3); so_data (vtxbuf, 0x20000000 | vb->stride); - so_reloc (vtxbuf, vb->buffer, vb->buffer_offset + + so_reloc (vtxbuf, bo, vb->buffer_offset + ve->src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (vtxbuf, vb->buffer, vb->buffer_offset + + so_reloc (vtxbuf, bo, vb->buffer_offset + ve->src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); } -- cgit v1.2.3 From bc466be695913cd504cefddd857ac1cefda87a04 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 10:19:04 +1000 Subject: nouveau: add pipe_buffer/fence code to pipe drivers, move nv50 over --- configure.ac | 2 +- src/gallium/drivers/nouveau/nouveau_screen.c | 242 +++++++++++++++++++++++++++ src/gallium/drivers/nouveau/nouveau_screen.h | 24 +++ src/gallium/drivers/nv50/nv50_context.h | 2 - src/gallium/drivers/nv50/nv50_query.c | 2 +- src/gallium/drivers/nv50/nv50_screen.c | 83 ++++----- src/gallium/drivers/nv50/nv50_screen.h | 4 +- src/gallium/drivers/nv50/nv50_surface.c | 6 +- src/gallium/drivers/nv50/nv50_transfer.c | 4 +- src/gallium/winsys/drm/nouveau/dri/Makefile | 3 +- 10 files changed, 310 insertions(+), 62 deletions(-) create mode 100644 src/gallium/drivers/nouveau/nouveau_screen.c create mode 100644 src/gallium/drivers/nouveau/nouveau_screen.h diff --git a/configure.ac b/configure.ac index 6f0f1f681d..eb2733c0dc 100644 --- a/configure.ac +++ b/configure.ac @@ -1181,7 +1181,7 @@ AC_ARG_ENABLE([gallium-nouveau], [enable_gallium_nouveau=no]) if test "x$enable_gallium_nouveau" = xyes; then GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau" - GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50" fi diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c new file mode 100644 index 0000000000..3cab83eec0 --- /dev/null +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -0,0 +1,242 @@ +#include +#include +#include + +#include + +#include "nouveau/nouveau_bo.h" +#include "nouveau_winsys.h" +#include "nouveau_screen.h" + +static const char * +nouveau_screen_get_name(struct pipe_screen *pscreen) +{ + struct nouveau_device *dev = nouveau_screen(pscreen)->device; + static char buffer[128]; + + snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); + return buffer; +} + +static const char * +nouveau_screen_get_vendor(struct pipe_screen *pscreen) +{ + return "nouveau"; +} + +static struct pipe_buffer * +nouveau_screen_bo_skel(struct pipe_screen *pscreen, struct nouveau_bo *bo, + unsigned alignment, unsigned usage, unsigned size) +{ + struct pipe_buffer *pb; + + pb = CALLOC(1, sizeof(struct pipe_buffer)+sizeof(struct nouveau_bo *)); + if (!pb) { + nouveau_bo_ref(NULL, &bo); + return NULL; + } + + pipe_reference_init(&pb->reference, 1); + pb->screen = pscreen; + pb->alignment = alignment; + pb->usage = usage; + pb->size = size; + *(struct nouveau_bo **)(pb + 1) = bo; + return pb; +} + +static struct pipe_buffer * +nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment, + unsigned usage, unsigned size) +{ + struct nouveau_device *dev = nouveau_screen(pscreen)->device; + struct nouveau_bo *bo = NULL; + uint32_t flags = NOUVEAU_BO_MAP; + int ret; + + if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER) + flags |= NOUVEAU_BO_GART; + else + if (usage & PIPE_BUFFER_USAGE_VERTEX) { + if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF)) + flags |= NOUVEAU_BO_GART; + } else + if (usage & PIPE_BUFFER_USAGE_INDEX) { + if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF)) + flags |= NOUVEAU_BO_GART; + } + + if (usage & PIPE_BUFFER_USAGE_PIXEL) { + if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE) + flags |= NOUVEAU_BO_GART; + if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE)) + flags |= NOUVEAU_BO_VRAM; + + if (dev->chipset == 0x50 || dev->chipset >= 0x80) { + flags |= NOUVEAU_BO_TILED; + if (usage & NOUVEAU_BUFFER_USAGE_ZETA) + flags |= NOUVEAU_BO_ZTILE; + } + } + + ret = nouveau_bo_new(dev, flags, alignment, size, &bo); + if (ret) + return NULL; + + return nouveau_screen_bo_skel(pscreen, bo, alignment, usage, size); +} + +static struct pipe_buffer * +nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes) +{ + struct nouveau_device *dev = nouveau_screen(pscreen)->device; + struct nouveau_bo *bo = NULL; + int ret; + + ret = nouveau_bo_user(dev, ptr, bytes, &bo); + if (ret) + return NULL; + + return nouveau_screen_bo_skel(pscreen, bo, 0, 0, bytes); +} + +static inline uint32_t +nouveau_screen_map_flags(unsigned pipe) +{ + uint32_t flags = 0; + + if (pipe & PIPE_BUFFER_USAGE_CPU_READ) + flags |= NOUVEAU_BO_RD; + if (pipe & PIPE_BUFFER_USAGE_CPU_WRITE) + flags |= NOUVEAU_BO_WR; +#ifdef NOUVEAU_BO_NOWAIT + if (pipe & PIPE_BUFFER_USAGE_DISCARD) + flags |= NOUVEAU_BO_INVAL; + + if (pipe & PIPE_BUFFER_USAGE_DONTBLOCK) + flags |= NOUVEAU_BO_NOWAIT; + else + if (pipe & 0 /*PIPE_BUFFER_USAGE_UNSYNCHRONIZED*/) + flags |= NOUVEAU_BO_NOSYNC; +#endif + + return flags; +} + +static void * +nouveau_screen_bo_map(struct pipe_screen *pscreen, struct pipe_buffer *pb, + unsigned usage) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + int ret; + + ret = nouveau_bo_map(bo, nouveau_screen_map_flags(usage)); + if (ret) { + debug_printf("map failed: %d\n", ret); + return NULL; + } + + return bo->map; +} + +#ifdef NOUVEAU_BO_NOWAIT +static void * +nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct pipe_buffer *pb, + unsigned offset, unsigned length, unsigned usage) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + int ret; + + ret = nouveau_bo_map_range(bo, offset, length, + nouveau_screen_map_flags(usage)); + if (ret) { + debug_printf("map_range failed: %d\n", ret); + return NULL; + } + + return bo->map; +} + +static void +nouveau_screen_bo_map_flush(struct pipe_screen *pscreen, struct pipe_buffer *pb, + unsigned offset, unsigned length) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + + nouveau_bo_map_flush(bo, offset, length); +} +#endif + +static void +nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct pipe_buffer *pb) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + + nouveau_bo_unmap(bo); +} + +static void +nouveau_screen_bo_del(struct pipe_buffer *pb) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + + nouveau_bo_ref(NULL, &bo); + FREE(pb); +} + +static void +nouveau_screen_fence_ref(struct pipe_screen *pscreen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *pfence) +{ + *ptr = pfence; +} + +static int +nouveau_screen_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *pfence, + unsigned flags) +{ + return 0; +} + +static int +nouveau_screen_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *pfence, + unsigned flags) +{ + return 0; +} + +int +nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) +{ + struct pipe_screen *pscreen = &screen->base; + + screen->device = dev; + + pscreen->get_name = nouveau_screen_get_name; + pscreen->get_vendor = nouveau_screen_get_vendor; + + pscreen->buffer_create = nouveau_screen_bo_new; + pscreen->user_buffer_create = nouveau_screen_bo_user; + pscreen->buffer_map = nouveau_screen_bo_map; +#ifdef NOUVEAU_BO_NOWAIT + pscreen->buffer_map_range = nouveau_screen_bo_map_range; + pscreen->buffer_flush_mapped_range = nouveau_screen_bo_map_flush; +#endif + pscreen->buffer_unmap = nouveau_screen_bo_unmap; + pscreen->buffer_destroy = nouveau_screen_bo_del; + + pscreen->fence_reference = nouveau_screen_fence_ref; + pscreen->fence_signalled = nouveau_screen_fence_signalled; + pscreen->fence_finish = nouveau_screen_fence_finish; + + return 0; +} + +void +nouveau_screen_fini(struct nouveau_screen *screen) +{ +} + diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h new file mode 100644 index 0000000000..cffba11762 --- /dev/null +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -0,0 +1,24 @@ +#ifndef __NOUVEAU_SCREEN_H__ +#define __NOUVEAU_SCREEN_H__ + +struct nouveau_screen { + struct pipe_screen base; + struct nouveau_device *device; +}; + +static inline struct nouveau_screen * +nouveau_screen(struct pipe_screen *pscreen) +{ + return (struct nouveau_screen *)pscreen; +} + +static inline struct nouveau_bo * +nouveau_bo(struct pipe_buffer *pb) +{ + return pb ? *(struct nouveau_bo **)(pb + 1) : NULL; +} + +int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *); +void nouveau_screen_fini(struct nouveau_screen *); + +#endif diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index d960657066..7b67a75439 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -23,8 +23,6 @@ #define NOUVEAU_MSG(fmt, args...) \ fprintf(stderr, "nouveau: "fmt, ##args); -#define nouveau_bo(pb) nv50->screen->nvws->get_bo(pb) - /* Constant buffer assignment */ #define NV50_CB_PMISC 0 #define NV50_CB_PVP 1 diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index 35cebdbdc3..4d05eeac2c 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -90,7 +90,7 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) struct nouveau_channel *chan = nv50->screen->nvws->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q = nv50_query(pq); - struct nouveau_bo *bo = nv50->screen->nvws->get_bo(q->buffer); + struct nouveau_bo *bo = nouveau_bo(q->buffer); WAIT_RING (chan, 5); BEGIN_RING(chan, tesla, 0x1b00, 4); diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index b7e9df77db..3b830847ca 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -22,8 +22,6 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" - #include "nv50_context.h" #include "nv50_screen.h" @@ -68,23 +66,6 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, return FALSE; } -static const char * -nv50_screen_get_name(struct pipe_screen *pscreen) -{ - struct nv50_screen *screen = nv50_screen(pscreen); - struct nouveau_device *dev = screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv50_screen_get_vendor(struct pipe_screen *pscreen) -{ - return "nouveau"; -} - static int nv50_screen_get_param(struct pipe_screen *pscreen, int param) { @@ -153,7 +134,10 @@ nv50_screen_get_paramf(struct pipe_screen *pscreen, int param) static void nv50_screen_destroy(struct pipe_screen *pscreen) { - FREE(pscreen); + struct nv50_screen *screen = nv50_screen(pscreen); + + nouveau_screen_fini(&screen->base); + FREE(screen); } struct pipe_screen * @@ -161,6 +145,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen); struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned chipset = dev->chipset; unsigned tesla_class = 0; @@ -168,13 +153,31 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) if (!screen) return NULL; + pscreen = &screen->base.base; + + ret = nouveau_screen_init(&screen->base, nvws->channel->device); + if (ret) { + nv50_screen_destroy(pscreen); + return NULL; + } + + /* Setup the pipe */ screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv50_screen_destroy; + pscreen->get_param = nv50_screen_get_param; + pscreen->get_paramf = nv50_screen_get_paramf; + pscreen->is_format_supported = nv50_screen_is_format_supported; + + nv50_screen_init_miptree_functions(pscreen); + nv50_transfer_init_screen_functions(pscreen); + /* DMA engine object */ ret = nvws->grobj_alloc(nvws, 0x5039, &screen->m2mf); if (ret) { NOUVEAU_ERR("Error creating M2MF object: %d\n", ret); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -182,7 +185,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->grobj_alloc(nvws, NV50_2D, &screen->eng2d); if (ret) { NOUVEAU_ERR("Error creating 2D object: %d\n", ret); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -200,20 +203,20 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) break; default: NOUVEAU_ERR("Not a known NV50 chipset: NV%02x\n", chipset); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } if (tesla_class == 0) { NOUVEAU_ERR("Unknown G8x chipset: NV%02x\n", chipset); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } ret = nvws->grobj_alloc(nvws, tesla_class, &screen->tesla); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -221,26 +224,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } - /* Setup the pipe */ - screen->pipe.winsys = ws; - - screen->pipe.destroy = nv50_screen_destroy; - - screen->pipe.get_name = nv50_screen_get_name; - screen->pipe.get_vendor = nv50_screen_get_vendor; - screen->pipe.get_param = nv50_screen_get_param; - screen->pipe.get_paramf = nv50_screen_get_paramf; - - screen->pipe.is_format_supported = nv50_screen_is_format_supported; - - nv50_screen_init_miptree_functions(&screen->pipe); - nv50_transfer_init_screen_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - /* Static M2MF init */ so = so_new(32, 0); so_method(so, screen->m2mf, 0x0180, 3); @@ -295,7 +282,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, &screen->constbuf_misc[0]); if (ret) { - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -303,7 +290,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, &screen->constbuf_parm[i]); if (ret) { - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } } @@ -313,7 +300,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nvws->res_init(&screen->parm_heap[1], 0, 128)) { NOUVEAU_ERR("Error initialising constant buffers.\n"); - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -362,7 +349,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) */ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tic); if (ret) { - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -381,7 +368,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tsc); if (ret) { - nv50_screen_destroy(&screen->pipe); + nv50_screen_destroy(pscreen); return NULL; } @@ -420,6 +407,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_ref (NULL, &so); nouveau_pushbuf_flush(nvws->channel, 0); - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h index fa7d8d0f0d..61e24a5b57 100644 --- a/src/gallium/drivers/nv50/nv50_screen.h +++ b/src/gallium/drivers/nv50/nv50_screen.h @@ -1,10 +1,10 @@ #ifndef __NV50_SCREEN_H__ #define __NV50_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" struct nv50_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index c0f0efe158..121eddfc83 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -54,14 +54,10 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) struct nv50_miptree *mt = nv50_miptree(ps->texture); struct nouveau_channel *chan = screen->nvws->channel; struct nouveau_grobj *eng2d = screen->eng2d; - struct nouveau_bo *bo; + struct nouveau_bo *bo = nouveau_bo(nv50_miptree(ps->texture)->buffer); int format, mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; int flags = NOUVEAU_BO_VRAM | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD); - bo = screen->nvws->get_bo(nv50_miptree(ps->texture)->buffer); - if (!bo) - return 1; - format = nv50_format(ps->format); if (format < 0) return 1; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 28e7edd144..5f1e430ad1 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -27,8 +27,8 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, struct nouveau_winsys *nvws = screen->nvws; struct nouveau_channel *chan = nvws->channel; struct nouveau_grobj *m2mf = screen->m2mf; - struct nouveau_bo *src_bo = nvws->get_bo(src); - struct nouveau_bo *dst_bo = nvws->get_bo(dst); + struct nouveau_bo *src_bo = nouveau_bo(src); + struct nouveau_bo *dst_bo = nouveau_bo(dst); src_reloc |= NOUVEAU_BO_RD; dst_reloc |= NOUVEAU_BO_WR; diff --git a/src/gallium/winsys/drm/nouveau/dri/Makefile b/src/gallium/winsys/drm/nouveau/dri/Makefile index 024ab150cb..0937f68c34 100644 --- a/src/gallium/winsys/drm/nouveau/dri/Makefile +++ b/src/gallium/winsys/drm/nouveau/dri/Makefile @@ -11,7 +11,8 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/nv20/libnv20.a \ $(TOP)/src/gallium/drivers/nv30/libnv30.a \ $(TOP)/src/gallium/drivers/nv40/libnv40.a \ - $(TOP)/src/gallium/drivers/nv50/libnv50.a + $(TOP)/src/gallium/drivers/nv50/libnv50.a \ + $(TOP)/src/gallium/drivers/nouveau/libnouveau.a DRIVER_SOURCES = -- cgit v1.2.3 From 74adb150d595a7bc3f769bd2520c98a07bbc8531 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:30:41 +1000 Subject: nv40: remove u_simple_screen usage --- src/gallium/drivers/nv40/nv40_context.h | 2 - src/gallium/drivers/nv40/nv40_screen.c | 69 +++++++++++++-------------------- src/gallium/drivers/nv40/nv40_screen.h | 4 +- src/gallium/drivers/nv40/nv40_surface.c | 5 ++- src/gallium/drivers/nv40/nv40_vbo.c | 2 +- 5 files changed, 32 insertions(+), 50 deletions(-) diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 393b31c5f0..97bc83292d 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -21,8 +21,6 @@ #include "nv40_state.h" -#define nouveau_bo(pb) nv40->screen->nvws->get_bo(pb) - #define NOUVEAU_ERR(fmt, args...) \ fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args); #define NOUVEAU_MSG(fmt, args...) \ diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 5030c3ecbc..3049bd8031 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -1,5 +1,4 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" #include "nv40_context.h" #include "nv40_screen.h" @@ -8,23 +7,6 @@ #define NV4X_GRCLASS4497_CHIPSETS 0x00005450 #define NV6X_GRCLASS4497_CHIPSETS 0x00000088 -static const char * -nv40_screen_get_name(struct pipe_screen *pscreen) -{ - struct nv40_screen *screen = nv40_screen(pscreen); - struct nouveau_device *dev = screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv40_screen_get_vendor(struct pipe_screen *pscreen) -{ - return "nouveau"; -} - static int nv40_screen_get_param(struct pipe_screen *pscreen, int param) { @@ -157,6 +139,8 @@ nv40_screen_destroy(struct pipe_screen *pscreen) nvws->notifier_free(&screen->sync); nvws->grobj_free(&screen->curie); + nouveau_screen_fini(&screen->base); + FREE(pscreen); } @@ -164,36 +148,49 @@ struct pipe_screen * nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned curie_class = 0; - unsigned chipset = nvws->channel->device->chipset; int ret; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv40_screen_destroy; + pscreen->get_param = nv40_screen_get_param; + pscreen->get_paramf = nv40_screen_get_paramf; + pscreen->is_format_supported = nv40_screen_surface_format_supported; + + nv40_screen_init_miptree_functions(pscreen); + nv40_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + /* 2D engine setup */ screen->eng2d = nv04_surface_2d_init(nvws); screen->eng2d->buf = nv40_surface_buffer; /* 3D object */ - switch (chipset & 0xf0) { + switch (dev->chipset & 0xf0) { case 0x40: - if (NV4X_GRCLASS4097_CHIPSETS & (1 << (chipset & 0x0f))) + if (NV4X_GRCLASS4097_CHIPSETS & (1 << (dev->chipset & 0x0f))) curie_class = NV40TCL; else - if (NV4X_GRCLASS4497_CHIPSETS & (1 << (chipset & 0x0f))) + if (NV4X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f))) curie_class = NV44TCL; break; case 0x60: - if (NV6X_GRCLASS4497_CHIPSETS & (1 << (chipset & 0x0f))) + if (NV6X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f))) curie_class = NV44TCL; break; } if (!curie_class) { - NOUVEAU_ERR("Unknown nv4x chipset: nv%02x\n", chipset); + NOUVEAU_ERR("Unknown nv4x chipset: nv%02x\n", dev->chipset); return NULL; } @@ -207,7 +204,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv40_screen_destroy(&screen->pipe); + nv40_screen_destroy(pscreen); return NULL; } @@ -215,21 +212,21 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 32, &screen->query); if (ret) { NOUVEAU_ERR("Error initialising query objects: %d\n", ret); - nv40_screen_destroy(&screen->pipe); + nv40_screen_destroy(pscreen); return NULL; } ret = nvws->res_init(&screen->query_heap, 0, 32); if (ret) { NOUVEAU_ERR("Error initialising query object heap: %d\n", ret); - nv40_screen_destroy(&screen->pipe); + nv40_screen_destroy(pscreen); return NULL; } /* Vtxprog resources */ if (nvws->res_init(&screen->vp_exec_heap, 0, 512) || nvws->res_init(&screen->vp_data_heap, 0, 256)) { - nv40_screen_destroy(&screen->pipe); + nv40_screen_destroy(pscreen); return NULL; } @@ -285,20 +282,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_ref(NULL, &so); nouveau_pushbuf_flush(nvws->channel, 0); - screen->pipe.winsys = ws; - screen->pipe.destroy = nv40_screen_destroy; - - screen->pipe.get_name = nv40_screen_get_name; - screen->pipe.get_vendor = nv40_screen_get_vendor; - screen->pipe.get_param = nv40_screen_get_param; - screen->pipe.get_paramf = nv40_screen_get_paramf; - - screen->pipe.is_format_supported = nv40_screen_surface_format_supported; - - nv40_screen_init_miptree_functions(&screen->pipe); - nv40_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nv40/nv40_screen.h index 7b503bd207..57b4c8fc46 100644 --- a/src/gallium/drivers/nv40/nv40_screen.h +++ b/src/gallium/drivers/nv40/nv40_screen.h @@ -1,11 +1,11 @@ #ifndef __NV40_SCREEN_H__ #define __NV40_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" #include "nv04/nv04_surface_2d.h" struct nv40_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; diff --git a/src/gallium/drivers/nv40/nv40_surface.c b/src/gallium/drivers/nv40/nv40_surface.c index 1a849da32d..a596547974 100644 --- a/src/gallium/drivers/nv40/nv40_surface.c +++ b/src/gallium/drivers/nv40/nv40_surface.c @@ -26,12 +26,13 @@ * **************************************************************************/ -#include "nv40_context.h" #include "pipe/p_defines.h" -#include "pipe/internal/p_winsys_screen.h" #include "pipe/p_inlines.h" + #include "util/u_tile.h" +#include "nv40_context.h" + static void nv40_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest, unsigned destx, unsigned desty, diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index 7add803df7..4abddba110 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -70,7 +70,7 @@ static boolean nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib, unsigned ib_size) { - struct pipe_screen *pscreen = &nv40->screen->pipe; + struct pipe_screen *pscreen = &nv40->screen->base.base; unsigned type; if (!ib) { -- cgit v1.2.3 From 901d7c3057d7ca3d12d5e417e376cb25ded0070c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:37:59 +1000 Subject: nv30: remove u_simple_screen usage --- src/gallium/drivers/nv30/nv30_context.h | 2 - src/gallium/drivers/nv30/nv30_screen.c | 70 +++++++++++++-------------------- src/gallium/drivers/nv30/nv30_screen.h | 5 ++- src/gallium/drivers/nv30/nv30_vbo.c | 2 +- 4 files changed, 31 insertions(+), 48 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 5ba474cc33..4229c0a0e1 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -19,8 +19,6 @@ #include "nouveau/nouveau_push.h" #include "nouveau/nouveau_stateobj.h" -#define nouveau_bo(pb) nv30->screen->nvws->get_bo(pb) - #include "nv30_state.h" #define NOUVEAU_ERR(fmt, args...) \ diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 772eb78566..f516038b9c 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -1,5 +1,7 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" +#include "pipe/p_state.h" + +#include "nouveau/nouveau_screen.h" #include "nv30_context.h" #include "nv30_screen.h" @@ -8,23 +10,6 @@ #define NV34TCL_CHIPSET_3X_MASK 0x00000010 #define NV35TCL_CHIPSET_3X_MASK 0x000001e0 -static const char * -nv30_screen_get_name(struct pipe_screen *pscreen) -{ - struct nv30_screen *screen = nv30_screen(pscreen); - struct nouveau_device *dev = screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv30_screen_get_vendor(struct pipe_screen *pscreen) -{ - return "nouveau"; -} - static int nv30_screen_get_param(struct pipe_screen *pscreen, int param) { @@ -155,29 +140,42 @@ struct pipe_screen * nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned rankine_class = 0; - unsigned chipset = nvws->channel->device->chipset; int ret, i; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv30_screen_destroy; + pscreen->get_param = nv30_screen_get_param; + pscreen->get_paramf = nv30_screen_get_paramf; + pscreen->is_format_supported = nv30_screen_surface_format_supported; + + nv30_screen_init_miptree_functions(pscreen); + nv30_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + /* 2D engine setup */ screen->eng2d = nv04_surface_2d_init(nvws); screen->eng2d->buf = nv30_surface_buffer; /* 3D object */ - switch (chipset & 0xf0) { + switch (dev->chipset & 0xf0) { case 0x30: - if (NV30TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f))) + if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f))) rankine_class = 0x0397; else - if (NV34TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f))) + if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f))) rankine_class = 0x0697; else - if (NV35TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f))) + if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f))) rankine_class = 0x0497; break; default: @@ -185,7 +183,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } if (!rankine_class) { - NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", chipset); + NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", dev->chipset); return NULL; } @@ -199,7 +197,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv30_screen_destroy(&screen->pipe); + nv30_screen_destroy(pscreen); return NULL; } @@ -207,21 +205,21 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 32, &screen->query); if (ret) { NOUVEAU_ERR("Error initialising query objects: %d\n", ret); - nv30_screen_destroy(&screen->pipe); + nv30_screen_destroy(pscreen); return NULL; } ret = nvws->res_init(&screen->query_heap, 0, 32); if (ret) { NOUVEAU_ERR("Error initialising query object heap: %d\n", ret); - nv30_screen_destroy(&screen->pipe); + nv30_screen_destroy(pscreen); return NULL; } /* Vtxprog resources */ if (nvws->res_init(&screen->vp_exec_heap, 0, 256) || nvws->res_init(&screen->vp_data_heap, 0, 256)) { - nv30_screen_destroy(&screen->pipe); + nv30_screen_destroy(pscreen); return NULL; } @@ -305,19 +303,5 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_ref(NULL, &so); nouveau_pushbuf_flush(nvws->channel, 0); - screen->pipe.winsys = ws; - screen->pipe.destroy = nv30_screen_destroy; - - screen->pipe.get_name = nv30_screen_get_name; - screen->pipe.get_vendor = nv30_screen_get_vendor; - screen->pipe.get_param = nv30_screen_get_param; - screen->pipe.get_paramf = nv30_screen_get_paramf; - - screen->pipe.is_format_supported = nv30_screen_surface_format_supported; - - nv30_screen_init_miptree_functions(&screen->pipe); - nv30_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h index 8e36883975..5fbd998b53 100644 --- a/src/gallium/drivers/nv30/nv30_screen.h +++ b/src/gallium/drivers/nv30/nv30_screen.h @@ -1,11 +1,12 @@ #ifndef __NV30_SCREEN_H__ #define __NV30_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" + #include "nv04/nv04_surface_2d.h" struct nv30_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index b7d8c2e008..ff2bf6e71b 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -70,7 +70,7 @@ static boolean nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib, unsigned ib_size) { - struct pipe_screen *pscreen = &nv30->screen->pipe; + struct pipe_screen *pscreen = &nv30->screen->base.base; unsigned type; if (!ib) { -- cgit v1.2.3 From 74c45add474862e9c4e5063d2c5173546366bfe6 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:44:20 +1000 Subject: nv20: remove u_simple_screen usage --- src/gallium/drivers/nv20/nv20_prim_vbuf.c | 2 +- src/gallium/drivers/nv20/nv20_screen.c | 58 +++++++++++-------------------- src/gallium/drivers/nv20/nv20_screen.h | 4 +-- 3 files changed, 23 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c index 8aa342cd2d..8f9f27ebdc 100644 --- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c +++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c @@ -358,7 +358,7 @@ nv20_vbuf_render_release_vertices( struct vbuf_render *render ) { struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render); struct nv20_context *nv20 = nv20_render->nv20; - struct pipe_screen *pscreen = &nv20->screen->pipe; + struct pipe_screen *pscreen = &nv20->screen->base.base; if (nv20_render->pbuffer) { pipe_buffer_reference(&nv20_render->pbuffer, NULL); diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 7760ae27c0..6f3d73fe16 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -4,23 +4,6 @@ #include "nv20_context.h" #include "nv20_screen.h" -static const char * -nv20_screen_get_name(struct pipe_screen *screen) -{ - struct nv20_screen *nv20screen = nv20_screen(screen); - struct nouveau_device *dev = nv20screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv20_screen_get_vendor(struct pipe_screen *screen) -{ - return "nouveau"; -} - static int nv20_screen_get_param(struct pipe_screen *screen, int param) { @@ -140,26 +123,39 @@ struct pipe_screen * nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; unsigned kelvin_class = 0; - unsigned chipset = nvws->channel->device->chipset; int ret; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv20_screen_destroy; + pscreen->get_param = nv20_screen_get_param; + pscreen->get_paramf = nv20_screen_get_paramf; + pscreen->is_format_supported = nv20_screen_is_format_supported; + + nv20_screen_init_miptree_functions(pscreen); + nv20_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + /* 2D engine setup */ screen->eng2d = nv04_surface_2d_init(nvws); screen->eng2d->buf = nv20_surface_buffer; /* 3D object */ - if (chipset >= 0x25) + if (dev->chipset >= 0x25) kelvin_class = NV25TCL; - else if (chipset >= 0x20) + else if (dev->chipset >= 0x20) kelvin_class = NV20TCL; - if (!kelvin_class || chipset >= 0x30) { - NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", chipset); + if (!kelvin_class || dev->chipset >= 0x30) { + NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", dev->chipset); return NULL; } @@ -173,24 +169,10 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv20_screen_destroy(&screen->pipe); + nv20_screen_destroy(pscreen); return NULL; } - screen->pipe.winsys = ws; - screen->pipe.destroy = nv20_screen_destroy; - - screen->pipe.get_name = nv20_screen_get_name; - screen->pipe.get_vendor = nv20_screen_get_vendor; - screen->pipe.get_param = nv20_screen_get_param; - screen->pipe.get_paramf = nv20_screen_get_paramf; - - screen->pipe.is_format_supported = nv20_screen_is_format_supported; - - nv20_screen_init_miptree_functions(&screen->pipe); - nv20_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv20/nv20_screen.h b/src/gallium/drivers/nv20/nv20_screen.h index d9fce2bced..fc7bb05033 100644 --- a/src/gallium/drivers/nv20/nv20_screen.h +++ b/src/gallium/drivers/nv20/nv20_screen.h @@ -1,11 +1,11 @@ #ifndef __NV20_SCREEN_H__ #define __NV20_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" #include "nv04/nv04_surface_2d.h" struct nv20_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; -- cgit v1.2.3 From 251c47117b6268e03f7dd033b3f98033272916f3 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:53:57 +1000 Subject: nv10: remove u_simple_screen usage --- src/gallium/drivers/nv10/nv10_prim_vbuf.c | 2 +- src/gallium/drivers/nv10/nv10_screen.c | 67 +++++++++++-------------------- src/gallium/drivers/nv10/nv10_screen.h | 4 +- 3 files changed, 27 insertions(+), 46 deletions(-) diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index 089c236302..f16e343fa6 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -203,7 +203,7 @@ nv10_vbuf_render_release_vertices( struct vbuf_render *render ) { struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render); struct nv10_context *nv10 = nv10_render->nv10; - struct pipe_screen *pscreen = &nv10->screen->pipe; + struct pipe_screen *pscreen = &nv10->screen->base.base; assert(nv10_render->buffer); pipe_buffer_reference(&nv10_render->buffer, NULL); diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index 6532a93c7b..5c36bee6e2 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -1,26 +1,8 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" #include "nv10_context.h" #include "nv10_screen.h" -static const char * -nv10_screen_get_name(struct pipe_screen *screen) -{ - struct nv10_screen *nv10screen = nv10_screen(screen); - struct nouveau_device *dev = nv10screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv10_screen_get_vendor(struct pipe_screen *screen) -{ - return "nouveau"; -} - static int nv10_screen_get_param(struct pipe_screen *screen, int param) { @@ -140,30 +122,43 @@ struct pipe_screen * nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv10_screen *screen = CALLOC_STRUCT(nv10_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; unsigned celsius_class; - unsigned chipset = nvws->channel->device->chipset; int ret; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; + pscreen->winsys = ws; + pscreen->destroy = nv10_screen_destroy; + pscreen->get_param = nv10_screen_get_param; + pscreen->get_paramf = nv10_screen_get_paramf; + pscreen->is_format_supported = nv10_screen_is_format_supported; + + nv10_screen_init_miptree_functions(pscreen); + nv10_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + /* 2D engine setup */ screen->eng2d = nv04_surface_2d_init(nvws); screen->eng2d->buf = nv10_surface_buffer; /* 3D object */ - if (chipset>=0x20) - celsius_class=NV11TCL; - else if (chipset>=0x17) - celsius_class=NV17TCL; - else if (chipset>=0x11) - celsius_class=NV11TCL; + if (dev->chipset >= 0x20) + celsius_class = NV11TCL; + else if (dev->chipset >= 0x17) + celsius_class = NV17TCL; + else if (dev->chipset >= 0x11) + celsius_class = NV11TCL; else - celsius_class=NV10TCL; + celsius_class = NV10TCL; if (!celsius_class) { - NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", chipset); + NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", dev->chipset); return NULL; } @@ -177,24 +172,10 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv10_screen_destroy(&screen->pipe); + nv10_screen_destroy(pscreen); return NULL; } - screen->pipe.winsys = ws; - screen->pipe.destroy = nv10_screen_destroy; - - screen->pipe.get_name = nv10_screen_get_name; - screen->pipe.get_vendor = nv10_screen_get_vendor; - screen->pipe.get_param = nv10_screen_get_param; - screen->pipe.get_paramf = nv10_screen_get_paramf; - - screen->pipe.is_format_supported = nv10_screen_is_format_supported; - - nv10_screen_init_miptree_functions(&screen->pipe); - nv10_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv10/nv10_screen.h b/src/gallium/drivers/nv10/nv10_screen.h index ad829ee3fd..86b6d8def5 100644 --- a/src/gallium/drivers/nv10/nv10_screen.h +++ b/src/gallium/drivers/nv10/nv10_screen.h @@ -1,11 +1,11 @@ #ifndef __NV10_SCREEN_H__ #define __NV10_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" #include "nv04/nv04_surface_2d.h" struct nv10_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; -- cgit v1.2.3 From d4d584b16e21b24a473d3a31d361432b8fa0b945 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 4 Jun 2009 21:57:53 +1000 Subject: nv04: remove u_simple_screen usage --- src/gallium/drivers/nv04/nv04_screen.c | 57 ++++++++++-------------------- src/gallium/drivers/nv04/nv04_screen.h | 4 +-- src/gallium/drivers/nv04/nv04_surface_2d.c | 14 ++++---- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c index f9f6d97426..308f7e5960 100644 --- a/src/gallium/drivers/nv04/nv04_screen.c +++ b/src/gallium/drivers/nv04/nv04_screen.c @@ -1,27 +1,9 @@ #include "pipe/p_screen.h" #include "pipe/p_inlines.h" -#include "util/u_simple_screen.h" #include "nv04_context.h" #include "nv04_screen.h" -static const char * -nv04_screen_get_name(struct pipe_screen *screen) -{ - struct nv04_screen *nv04screen = nv04_screen(screen); - struct nouveau_device *dev = nv04screen->nvws->channel->device; - static char buffer[128]; - - snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); - return buffer; -} - -static const char * -nv04_screen_get_vendor(struct pipe_screen *screen) -{ - return "nouveau"; -} - static int nv04_screen_get_param(struct pipe_screen *screen, int param) { @@ -144,18 +126,31 @@ struct pipe_screen * nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv04_screen *screen = CALLOC_STRUCT(nv04_screen); + struct nouveau_device *dev = nvws->channel->device; + struct pipe_screen *pscreen; unsigned fahrenheit_class = 0, sub3d_class = 0; - unsigned chipset = nvws->channel->device->chipset; int ret; if (!screen) return NULL; + pscreen = &screen->base.base; + screen->nvws = nvws; - if (chipset>=0x20) { + pscreen->winsys = ws; + pscreen->destroy = nv04_screen_destroy; + pscreen->get_param = nv04_screen_get_param; + pscreen->get_paramf = nv04_screen_get_paramf; + pscreen->is_format_supported = nv04_screen_is_format_supported; + + nv04_screen_init_miptree_functions(pscreen); + nv04_screen_init_transfer_functions(pscreen); + nouveau_screen_init(&screen->base, dev); + + if (dev->chipset >= 0x20) { fahrenheit_class = 0; sub3d_class = 0; - } else if (chipset>=0x10) { + } else if (dev->chipset >= 0x10) { fahrenheit_class = NV10_DX5_TEXTURED_TRIANGLE; sub3d_class = NV10_CONTEXT_SURFACES_3D; } else { @@ -164,7 +159,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } if (!fahrenheit_class) { - NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", chipset); + NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", dev->chipset); return NULL; } @@ -190,24 +185,10 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) ret = nvws->notifier_alloc(nvws, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); - nv04_screen_destroy(&screen->pipe); + nv04_screen_destroy(pscreen); return NULL; } - screen->pipe.winsys = ws; - screen->pipe.destroy = nv04_screen_destroy; - - screen->pipe.get_name = nv04_screen_get_name; - screen->pipe.get_vendor = nv04_screen_get_vendor; - screen->pipe.get_param = nv04_screen_get_param; - screen->pipe.get_paramf = nv04_screen_get_paramf; - - screen->pipe.is_format_supported = nv04_screen_is_format_supported; - - nv04_screen_init_miptree_functions(&screen->pipe); - nv04_screen_init_transfer_functions(&screen->pipe); - u_simple_screen_init(&screen->pipe); - - return &screen->pipe; + return pscreen; } diff --git a/src/gallium/drivers/nv04/nv04_screen.h b/src/gallium/drivers/nv04/nv04_screen.h index ee6fb6db44..11466b9442 100644 --- a/src/gallium/drivers/nv04/nv04_screen.h +++ b/src/gallium/drivers/nv04/nv04_screen.h @@ -1,11 +1,11 @@ #ifndef __NV04_SCREEN_H__ #define __NV04_SCREEN_H__ -#include "pipe/p_screen.h" +#include "nouveau/nouveau_screen.h" #include "nv04_surface_2d.h" struct nv04_screen { - struct pipe_screen pipe; + struct nouveau_screen base; struct nouveau_winsys *nvws; unsigned chipset; diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index f3a8d7efee..2133123582 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -99,8 +99,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, struct nouveau_channel *chan = ctx->nvws->channel; struct nouveau_grobj *swzsurf = ctx->swzsurf; struct nouveau_grobj *sifm = ctx->sifm; - struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); - struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); + struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); const unsigned src_pitch = ((struct nv04_surface *)src)->pitch; const unsigned max_w = 1024; const unsigned max_h = 1024; @@ -169,8 +169,8 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, { struct nouveau_channel *chan = ctx->nvws->channel; struct nouveau_grobj *m2mf = ctx->m2mf; - struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); - struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); + struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); unsigned src_pitch = ((struct nv04_surface *)src)->pitch; unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; unsigned dst_offset = dst->offset + dy * dst_pitch + @@ -216,8 +216,8 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, struct nouveau_channel *chan = ctx->nvws->channel; struct nouveau_grobj *surf2d = ctx->surf2d; struct nouveau_grobj *blit = ctx->blit; - struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src)); - struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); + struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); unsigned src_pitch = ((struct nv04_surface *)src)->pitch; unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; int format; @@ -282,7 +282,7 @@ nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst, struct nouveau_channel *chan = ctx->nvws->channel; struct nouveau_grobj *surf2d = ctx->surf2d; struct nouveau_grobj *rect = ctx->rect; - struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst)); + struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; int cs2d_format, gdirect_format; -- cgit v1.2.3 From 1b207d9bb81ae3385e5658a81c71fbf2fe15c18f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 08:47:42 +1000 Subject: nouveau: call notifier/grobj etc funcs directly libdrm_nouveau is linked with the winsys, there's no good reason to do all this through yet another layer. --- src/gallium/drivers/nouveau/nouveau_screen.h | 1 + src/gallium/drivers/nouveau/nouveau_winsys.h | 27 --------- src/gallium/drivers/nv04/nv04_screen.c | 32 +++++++---- src/gallium/drivers/nv04/nv04_surface_2d.c | 1 + src/gallium/drivers/nv10/nv10_screen.c | 28 ++++++---- src/gallium/drivers/nv20/nv20_screen.c | 29 ++++++---- src/gallium/drivers/nv30/nv30_query.c | 25 ++++----- src/gallium/drivers/nv30/nv30_screen.c | 64 ++++++++++++---------- src/gallium/drivers/nv30/nv30_vertprog.c | 20 +++---- src/gallium/drivers/nv40/nv40_query.c | 25 ++++----- src/gallium/drivers/nv40/nv40_screen.c | 43 +++++++++------ src/gallium/drivers/nv40/nv40_vertprog.c | 19 +++---- src/gallium/drivers/nv50/nv50_program.c | 18 +++--- src/gallium/drivers/nv50/nv50_screen.c | 39 ++++++++----- .../winsys/drm/nouveau/drm/nouveau_winsys.c | 50 ----------------- 15 files changed, 195 insertions(+), 226 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index cffba11762..9968b07896 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -4,6 +4,7 @@ struct nouveau_screen { struct pipe_screen base; struct nouveau_device *device; + struct nouveau_channel *channel; }; static inline struct nouveau_screen * diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index 762c3a2a21..7998497240 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -27,33 +27,6 @@ struct nouveau_winsys { struct pipe_winsys *ws; struct nouveau_channel *channel; - - int (*res_init)(struct nouveau_resource **heap, unsigned start, - unsigned size); - int (*res_alloc)(struct nouveau_resource *heap, int size, void *priv, - struct nouveau_resource **); - void (*res_free)(struct nouveau_resource **); - - int (*grobj_alloc)(struct nouveau_winsys *, int grclass, - struct nouveau_grobj **); - void (*grobj_free)(struct nouveau_grobj **); - - int (*notifier_alloc)(struct nouveau_winsys *, int count, - struct nouveau_notifier **); - void (*notifier_free)(struct nouveau_notifier **); - void (*notifier_reset)(struct nouveau_notifier *, int id); - uint32_t (*notifier_status)(struct nouveau_notifier *, int id); - uint32_t (*notifier_retval)(struct nouveau_notifier *, int id); - int (*notifier_wait)(struct nouveau_notifier *, int id, - int status, double timeout); - - int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *, - unsigned, unsigned, struct pipe_surface *, - unsigned, unsigned, unsigned, unsigned); - int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *, - unsigned, unsigned, unsigned, unsigned, unsigned); - - struct nouveau_bo *(*get_bo)(struct pipe_buffer *); }; extern struct pipe_screen * diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c index 308f7e5960..98e2dafcd8 100644 --- a/src/gallium/drivers/nv04/nv04_screen.c +++ b/src/gallium/drivers/nv04/nv04_screen.c @@ -105,10 +105,9 @@ static void nv04_screen_destroy(struct pipe_screen *pscreen) { struct nv04_screen *screen = nv04_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - nvws->notifier_free(&screen->sync); - nvws->grobj_free(&screen->fahrenheit); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->fahrenheit); nv04_surface_2d_takedown(&screen->eng2d); FREE(pscreen); @@ -127,6 +126,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv04_screen *screen = CALLOC_STRUCT(nv04_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned fahrenheit_class = 0, sub3d_class = 0; int ret; @@ -135,6 +135,13 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; + ret = nouveau_screen_init(&screen->base, dev); + if (ret) { + nv04_screen_destroy(pscreen); + return NULL; + } + screen->base.channel = chan = nvws->channel; + screen->nvws = nvws; pscreen->winsys = ws; @@ -145,7 +152,6 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv04_screen_init_miptree_functions(pscreen); nv04_screen_init_transfer_functions(pscreen); - nouveau_screen_init(&screen->base, dev); if (dev->chipset >= 0x20) { fahrenheit_class = 0; @@ -163,26 +169,30 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); - screen->eng2d->buf = nv04_surface_buffer; - /* 3D object */ - ret = nvws->grobj_alloc(nvws, fahrenheit_class, &screen->fahrenheit); + ret = nouveau_grobj_alloc(chan, 0xbeef0001, fahrenheit_class, + &screen->fahrenheit); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); return NULL; } + BIND_RING(chan, screen->fahrenheit, 7); /* 3D surface object */ - ret = nvws->grobj_alloc(nvws, sub3d_class, &screen->context_surfaces_3d); + ret = nouveau_grobj_alloc(chan, 0xbeef0002, sub3d_class, + &screen->context_surfaces_3d); if (ret) { NOUVEAU_ERR("Error creating 3D surface object: %d\n", ret); return NULL; } + BIND_RING(chan, screen->context_surfaces_3d, 6); + + /* 2D engine setup */ + screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d->buf = nv04_surface_buffer; /* Notifier for sync purposes */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv04_screen_destroy(pscreen); diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 2133123582..fcb6501411 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -4,6 +4,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_util.h" +#include "nouveau/nouveau_screen.h" #include "nv04_surface_2d.h" static INLINE int diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index 5c36bee6e2..f090d2b0b7 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -102,10 +102,9 @@ static void nv10_screen_destroy(struct pipe_screen *pscreen) { struct nv10_screen *screen = nv10_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - nvws->notifier_free(&screen->sync); - nvws->grobj_free(&screen->celsius); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->celsius); FREE(pscreen); } @@ -123,6 +122,7 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv10_screen *screen = CALLOC_STRUCT(nv10_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned celsius_class; int ret; @@ -131,6 +131,13 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; + ret = nouveau_screen_init(&screen->base, dev); + if (ret) { + nv10_screen_destroy(pscreen); + return NULL; + } + screen->base.channel = chan = nvws->channel; + screen->nvws = nvws; pscreen->winsys = ws; @@ -141,11 +148,6 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv10_screen_init_miptree_functions(pscreen); nv10_screen_init_transfer_functions(pscreen); - nouveau_screen_init(&screen->base, dev); - - /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); - screen->eng2d->buf = nv10_surface_buffer; /* 3D object */ if (dev->chipset >= 0x20) @@ -162,14 +164,20 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - ret = nvws->grobj_alloc(nvws, celsius_class, &screen->celsius); + ret = nouveau_grobj_alloc(chan, 0xbeef0001, celsius_class, + &screen->celsius); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); return FALSE; } + BIND_RING(chan, screen->celsius, 7); + + /* 2D engine setup */ + screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d->buf = nv10_surface_buffer; /* Notifier for sync purposes */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv10_screen_destroy(pscreen); diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 6f3d73fe16..4d991852a1 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -1,5 +1,4 @@ #include "pipe/p_screen.h" -#include "util/u_simple_screen.h" #include "nv20_context.h" #include "nv20_screen.h" @@ -103,10 +102,9 @@ static void nv20_screen_destroy(struct pipe_screen *pscreen) { struct nv20_screen *screen = nv20_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - nvws->notifier_free(&screen->sync); - nvws->grobj_free(&screen->kelvin); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->kelvin); FREE(pscreen); } @@ -124,6 +122,7 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned kelvin_class = 0; int ret; @@ -132,6 +131,13 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; + ret = nouveau_screen_init(&screen->base, dev); + if (ret) { + nv20_screen_destroy(pscreen); + return NULL; + } + screen->base.channel = chan = nvws->channel; + screen->nvws = nvws; pscreen->winsys = ws; @@ -142,11 +148,6 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv20_screen_init_miptree_functions(pscreen); nv20_screen_init_transfer_functions(pscreen); - nouveau_screen_init(&screen->base, dev); - - /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); - screen->eng2d->buf = nv20_surface_buffer; /* 3D object */ if (dev->chipset >= 0x25) @@ -159,14 +160,20 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - ret = nvws->grobj_alloc(nvws, kelvin_class, &screen->kelvin); + ret = nouveau_grobj_alloc(chan, 0xbeef0097, kelvin_class, + &screen->kelvin); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); return FALSE; } + BIND_RING(chan, screen->kelvin, 7); + + /* 2D engine setup */ + screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d->buf = nv20_surface_buffer; /* Notifier for sync purposes */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv20_screen_destroy(pscreen); diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c index 2f974cf5c4..1d1c8a484e 100644 --- a/src/gallium/drivers/nv30/nv30_query.c +++ b/src/gallium/drivers/nv30/nv30_query.c @@ -29,11 +29,10 @@ nv30_query_create(struct pipe_context *pipe, unsigned query_type) static void nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv30_context *nv30 = nv30_context(pipe); struct nv30_query *q = nv30_query(pq); if (q->object) - nv30->nvws->res_free(&q->object); + nouveau_resource_free(&q->object); FREE(q); } @@ -54,9 +53,9 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq) pipe->get_query_result(pipe, pq, 1, &tmp); } - if (nv30->nvws->res_alloc(nv30->screen->query_heap, 1, NULL, &q->object)) + if (nouveau_resource_alloc(nv30->screen->query_heap, 1, NULL, &q->object)) assert(0); - nv30->nvws->notifier_reset(nv30->screen->query, q->object->start); + nouveau_notifier_reset(nv30->screen->query, q->object->start); BEGIN_RING(rankine, NV34TCL_QUERY_RESET, 1); OUT_RING (1); @@ -84,27 +83,27 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq, { struct nv30_context *nv30 = nv30_context(pipe); struct nv30_query *q = nv30_query(pq); - struct nouveau_winsys *nvws = nv30->nvws; assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER); if (!q->ready) { unsigned status; - status = nvws->notifier_status(nv30->screen->query, - q->object->start); + status = nouveau_notifier_status(nv30->screen->query, + q->object->start); if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) { if (wait == FALSE) return FALSE; - nvws->notifier_wait(nv30->screen->query, q->object->start, - NV_NOTIFY_STATE_STATUS_COMPLETED, - 0); + + nouveau_notifier_wait_status(nv30->screen->query, + q->object->start, + NV_NOTIFY_STATE_STATUS_COMPLETED, 0); } - q->result = nvws->notifier_retval(nv30->screen->query, - q->object->start); + q->result = nouveau_notifier_return_val(nv30->screen->query, + q->object->start); q->ready = TRUE; - nvws->res_free(&q->object); + nouveau_resource_free(&q->object); } *result = q->result; diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index f516038b9c..60e2f0855d 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -124,14 +124,13 @@ static void nv30_screen_destroy(struct pipe_screen *pscreen) { struct nv30_screen *screen = nv30_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - nvws->res_free(&screen->vp_exec_heap); - nvws->res_free(&screen->vp_data_heap); - nvws->res_free(&screen->query_heap); - nvws->notifier_free(&screen->query); - nvws->notifier_free(&screen->sync); - nvws->grobj_free(&screen->rankine); + nouveau_resource_free(&screen->vp_exec_heap); + nouveau_resource_free(&screen->vp_data_heap); + nouveau_resource_free(&screen->query_heap); + nouveau_notifier_free(&screen->query); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->rankine); FREE(pscreen); } @@ -141,6 +140,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned rankine_class = 0; @@ -150,6 +150,13 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; + ret = nouveau_screen_init(&screen->base, dev); + if (ret) { + nv30_screen_destroy(pscreen); + return NULL; + } + screen->base.channel = chan = nvws->channel; + screen->nvws = nvws; pscreen->winsys = ws; @@ -160,11 +167,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv30_screen_init_miptree_functions(pscreen); nv30_screen_init_transfer_functions(pscreen); - nouveau_screen_init(&screen->base, dev); - - /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); - screen->eng2d->buf = nv30_surface_buffer; /* 3D object */ switch (dev->chipset & 0xf0) { @@ -187,14 +189,20 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - ret = nvws->grobj_alloc(nvws, rankine_class, &screen->rankine); + ret = nouveau_grobj_alloc(chan, 0xbeef3097, rankine_class, + &screen->rankine); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); return FALSE; } + BIND_RING(chan, screen->rankine, 7); + + /* 2D engine setup */ + screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d->buf = nv30_surface_buffer; /* Notifier for sync purposes */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv30_screen_destroy(pscreen); @@ -202,14 +210,14 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } /* Query objects */ - ret = nvws->notifier_alloc(nvws, 32, &screen->query); + ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query); if (ret) { NOUVEAU_ERR("Error initialising query objects: %d\n", ret); nv30_screen_destroy(pscreen); return NULL; } - ret = nvws->res_init(&screen->query_heap, 0, 32); + ret = nouveau_resource_init(&screen->query_heap, 0, 32); if (ret) { NOUVEAU_ERR("Error initialising query object heap: %d\n", ret); nv30_screen_destroy(pscreen); @@ -217,8 +225,8 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } /* Vtxprog resources */ - if (nvws->res_init(&screen->vp_exec_heap, 0, 256) || - nvws->res_init(&screen->vp_data_heap, 0, 256)) { + if (nouveau_resource_init(&screen->vp_exec_heap, 0, 256) || + nouveau_resource_init(&screen->vp_data_heap, 0, 256)) { nv30_screen_destroy(pscreen); return NULL; } @@ -228,23 +236,23 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->rankine, NV34TCL_DMA_NOTIFY, 1); so_data (so, screen->sync->handle); so_method(so, screen->rankine, NV34TCL_DMA_TEXTURE0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->gart->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->gart->handle); so_method(so, screen->rankine, NV34TCL_DMA_COLOR1, 1); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->rankine, NV34TCL_DMA_COLOR0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->rankine, NV34TCL_DMA_VTXBUF0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->gart->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->gart->handle); /* so_method(so, screen->rankine, NV34TCL_DMA_FENCE, 2); so_data (so, 0); so_data (so, screen->query->handle);*/ so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY7, 1); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY8, 1); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); for (i=1; i<8; i++) { so_method(so, screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1); @@ -301,7 +309,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_emit(nvws, so); so_ref(NULL, &so); - nouveau_pushbuf_flush(nvws->channel, 0); + nouveau_pushbuf_flush(chan, 0); return pscreen; } diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index eaf543b8f7..aec39aae9c 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -645,7 +645,6 @@ out_err: static boolean nv30_vertprog_validate(struct nv30_context *nv30) { - struct nouveau_winsys *nvws = nv30->nvws; struct pipe_winsys *ws = nv30->pipe.winsys; struct nouveau_grobj *rankine = nv30->screen->rankine; struct nv30_vertex_program *vp; @@ -669,15 +668,15 @@ nv30_vertprog_validate(struct nv30_context *nv30) struct nouveau_stateobj *so; uint vplen = vp->nr_insns; - if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) { + if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) { while (heap->next && heap->size < vplen) { struct nv30_vertex_program *evict; evict = heap->next->priv; - nvws->res_free(&evict->exec); + nouveau_resource_free(&evict->exec); } - if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) + if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) assert(0); } @@ -694,15 +693,16 @@ nv30_vertprog_validate(struct nv30_context *nv30) if (vp->nr_consts && !vp->data) { struct nouveau_resource *heap = nv30->screen->vp_data_heap; - if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) { + if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) { while (heap->next && heap->size < vp->nr_consts) { struct nv30_vertex_program *evict; evict = heap->next->priv; - nvws->res_free(&evict->data); + nouveau_resource_free(&evict->data); } - if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) + if (nouveau_resource_alloc(heap, vp->nr_consts, vp, + &vp->data)) assert(0); } @@ -804,8 +804,6 @@ nv30_vertprog_validate(struct nv30_context *nv30) void nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp) { - struct nouveau_winsys *nvws = nv30->screen->nvws; - vp->translated = FALSE; if (vp->nr_insns) { @@ -820,9 +818,9 @@ nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp) vp->nr_consts = 0; } - nvws->res_free(&vp->exec); + nouveau_resource_free(&vp->exec); vp->exec_start = 0; - nvws->res_free(&vp->data); + nouveau_resource_free(&vp->data); vp->data_start = 0; vp->data_start_min = 0; diff --git a/src/gallium/drivers/nv40/nv40_query.c b/src/gallium/drivers/nv40/nv40_query.c index 9b9a43f49d..7874aedd42 100644 --- a/src/gallium/drivers/nv40/nv40_query.c +++ b/src/gallium/drivers/nv40/nv40_query.c @@ -29,11 +29,10 @@ nv40_query_create(struct pipe_context *pipe, unsigned query_type) static void nv40_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) { - struct nv40_context *nv40 = nv40_context(pipe); struct nv40_query *q = nv40_query(pq); if (q->object) - nv40->nvws->res_free(&q->object); + nouveau_resource_free(&q->object); FREE(q); } @@ -54,9 +53,9 @@ nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq) pipe->get_query_result(pipe, pq, 1, &tmp); } - if (nv40->nvws->res_alloc(nv40->screen->query_heap, 1, NULL, &q->object)) + if (nouveau_resource_alloc(nv40->screen->query_heap, 1, NULL, &q->object)) assert(0); - nv40->nvws->notifier_reset(nv40->screen->query, q->object->start); + nouveau_notifier_reset(nv40->screen->query, q->object->start); BEGIN_RING(curie, NV40TCL_QUERY_RESET, 1); OUT_RING (1); @@ -84,27 +83,27 @@ nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq, { struct nv40_context *nv40 = nv40_context(pipe); struct nv40_query *q = nv40_query(pq); - struct nouveau_winsys *nvws = nv40->nvws; assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER); if (!q->ready) { unsigned status; - status = nvws->notifier_status(nv40->screen->query, - q->object->start); + status = nouveau_notifier_status(nv40->screen->query, + q->object->start); if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) { if (wait == FALSE) return FALSE; - nvws->notifier_wait(nv40->screen->query, q->object->start, - NV_NOTIFY_STATE_STATUS_COMPLETED, - 0); + nouveau_notifier_wait_status(nv40->screen->query, + q->object->start, + NV_NOTIFY_STATE_STATUS_COMPLETED, + 0); } - q->result = nvws->notifier_retval(nv40->screen->query, - q->object->start); + q->result = nouveau_notifier_return_val(nv40->screen->query, + q->object->start); q->ready = TRUE; - nvws->res_free(&q->object); + nouveau_resource_free(&q->object); } *result = q->result; diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 3049bd8031..2114c93cd9 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -130,14 +130,13 @@ static void nv40_screen_destroy(struct pipe_screen *pscreen) { struct nv40_screen *screen = nv40_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - nvws->res_free(&screen->vp_exec_heap); - nvws->res_free(&screen->vp_data_heap); - nvws->res_free(&screen->query_heap); - nvws->notifier_free(&screen->query); - nvws->notifier_free(&screen->sync); - nvws->grobj_free(&screen->curie); + nouveau_resource_free(&screen->vp_exec_heap); + nouveau_resource_free(&screen->vp_data_heap); + nouveau_resource_free(&screen->query_heap); + nouveau_notifier_free(&screen->query); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->curie); nouveau_screen_fini(&screen->base); @@ -149,6 +148,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned curie_class = 0; @@ -158,6 +158,13 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; + ret = nouveau_screen_init(&screen->base, dev); + if (ret) { + nv40_screen_destroy(pscreen); + return NULL; + } + screen->base.channel = chan = nvws->channel; + screen->nvws = nvws; pscreen->winsys = ws; @@ -168,11 +175,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv40_screen_init_miptree_functions(pscreen); nv40_screen_init_transfer_functions(pscreen); - nouveau_screen_init(&screen->base, dev); - - /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); - screen->eng2d->buf = nv40_surface_buffer; /* 3D object */ switch (dev->chipset & 0xf0) { @@ -194,14 +196,19 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - ret = nvws->grobj_alloc(nvws, curie_class, &screen->curie); + ret = nouveau_grobj_alloc(chan, 0xbeef3097, curie_class, &screen->curie); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); return FALSE; } + BIND_RING(chan, screen->curie, 7); + + /* 2D engine setup */ + screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d->buf = nv40_surface_buffer; /* Notifier for sync purposes */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv40_screen_destroy(pscreen); @@ -209,14 +216,14 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } /* Query objects */ - ret = nvws->notifier_alloc(nvws, 32, &screen->query); + ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query); if (ret) { NOUVEAU_ERR("Error initialising query objects: %d\n", ret); nv40_screen_destroy(pscreen); return NULL; } - ret = nvws->res_init(&screen->query_heap, 0, 32); + nouveau_resource_init(&screen->query_heap, 0, 32); if (ret) { NOUVEAU_ERR("Error initialising query object heap: %d\n", ret); nv40_screen_destroy(pscreen); @@ -224,8 +231,8 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } /* Vtxprog resources */ - if (nvws->res_init(&screen->vp_exec_heap, 0, 512) || - nvws->res_init(&screen->vp_data_heap, 0, 256)) { + if (nouveau_resource_init(&screen->vp_exec_heap, 0, 512) || + nouveau_resource_init(&screen->vp_data_heap, 0, 256)) { nv40_screen_destroy(pscreen); return NULL; } diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 7df9a4d326..f32d4d690c 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -855,7 +855,6 @@ out_err: static boolean nv40_vertprog_validate(struct nv40_context *nv40) { - struct nouveau_winsys *nvws = nv40->nvws; struct pipe_winsys *ws = nv40->pipe.winsys; struct nouveau_grobj *curie = nv40->screen->curie; struct nv40_vertex_program *vp; @@ -895,15 +894,15 @@ check_gpu_resources: struct nouveau_stateobj *so; uint vplen = vp->nr_insns; - if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) { + if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) { while (heap->next && heap->size < vplen) { struct nv40_vertex_program *evict; evict = heap->next->priv; - nvws->res_free(&evict->exec); + nouveau_resource_free(&evict->exec); } - if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) + if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) assert(0); } @@ -925,15 +924,15 @@ check_gpu_resources: if (vp->nr_consts && !vp->data) { struct nouveau_resource *heap = nv40->screen->vp_data_heap; - if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) { + if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) { while (heap->next && heap->size < vp->nr_consts) { struct nv40_vertex_program *evict; evict = heap->next->priv; - nvws->res_free(&evict->data); + nouveau_resource_free(&evict->data); } - if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) + if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) assert(0); } @@ -1035,8 +1034,6 @@ check_gpu_resources: void nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp) { - struct nouveau_winsys *nvws = nv40->screen->nvws; - vp->translated = FALSE; if (vp->nr_insns) { @@ -1051,9 +1048,9 @@ nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp) vp->nr_consts = 0; } - nvws->res_free(&vp->exec); + nouveau_resource_free(&vp->exec); vp->exec_start = 0; - nvws->res_free(&vp->data); + nouveau_resource_free(&vp->data); vp->data_start = 0; vp->data_start_min = 0; diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 1576d4295e..bc853296cb 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2241,13 +2241,14 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) if (!p->data[0] && p->immd_nr) { struct nouveau_resource *heap = nv50->screen->immd_heap[0]; - if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0])) { + if (nouveau_resource_alloc(heap, p->immd_nr, p, &p->data[0])) { while (heap->next && heap->size < p->immd_nr) { struct nv50_program *evict = heap->next->priv; - nvws->res_free(&evict->data[0]); + nouveau_resource_free(&evict->data[0]); } - if (nvws->res_alloc(heap, p->immd_nr, p, &p->data[0])) + if (nouveau_resource_alloc(heap, p->immd_nr, p, + &p->data[0])) assert(0); } @@ -2260,13 +2261,14 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) struct nouveau_resource *heap = nv50->screen->parm_heap[p->type]; - if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1])) { + if (nouveau_resource_alloc(heap, p->param_nr, p, &p->data[1])) { while (heap->next && heap->size < p->param_nr) { struct nv50_program *evict = heap->next->priv; - nvws->res_free(&evict->data[1]); + nouveau_resource_free(&evict->data[1]); } - if (nvws->res_alloc(heap, p->param_nr, p, &p->data[1])) + if (nouveau_resource_alloc(heap, p->param_nr, p, + &p->data[1])) assert(0); } } @@ -2472,8 +2474,8 @@ nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p) nouveau_bo_ref(NULL, &p->bo); - nv50->screen->nvws->res_free(&p->data[0]); - nv50->screen->nvws->res_free(&p->data[1]); + nouveau_resource_free(&p->data[0]); + nouveau_resource_free(&p->data[1]); p->translated = 0; } diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 3b830847ca..709b7419da 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -136,6 +136,10 @@ nv50_screen_destroy(struct pipe_screen *pscreen) { struct nv50_screen *screen = nv50_screen(pscreen); + nouveau_notifier_free(&screen->sync); + nouveau_grobj_free(&screen->tesla); + nouveau_grobj_free(&screen->eng2d); + nouveau_grobj_free(&screen->m2mf); nouveau_screen_fini(&screen->base); FREE(screen); } @@ -145,6 +149,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) { struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen); struct nouveau_device *dev = nvws->channel->device; + struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; unsigned chipset = dev->chipset; @@ -160,6 +165,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv50_screen_destroy(pscreen); return NULL; } + screen->base.channel = chan = nvws->channel; /* Setup the pipe */ screen->nvws = nvws; @@ -174,20 +180,22 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv50_transfer_init_screen_functions(pscreen); /* DMA engine object */ - ret = nvws->grobj_alloc(nvws, 0x5039, &screen->m2mf); + ret = nouveau_grobj_alloc(chan, 0xbeef5039, 0x5039, &screen->m2mf); if (ret) { NOUVEAU_ERR("Error creating M2MF object: %d\n", ret); nv50_screen_destroy(pscreen); return NULL; } + BIND_RING(chan, screen->m2mf, 1); /* 2D object */ - ret = nvws->grobj_alloc(nvws, NV50_2D, &screen->eng2d); + ret = nouveau_grobj_alloc(chan, 0xbeef502d, 0x502d, &screen->eng2d); if (ret) { NOUVEAU_ERR("Error creating 2D object: %d\n", ret); nv50_screen_destroy(pscreen); return NULL; } + BIND_RING(chan, screen->eng2d, 2); /* 3D object */ switch (chipset & 0xf0) { @@ -213,15 +221,16 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; } - ret = nvws->grobj_alloc(nvws, tesla_class, &screen->tesla); + ret = nouveau_grobj_alloc(chan, 0xbeef5097, tesla_class, &screen->tesla); if (ret) { NOUVEAU_ERR("Error creating 3D object: %d\n", ret); nv50_screen_destroy(pscreen); return NULL; } + BIND_RING(chan, screen->tesla, 3); /* Sync notifier */ - ret = nvws->notifier_alloc(nvws, 1, &screen->sync); + ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync); if (ret) { NOUVEAU_ERR("Error creating notifier object: %d\n", ret); nv50_screen_destroy(pscreen); @@ -232,8 +241,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so = so_new(32, 0); so_method(so, screen->m2mf, 0x0180, 3); so_data (so, screen->sync->handle); - so_data (so, screen->nvws->channel->vram->handle); - so_data (so, screen->nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_emit(nvws, so); so_ref (NULL, &so); @@ -241,9 +250,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so = so_new(64, 0); so_method(so, screen->eng2d, NV50_2D_DMA_NOTIFY, 4); so_data (so, screen->sync->handle); - so_data (so, screen->nvws->channel->vram->handle); - so_data (so, screen->nvws->channel->vram->handle); - so_data (so, screen->nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->eng2d, NV50_2D_OPERATION, 1); so_data (so, NV50_2D_OPERATION_SRCCOPY); so_method(so, screen->eng2d, 0x0290, 1); @@ -263,11 +272,11 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->tesla, NV50TCL_DMA_UNK0(0), NV50TCL_DMA_UNK0__SIZE); for (i = 0; i < NV50TCL_DMA_UNK0__SIZE; i++) - so_data(so, nvws->channel->vram->handle); + so_data(so, chan->vram->handle); so_method(so, screen->tesla, NV50TCL_DMA_UNK1(0), NV50TCL_DMA_UNK1__SIZE); for (i = 0; i < NV50TCL_DMA_UNK1__SIZE; i++) - so_data(so, nvws->channel->vram->handle); + so_data(so, chan->vram->handle); so_method(so, screen->tesla, 0x121c, 1); so_data (so, 1); @@ -295,9 +304,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) } } - if (nvws->res_init(&screen->immd_heap[0], 0, 128) || - nvws->res_init(&screen->parm_heap[0], 0, 128) || - nvws->res_init(&screen->parm_heap[1], 0, 128)) + if (nouveau_resource_init(&screen->immd_heap[0], 0, 128) || + nouveau_resource_init(&screen->parm_heap[0], 0, 128) || + nouveau_resource_init(&screen->parm_heap[1], 0, 128)) { NOUVEAU_ERR("Error initialising constant buffers.\n"); nv50_screen_destroy(pscreen); @@ -405,7 +414,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_emit(nvws, so); so_ref (so, &screen->static_init); so_ref (NULL, &so); - nouveau_pushbuf_flush(nvws->channel, 0); + nouveau_pushbuf_flush(chan, 0); return pscreen; } diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c index 2e0148543d..c03e6ddcae 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c @@ -2,40 +2,6 @@ #include "nouveau_winsys_pipe.h" -static int -nouveau_pipe_notifier_alloc(struct nouveau_winsys *nvws, int count, - struct nouveau_notifier **notify) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(nvws->ws); - - return nouveau_notifier_alloc(nvpws->channel, nvpws->next_handle++, - count, notify); -} - -static int -nouveau_pipe_grobj_alloc(struct nouveau_winsys *nvws, int grclass, - struct nouveau_grobj **grobj) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(nvws->ws); - struct nouveau_channel *chan = nvpws->channel; - int ret; - - ret = nouveau_grobj_alloc(chan, nvpws->next_handle++, grclass, grobj); - if (ret) - return ret; - - BEGIN_RING(chan, *grobj, 0x0000, 1); - OUT_RING (chan, (*grobj)->handle); - (*grobj)->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT; - return 0; -} - -static struct nouveau_bo * -nouveau_pipe_get_bo(struct pipe_buffer *pb) -{ - return nouveau_pipe_buffer(pb)->bo; -} - struct nouveau_winsys * nouveau_winsys_new(struct pipe_winsys *ws) { @@ -49,22 +15,6 @@ nouveau_winsys_new(struct pipe_winsys *ws) nvws->ws = ws; nvws->channel = nvpws->channel; - nvws->res_init = nouveau_resource_init; - nvws->res_alloc = nouveau_resource_alloc; - nvws->res_free = nouveau_resource_free; - - nvws->grobj_alloc = nouveau_pipe_grobj_alloc; - nvws->grobj_free = nouveau_grobj_free; - - nvws->notifier_alloc = nouveau_pipe_notifier_alloc; - nvws->notifier_free = nouveau_notifier_free; - nvws->notifier_reset = nouveau_notifier_reset; - nvws->notifier_status = nouveau_notifier_status; - nvws->notifier_retval = nouveau_notifier_return_val; - nvws->notifier_wait = nouveau_notifier_wait_status; - - nvws->get_bo = nouveau_pipe_get_bo; - return nvws; } -- cgit v1.2.3 From 80e9e1ee8172d1e5a81d702681897dddd9d815f1 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 10:28:13 +1000 Subject: nouveau: move channel creation into pipe drivers --- src/gallium/drivers/nouveau/nouveau_push.h | 21 +++-- src/gallium/drivers/nouveau/nouveau_screen.c | 5 ++ src/gallium/drivers/nouveau/nouveau_stateobj.h | 25 +++--- src/gallium/drivers/nouveau/nouveau_winsys.h | 18 ++--- src/gallium/drivers/nv04/nv04_screen.c | 9 +-- src/gallium/drivers/nv04/nv04_surface_2d.c | 13 ++- src/gallium/drivers/nv04/nv04_surface_2d.h | 3 +- src/gallium/drivers/nv10/nv10_context.c | 10 +-- src/gallium/drivers/nv10/nv10_screen.c | 9 +-- src/gallium/drivers/nv20/nv20_context.c | 14 ++-- src/gallium/drivers/nv20/nv20_screen.c | 9 +-- src/gallium/drivers/nv30/nv30_screen.c | 11 +-- src/gallium/drivers/nv30/nv30_state_emit.c | 11 +-- src/gallium/drivers/nv30/nv30_state_fb.c | 35 ++++---- src/gallium/drivers/nv30/nv30_vbo.c | 10 +-- src/gallium/drivers/nv40/nv40_draw.c | 2 +- src/gallium/drivers/nv40/nv40_screen.c | 35 ++++---- src/gallium/drivers/nv40/nv40_state_emit.c | 11 +-- src/gallium/drivers/nv40/nv40_state_fb.c | 92 ++++++++++++---------- src/gallium/drivers/nv40/nv40_vbo.c | 10 +-- src/gallium/drivers/nv50/nv50_clear.c | 2 +- src/gallium/drivers/nv50/nv50_context.c | 2 +- src/gallium/drivers/nv50/nv50_program.c | 13 ++- src/gallium/drivers/nv50/nv50_query.c | 4 +- src/gallium/drivers/nv50/nv50_screen.c | 16 ++-- src/gallium/drivers/nv50/nv50_state_validate.c | 40 +++++----- src/gallium/drivers/nv50/nv50_surface.c | 6 +- src/gallium/drivers/nv50/nv50_transfer.c | 3 +- src/gallium/drivers/nv50/nv50_vbo.c | 10 +-- src/gallium/winsys/drm/nouveau/drm/Makefile | 3 +- .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 11 +-- .../winsys/drm/nouveau/drm/nouveau_winsys.c | 20 ----- 32 files changed, 218 insertions(+), 265 deletions(-) delete mode 100644 src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h index afe4668fcd..0f2c42915b 100644 --- a/src/gallium/drivers/nouveau/nouveau_push.h +++ b/src/gallium/drivers/nouveau/nouveau_push.h @@ -9,13 +9,13 @@ #define OUT_RING(data) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - (*pc->nvws->channel->pushbuf->cur++) = (data); \ + (*pc->base.channel->pushbuf->cur++) = (data); \ } while(0) #define OUT_RINGp(src,size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - memcpy(pc->nvws->channel->pushbuf->cur, (src), (size) * 4); \ - pc->nvws->channel->pushbuf->cur += (size); \ + memcpy(pc->base.channel->pushbuf->cur, (src), (size) * 4); \ + pc->base.channel->pushbuf->cur += (size); \ } while(0) #define OUT_RINGf(data) do { \ @@ -26,7 +26,7 @@ #define BEGIN_RING(obj,mthd,size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - struct nouveau_channel *chan = pc->nvws->channel; \ + struct nouveau_channel *chan = pc->base.channel; \ if (chan->pushbuf->remaining < ((size) + 1)) \ nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \ @@ -47,14 +47,13 @@ DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) #define FIRE_RING(fence) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - DO_FIRE_RING(pc->nvws->channel, fence); \ + DO_FIRE_RING(pc->base.channel, fence); \ } while(0) #define OUT_RELOC(bo,data,flags,vor,tor) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - struct nouveau_channel *chan = pc->nvws->channel; \ - nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, \ - pc->nvws->get_bo(bo), \ + struct nouveau_channel *chan = pc->base.channel; \ + nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, nouveau_bo(bo), \ (data), (flags), (vor), (tor)); \ } while(0) @@ -66,8 +65,8 @@ DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) /* FB/TT object handle */ #define OUT_RELOCo(bo,flags) do { \ OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \ - pc->nvws->channel->vram->handle, \ - pc->nvws->channel->gart->handle); \ + pc->base.channel->vram->handle, \ + pc->base.channel->gart->handle); \ } while(0) /* Low 32-bits of offset */ @@ -83,7 +82,7 @@ DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) /* A reloc which'll recombine into a NV_DMA_METHOD packet header */ #define OUT_RELOCm(bo, flags, obj, mthd, size) do { \ NOUVEAU_PUSH_CONTEXT(pc); \ - struct nouveau_channel *chan = pc->nvws->channel; \ + struct nouveau_channel *chan = pc->base.channel; \ if (chan->pushbuf->remaining < ((size) + 1)) \ nouveau_pushbuf_flush(chan, ((size) + 1)); \ OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \ diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 3cab83eec0..ab522a124a 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -212,7 +212,12 @@ int nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) { struct pipe_screen *pscreen = &screen->base; + int ret; + ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202, + &screen->channel); + if (ret) + return ret; screen->device = dev; pscreen->get_name = nouveau_screen_get_name; diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index de3ba9cf14..8e818d9d38 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -107,21 +107,21 @@ so_dump(struct nouveau_stateobj *so) } static INLINE void -so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) +so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so) { - struct nouveau_pushbuf *pb = nvws->channel->pushbuf; + struct nouveau_pushbuf *pb = chan->pushbuf; unsigned nr, i; nr = so->cur - so->push; if (pb->remaining < nr) - nouveau_pushbuf_flush(nvws->channel, nr); + nouveau_pushbuf_flush(chan, nr); pb->remaining -= nr; memcpy(pb->cur, so->push, nr * 4); for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur + r->offset, + nouveau_pushbuf_emit_reloc(chan, pb->cur + r->offset, r->bo, r->data, r->flags, r->vor, r->tor); } @@ -129,30 +129,29 @@ so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) } static INLINE void -so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so) +so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so) { - struct nouveau_pushbuf *pb = nvws->channel->pushbuf; + struct nouveau_pushbuf *pb = chan->pushbuf; unsigned i; if (!so) return; i = so->cur_reloc << 1; - if (nvws->channel->pushbuf->remaining < i) - nouveau_pushbuf_flush(nvws->channel, i); - nvws->channel->pushbuf->remaining -= i; + if (pb->remaining < i) + nouveau_pushbuf_flush(chan, i); + pb->remaining -= i; for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, r->bo, - r->packet, + nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->packet, (r->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RDWR)) | NOUVEAU_BO_DUMMY, 0, 0); - nouveau_pushbuf_emit_reloc(nvws->channel, pb->cur++, r->bo, - r->data, r->flags | NOUVEAU_BO_DUMMY, + nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->data, + r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor); } } diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index 7998497240..42c77e5e77 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -23,44 +23,38 @@ #define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17) #define NOUVEAU_BUFFER_USAGE_TRANSFER (1 << 18) -struct nouveau_winsys { - struct pipe_winsys *ws; - - struct nouveau_channel *channel; -}; - extern struct pipe_screen * -nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv04_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv04_create(struct pipe_screen *, unsigned pctx_id); extern struct pipe_screen * -nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv10_create(struct pipe_screen *, unsigned pctx_id); extern struct pipe_screen * -nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv20_create(struct pipe_screen *, unsigned pctx_id); extern struct pipe_screen * -nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv30_create(struct pipe_screen *, unsigned pctx_id); extern struct pipe_screen * -nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv40_create(struct pipe_screen *, unsigned pctx_id); extern struct pipe_screen * -nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *); +nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *); extern struct pipe_context * nv50_create(struct pipe_screen *, unsigned pctx_id); diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c index 98e2dafcd8..4bbedfb4d6 100644 --- a/src/gallium/drivers/nv04/nv04_screen.c +++ b/src/gallium/drivers/nv04/nv04_screen.c @@ -122,10 +122,9 @@ nv04_surface_buffer(struct pipe_surface *surf) } struct pipe_screen * -nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv04_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv04_screen *screen = CALLOC_STRUCT(nv04_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned fahrenheit_class = 0, sub3d_class = 0; @@ -140,9 +139,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv04_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv04_screen_destroy; @@ -188,7 +185,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) BIND_RING(chan, screen->context_surfaces_3d, 6); /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d = nv04_surface_2d_init(&screen->base); screen->eng2d->buf = nv04_surface_buffer; /* Notifier for sync purposes */ diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index fcb6501411..5afd028ddd 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -97,7 +97,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, struct pipe_surface *src, int sx, int sy, int w, int h) { - struct nouveau_channel *chan = ctx->nvws->channel; + struct nouveau_channel *chan = ctx->swzsurf->channel; struct nouveau_grobj *swzsurf = ctx->swzsurf; struct nouveau_grobj *sifm = ctx->sifm; struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); @@ -168,7 +168,7 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, struct pipe_surface *dst, int dx, int dy, struct pipe_surface *src, int sx, int sy, int w, int h) { - struct nouveau_channel *chan = ctx->nvws->channel; + struct nouveau_channel *chan = ctx->m2mf->channel; struct nouveau_grobj *m2mf = ctx->m2mf; struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); @@ -214,7 +214,7 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, int dx, int dy, struct pipe_surface *src, int sx, int sy, int w, int h) { - struct nouveau_channel *chan = ctx->nvws->channel; + struct nouveau_channel *chan = ctx->surf2d->channel; struct nouveau_grobj *surf2d = ctx->surf2d; struct nouveau_grobj *blit = ctx->blit; struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); @@ -280,7 +280,7 @@ static void nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst, int dx, int dy, int w, int h, unsigned value) { - struct nouveau_channel *chan = ctx->nvws->channel; + struct nouveau_channel *chan = ctx->surf2d->channel; struct nouveau_grobj *surf2d = ctx->surf2d; struct nouveau_grobj *rect = ctx->rect; struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); @@ -335,10 +335,10 @@ nv04_surface_2d_takedown(struct nv04_surface_2d **pctx) } struct nv04_surface_2d * -nv04_surface_2d_init(struct nouveau_winsys *nvws) +nv04_surface_2d_init(struct nouveau_screen *screen) { struct nv04_surface_2d *ctx = CALLOC_STRUCT(nv04_surface_2d); - struct nouveau_channel *chan = nvws->channel; + struct nouveau_channel *chan = screen->channel; unsigned handle = 0x88000000, class; int ret; @@ -461,7 +461,6 @@ nv04_surface_2d_init(struct nouveau_winsys *nvws) return NULL; } - ctx->nvws = nvws; ctx->copy = nv04_surface_copy; ctx->fill = nv04_surface_fill; return ctx; diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.h b/src/gallium/drivers/nv04/nv04_surface_2d.h index 82ce7189c8..02b3f56ba8 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.h +++ b/src/gallium/drivers/nv04/nv04_surface_2d.h @@ -7,7 +7,6 @@ struct nv04_surface { }; struct nv04_surface_2d { - struct nouveau_winsys *nvws; struct nouveau_notifier *ntfy; struct nouveau_grobj *surf2d; struct nouveau_grobj *swzsurf; @@ -26,7 +25,7 @@ struct nv04_surface_2d { }; struct nv04_surface_2d * -nv04_surface_2d_init(struct nouveau_winsys *nvws); +nv04_surface_2d_init(struct nouveau_screen *screen); void nv04_surface_2d_takedown(struct nv04_surface_2d **); diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c index 3da8d2f568..a127b134ec 100644 --- a/src/gallium/drivers/nv10/nv10_context.c +++ b/src/gallium/drivers/nv10/nv10_context.c @@ -30,18 +30,18 @@ nv10_destroy(struct pipe_context *pipe) static void nv10_init_hwctx(struct nv10_context *nv10) { struct nv10_screen *screen = nv10->screen; - struct nouveau_winsys *nvws = screen->nvws; + struct nouveau_channel *chan = screen->base.channel; int i; float projectionmatrix[16]; BEGIN_RING(celsius, NV10TCL_DMA_NOTIFY, 1); OUT_RING (screen->sync->handle); BEGIN_RING(celsius, NV10TCL_DMA_IN_MEMORY0, 2); - OUT_RING (nvws->channel->vram->handle); - OUT_RING (nvws->channel->gart->handle); + OUT_RING (chan->vram->handle); + OUT_RING (chan->gart->handle); BEGIN_RING(celsius, NV10TCL_DMA_IN_MEMORY2, 2); - OUT_RING (nvws->channel->vram->handle); - OUT_RING (nvws->channel->vram->handle); + OUT_RING (chan->vram->handle); + OUT_RING (chan->vram->handle); BEGIN_RING(celsius, NV10TCL_NOP, 1); OUT_RING (0); diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c index f090d2b0b7..b03c291f9d 100644 --- a/src/gallium/drivers/nv10/nv10_screen.c +++ b/src/gallium/drivers/nv10/nv10_screen.c @@ -118,10 +118,9 @@ nv10_surface_buffer(struct pipe_surface *surf) } struct pipe_screen * -nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv10_screen *screen = CALLOC_STRUCT(nv10_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned celsius_class; @@ -136,9 +135,7 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv10_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv10_screen_destroy; @@ -173,7 +170,7 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) BIND_RING(chan, screen->celsius, 7); /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d = nv04_surface_2d_init(&screen->base); screen->eng2d->buf = nv10_surface_buffer; /* Notifier for sync purposes */ diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c index cbc41707d5..b32d0d83ba 100644 --- a/src/gallium/drivers/nv20/nv20_context.c +++ b/src/gallium/drivers/nv20/nv20_context.c @@ -30,7 +30,7 @@ nv20_destroy(struct pipe_context *pipe) static void nv20_init_hwctx(struct nv20_context *nv20) { struct nv20_screen *screen = nv20->screen; - struct nouveau_winsys *nvws = screen->nvws; + struct nouveau_channel *chan = screen->base.channel; int i; float projectionmatrix[16]; const boolean is_nv25tcl = (nv20->screen->kelvin->grclass == NV25TCL); @@ -38,11 +38,11 @@ static void nv20_init_hwctx(struct nv20_context *nv20) BEGIN_RING(kelvin, NV20TCL_DMA_NOTIFY, 1); OUT_RING (screen->sync->handle); BEGIN_RING(kelvin, NV20TCL_DMA_TEXTURE0, 2); - OUT_RING (nvws->channel->vram->handle); - OUT_RING (nvws->channel->gart->handle); /* TEXTURE1 */ + OUT_RING (chan->vram->handle); + OUT_RING (chan->gart->handle); /* TEXTURE1 */ BEGIN_RING(kelvin, NV20TCL_DMA_COLOR, 2); - OUT_RING (nvws->channel->vram->handle); - OUT_RING (nvws->channel->vram->handle); /* ZETA */ + OUT_RING (chan->vram->handle); + OUT_RING (chan->vram->handle); /* ZETA */ BEGIN_RING(kelvin, NV20TCL_DMA_QUERY, 1); OUT_RING (0); /* renouveau: beef0351, unique */ @@ -99,9 +99,9 @@ static void nv20_init_hwctx(struct nv20_context *nv20) OUT_RING (3); BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY9, 1); - OUT_RING (nvws->channel->vram->handle); + OUT_RING (chan->vram->handle); BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY8, 1); - OUT_RING (nvws->channel->vram->handle); + OUT_RING (chan->vram->handle); } BEGIN_RING(kelvin, NV20TCL_DMA_FENCE, 1); OUT_RING (0); /* renouveau: beef1e10 */ diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c index 4d991852a1..024356ca74 100644 --- a/src/gallium/drivers/nv20/nv20_screen.c +++ b/src/gallium/drivers/nv20/nv20_screen.c @@ -118,10 +118,9 @@ nv20_surface_buffer(struct pipe_surface *surf) } struct pipe_screen * -nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; unsigned kelvin_class = 0; @@ -136,9 +135,7 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv20_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv20_screen_destroy; @@ -169,7 +166,7 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) BIND_RING(chan, screen->kelvin, 7); /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d = nv04_surface_2d_init(&screen->base); screen->eng2d->buf = nv20_surface_buffer; /* Notifier for sync purposes */ diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 60e2f0855d..31bc1f3173 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -136,10 +136,9 @@ nv30_screen_destroy(struct pipe_screen *pscreen) } struct pipe_screen * -nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; @@ -155,9 +154,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv30_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv30_screen_destroy; @@ -198,7 +195,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) BIND_RING(chan, screen->rankine, 7); /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d = nv04_surface_2d_init(&screen->base); screen->eng2d->buf = nv30_surface_buffer; /* Notifier for sync purposes */ @@ -307,7 +304,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->rankine, 0x1e94, 1); so_data (so, 0x13); - so_emit(nvws, so); + so_emit(chan, so); so_ref(NULL, &so); nouveau_pushbuf_flush(chan, 0); diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c index c18be20a32..621b8846c8 100644 --- a/src/gallium/drivers/nv30/nv30_state_emit.c +++ b/src/gallium/drivers/nv30/nv30_state_emit.c @@ -38,6 +38,7 @@ nv30_state_do_validate(struct nv30_context *nv30, void nv30_state_emit(struct nv30_context *nv30) { + struct nouveau_channel *chan = nv30->screen->base.channel; struct nv30_state *state = &nv30->state; struct nv30_screen *screen = nv30->screen; unsigned i, samplers; @@ -57,23 +58,23 @@ nv30_state_emit(struct nv30_context *nv30) continue; so_ref (state->hw[i], &nv30->screen->state[i]); if (state->hw[i]) - so_emit(nv30->nvws, nv30->screen->state[i]); + so_emit(chan, nv30->screen->state[i]); states &= ~(1ULL << i); } state->dirty = 0; - so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FB]); + so_emit_reloc_markers(chan, state->hw[NV30_STATE_FB]); for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) { if (!(samplers & (1 << i))) continue; - so_emit_reloc_markers(nv30->nvws, + so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGTEX0+i]); samplers &= ~(1ULL << i); } - so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FRAGPROG]); + so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGPROG]); if (state->hw[NV30_STATE_VTXBUF] /*&& nv30->render_mode == HW*/) - so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_VTXBUF]); + so_emit_reloc_markers(chan, state->hw[NV30_STATE_VTXBUF]); } boolean diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 1be916872f..cb1a260eaa 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -5,6 +5,8 @@ static boolean nv30_state_framebuffer_validate(struct nv30_context *nv30) { struct pipe_framebuffer_state *fb = &nv30->framebuffer; + struct nouveau_channel *chan = nv30->screen->base.channel; + struct nouveau_grobj *rankine = nv30->screen->rankine; struct nv04_surface *rt[2], *zeta = NULL; uint32_t rt_enable, rt_format; int i, colour_format = 0, zeta_format = 0; @@ -79,11 +81,10 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } nv30mt = (struct nv30_miptree *)rt[0]->base.texture; - so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1); + so_method(so, rankine, NV34TCL_DMA_COLOR0, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); - so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2); + chan->vram->handle, chan->gart->handle); + so_method(so, rankine, NV34TCL_COLOR0_PITCH, 2); so_data (so, pitch); so_reloc (so, nouveau_bo(nv30mt->buffer), rt[0]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); @@ -91,11 +92,10 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) { nv30mt = (struct nv30_miptree *)rt[1]->base.texture; - so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1); + so_method(so, rankine, NV34TCL_DMA_COLOR1, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); - so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2); + chan->vram->handle, chan->gart->handle); + so_method(so, rankine, NV34TCL_COLOR1_OFFSET, 2); so_reloc (so, nouveau_bo(nv30mt->buffer), rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); so_data (so, rt[1]->pitch); @@ -103,32 +103,31 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) if (zeta_format) { nv30mt = (struct nv30_miptree *)zeta->base.texture; - so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1); + so_method(so, rankine, NV34TCL_DMA_ZETA, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, - nv30->nvws->channel->vram->handle, - nv30->nvws->channel->gart->handle); - so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1); + chan->vram->handle, chan->gart->handle); + so_method(so, rankine, NV34TCL_ZETA_OFFSET, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); /* TODO: allocate LMA depth buffer */ } - so_method(so, nv30->screen->rankine, NV34TCL_RT_ENABLE, 1); + so_method(so, rankine, NV34TCL_RT_ENABLE, 1); so_data (so, rt_enable); - so_method(so, nv30->screen->rankine, NV34TCL_RT_HORIZ, 3); + so_method(so, rankine, NV34TCL_RT_HORIZ, 3); so_data (so, (w << 16) | 0); so_data (so, (h << 16) | 0); so_data (so, rt_format); - so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_HORIZ, 2); + so_method(so, rankine, NV34TCL_VIEWPORT_HORIZ, 2); so_data (so, (w << 16) | 0); so_data (so, (h << 16) | 0); - so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2); + so_method(so, rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2); so_data (so, ((w - 1) << 16) | 0); so_data (so, ((h - 1) << 16) | 0); - so_method(so, nv30->screen->rankine, 0x1d88, 1); + so_method(so, rankine, 0x1d88, 1); so_data (so, (1 << 12) | h); /* Wonder why this is needed, context should all be set to zero on init */ - so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1); + so_method(so, rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1); so_data (so, 0); so_ref(so, &nv30->state.hw[NV30_STATE_FB]); diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index ff2bf6e71b..9b72bc3002 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -168,7 +168,7 @@ nv30_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv30_context *nv30 = nv30_context(pipe); - struct nouveau_channel *chan = nv30->nvws->channel; + struct nouveau_channel *chan = nv30->screen->base.channel; unsigned restart = 0; nv30_vbo_set_idxbuf(nv30, NULL, 0); @@ -228,7 +228,7 @@ static INLINE void nv30_draw_elements_u08(struct nv30_context *nv30, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv30->nvws->channel; + struct nouveau_channel *chan = nv30->screen->base.channel; while (count) { uint8_t *elts = (uint8_t *)ib + start; @@ -277,7 +277,7 @@ static INLINE void nv30_draw_elements_u16(struct nv30_context *nv30, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv30->nvws->channel; + struct nouveau_channel *chan = nv30->screen->base.channel; while (count) { uint16_t *elts = (uint16_t *)ib + start; @@ -326,7 +326,7 @@ static INLINE void nv30_draw_elements_u32(struct nv30_context *nv30, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv30->nvws->channel; + struct nouveau_channel *chan = nv30->screen->base.channel; while (count) { uint32_t *elts = (uint32_t *)ib + start; @@ -401,7 +401,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv30_context *nv30 = nv30_context(pipe); - struct nouveau_channel *chan = nv30->nvws->channel; + struct nouveau_channel *chan = nv30->screen->base.channel; unsigned restart = 0; while (count) { diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c index c83ff91d7e..e7d8cf93a9 100644 --- a/src/gallium/drivers/nv40/nv40_draw.c +++ b/src/gallium/drivers/nv40/nv40_draw.c @@ -81,7 +81,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, { struct nv40_render_stage *rs = nv40_render_stage(stage); struct nv40_context *nv40 = rs->nv40; - struct nouveau_pushbuf *pb = nv40->nvws->channel->pushbuf; + struct nouveau_pushbuf *pb = nv40->screen->base.channel->pushbuf; unsigned i; /* Ensure there's room for 4xfloat32 + potentially 3 begin/end */ diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c index 2114c93cd9..b8b2af482a 100644 --- a/src/gallium/drivers/nv40/nv40_screen.c +++ b/src/gallium/drivers/nv40/nv40_screen.c @@ -144,10 +144,9 @@ nv40_screen_destroy(struct pipe_screen *pscreen) } struct pipe_screen * -nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; @@ -163,9 +162,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) nv40_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv40_screen_destroy; @@ -204,7 +201,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) BIND_RING(chan, screen->curie, 7); /* 2D engine setup */ - screen->eng2d = nv04_surface_2d_init(nvws); + screen->eng2d = nv04_surface_2d_init(&screen->base); screen->eng2d->buf = nv40_surface_buffer; /* Notifier for sync purposes */ @@ -242,25 +239,25 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->curie, NV40TCL_DMA_NOTIFY, 1); so_data (so, screen->sync->handle); so_method(so, screen->curie, NV40TCL_DMA_TEXTURE0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->gart->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->gart->handle); so_method(so, screen->curie, NV40TCL_DMA_COLOR1, 1); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->curie, NV40TCL_DMA_COLOR0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->curie, NV40TCL_DMA_VTXBUF0, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->gart->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->gart->handle); so_method(so, screen->curie, NV40TCL_DMA_FENCE, 2); so_data (so, 0); so_data (so, screen->query->handle); so_method(so, screen->curie, NV40TCL_DMA_UNK01AC, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->curie, NV40TCL_DMA_COLOR2, 2); - so_data (so, nvws->channel->vram->handle); - so_data (so, nvws->channel->vram->handle); + so_data (so, chan->vram->handle); + so_data (so, chan->vram->handle); so_method(so, screen->curie, 0x1ea4, 3); so_data (so, 0x00000010); @@ -285,9 +282,9 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->curie, 0x1e94, 1); so_data (so, 0x00000001); - so_emit(nvws, so); + so_emit(chan, so); so_ref(NULL, &so); - nouveau_pushbuf_flush(nvws->channel, 0); + nouveau_pushbuf_flush(chan, 0); return pscreen; } diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c index 10aae29832..198692965d 100644 --- a/src/gallium/drivers/nv40/nv40_state_emit.c +++ b/src/gallium/drivers/nv40/nv40_state_emit.c @@ -54,6 +54,7 @@ nv40_state_do_validate(struct nv40_context *nv40, void nv40_state_emit(struct nv40_context *nv40) { + struct nouveau_channel *chan = nv40->screen->base.channel; struct nv40_state *state = &nv40->state; struct nv40_screen *screen = nv40->screen; unsigned i, samplers; @@ -73,7 +74,7 @@ nv40_state_emit(struct nv40_context *nv40) continue; so_ref (state->hw[i], &nv40->screen->state[i]); if (state->hw[i]) - so_emit(nv40->nvws, nv40->screen->state[i]); + so_emit(chan, nv40->screen->state[i]); states &= ~(1ULL << i); } @@ -87,17 +88,17 @@ nv40_state_emit(struct nv40_context *nv40) state->dirty = 0; - so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FB]); + so_emit_reloc_markers(chan, state->hw[NV40_STATE_FB]); for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) { if (!(samplers & (1 << i))) continue; - so_emit_reloc_markers(nv40->nvws, + so_emit_reloc_markers(chan, state->hw[NV40_STATE_FRAGTEX0+i]); samplers &= ~(1ULL << i); } - so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_FRAGPROG]); + so_emit_reloc_markers(chan, state->hw[NV40_STATE_FRAGPROG]); if (state->hw[NV40_STATE_VTXBUF] && nv40->render_mode == HW) - so_emit_reloc_markers(nv40->nvws, state->hw[NV40_STATE_VTXBUF]); + so_emit_reloc_markers(chan, state->hw[NV40_STATE_VTXBUF]); } boolean diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index d8364ff993..273142f9e0 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -13,6 +13,8 @@ nv40_do_surface_buffer(struct pipe_surface *surface) static boolean nv40_state_framebuffer_validate(struct nv40_context *nv40) { + struct nouveau_channel *chan = nv40->screen->base.channel; + struct nouveau_grobj *curie = nv40->screen->curie; struct pipe_framebuffer_state *fb = &nv40->framebuffer; struct nv04_surface *rt[4], *zeta; uint32_t rt_enable, rt_format; @@ -79,76 +81,80 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) } if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) { - so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR0, 1); - so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0, rt_flags | NOUVEAU_BO_OR, - nv40->nvws->channel->vram->handle, - nv40->nvws->channel->gart->handle); - so_method(so, nv40->screen->curie, NV40TCL_COLOR0_PITCH, 2); + so_method(so, curie, NV40TCL_DMA_COLOR0, 1); + so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0, + rt_flags | NOUVEAU_BO_OR, + chan->vram->handle, chan->gart->handle); + so_method(so, curie, NV40TCL_COLOR0_PITCH, 2); so_data (so, rt[0]->pitch); - so_reloc (so, nv40_surface_buffer(&rt[0]->base), rt[0]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); + so_reloc (so, nv40_surface_buffer(&rt[0]->base), + rt[0]->base.offset, rt_flags | NOUVEAU_BO_LOW, + 0, 0); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) { - so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR1, 1); - so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0, rt_flags | NOUVEAU_BO_OR, - nv40->nvws->channel->vram->handle, - nv40->nvws->channel->gart->handle); - so_method(so, nv40->screen->curie, NV40TCL_COLOR1_OFFSET, 2); - so_reloc (so, nv40_surface_buffer(&rt[1]->base), rt[1]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); + so_method(so, curie, NV40TCL_DMA_COLOR1, 1); + so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0, + rt_flags | NOUVEAU_BO_OR, + chan->vram->handle, chan->gart->handle); + so_method(so, curie, NV40TCL_COLOR1_OFFSET, 2); + so_reloc (so, nv40_surface_buffer(&rt[1]->base), + rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW, + 0, 0); so_data (so, rt[1]->pitch); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) { - so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR2, 1); - so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0, rt_flags | NOUVEAU_BO_OR, - nv40->nvws->channel->vram->handle, - nv40->nvws->channel->gart->handle); - so_method(so, nv40->screen->curie, NV40TCL_COLOR2_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(&rt[2]->base), rt[2]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); - so_method(so, nv40->screen->curie, NV40TCL_COLOR2_PITCH, 1); + so_method(so, curie, NV40TCL_DMA_COLOR2, 1); + so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0, + rt_flags | NOUVEAU_BO_OR, + chan->vram->handle, chan->gart->handle); + so_method(so, curie, NV40TCL_COLOR2_OFFSET, 1); + so_reloc (so, nv40_surface_buffer(&rt[2]->base), + rt[2]->base.offset, rt_flags | NOUVEAU_BO_LOW, + 0, 0); + so_method(so, curie, NV40TCL_COLOR2_PITCH, 1); so_data (so, rt[2]->pitch); } if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) { - so_method(so, nv40->screen->curie, NV40TCL_DMA_COLOR3, 1); - so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0, rt_flags | NOUVEAU_BO_OR, - nv40->nvws->channel->vram->handle, - nv40->nvws->channel->gart->handle); - so_method(so, nv40->screen->curie, NV40TCL_COLOR3_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(&rt[3]->base), rt[3]->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); - so_method(so, nv40->screen->curie, NV40TCL_COLOR3_PITCH, 1); + so_method(so, curie, NV40TCL_DMA_COLOR3, 1); + so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0, + rt_flags | NOUVEAU_BO_OR, + chan->vram->handle, chan->gart->handle); + so_method(so, curie, NV40TCL_COLOR3_OFFSET, 1); + so_reloc (so, nv40_surface_buffer(&rt[3]->base), + rt[3]->base.offset, rt_flags | NOUVEAU_BO_LOW, + 0, 0); + so_method(so, curie, NV40TCL_COLOR3_PITCH, 1); so_data (so, rt[3]->pitch); } if (zeta_format) { - so_method(so, nv40->screen->curie, NV40TCL_DMA_ZETA, 1); - so_reloc (so, nv40_surface_buffer(&zeta->base), 0, rt_flags | NOUVEAU_BO_OR, - nv40->nvws->channel->vram->handle, - nv40->nvws->channel->gart->handle); - so_method(so, nv40->screen->curie, NV40TCL_ZETA_OFFSET, 1); - so_reloc (so, nv40_surface_buffer(&zeta->base), zeta->base.offset, rt_flags | - NOUVEAU_BO_LOW, 0, 0); - so_method(so, nv40->screen->curie, NV40TCL_ZETA_PITCH, 1); + so_method(so, curie, NV40TCL_DMA_ZETA, 1); + so_reloc (so, nv40_surface_buffer(&zeta->base), 0, + rt_flags | NOUVEAU_BO_OR, + chan->vram->handle, chan->gart->handle); + so_method(so, curie, NV40TCL_ZETA_OFFSET, 1); + so_reloc (so, nv40_surface_buffer(&zeta->base), + zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); + so_method(so, curie, NV40TCL_ZETA_PITCH, 1); so_data (so, zeta->pitch); } - so_method(so, nv40->screen->curie, NV40TCL_RT_ENABLE, 1); + so_method(so, curie, NV40TCL_RT_ENABLE, 1); so_data (so, rt_enable); - so_method(so, nv40->screen->curie, NV40TCL_RT_HORIZ, 3); + so_method(so, curie, NV40TCL_RT_HORIZ, 3); so_data (so, (w << 16) | 0); so_data (so, (h << 16) | 0); so_data (so, rt_format); - so_method(so, nv40->screen->curie, NV40TCL_VIEWPORT_HORIZ, 2); + so_method(so, curie, NV40TCL_VIEWPORT_HORIZ, 2); so_data (so, (w << 16) | 0); so_data (so, (h << 16) | 0); - so_method(so, nv40->screen->curie, NV40TCL_VIEWPORT_CLIP_HORIZ(0), 2); + so_method(so, curie, NV40TCL_VIEWPORT_CLIP_HORIZ(0), 2); so_data (so, ((w - 1) << 16) | 0); so_data (so, ((h - 1) << 16) | 0); - so_method(so, nv40->screen->curie, 0x1d88, 1); + so_method(so, curie, 0x1d88, 1); so_data (so, (1 << 12) | h); so_ref(so, &nv40->state.hw[NV40_STATE_FB]); diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index 4abddba110..24bd116539 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -168,7 +168,7 @@ nv40_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv40_context *nv40 = nv40_context(pipe); - struct nouveau_channel *chan = nv40->nvws->channel; + struct nouveau_channel *chan = nv40->screen->base.channel; unsigned restart; nv40_vbo_set_idxbuf(nv40, NULL, 0); @@ -227,7 +227,7 @@ static INLINE void nv40_draw_elements_u08(struct nv40_context *nv40, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv40->nvws->channel; + struct nouveau_channel *chan = nv40->screen->base.channel; while (count) { uint8_t *elts = (uint8_t *)ib + start; @@ -276,7 +276,7 @@ static INLINE void nv40_draw_elements_u16(struct nv40_context *nv40, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv40->nvws->channel; + struct nouveau_channel *chan = nv40->screen->base.channel; while (count) { uint16_t *elts = (uint16_t *)ib + start; @@ -325,7 +325,7 @@ static INLINE void nv40_draw_elements_u32(struct nv40_context *nv40, void *ib, unsigned mode, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv40->nvws->channel; + struct nouveau_channel *chan = nv40->screen->base.channel; while (count) { uint32_t *elts = (uint32_t *)ib + start; @@ -400,7 +400,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv40_context *nv40 = nv40_context(pipe); - struct nouveau_channel *chan = nv40->nvws->channel; + struct nouveau_channel *chan = nv40->screen->base.channel; unsigned restart; while (count) { diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c index 33427a15a5..e0b2d2880b 100644 --- a/src/gallium/drivers/nv50/nv50_clear.c +++ b/src/gallium/drivers/nv50/nv50_clear.c @@ -31,7 +31,7 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { struct nv50_context *nv50 = nv50_context(pipe); - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct pipe_framebuffer_state *fb = &nv50->framebuffer; unsigned mode = 0, i; diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index a511f655c1..e02afc4be9 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -33,7 +33,7 @@ nv50_flush(struct pipe_context *pipe, unsigned flags, { struct nv50_context *nv50 = (struct nv50_context *)pipe; - FIRE_RING(nv50->screen->nvws->channel); + FIRE_RING(nv50->screen->base.channel); } static void diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index bc853296cb..9d6427e2bc 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2215,7 +2215,7 @@ static void nv50_program_upload_data(struct nv50_context *nv50, float *map, unsigned start, unsigned count, unsigned cbuf) { - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; while (count) { @@ -2235,7 +2235,6 @@ nv50_program_upload_data(struct nv50_context *nv50, float *map, static void nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) { - struct nouveau_winsys *nvws = nv50->screen->nvws; struct pipe_winsys *ws = nv50->pipe.winsys; if (!p->data[0] && p->immd_nr) { @@ -2288,7 +2287,7 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) static void nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) { - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_program_exec *e; struct nouveau_stateobj *so; @@ -2353,14 +2352,14 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) start = 0; count = p->exec_size; while (count) { - struct nouveau_winsys *nvws = nv50->screen->nvws; + struct nouveau_channel *chan = nv50->screen->base.channel; unsigned nr; - so_emit(nvws, so); + so_emit(chan, so); nr = MIN2(count, 2047); - nr = MIN2(nvws->channel->pushbuf->remaining, nr); - if (nvws->channel->pushbuf->remaining < (nr + 3)) { + nr = MIN2(chan->pushbuf->remaining, nr); + if (chan->pushbuf->remaining < (nr + 3)) { FIRE_RING(chan); continue; } diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index 4d05eeac2c..c77ffe84e7 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -71,7 +71,7 @@ static void nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq) { struct nv50_context *nv50 = nv50_context(pipe); - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q = nv50_query(pq); @@ -87,7 +87,7 @@ static void nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) { struct nv50_context *nv50 = nv50_context(pipe); - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q = nv50_query(pq); struct nouveau_bo *bo = nouveau_bo(q->buffer); diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 709b7419da..7904b51f77 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -145,10 +145,9 @@ nv50_screen_destroy(struct pipe_screen *pscreen) } struct pipe_screen * -nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) +nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) { struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen); - struct nouveau_device *dev = nvws->channel->device; struct nouveau_channel *chan; struct pipe_screen *pscreen; struct nouveau_stateobj *so; @@ -160,15 +159,12 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) return NULL; pscreen = &screen->base.base; - ret = nouveau_screen_init(&screen->base, nvws->channel->device); + ret = nouveau_screen_init(&screen->base, dev); if (ret) { nv50_screen_destroy(pscreen); return NULL; } - screen->base.channel = chan = nvws->channel; - - /* Setup the pipe */ - screen->nvws = nvws; + chan = screen->base.channel; pscreen->winsys = ws; pscreen->destroy = nv50_screen_destroy; @@ -243,7 +239,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_data (so, screen->sync->handle); so_data (so, chan->vram->handle); so_data (so, chan->vram->handle); - so_emit(nvws, so); + so_emit(chan, so); so_ref (NULL, &so); /* Static 2D init */ @@ -259,7 +255,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_data (so, 0); so_method(so, screen->eng2d, 0x0888, 1); so_data (so, 1); - so_emit(nvws, so); + so_emit(chan, so); so_ref(NULL, &so); /* Static tesla init */ @@ -411,7 +407,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) so_method(so, screen->tesla, 0x1458, 1); so_data (so, 1); - so_emit(nvws, so); + so_emit(chan, so); so_ref (so, &screen->static_init); so_ref (NULL, &so); nouveau_pushbuf_flush(chan, 0); diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index d1f0ccdd8a..9e70d4b78d 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -131,7 +131,7 @@ static void nv50_state_emit(struct nv50_context *nv50) { struct nv50_screen *screen = nv50->screen; - struct nouveau_winsys *nvws = screen->nvws; + struct nouveau_channel *chan = screen->base.channel; if (nv50->pctx_id != screen->cur_pctx) { nv50->state.dirty |= 0xffffffff; @@ -139,40 +139,40 @@ nv50_state_emit(struct nv50_context *nv50) } if (nv50->state.dirty & NV50_NEW_FRAMEBUFFER) - so_emit(nvws, nv50->state.fb); + so_emit(chan, nv50->state.fb); if (nv50->state.dirty & NV50_NEW_BLEND) - so_emit(nvws, nv50->state.blend); + so_emit(chan, nv50->state.blend); if (nv50->state.dirty & NV50_NEW_ZSA) - so_emit(nvws, nv50->state.zsa); + so_emit(chan, nv50->state.zsa); if (nv50->state.dirty & NV50_NEW_VERTPROG) - so_emit(nvws, nv50->state.vertprog); + so_emit(chan, nv50->state.vertprog); if (nv50->state.dirty & NV50_NEW_FRAGPROG) - so_emit(nvws, nv50->state.fragprog); + so_emit(chan, nv50->state.fragprog); if (nv50->state.dirty & NV50_NEW_RASTERIZER) - so_emit(nvws, nv50->state.rast); + so_emit(chan, nv50->state.rast); if (nv50->state.dirty & NV50_NEW_BLEND_COLOUR) - so_emit(nvws, nv50->state.blend_colour); + so_emit(chan, nv50->state.blend_colour); if (nv50->state.dirty & NV50_NEW_STIPPLE) - so_emit(nvws, nv50->state.stipple); + so_emit(chan, nv50->state.stipple); if (nv50->state.dirty & NV50_NEW_SCISSOR) - so_emit(nvws, nv50->state.scissor); + so_emit(chan, nv50->state.scissor); if (nv50->state.dirty & NV50_NEW_VIEWPORT) - so_emit(nvws, nv50->state.viewport); + so_emit(chan, nv50->state.viewport); if (nv50->state.dirty & NV50_NEW_SAMPLER) - so_emit(nvws, nv50->state.tsc_upload); + so_emit(chan, nv50->state.tsc_upload); if (nv50->state.dirty & NV50_NEW_TEXTURE) - so_emit(nvws, nv50->state.tic_upload); + so_emit(chan, nv50->state.tic_upload); if (nv50->state.dirty & NV50_NEW_ARRAYS) { - so_emit(nvws, nv50->state.vtxfmt); - so_emit(nvws, nv50->state.vtxbuf); + so_emit(chan, nv50->state.vtxfmt); + so_emit(chan, nv50->state.vtxbuf); } nv50->state.dirty = 0; - so_emit_reloc_markers(nvws, nv50->state.fb); - so_emit_reloc_markers(nvws, nv50->state.vertprog); - so_emit_reloc_markers(nvws, nv50->state.fragprog); - so_emit_reloc_markers(nvws, nv50->state.vtxbuf); - so_emit_reloc_markers(nvws, nv50->screen->static_init); + so_emit_reloc_markers(chan, nv50->state.fb); + so_emit_reloc_markers(chan, nv50->state.vertprog); + so_emit_reloc_markers(chan, nv50->state.fragprog); + so_emit_reloc_markers(chan, nv50->state.vtxbuf); + so_emit_reloc_markers(chan, nv50->screen->static_init); } boolean diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 121eddfc83..cd4e7ef690 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -52,7 +52,7 @@ static int nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) { struct nv50_miptree *mt = nv50_miptree(ps->texture); - struct nouveau_channel *chan = screen->nvws->channel; + struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_grobj *eng2d = screen->eng2d; struct nouveau_bo *bo = nouveau_bo(nv50_miptree(ps->texture)->buffer); int format, mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; @@ -104,7 +104,7 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst, int dx, int dy, struct pipe_surface *src, int sx, int sy, int w, int h) { - struct nouveau_channel *chan = screen->nvws->channel; + struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_grobj *eng2d = screen->eng2d; int ret; @@ -161,7 +161,7 @@ nv50_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest, { struct nv50_context *nv50 = (struct nv50_context *)pipe; struct nv50_screen *screen = nv50->screen; - struct nouveau_channel *chan = screen->nvws->channel; + struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_grobj *eng2d = screen->eng2d; int format, ret; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 5f1e430ad1..a0a2099035 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -24,8 +24,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, unsigned src_reloc, unsigned dst_reloc) { struct nv50_screen *screen = nv50_screen(pscreen); - struct nouveau_winsys *nvws = screen->nvws; - struct nouveau_channel *chan = nvws->channel; + struct nouveau_channel *chan = screen->m2mf->channel; struct nouveau_grobj *m2mf = screen->m2mf; struct nouveau_bo *src_bo = nouveau_bo(src); struct nouveau_bo *dst_bo = nouveau_bo(dst); diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index 6f4981d1ff..a9b53a0f2e 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -53,7 +53,7 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv50_context *nv50 = nv50_context(pipe); - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; nv50_state_validate(nv50); @@ -83,7 +83,7 @@ static INLINE void nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; map += start; @@ -112,7 +112,7 @@ static INLINE void nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; map += start; @@ -141,7 +141,7 @@ static INLINE void nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint8_t *map, unsigned start, unsigned count) { - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; map += start; @@ -163,7 +163,7 @@ nv50_draw_elements(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv50_context *nv50 = nv50_context(pipe); - struct nouveau_channel *chan = nv50->screen->nvws->channel; + struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct pipe_winsys *ws = pipe->winsys; void *map = ws->buffer_map(ws, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ); diff --git a/src/gallium/winsys/drm/nouveau/drm/Makefile b/src/gallium/winsys/drm/nouveau/drm/Makefile index 2da78d8690..621ad2a807 100644 --- a/src/gallium/winsys/drm/nouveau/drm/Makefile +++ b/src/gallium/winsys/drm/nouveau/drm/Makefile @@ -4,8 +4,7 @@ include $(TOP)/configs/current LIBNAME = nouveaudrm C_SOURCES = nouveau_drm_api.c \ - nouveau_winsys_pipe.c \ - nouveau_winsys.c + nouveau_winsys_pipe.c LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I) LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other) diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index b355a1391d..22c53f6ea9 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -70,10 +70,9 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) { struct dri1_create_screen_arg *dri1 = (void *)arg; struct pipe_winsys *ws; - struct nouveau_winsys *nvws; struct nouveau_device *dev = NULL; struct pipe_screen *(*init)(struct pipe_winsys *, - struct nouveau_winsys *); + struct nouveau_device *); int ret; ret = nouveau_device_open_existing(&dev, 0, fd, 0); @@ -114,13 +113,7 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) return NULL; } - nvws = nouveau_winsys_new(ws); - if (!nvws) { - ws->destroy(ws); - return NULL; - } - - nouveau_pipe_winsys(ws)->pscreen = init(ws, nvws); + nouveau_pipe_winsys(ws)->pscreen = init(ws, dev); if (!nouveau_pipe_winsys(ws)->pscreen) { ws->destroy(ws); return NULL; diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c deleted file mode 100644 index c03e6ddcae..0000000000 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "util/u_memory.h" - -#include "nouveau_winsys_pipe.h" - -struct nouveau_winsys * -nouveau_winsys_new(struct pipe_winsys *ws) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); - struct nouveau_winsys *nvws; - - nvws = CALLOC_STRUCT(nouveau_winsys); - if (!nvws) - return NULL; - - nvws->ws = ws; - nvws->channel = nvpws->channel; - - return nvws; -} - -- cgit v1.2.3 From 6b3ca672eb85d30d6c28e91000e2cc2231a41bef Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 11:21:08 +1000 Subject: nouveau: remove unneeded code from ws, use pipe_buffer_ instead of ws-> --- src/gallium/drivers/nv04/nv04_state.c | 7 +- src/gallium/drivers/nv04/nv04_vbo.c | 16 +- src/gallium/drivers/nv10/nv10_prim_vbuf.c | 14 +- src/gallium/drivers/nv10/nv10_state.c | 7 +- src/gallium/drivers/nv10/nv10_vbo.c | 15 +- src/gallium/drivers/nv20/nv20_prim_vbuf.c | 12 +- src/gallium/drivers/nv20/nv20_state.c | 7 +- src/gallium/drivers/nv20/nv20_vbo.c | 16 +- src/gallium/drivers/nv20/nv20_vertprog.c | 12 +- src/gallium/drivers/nv30/nv30_fragprog.c | 17 +- src/gallium/drivers/nv30/nv30_vbo.c | 18 +- src/gallium/drivers/nv30/nv30_vertprog.c | 12 +- src/gallium/drivers/nv40/nv40_draw.c | 19 +- src/gallium/drivers/nv40/nv40_fragprog.c | 17 +- src/gallium/drivers/nv40/nv40_vbo.c | 17 +- src/gallium/drivers/nv40/nv40_vertprog.c | 9 +- src/gallium/drivers/nv50/nv50_program.c | 8 +- src/gallium/drivers/nv50/nv50_query.c | 8 +- src/gallium/drivers/nv50/nv50_vbo.c | 8 +- src/gallium/winsys/drm/nouveau/drm/Makefile | 3 +- .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 84 +++++---- .../winsys/drm/nouveau/drm/nouveau_drm_api.h | 27 +++ .../winsys/drm/nouveau/drm/nouveau_winsys_pipe.c | 205 --------------------- .../winsys/drm/nouveau/drm/nouveau_winsys_pipe.h | 54 ------ 24 files changed, 198 insertions(+), 414 deletions(-) delete mode 100644 src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c delete mode 100644 src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h diff --git a/src/gallium/drivers/nv04/nv04_state.c b/src/gallium/drivers/nv04/nv04_state.c index 87c635f962..d356ebd8b3 100644 --- a/src/gallium/drivers/nv04/nv04_state.c +++ b/src/gallium/drivers/nv04/nv04_state.c @@ -2,6 +2,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_inlines.h" #include "tgsi/tgsi_parse.h" @@ -334,7 +335,7 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf ) { struct nv04_context *nv04 = nv04_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; assert(shader < PIPE_SHADER_TYPES); assert(index == 0); @@ -342,12 +343,12 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, if (buf) { void *mapped; if (buf->buffer && buf->buffer->size && - (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) + (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) { memcpy(nv04->constbuf[shader], mapped, buf->buffer->size); nv04->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float)); - ws->buffer_unmap(ws, buf->buffer); + pipe_buffer_unmap(pscreen, buf->buffer); } } } diff --git a/src/gallium/drivers/nv04/nv04_vbo.c b/src/gallium/drivers/nv04/nv04_vbo.c index d21a0e34f7..e3167814f2 100644 --- a/src/gallium/drivers/nv04/nv04_vbo.c +++ b/src/gallium/drivers/nv04/nv04_vbo.c @@ -1,6 +1,7 @@ #include "draw/draw_context.h" #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv04_context.h" #include "nv04_state.h" @@ -13,6 +14,7 @@ boolean nv04_draw_elements( struct pipe_context *pipe, unsigned indexSize, unsigned prim, unsigned start, unsigned count) { + struct pipe_screen *pscreen = pipe->screen; struct nv04_context *nv04 = nv04_context( pipe ); struct draw_context *draw = nv04->draw; unsigned i; @@ -25,17 +27,17 @@ boolean nv04_draw_elements( struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv04->vtxbuf[i].buffer) { void *buf - = pipe->winsys->buffer_map(pipe->winsys, - nv04->vtxbuf[i].buffer, - PIPE_BUFFER_USAGE_CPU_READ); + = pipe_buffer_map(pscreen, + nv04->vtxbuf[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(draw, i, buf); } } /* Map index buffer, if present */ if (indexBuffer) { void *mapped_indexes - = pipe->winsys->buffer_map(pipe->winsys, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); + = pipe_buffer_map(pscreen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes); } else { @@ -55,12 +57,12 @@ boolean nv04_draw_elements( struct pipe_context *pipe, */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv04->vtxbuf[i].buffer) { - pipe->winsys->buffer_unmap(pipe->winsys, nv04->vtxbuf[i].buffer); + pipe_buffer_unmap(pscreen, nv04->vtxbuf[i].buffer); draw_set_mapped_vertex_buffer(draw, i, NULL); } } if (indexBuffer) { - pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer); + pipe_buffer_unmap(pscreen, indexBuffer); draw_set_mapped_element_buffer(draw, 0, NULL); } diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index f16e343fa6..1806d5f8cc 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -40,7 +40,6 @@ #include "util/u_debug.h" #include "pipe/p_inlines.h" -#include "pipe/internal/p_winsys_screen.h" #include "nv10_context.h" #include "nv10_state.h" @@ -124,11 +123,10 @@ nv10_vbuf_render_map_vertices( struct vbuf_render *render ) { struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render); struct nv10_context *nv10 = nv10_render->nv10; - struct pipe_winsys *winsys = nv10->pipe.winsys; + struct pipe_screen *pscreen = nv10->pipe.screen; - return winsys->buffer_map(winsys, - nv10_render->buffer, - PIPE_BUFFER_USAGE_CPU_WRITE); + return pipe_buffer_map(pscreen, nv10_render->buffer, + PIPE_BUFFER_USAGE_CPU_WRITE); } static void @@ -138,10 +136,10 @@ nv10_vbuf_render_unmap_vertices( struct vbuf_render *render, { struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render); struct nv10_context *nv10 = nv10_render->nv10; - struct pipe_winsys *winsys = nv10->pipe.winsys; + struct pipe_screen *pscreen = nv10->pipe.screen; assert(!nv10_render->buffer); - winsys->buffer_unmap(winsys, nv10_render->buffer); + pipe_buffer_unmap(pscreen, nv10_render->buffer); } static boolean @@ -202,8 +200,6 @@ static void nv10_vbuf_render_release_vertices( struct vbuf_render *render ) { struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render); - struct nv10_context *nv10 = nv10_render->nv10; - struct pipe_screen *pscreen = &nv10->screen->base.base; assert(nv10_render->buffer); pipe_buffer_reference(&nv10_render->buffer, NULL); diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c index 119af66dfd..9b38219b99 100644 --- a/src/gallium/drivers/nv10/nv10_state.c +++ b/src/gallium/drivers/nv10/nv10_state.c @@ -2,6 +2,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_inlines.h" #include "tgsi/tgsi_parse.h" @@ -460,7 +461,7 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf ) { struct nv10_context *nv10 = nv10_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; assert(shader < PIPE_SHADER_TYPES); assert(index == 0); @@ -468,12 +469,12 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, if (buf) { void *mapped; if (buf->buffer && buf->buffer->size && - (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) + (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) { memcpy(nv10->constbuf[shader], mapped, buf->buffer->size); nv10->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float)); - ws->buffer_unmap(ws, buf->buffer); + pipe_buffer_unmap(pscreen, buf->buffer); } } } diff --git a/src/gallium/drivers/nv10/nv10_vbo.c b/src/gallium/drivers/nv10/nv10_vbo.c index d0e788ac03..441a4f75f3 100644 --- a/src/gallium/drivers/nv10/nv10_vbo.c +++ b/src/gallium/drivers/nv10/nv10_vbo.c @@ -1,6 +1,7 @@ #include "draw/draw_context.h" #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv10_context.h" #include "nv10_state.h" @@ -15,6 +16,7 @@ boolean nv10_draw_elements( struct pipe_context *pipe, { struct nv10_context *nv10 = nv10_context( pipe ); struct draw_context *draw = nv10->draw; + struct pipe_screen *pscreen = pipe->screen; unsigned i; nv10_emit_hw_state(nv10); @@ -24,9 +26,8 @@ boolean nv10_draw_elements( struct pipe_context *pipe, */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv10->vtxbuf[i].buffer) { - void *buf - = pipe->winsys->buffer_map(pipe->winsys, - nv10->vtxbuf[i].buffer, + void *buf = + pipe_buffer_map(pscreen, nv10->vtxbuf[i].buffer, PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(draw, i, buf); } @@ -34,8 +35,8 @@ boolean nv10_draw_elements( struct pipe_context *pipe, /* Map index buffer, if present */ if (indexBuffer) { void *mapped_indexes - = pipe->winsys->buffer_map(pipe->winsys, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); + = pipe_buffer_map(pscreen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes); } else { @@ -55,12 +56,12 @@ boolean nv10_draw_elements( struct pipe_context *pipe, */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv10->vtxbuf[i].buffer) { - pipe->winsys->buffer_unmap(pipe->winsys, nv10->vtxbuf[i].buffer); + pipe_buffer_unmap(pscreen, nv10->vtxbuf[i].buffer); draw_set_mapped_vertex_buffer(draw, i, NULL); } } if (indexBuffer) { - pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer); + pipe_buffer_unmap(pscreen, indexBuffer); draw_set_mapped_element_buffer(draw, 0, NULL); } diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c index 8f9f27ebdc..ddfcdb8057 100644 --- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c +++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c @@ -152,12 +152,11 @@ static void * nv20_vbuf_render_map_vertices( struct vbuf_render *render ) { struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render); - struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys; + struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen; if (nv20_render->pbuffer) { - return winsys->buffer_map(winsys, - nv20_render->pbuffer, - PIPE_BUFFER_USAGE_CPU_WRITE); + return pipe_buffer_map(pscreen, nv20_render->pbuffer, + PIPE_BUFFER_USAGE_CPU_WRITE); } else if (nv20_render->mbuffer) { return nv20_render->mbuffer; } else @@ -173,10 +172,10 @@ nv20_vbuf_render_unmap_vertices( struct vbuf_render *render, ushort max_index ) { struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render); - struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys; + struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen; if (nv20_render->pbuffer) - winsys->buffer_unmap(winsys, nv20_render->pbuffer); + pipe_buffer_unmap(pscreen, nv20_render->pbuffer); } static boolean @@ -358,7 +357,6 @@ nv20_vbuf_render_release_vertices( struct vbuf_render *render ) { struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render); struct nv20_context *nv20 = nv20_render->nv20; - struct pipe_screen *pscreen = &nv20->screen->base.base; if (nv20_render->pbuffer) { pipe_buffer_reference(&nv20_render->pbuffer, NULL); diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c index ecec4f49a0..ed4084980f 100644 --- a/src/gallium/drivers/nv20/nv20_state.c +++ b/src/gallium/drivers/nv20/nv20_state.c @@ -2,6 +2,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_inlines.h" #include "tgsi/tgsi_parse.h" @@ -453,7 +454,7 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf ) { struct nv20_context *nv20 = nv20_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; assert(shader < PIPE_SHADER_TYPES); assert(index == 0); @@ -461,12 +462,12 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, if (buf) { void *mapped; if (buf->buffer && buf->buffer->size && - (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) + (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) { memcpy(nv20->constbuf[shader], mapped, buf->buffer->size); nv20->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float)); - ws->buffer_unmap(ws, buf->buffer); + pipe_buffer_unmap(pscreen, buf->buffer); } } } diff --git a/src/gallium/drivers/nv20/nv20_vbo.c b/src/gallium/drivers/nv20/nv20_vbo.c index 24d8f4bef0..84d7db6c5e 100644 --- a/src/gallium/drivers/nv20/nv20_vbo.c +++ b/src/gallium/drivers/nv20/nv20_vbo.c @@ -1,6 +1,7 @@ #include "draw/draw_context.h" #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv20_context.h" #include "nv20_state.h" @@ -13,6 +14,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe, unsigned indexSize, unsigned prim, unsigned start, unsigned count) { + struct pipe_screen *pscreen = pipe->screen; struct nv20_context *nv20 = nv20_context( pipe ); struct draw_context *draw = nv20->draw; unsigned i; @@ -25,17 +27,17 @@ boolean nv20_draw_elements( struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv20->vtxbuf[i].buffer) { void *buf - = pipe->winsys->buffer_map(pipe->winsys, - nv20->vtxbuf[i].buffer, - PIPE_BUFFER_USAGE_CPU_READ); + = pipe_buffer_map(pscreen, + nv20->vtxbuf[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(draw, i, buf); } } /* Map index buffer, if present */ if (indexBuffer) { void *mapped_indexes - = pipe->winsys->buffer_map(pipe->winsys, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); + = pipe_buffer_map(pscreen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes); } else { @@ -55,12 +57,12 @@ boolean nv20_draw_elements( struct pipe_context *pipe, */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (nv20->vtxbuf[i].buffer) { - pipe->winsys->buffer_unmap(pipe->winsys, nv20->vtxbuf[i].buffer); + pipe_buffer_unmap(pscreen, nv20->vtxbuf[i].buffer); draw_set_mapped_vertex_buffer(draw, i, NULL); } } if (indexBuffer) { - pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer); + pipe_buffer_unmap(pscreen, indexBuffer); draw_set_mapped_element_buffer(draw, 0, NULL); } diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index 5db0e807ff..c1e588902b 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -645,8 +646,8 @@ out_err: static boolean nv20_vertprog_validate(struct nv20_context *nv20) { + struct pipe_screen *pscreen = nv20->pipe.screen; struct nouveau_winsys *nvws = nv20->nvws; - struct pipe_winsys *ws = nv20->pipe.winsys; struct nouveau_grobj *rankine = nv20->screen->rankine; struct nv20_vertex_program *vp; struct pipe_buffer *constbuf; @@ -749,8 +750,8 @@ nv20_vertprog_validate(struct nv20_context *nv20) float *map = NULL; if (constbuf) { - map = ws->buffer_map(ws, constbuf, - PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, constbuf, + PIPE_BUFFER_USAGE_CPU_READ); } for (i = 0; i < vp->nr_consts; i++) { @@ -770,9 +771,8 @@ nv20_vertprog_validate(struct nv20_context *nv20) OUT_RINGp ((uint32_t *)vpd->value, 4); } - if (constbuf) { - ws->buffer_unmap(ws, constbuf); - } + if (constbuf) + pipe_buffer_unmap(pscreen, constbuf); } /* Upload vtxprog */ diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 956b450726..1d1c556fb1 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -798,12 +799,12 @@ static void nv30_fragprog_upload(struct nv30_context *nv30, struct nv30_fragment_program *fp) { - struct pipe_winsys *ws = nv30->pipe.winsys; + struct pipe_screen *pscreen = nv30->pipe.screen; const uint32_t le = 1; uint32_t *map; int i; - map = ws->buffer_map(ws, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map(pscreen, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); #if 0 for (i = 0; i < fp->insn_len; i++) { @@ -825,7 +826,7 @@ nv30_fragprog_upload(struct nv30_context *nv30, } } - ws->buffer_unmap(ws, fp->buffer); + pipe_buffer_unmap(pscreen, fp->buffer); } static boolean @@ -834,8 +835,7 @@ nv30_fragprog_validate(struct nv30_context *nv30) struct nv30_fragment_program *fp = nv30->fragprog; struct pipe_buffer *constbuf = nv30->constbuf[PIPE_SHADER_FRAGMENT]; - struct pipe_screen *screen = nv30->pipe.screen; - struct pipe_winsys *ws = nv30->pipe.winsys; + struct pipe_screen *pscreen = nv30->pipe.screen; struct nouveau_stateobj *so; boolean new_consts = FALSE; int i; @@ -850,7 +850,7 @@ nv30_fragprog_validate(struct nv30_context *nv30) return FALSE; } - fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4); + fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4); nv30_fragprog_upload(nv30, fp); so = so_new(8, 1); @@ -872,7 +872,8 @@ update_constants: if (fp->nr_consts) { float *map; - map = ws->buffer_map(ws, constbuf, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, constbuf, + PIPE_BUFFER_USAGE_CPU_READ); for (i = 0; i < fp->nr_consts; i++) { struct nv30_fragment_program_data *fpd = &fp->consts[i]; uint32_t *p = &fp->insn[fpd->offset]; @@ -883,7 +884,7 @@ update_constants: memcpy(p, cb, 4 * sizeof(float)); new_consts = TRUE; } - ws->buffer_unmap(ws, constbuf); + pipe_buffer_unmap(pscreen, constbuf); if (new_consts) nv30_fragprog_upload(nv30, fp); diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index 9b72bc3002..189656ec81 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -1,5 +1,6 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv30_context.h" #include "nv30_state.h" @@ -108,7 +109,7 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so, int attrib, struct pipe_vertex_element *ve, struct pipe_vertex_buffer *vb) { - struct pipe_winsys *ws = nv30->pipe.winsys; + struct pipe_screen *pscreen = nv30->pipe.screen; struct nouveau_grobj *rankine = nv30->screen->rankine; unsigned type, ncomp; void *map; @@ -116,7 +117,7 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so, if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp)) return FALSE; - map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ); map += vb->buffer_offset + ve->src_offset; switch (type) { @@ -148,18 +149,17 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so, so_data (so, fui(v[0])); break; default: - ws->buffer_unmap(ws, vb->buffer); + pipe_buffer_unmap(pscreen, vb->buffer); return FALSE; } } break; default: - ws->buffer_unmap(ws, vb->buffer); + pipe_buffer_unmap(pscreen, vb->buffer); return FALSE; } - ws->buffer_unmap(ws, vb->buffer); - + pipe_buffer_unmap(pscreen, vb->buffer); return TRUE; } @@ -368,10 +368,10 @@ nv30_draw_elements_inline(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv30_context *nv30 = nv30_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; void *map; - map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, ib, PIPE_BUFFER_USAGE_CPU_READ); if (!ib) { NOUVEAU_ERR("failed mapping ib\n"); return FALSE; @@ -392,7 +392,7 @@ nv30_draw_elements_inline(struct pipe_context *pipe, break; } - ws->buffer_unmap(ws, ib); + pipe_buffer_unmap(pscreen, ib); return TRUE; } diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index aec39aae9c..c7514efcfe 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -645,7 +646,7 @@ out_err: static boolean nv30_vertprog_validate(struct nv30_context *nv30) { - struct pipe_winsys *ws = nv30->pipe.winsys; + struct pipe_screen *pscreen = nv30->pipe.screen; struct nouveau_grobj *rankine = nv30->screen->rankine; struct nv30_vertex_program *vp; struct pipe_buffer *constbuf; @@ -750,8 +751,8 @@ nv30_vertprog_validate(struct nv30_context *nv30) float *map = NULL; if (constbuf) { - map = ws->buffer_map(ws, constbuf, - PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, constbuf, + PIPE_BUFFER_USAGE_CPU_READ); } for (i = 0; i < vp->nr_consts; i++) { @@ -771,9 +772,8 @@ nv30_vertprog_validate(struct nv30_context *nv30) OUT_RINGp ((uint32_t *)vpd->value, 4); } - if (constbuf) { - ws->buffer_unmap(ws, constbuf); - } + if (constbuf) + pipe_buffer_unmap(pscreen, constbuf); } /* Upload vtxprog */ diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c index e7d8cf93a9..b2f19ecb69 100644 --- a/src/gallium/drivers/nv40/nv40_draw.c +++ b/src/gallium/drivers/nv40/nv40_draw.c @@ -1,4 +1,5 @@ #include "pipe/p_shader_tokens.h" +#include "pipe/p_inlines.h" #include "util/u_pack_color.h" @@ -231,7 +232,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv40_context *nv40 = nv40_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; unsigned i; void *map; @@ -241,13 +242,14 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe, nv40_state_emit(nv40); for (i = 0; i < nv40->vtxbuf_nr; i++) { - map = ws->buffer_map(ws, nv40->vtxbuf[i].buffer, + map = pipe_buffer_map(pscreen, nv40->vtxbuf[i].buffer, PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(nv40->draw, i, map); } if (idxbuf) { - map = ws->buffer_map(ws, idxbuf, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, idxbuf, + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_element_buffer(nv40->draw, idxbuf_size, map); } else { draw_set_mapped_element_buffer(nv40->draw, 0, NULL); @@ -256,21 +258,22 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe, if (nv40->constbuf[PIPE_SHADER_VERTEX]) { const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX]; - map = ws->buffer_map(ws, nv40->constbuf[PIPE_SHADER_VERTEX], - PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, + nv40->constbuf[PIPE_SHADER_VERTEX], + PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_constant_buffer(nv40->draw, map, nr); } draw_arrays(nv40->draw, mode, start, count); for (i = 0; i < nv40->vtxbuf_nr; i++) - ws->buffer_unmap(ws, nv40->vtxbuf[i].buffer); + pipe_buffer_unmap(pscreen, nv40->vtxbuf[i].buffer); if (idxbuf) - ws->buffer_unmap(ws, idxbuf); + pipe_buffer_unmap(pscreen, idxbuf); if (nv40->constbuf[PIPE_SHADER_VERTEX]) - ws->buffer_unmap(ws, nv40->constbuf[PIPE_SHADER_VERTEX]); + pipe_buffer_unmap(pscreen, nv40->constbuf[PIPE_SHADER_VERTEX]); draw_flush(nv40->draw); pipe->flush(pipe, 0, NULL); diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index b45dfaa913..680976da56 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -881,12 +882,12 @@ static void nv40_fragprog_upload(struct nv40_context *nv40, struct nv40_fragment_program *fp) { - struct pipe_winsys *ws = nv40->pipe.winsys; + struct pipe_screen *pscreen = nv40->pipe.screen; const uint32_t le = 1; uint32_t *map; int i; - map = ws->buffer_map(ws, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map(pscreen, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); #if 0 for (i = 0; i < fp->insn_len; i++) { @@ -908,7 +909,7 @@ nv40_fragprog_upload(struct nv40_context *nv40, } } - ws->buffer_unmap(ws, fp->buffer); + pipe_buffer_unmap(pscreen, fp->buffer); } static boolean @@ -917,8 +918,7 @@ nv40_fragprog_validate(struct nv40_context *nv40) struct nv40_fragment_program *fp = nv40->fragprog; struct pipe_buffer *constbuf = nv40->constbuf[PIPE_SHADER_FRAGMENT]; - struct pipe_screen *screen = nv40->pipe.screen; - struct pipe_winsys *ws = nv40->pipe.winsys; + struct pipe_screen *pscreen = nv40->pipe.screen; struct nouveau_stateobj *so; boolean new_consts = FALSE; int i; @@ -933,7 +933,7 @@ nv40_fragprog_validate(struct nv40_context *nv40) return FALSE; } - fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4); + fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4); nv40_fragprog_upload(nv40, fp); so = so_new(4, 1); @@ -951,7 +951,8 @@ update_constants: if (fp->nr_consts) { float *map; - map = ws->buffer_map(ws, constbuf, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, constbuf, + PIPE_BUFFER_USAGE_CPU_READ); for (i = 0; i < fp->nr_consts; i++) { struct nv40_fragment_program_data *fpd = &fp->consts[i]; uint32_t *p = &fp->insn[fpd->offset]; @@ -962,7 +963,7 @@ update_constants: memcpy(p, cb, 4 * sizeof(float)); new_consts = TRUE; } - ws->buffer_unmap(ws, constbuf); + pipe_buffer_unmap(pscreen, constbuf); if (new_consts) nv40_fragprog_upload(nv40, fp); diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index 24bd116539..b2753b8e2e 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -1,5 +1,6 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv40_context.h" #include "nv40_state.h" @@ -108,7 +109,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so, int attrib, struct pipe_vertex_element *ve, struct pipe_vertex_buffer *vb) { - struct pipe_winsys *ws = nv40->pipe.winsys; + struct pipe_screen *pscreen = nv40->pipe.screen; struct nouveau_grobj *curie = nv40->screen->curie; unsigned type, ncomp; void *map; @@ -116,7 +117,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so, if (nv40_vbo_format_to_hw(ve->src_format, &type, &ncomp)) return FALSE; - map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ); map += vb->buffer_offset + ve->src_offset; switch (type) { @@ -148,17 +149,17 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so, so_data (so, fui(v[0])); break; default: - ws->buffer_unmap(ws, vb->buffer); + pipe_buffer_unmap(pscreen, vb->buffer); return FALSE; } } break; default: - ws->buffer_unmap(ws, vb->buffer); + pipe_buffer_unmap(pscreen, vb->buffer); return FALSE; } - ws->buffer_unmap(ws, vb->buffer); + pipe_buffer_unmap(pscreen, vb->buffer); return TRUE; } @@ -367,10 +368,10 @@ nv40_draw_elements_inline(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) { struct nv40_context *nv40 = nv40_context(pipe); - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; void *map; - map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, ib, PIPE_BUFFER_USAGE_CPU_READ); if (!ib) { NOUVEAU_ERR("failed mapping ib\n"); return FALSE; @@ -391,7 +392,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe, break; } - ws->buffer_unmap(ws, ib); + pipe_buffer_unmap(pscreen, ib); return TRUE; } diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index f32d4d690c..e75e8d3f42 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" #include "tgsi/tgsi_parse.h" @@ -855,7 +856,7 @@ out_err: static boolean nv40_vertprog_validate(struct nv40_context *nv40) { - struct pipe_winsys *ws = nv40->pipe.winsys; + struct pipe_screen *pscreen = nv40->pipe.screen; struct nouveau_grobj *curie = nv40->screen->curie; struct nv40_vertex_program *vp; struct pipe_buffer *constbuf; @@ -980,8 +981,8 @@ check_gpu_resources: float *map = NULL; if (constbuf) { - map = ws->buffer_map(ws, constbuf, - PIPE_BUFFER_USAGE_CPU_READ); + map = pipe_buffer_map(pscreen, constbuf, + PIPE_BUFFER_USAGE_CPU_READ); } for (i = 0; i < vp->nr_consts; i++) { @@ -1002,7 +1003,7 @@ check_gpu_resources: } if (constbuf) - ws->buffer_unmap(ws, constbuf); + pscreen->buffer_unmap(pscreen, constbuf); } /* Upload vtxprog */ diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 9d6427e2bc..5f7d06dbec 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2235,7 +2235,7 @@ nv50_program_upload_data(struct nv50_context *nv50, float *map, static void nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) { - struct pipe_winsys *ws = nv50->pipe.winsys; + struct pipe_screen *pscreen = nv50->pipe.screen; if (!p->data[0] && p->immd_nr) { struct nouveau_resource *heap = nv50->screen->immd_heap[0]; @@ -2274,13 +2274,13 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) if (p->param_nr) { unsigned cbuf = NV50_CB_PVP; - float *map = ws->buffer_map(ws, nv50->constbuf[p->type], - PIPE_BUFFER_USAGE_CPU_READ); + float *map = pipe_buffer_map(pscreen, nv50->constbuf[p->type], + PIPE_BUFFER_USAGE_CPU_READ); if (p->type == PIPE_SHADER_FRAGMENT) cbuf = NV50_CB_PFP; nv50_program_upload_data(nv50, map, p->data[1]->start, p->param_nr, cbuf); - ws->buffer_unmap(ws, nv50->constbuf[p->type]); + pipe_buffer_unmap(pscreen, nv50->constbuf[p->type]); } } diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index c77ffe84e7..f57540150a 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -105,7 +105,7 @@ static boolean nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, boolean wait, uint64_t *result) { - struct pipe_winsys *ws = pipe->winsys; + struct pipe_screen *pscreen = pipe->screen; struct nv50_query *q = nv50_query(pq); /*XXX: Want to be able to return FALSE here instead of blocking @@ -113,11 +113,11 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, */ if (!q->ready) { - uint32_t *map = ws->buffer_map(ws, q->buffer, - PIPE_BUFFER_USAGE_CPU_READ); + uint32_t *map = pipe_buffer_map(pscreen, q->buffer, + PIPE_BUFFER_USAGE_CPU_READ); q->result = map[1]; q->ready = TRUE; - ws->buffer_unmap(ws, q->buffer); + pipe_buffer_unmap(pscreen, q->buffer); } *result = q->result; diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index a9b53a0f2e..f81929f238 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -22,6 +22,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" +#include "pipe/p_inlines.h" #include "nv50_context.h" @@ -165,8 +166,10 @@ nv50_draw_elements(struct pipe_context *pipe, struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; - struct pipe_winsys *ws = pipe->winsys; - void *map = ws->buffer_map(ws, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ); + struct pipe_screen *pscreen = pipe->screen; + void *map; + + map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ); nv50_state_validate(nv50); @@ -193,6 +196,7 @@ nv50_draw_elements(struct pipe_context *pipe, BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1); OUT_RING (chan, 0); + pipe_buffer_unmap(pscreen, indexBuffer); pipe->flush(pipe, 0, NULL); return TRUE; } diff --git a/src/gallium/winsys/drm/nouveau/drm/Makefile b/src/gallium/winsys/drm/nouveau/drm/Makefile index 621ad2a807..54c3b26c75 100644 --- a/src/gallium/winsys/drm/nouveau/drm/Makefile +++ b/src/gallium/winsys/drm/nouveau/drm/Makefile @@ -3,8 +3,7 @@ include $(TOP)/configs/current LIBNAME = nouveaudrm -C_SOURCES = nouveau_drm_api.c \ - nouveau_winsys_pipe.c +C_SOURCES = nouveau_drm_api.c LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I) LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other) diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 22c53f6ea9..395b21ec7a 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -1,12 +1,16 @@ +#include "pipe/p_context.h" +#include "pipe/p_state.h" #include "util/u_memory.h" #include "nouveau_drm_api.h" -#include "nouveau_winsys_pipe.h" #include "nouveau_drmif.h" #include "nouveau_channel.h" #include "nouveau_bo.h" +#include "nouveau/nouveau_winsys.h" +#include "nouveau/nouveau_screen.h" + static struct pipe_surface * dri_surface_from_handle(struct pipe_screen *screen, unsigned handle, @@ -58,7 +62,7 @@ dri_surface_from_handle(struct pipe_screen *screen, static struct pipe_surface * nouveau_dri1_front_surface(struct pipe_context *pipe) { - return nouveau_screen(pipe->screen)->front; + return nouveau_winsys_screen(pipe->screen)->front; } static struct dri1_api nouveau_dri1_api = { @@ -69,6 +73,7 @@ static struct pipe_screen * nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) { struct dri1_create_screen_arg *dri1 = (void *)arg; + struct nouveau_winsys *nvws; struct pipe_winsys *ws; struct nouveau_device *dev = NULL; struct pipe_screen *(*init)(struct pipe_winsys *, @@ -107,20 +112,20 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) return NULL; } - ws = nouveau_pipe_winsys_new(dev); - if (!ws) { + nvws = CALLOC_STRUCT(nouveau_winsys); + if (!nvws) { nouveau_device_close(&dev); return NULL; } + ws = &nvws->base; - nouveau_pipe_winsys(ws)->pscreen = init(ws, dev); - if (!nouveau_pipe_winsys(ws)->pscreen) { + nvws->pscreen = init(ws, dev); + if (!nvws->pscreen) { ws->destroy(ws); return NULL; } if (arg->mode == DRM_CREATE_DRI1) { - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); struct nouveau_dri *nvdri = dri1->ddx_info; enum pipe_format format; @@ -129,14 +134,14 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) else format = PIPE_FORMAT_A8R8G8B8_UNORM; - nvpws->front = dri_surface_from_handle(nvpws->pscreen, + nvws->front = dri_surface_from_handle(nvws->pscreen, nvdri->front_offset, format, nvdri->width, nvdri->height, nvdri->front_pitch * (nvdri->bpp / 8)); - if (!nvpws->front) { + if (!nvws->front) { debug_printf("%s: error referencing front buffer\n", __func__); ws->destroy(ws); @@ -146,15 +151,15 @@ nouveau_drm_create_screen(int fd, struct drm_create_screen_arg *arg) dri1->api = &nouveau_dri1_api; } - return nouveau_pipe_winsys(ws)->pscreen; + return nvws->pscreen; } static struct pipe_context * nouveau_drm_create_context(struct pipe_screen *pscreen) { - struct nouveau_pipe_winsys *nvpws = nouveau_screen(pscreen); + struct nouveau_winsys *nvws = nouveau_winsys_screen(pscreen); struct pipe_context *(*init)(struct pipe_screen *, unsigned); - unsigned chipset = nvpws->channel->device->chipset; + unsigned chipset = nouveau_screen(pscreen)->device->chipset; int i; switch (chipset & 0xf0) { @@ -185,19 +190,19 @@ nouveau_drm_create_context(struct pipe_screen *pscreen) } /* Find a free slot for a pipe context, allocate a new one if needed */ - for (i = 0; i < nvpws->nr_pctx; i++) { - if (nvpws->pctx[i] == NULL) + for (i = 0; i < nvws->nr_pctx; i++) { + if (nvws->pctx[i] == NULL) break; } - if (i == nvpws->nr_pctx) { - nvpws->nr_pctx++; - nvpws->pctx = realloc(nvpws->pctx, - sizeof(*nvpws->pctx) * nvpws->nr_pctx); + if (i == nvws->nr_pctx) { + nvws->nr_pctx++; + nvws->pctx = realloc(nvws->pctx, + sizeof(*nvws->pctx) * nvws->nr_pctx); } - nvpws->pctx[i] = init(pscreen, i); - return nvpws->pctx[i]; + nvws->pctx[i] = init(pscreen, i); + return nvws->pctx[i]; } static boolean @@ -211,42 +216,41 @@ static struct pipe_buffer * nouveau_drm_pb_from_handle(struct pipe_screen *pscreen, const char *name, unsigned handle) { - struct nouveau_pipe_winsys *nvpws = nouveau_screen(pscreen); - struct nouveau_device *dev = nvpws->channel->device; - struct nouveau_pipe_buffer *nvpb; + struct nouveau_device *dev = nouveau_screen(pscreen)->device; + struct pipe_buffer *pb; int ret; - nvpb = CALLOC_STRUCT(nouveau_pipe_buffer); - if (!nvpb) + pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*)); + if (!pb) return NULL; - ret = nouveau_bo_handle_ref(dev, handle, &nvpb->bo); + ret = nouveau_bo_handle_ref(dev, handle, (struct nouveau_bo**)(pb+1)); if (ret) { debug_printf("%s: ref name 0x%08x failed with %d\n", __func__, handle, ret); - FREE(nvpb); + FREE(pb); return NULL; } - pipe_reference_init(&nvpb->base.reference, 1); - nvpb->base.screen = pscreen; - nvpb->base.alignment = 0; - nvpb->base.usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE | - PIPE_BUFFER_USAGE_CPU_READ_WRITE; - nvpb->base.size = nvpb->bo->size; - return &nvpb->base; + pipe_reference_init(&pb->reference, 1); + pb->screen = pscreen; + pb->alignment = 0; + pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE | + PIPE_BUFFER_USAGE_CPU_READ_WRITE; + pb->size = nouveau_bo(pb)->size; + return pb; } static boolean nouveau_drm_handle_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb, unsigned *handle) { - struct nouveau_pipe_buffer *nvpb = nouveau_pipe_buffer(pb); + struct nouveau_bo *bo = nouveau_bo(pb); - if (!nvpb) + if (!bo) return FALSE; - *handle = nvpb->bo->handle; + *handle = bo->handle; return TRUE; } @@ -254,12 +258,12 @@ static boolean nouveau_drm_name_from_pb(struct pipe_screen *pscreen, struct pipe_buffer *pb, unsigned *handle) { - struct nouveau_pipe_buffer *nvpb = nouveau_pipe_buffer(pb); + struct nouveau_bo *bo = nouveau_bo(pb); - if (!nvpb) + if (!bo) return FALSE; - return nouveau_bo_handle_get(nvpb->bo, handle) == 0; + return nouveau_bo_handle_get(bo, handle) == 0; } struct drm_api drm_api_hooks = { diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h index cc237bfc13..e61e0e0957 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h @@ -1,7 +1,34 @@ #ifndef __NOUVEAU_DRM_API_H__ #define __NOUVEAU_DRM_API_H__ + #include "state_tracker/drm_api.h" #include "state_tracker/dri1_api.h" + +#include "pipe/internal/p_winsys_screen.h" + #include "nouveau_dri.h" +struct nouveau_winsys { + struct pipe_winsys base; + + struct pipe_screen *pscreen; + + unsigned nr_pctx; + struct pipe_context **pctx; + + struct pipe_surface *front; +}; + +static INLINE struct nouveau_winsys * +nouveau_winsys(struct pipe_winsys *ws) +{ + return (struct nouveau_winsys *)ws; +} + +static INLINE struct nouveau_winsys * +nouveau_winsys_screen(struct pipe_screen *pscreen) +{ + return nouveau_winsys(pscreen->winsys); +} + #endif diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c deleted file mode 100644 index 2dca8cd3a9..0000000000 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.c +++ /dev/null @@ -1,205 +0,0 @@ -#include "pipe/internal/p_winsys_screen.h" -#include -#include -#include - -#include "nouveau_winsys_pipe.h" - -#include "nouveau_drmif.h" -#include "nouveau_bo.h" - -static const char * -nouveau_get_name(struct pipe_winsys *pws) -{ - return "Nouveau/DRI"; -} - -static uint32_t -nouveau_flags_from_usage(struct pipe_winsys *ws, unsigned usage) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); - struct pipe_screen *pscreen = nvpws->pscreen; - uint32_t flags = NOUVEAU_BO_LOCAL; - - if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER) - flags |= NOUVEAU_BO_GART; - - if (usage & PIPE_BUFFER_USAGE_PIXEL) { - if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE) - flags |= NOUVEAU_BO_GART; - if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE)) - flags |= NOUVEAU_BO_VRAM; - - switch (nvpws->channel->device->chipset & 0xf0) { - case 0x50: - case 0x80: - case 0x90: - flags |= NOUVEAU_BO_TILED; - if (usage & NOUVEAU_BUFFER_USAGE_ZETA) - flags |= NOUVEAU_BO_ZTILE; - break; - default: - break; - } - } - - if (usage & PIPE_BUFFER_USAGE_VERTEX) { - if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF)) - flags |= NOUVEAU_BO_GART; - } - - if (usage & PIPE_BUFFER_USAGE_INDEX) { - if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF)) - flags |= NOUVEAU_BO_GART; - } - - return flags; -} - -static struct pipe_buffer * -nouveau_pipe_bo_create(struct pipe_winsys *ws, unsigned alignment, - unsigned usage, unsigned size) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); - struct nouveau_device *dev = nvpws->channel->device; - struct nouveau_pipe_buffer *nvbuf; - uint32_t flags; - - nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer); - if (!nvbuf) - return NULL; - pipe_reference_init(&nvbuf->base.reference, 1); - nvbuf->base.alignment = alignment; - nvbuf->base.usage = usage; - nvbuf->base.size = size; - - flags = nouveau_flags_from_usage(ws, usage); - flags |= NOUVEAU_BO_MAP; - if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) { - FREE(nvbuf); - return NULL; - } - - return &nvbuf->base; -} - -static struct pipe_buffer * -nouveau_pipe_bo_user_create(struct pipe_winsys *ws, void *ptr, unsigned bytes) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); - struct nouveau_device *dev = nvpws->channel->device; - struct nouveau_pipe_buffer *nvbuf; - - nvbuf = CALLOC_STRUCT(nouveau_pipe_buffer); - if (!nvbuf) - return NULL; - pipe_reference_init(&nvbuf->base.reference, 1); - nvbuf->base.size = bytes; - - if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) { - FREE(nvbuf); - return NULL; - } - - return &nvbuf->base; -} - -static void -nouveau_pipe_bo_del(struct pipe_buffer *buf) -{ - struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf); - - nouveau_bo_ref(NULL, &nvbuf->bo); - FREE(nvbuf); -} - -static void * -nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned flags) -{ - struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf); - uint32_t map_flags = 0; - - if (flags & PIPE_BUFFER_USAGE_CPU_READ) - map_flags |= NOUVEAU_BO_RD; - if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) - map_flags |= NOUVEAU_BO_WR; - - if (nouveau_bo_map(nvbuf->bo, map_flags)) - return NULL; - return nvbuf->bo->map; -} - -static void -nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf) -{ - struct nouveau_pipe_buffer *nvbuf = nouveau_pipe_buffer(buf); - - nouveau_bo_unmap(nvbuf->bo); -} - -static void -nouveau_pipe_fence_reference(struct pipe_winsys *ws, - struct pipe_fence_handle **ptr, - struct pipe_fence_handle *pfence) -{ - *ptr = pfence; -} - -static int -nouveau_pipe_fence_signalled(struct pipe_winsys *ws, - struct pipe_fence_handle *pfence, unsigned flag) -{ - return 0; -} - -static int -nouveau_pipe_fence_finish(struct pipe_winsys *ws, - struct pipe_fence_handle *pfence, unsigned flag) -{ - return 0; -} - -static void -nouveau_destroy(struct pipe_winsys *ws) -{ - struct nouveau_pipe_winsys *nvpws = nouveau_pipe_winsys(ws); - - nouveau_device_close(&nvpws->channel->device); - FREE(nvpws); -} - -struct pipe_winsys * -nouveau_pipe_winsys_new(struct nouveau_device *dev) -{ - struct nouveau_pipe_winsys *nvpws; - int ret; - - nvpws = CALLOC_STRUCT(nouveau_pipe_winsys); - if (!nvpws) - return NULL; - - ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202, - &nvpws->channel); - if (ret) { - debug_printf("%s: error opening GPU channel: %d\n", - __func__, ret); - FREE(nvpws); - return NULL; - } - nvpws->next_handle = 0x77000000; - - nvpws->base.buffer_create = nouveau_pipe_bo_create; - nvpws->base.buffer_destroy = nouveau_pipe_bo_del; - nvpws->base.user_buffer_create = nouveau_pipe_bo_user_create; - nvpws->base.buffer_map = nouveau_pipe_bo_map; - nvpws->base.buffer_unmap = nouveau_pipe_bo_unmap; - - nvpws->base.fence_reference = nouveau_pipe_fence_reference; - nvpws->base.fence_signalled = nouveau_pipe_fence_signalled; - nvpws->base.fence_finish = nouveau_pipe_fence_finish; - - nvpws->base.get_name = nouveau_get_name; - nvpws->base.destroy = nouveau_destroy; - return &nvpws->base; -} diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h b/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h deleted file mode 100644 index ec10f1e00c..0000000000 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_winsys_pipe.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef NOUVEAU_PIPE_WINSYS_H -#define NOUVEAU_PIPE_WINSYS_H - -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_context.h" - -#include "nouveau/nouveau_winsys.h" - -#include "nouveau_device.h" - -struct nouveau_pipe_buffer { - struct pipe_buffer base; - struct nouveau_bo *bo; -}; - -static INLINE struct nouveau_pipe_buffer * -nouveau_pipe_buffer(struct pipe_buffer *buf) -{ - return (struct nouveau_pipe_buffer *)buf; -} - -struct nouveau_pipe_winsys { - struct pipe_winsys base; - - struct pipe_screen *pscreen; - - struct nouveau_channel *channel; - uint32_t next_handle; - - unsigned nr_pctx; - struct pipe_context **pctx; - - struct pipe_surface *front; -}; - -static INLINE struct nouveau_pipe_winsys * -nouveau_pipe_winsys(struct pipe_winsys *ws) -{ - return (struct nouveau_pipe_winsys *)ws; -} - -static INLINE struct nouveau_pipe_winsys * -nouveau_screen(struct pipe_screen *pscreen) -{ - return nouveau_pipe_winsys(pscreen->winsys); -} - -struct pipe_winsys * -nouveau_pipe_winsys_new(struct nouveau_device *); - -struct nouveau_winsys * -nouveau_winsys_new(struct pipe_winsys *ws); - -#endif -- cgit v1.2.3 From 40ed44991851a526f0e2cafd5dab6149cb7a3342 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 12:27:42 +1000 Subject: nouveau: fix build with libdrm_nouveau 0.6 --- src/gallium/drivers/nouveau/nouveau_push.h | 2 +- src/gallium/drivers/nouveau/nouveau_screen.c | 9 ++++----- src/gallium/drivers/nouveau/nouveau_stateobj.h | 8 ++++---- src/gallium/drivers/nv50/nv50_surface.c | 4 ++-- src/gallium/drivers/nv50/nv50_tex.c | 2 +- src/gallium/drivers/nv50/nv50_transfer.c | 12 ++++++------ 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_push.h b/src/gallium/drivers/nouveau/nouveau_push.h index 0f2c42915b..9c235080a5 100644 --- a/src/gallium/drivers/nouveau/nouveau_push.h +++ b/src/gallium/drivers/nouveau/nouveau_push.h @@ -54,7 +54,7 @@ DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence) NOUVEAU_PUSH_CONTEXT(pc); \ struct nouveau_channel *chan = pc->base.channel; \ nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, nouveau_bo(bo), \ - (data), (flags), (vor), (tor)); \ + (data), 0, (flags), (vor), (tor)); \ } while(0) /* Raw data + flags depending on FB/TT buffer */ diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index ab522a124a..0ab1d82ebc 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -8,6 +8,8 @@ #include "nouveau_winsys.h" #include "nouveau_screen.h" +//#define ENABLE_BUFRANGE + static const char * nouveau_screen_get_name(struct pipe_screen *pscreen) { @@ -109,16 +111,13 @@ nouveau_screen_map_flags(unsigned pipe) flags |= NOUVEAU_BO_RD; if (pipe & PIPE_BUFFER_USAGE_CPU_WRITE) flags |= NOUVEAU_BO_WR; -#ifdef NOUVEAU_BO_NOWAIT if (pipe & PIPE_BUFFER_USAGE_DISCARD) flags |= NOUVEAU_BO_INVAL; - if (pipe & PIPE_BUFFER_USAGE_DONTBLOCK) flags |= NOUVEAU_BO_NOWAIT; else if (pipe & 0 /*PIPE_BUFFER_USAGE_UNSYNCHRONIZED*/) flags |= NOUVEAU_BO_NOSYNC; -#endif return flags; } @@ -139,7 +138,7 @@ nouveau_screen_bo_map(struct pipe_screen *pscreen, struct pipe_buffer *pb, return bo->map; } -#ifdef NOUVEAU_BO_NOWAIT +#ifdef ENABLE_BUFRANGE static void * nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct pipe_buffer *pb, unsigned offset, unsigned length, unsigned usage) @@ -226,7 +225,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) pscreen->buffer_create = nouveau_screen_bo_new; pscreen->user_buffer_create = nouveau_screen_bo_user; pscreen->buffer_map = nouveau_screen_bo_map; -#ifdef NOUVEAU_BO_NOWAIT +#ifdef ENABLE_BUFRANGE pscreen->buffer_map_range = nouveau_screen_bo_map_range; pscreen->buffer_flush_mapped_range = nouveau_screen_bo_map_flush; #endif diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index 8e818d9d38..b595405357 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -122,8 +122,8 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so) struct nouveau_stateobj_reloc *r = &so->reloc[i]; nouveau_pushbuf_emit_reloc(chan, pb->cur + r->offset, - r->bo, r->data, r->flags, r->vor, - r->tor); + r->bo, r->data, 0, r->flags, + r->vor, r->tor); } pb->cur += nr; } @@ -145,12 +145,12 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so) for (i = 0; i < so->cur_reloc; i++) { struct nouveau_stateobj_reloc *r = &so->reloc[i]; - nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->packet, + nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->packet, 0, (r->flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RDWR)) | NOUVEAU_BO_DUMMY, 0, 0); - nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->data, + nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->data, 0, r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor); } diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index cd4e7ef690..936fe43561 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -62,7 +62,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) if (format < 0) return 1; - if (!bo->tiled) { + if (!bo->tile_flags) { BEGIN_RING(chan, eng2d, mthd, 2); OUT_RING (chan, format); OUT_RING (chan, 1); @@ -76,7 +76,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) BEGIN_RING(chan, eng2d, mthd, 5); OUT_RING (chan, format); OUT_RING (chan, 0); - OUT_RING (chan, 0); + OUT_RING (chan, bo->tile_mode << 4); OUT_RING (chan, 1); OUT_RING (chan, 0); BEGIN_RING(chan, eng2d, mthd + 0x18, 4); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 86947faee3..5539a796e8 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -122,7 +122,7 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, so_reloc(so, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); - so_data (so, 0xd0005000); + so_data (so, 0xd0005000 | bo->tile_mode << 22); so_data (so, 0x00300000); so_data (so, mt->base.width[0]); so_data (so, (mt->base.last_level << 28) | diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index a0a2099035..babb35a227 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -34,7 +34,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, WAIT_RING (chan, 14); - if (!src_bo->tiled) { + if (!src_bo->tile_flags) { BEGIN_RING(chan, m2mf, 0x0200, 1); OUT_RING (chan, 1); BEGIN_RING(chan, m2mf, 0x0314, 1); @@ -43,14 +43,14 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, } else { BEGIN_RING(chan, m2mf, 0x0200, 6); OUT_RING (chan, 0); - OUT_RING (chan, 0); + OUT_RING (chan, src_bo->tile_mode << 4); OUT_RING (chan, sw * cpp); OUT_RING (chan, sh); OUT_RING (chan, 1); OUT_RING (chan, 0); } - if (!dst_bo->tiled) { + if (!dst_bo->tile_flags) { BEGIN_RING(chan, m2mf, 0x021c, 1); OUT_RING (chan, 1); BEGIN_RING(chan, m2mf, 0x0318, 1); @@ -59,7 +59,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, } else { BEGIN_RING(chan, m2mf, 0x021c, 6); OUT_RING (chan, 0); - OUT_RING (chan, 0); + OUT_RING (chan, dst_bo->tile_mode << 4); OUT_RING (chan, dw * cpp); OUT_RING (chan, dh); OUT_RING (chan, 1); @@ -76,13 +76,13 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, BEGIN_RING(chan, m2mf, 0x030c, 2); OUT_RELOCl(chan, src_bo, src_offset, src_reloc); OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc); - if (src_bo->tiled) { + if (src_bo->tile_flags) { BEGIN_RING(chan, m2mf, 0x0218, 1); OUT_RING (chan, (dy << 16) | sx); } else { src_offset += (line_count * src_pitch); } - if (dst_bo->tiled) { + if (dst_bo->tile_flags) { BEGIN_RING(chan, m2mf, 0x0234, 1); OUT_RING (chan, (sy << 16) | dx); } else { -- cgit v1.2.3 From 36705ee044681da9899d0950c22ae7baa10c3d33 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 14:48:45 +1000 Subject: nouveau: plug in our map_buffer_range and friends --- src/gallium/drivers/nouveau/nouveau_screen.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 0ab1d82ebc..832366e646 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -8,8 +8,6 @@ #include "nouveau_winsys.h" #include "nouveau_screen.h" -//#define ENABLE_BUFRANGE - static const char * nouveau_screen_get_name(struct pipe_screen *pscreen) { @@ -138,7 +136,6 @@ nouveau_screen_bo_map(struct pipe_screen *pscreen, struct pipe_buffer *pb, return bo->map; } -#ifdef ENABLE_BUFRANGE static void * nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct pipe_buffer *pb, unsigned offset, unsigned length, unsigned usage) @@ -153,7 +150,7 @@ nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct pipe_buffer *pb, return NULL; } - return bo->map; + return (char *)bo->map - offset; /* why gallium? why? */ } static void @@ -164,7 +161,6 @@ nouveau_screen_bo_map_flush(struct pipe_screen *pscreen, struct pipe_buffer *pb, nouveau_bo_map_flush(bo, offset, length); } -#endif static void nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct pipe_buffer *pb) @@ -225,10 +221,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) pscreen->buffer_create = nouveau_screen_bo_new; pscreen->user_buffer_create = nouveau_screen_bo_user; pscreen->buffer_map = nouveau_screen_bo_map; -#ifdef ENABLE_BUFRANGE pscreen->buffer_map_range = nouveau_screen_bo_map_range; pscreen->buffer_flush_mapped_range = nouveau_screen_bo_map_flush; -#endif pscreen->buffer_unmap = nouveau_screen_bo_unmap; pscreen->buffer_destroy = nouveau_screen_bo_del; -- cgit v1.2.3 From fb7d1fb0f0ce4137b6cb84198997241d190d13a8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 4 Jun 2009 21:38:33 -0700 Subject: r300: Moar vs debug. --- src/gallium/drivers/r300/r300_debug.c | 19 ++++++++++++++++--- src/gallium/drivers/r300/r300_debug.h | 12 ++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index ffc93eb591..32fa739a1e 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -165,14 +165,27 @@ static void r300_vs_op_dump(uint32_t op) } } +void r300_vs_src_dump(uint32_t src) +{ + debug_printf(" %s/%s/%s/%s\n", + r300_vs_swiz_debug[(src >> 13) & 0x7], + r300_vs_swiz_debug[(src >> 16) & 0x7], + r300_vs_swiz_debug[(src >> 19) & 0x7], + r300_vs_swiz_debug[(src >> 22) & 0x7]); +} + void r300_vs_dump(struct r300_vertex_shader* vs) { int i; for (i = 0; i < vs->instruction_count; i++) { + debug_printf("%d: op: 0x%08x", i, vs->instructions[i].inst0); r300_vs_op_dump(vs->instructions[i].inst0); - debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1); - debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2); - debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3); + debug_printf(" src0: 0x%08x", vs->instructions[i].inst1); + r300_vs_src_dump(vs->instructions[i].inst1); + debug_printf(" src1: 0x%08x", vs->instructions[i].inst2); + r300_vs_src_dump(vs->instructions[i].inst2); + debug_printf(" src2: 0x%08x", vs->instructions[i].inst3); + r300_vs_src_dump(vs->instructions[i].inst3); } } diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h index 6306594099..3939d834c2 100644 --- a/src/gallium/drivers/r300/r300_debug.h +++ b/src/gallium/drivers/r300/r300_debug.h @@ -173,6 +173,18 @@ static char* r300_vs_me_ops[] = { " (reserved)", }; +/* XXX refactor to avoid clashing symbols */ +static char* r300_vs_swiz_debug[] = { + "X", + "Y", + "Z", + "W", + "0", + "1", + "U", + "U", +}; + void r500_fs_dump(struct r500_fragment_shader* fs); void r300_vs_dump(struct r300_vertex_shader* vs); -- cgit v1.2.3 From 31609acbe9d80daea49e98f026196023a20258a0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 4 Jun 2009 22:41:33 -0700 Subject: r300-gallium: vs: Add negation, SUB. Doesn't work. WTF. --- src/gallium/drivers/r300/r300_debug.c | 6 +++++- src/gallium/drivers/r300/r300_state_tcl.c | 17 +++++++++++++---- src/gallium/drivers/r300/r300_state_tcl.h | 7 +++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 32fa739a1e..1a8c17b28d 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -167,10 +167,14 @@ static void r300_vs_op_dump(uint32_t op) void r300_vs_src_dump(uint32_t src) { - debug_printf(" %s/%s/%s/%s\n", + debug_printf(" %s%s/%s%s/%s%s/%s%s\n", + src & (1 << 25) ? "-" : " ", r300_vs_swiz_debug[(src >> 13) & 0x7], + src & (1 << 26) ? "-" : " ", r300_vs_swiz_debug[(src >> 16) & 0x7], + src & (1 << 27) ? "-" : " ", r300_vs_swiz_debug[(src >> 19) & 0x7], + src & (1 << 28) ? "-" : " ", r300_vs_swiz_debug[(src >> 22) & 0x7]); } diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 32e61bc1d7..30a8dab307 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -144,6 +144,7 @@ static uint32_t r300_vs_op(unsigned op) return R300_VE_MULTIPLY; case TGSI_OPCODE_ADD: case TGSI_OPCODE_MOV: + case TGSI_OPCODE_SUB: case TGSI_OPCODE_SWZ: return R300_VE_ADD; case TGSI_OPCODE_MAX: @@ -163,12 +164,14 @@ static uint32_t r300_vs_op(unsigned op) static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { - return reg->SrcRegisterExtSwz.ExtSwizzleX | + return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + reg->SrcRegisterExtSwz.ExtSwizzleX | (reg->SrcRegisterExtSwz.ExtSwizzleY << 3) | (reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) | (reg->SrcRegisterExtSwz.ExtSwizzleW << 9); } else { - return reg->SrcRegister.SwizzleX | + return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleY << 3) | (reg->SrcRegister.SwizzleZ << 6) | (reg->SrcRegister.SwizzleW << 9); @@ -179,12 +182,14 @@ static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) static uint32_t r300_vs_scalar_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { - return reg->SrcRegisterExtSwz.ExtSwizzleX | + return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + reg->SrcRegisterExtSwz.ExtSwizzleX | (reg->SrcRegisterExtSwz.ExtSwizzleX << 3) | (reg->SrcRegisterExtSwz.ExtSwizzleX << 6) | (reg->SrcRegisterExtSwz.ExtSwizzleX << 9); } else { - return reg->SrcRegister.SwizzleX | + return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleX << 3) | (reg->SrcRegister.SwizzleX << 6) | (reg->SrcRegister.SwizzleX << 9); @@ -246,6 +251,10 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs, &inst->FullDstRegisters[0], inst->Instruction.Opcode, 1, TRUE); break; + case TGSI_OPCODE_SUB: + inst->FullSrcRegisters[1].SrcRegister.Negate = + !inst->FullSrcRegisters[1].SrcRegister.Negate; + /* Fall through */ case TGSI_OPCODE_ADD: case TGSI_OPCODE_MUL: case TGSI_OPCODE_MAX: diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h index d5d425e9d6..2c8b586c2f 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.h +++ b/src/gallium/drivers/r300/r300_state_tcl.h @@ -76,6 +76,13 @@ ((R300_PVS_SRC_SELECT_FORCE_1 | (R300_PVS_SRC_SELECT_FORCE_1 << 3) | \ (R300_PVS_SRC_SELECT_FORCE_1 << 6) | \ (R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13) +#define R300_PVS_MODIFIER_X (1 << 25) +#define R300_PVS_MODIFIER_Y (1 << 26) +#define R300_PVS_MODIFIER_Z (1 << 27) +#define R300_PVS_MODIFIER_W (1 << 28) +#define R300_PVS_NEGATE_XYZW \ + (R300_PVS_MODIFIER_X | R300_PVS_MODIFIER_Y | \ + R300_PVS_MODIFIER_Z | R300_PVS_MODIFIER_W) static const struct tgsi_full_src_register r300_constant_zero = { .SrcRegister.Extended = TRUE, -- cgit v1.2.3 From 8652ad68992a63a275bdc3816540c39776b143b2 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 4 Jun 2009 23:25:46 -0700 Subject: r300-gallium: Improve vs debug more. Still not showing me why my stuff's failing, but getting there. --- src/gallium/drivers/r300/r300_debug.c | 5 ++++- src/gallium/drivers/r300/r300_debug.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 1a8c17b28d..678cd2b812 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -152,6 +152,8 @@ void r500_fs_dump(struct r500_fragment_shader* fs) static void r300_vs_op_dump(uint32_t op) { + debug_printf(" dst: %d%s op: ", + (op >> 13) & 0x7f, r300_vs_dst_debug[(op >> 8) & 0x7]); if (op & 0x80) { if (op & 0x1) { debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n"); @@ -167,7 +169,8 @@ static void r300_vs_op_dump(uint32_t op) void r300_vs_src_dump(uint32_t src) { - debug_printf(" %s%s/%s%s/%s%s/%s%s\n", + debug_printf(" reg: %d%s swiz: %s%s/%s%s/%s%s/%s%s\n", + (src >> 5) & 0x7f, r300_vs_src_debug[src & 0x3], src & (1 << 25) ? "-" : " ", r300_vs_swiz_debug[(src >> 13) & 0x7], src & (1 << 26) ? "-" : " ", diff --git a/src/gallium/drivers/r300/r300_debug.h b/src/gallium/drivers/r300/r300_debug.h index 3939d834c2..c86410ec0a 100644 --- a/src/gallium/drivers/r300/r300_debug.h +++ b/src/gallium/drivers/r300/r300_debug.h @@ -174,6 +174,24 @@ static char* r300_vs_me_ops[] = { }; /* XXX refactor to avoid clashing symbols */ +static char* r300_vs_src_debug[] = { + "t", + "i", + "c", + "a", +}; + +static char* r300_vs_dst_debug[] = { + "t", + "a0", + "o", + "ox", + "a", + "i", + "u", + "u", +}; + static char* r300_vs_swiz_debug[] = { "X", "Y", -- cgit v1.2.3 From 571b36831bed3c8dd5691cad5b544667d07c60b0 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 4 Jun 2009 23:56:08 -0700 Subject: r300-gallium: Fix pasta. Trivial but annoying. --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index caeb73a8ed..61b416663b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -374,7 +374,7 @@ void r300_emit_vertex_shader(struct r300_context* r300, if (constants->count) { BEGIN_CS(16 + (vs->instruction_count * 4) + (constants->count * 4)); } else { - BEGIN_CS(13 + (vs->instruction_count * 4) + (constants->count * 4)); + BEGIN_CS(13 + (vs->instruction_count * 4)); } OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) | -- cgit v1.2.3 From 4c66c5bf921357c94611e583d1a64f653e957765 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 4 Jun 2009 23:56:32 -0700 Subject: r300-gallium: vs: Fix negation calculation. Still doesn't draw right, but at least it's the right numbers now. Thanks to taiu in #dri-devel. --- src/gallium/drivers/r300/r300_state_tcl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c index 30a8dab307..8cf8250425 100644 --- a/src/gallium/drivers/r300/r300_state_tcl.c +++ b/src/gallium/drivers/r300/r300_state_tcl.c @@ -164,13 +164,13 @@ static uint32_t r300_vs_op(unsigned op) static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { - return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + return (reg->SrcRegister.Negate ? (0xf << 12) : 0) | reg->SrcRegisterExtSwz.ExtSwizzleX | (reg->SrcRegisterExtSwz.ExtSwizzleY << 3) | (reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) | (reg->SrcRegisterExtSwz.ExtSwizzleW << 9); } else { - return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + return (reg->SrcRegister.Negate ? (0xf << 12) : 0) | reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleY << 3) | (reg->SrcRegister.SwizzleZ << 6) | @@ -182,13 +182,13 @@ static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg) static uint32_t r300_vs_scalar_swiz(struct tgsi_full_src_register* reg) { if (reg->SrcRegister.Extended) { - return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + return (reg->SrcRegister.Negate ? (0xf << 12) : 0) | reg->SrcRegisterExtSwz.ExtSwizzleX | (reg->SrcRegisterExtSwz.ExtSwizzleX << 3) | (reg->SrcRegisterExtSwz.ExtSwizzleX << 6) | (reg->SrcRegisterExtSwz.ExtSwizzleX << 9); } else { - return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) | + return (reg->SrcRegister.Negate ? (0xf << 12) : 0) | reg->SrcRegister.SwizzleX | (reg->SrcRegister.SwizzleX << 3) | (reg->SrcRegister.SwizzleX << 6) | -- cgit v1.2.3 From 90bfff0a295ce28143ecde98ed91eb6d8cfba23c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 5 Jun 2009 00:12:26 -0700 Subject: r300-gallium: Mute some debug info. Most of it is no longer interesting. --- src/gallium/drivers/r300/r300_cs.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 2abf04d27e..71b142c0db 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -34,6 +34,7 @@ #define MAX_CS_SIZE 64 * 1024 / 4 +#define VERY_VERBOSE_CS 0 #define VERY_VERBOSE_REGISTERS 0 /* XXX stolen from radeon_drm.h */ @@ -56,8 +57,10 @@ #define BEGIN_CS(size) do { \ CHECK_CS(size); \ - debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \ - size, __FUNCTION__, __FILE__, __LINE__); \ + if (VERY_VERBOSE_CS) { \ + debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \ + size, __FUNCTION__, __FILE__, __LINE__); \ + } \ cs_winsys->begin_cs(cs_winsys, (size), \ __FILE__, __FUNCTION__, __LINE__); \ cs_count = size; \ @@ -103,16 +106,20 @@ } while (0) #define END_CS do { \ - debug_printf("r300: END_CS in %s (%s:%d)\n", __FUNCTION__, __FILE__, \ - __LINE__); \ + if (VERY_VERBOSE_CS) { \ + debug_printf("r300: END_CS in %s (%s:%d)\n", __FUNCTION__, \ + __FILE__, __LINE__); \ + } \ if (cs_count != 0) \ debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \ cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \ } while (0) #define FLUSH_CS do { \ - debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \ - __LINE__); \ + if (VERY_VERBOSE_CS) { \ + debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, \ + __FILE__, __LINE__); \ + } \ cs_winsys->flush_cs(cs_winsys); \ } while (0) -- cgit v1.2.3 From b04470b0bce6a24a74a0ec8cf16d9d3f03aff5f2 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 5 Jun 2009 14:32:31 +0200 Subject: util: Fix winsock include. --- src/gallium/auxiliary/util/u_network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c index 465d50255e..07d804ecdb 100644 --- a/src/gallium/auxiliary/util/u_network.c +++ b/src/gallium/auxiliary/util/u_network.c @@ -4,8 +4,8 @@ #include "util/u_debug.h" #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) +# include # include -# include #elif defined(PIPE_OS_LINUX) # include # include -- cgit v1.2.3 From 1a92c71a66dd9d785906cdb78c107e63dcf48672 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 20:32:32 +1000 Subject: nv50: create textures with nouveau_bo, for flexibility with tiling later --- src/gallium/drivers/nv50/nv50_context.h | 10 ++----- src/gallium/drivers/nv50/nv50_miptree.c | 22 ++++++++------ src/gallium/drivers/nv50/nv50_state_validate.c | 6 ++-- src/gallium/drivers/nv50/nv50_surface.c | 2 +- src/gallium/drivers/nv50/nv50_tex.c | 6 ++-- src/gallium/drivers/nv50/nv50_transfer.c | 41 +++++++++++++++----------- 6 files changed, 46 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 7b67a75439..c3ffdcca9f 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -70,7 +70,8 @@ struct nv50_miptree_level { struct nv50_miptree { struct pipe_texture base; - struct pipe_buffer *buffer; + + struct nouveau_bo *bo; struct nv50_miptree_level level[PIPE_MAX_TEXTURE_LEVELS]; int image_nr; @@ -93,13 +94,6 @@ nv50_surface(struct pipe_surface *pt) return (struct nv50_surface *)pt; } -static INLINE struct pipe_buffer * -nv50_surface_buffer(struct pipe_surface *surface) -{ - struct nv50_miptree *mt = (struct nv50_miptree *)surface->texture; - return mt->buffer; -} - struct nv50_state { unsigned dirty; diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index f79a7ca86c..2fbedb6779 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -29,23 +29,25 @@ static struct pipe_texture * nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) { + struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree); struct pipe_texture *pt = &mt->base; - unsigned usage, width = tmp->width[0], height = tmp->height[0]; + unsigned width = tmp->width[0], height = tmp->height[0]; unsigned depth = tmp->depth[0]; - int i, l; + uint32_t tile_mode = 0, tile_flags = 0; + int ret, i, l; mt->base = *tmp; pipe_reference_init(&mt->base.reference, 1); mt->base.screen = pscreen; - usage = PIPE_BUFFER_USAGE_PIXEL; switch (pt->format) { case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z16_UNORM: - usage |= NOUVEAU_BUFFER_USAGE_ZETA; + tile_flags = 0x2800; break; default: + tile_flags = 0x7000; break; } @@ -93,12 +95,13 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) } } - mt->buffer = pscreen->buffer_create(pscreen, 256, usage, mt->total_size); - if (!mt->buffer) { + ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM, 256, mt->total_size, + tile_mode, tile_flags, &mt->bo); + if (ret) { FREE(mt); return NULL; } - + return &mt->base; } @@ -106,6 +109,7 @@ static struct pipe_texture * nv50_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, const unsigned *stride, struct pipe_buffer *pb) { + struct nouveau_bo *bo = nouveau_bo(pb); struct nv50_miptree *mt; /* Only supports 2D, non-mipmapped textures for the moment */ @@ -124,7 +128,7 @@ nv50_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].pitch = *stride; mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); - pipe_buffer_reference(&mt->buffer, pb); + nouveau_bo_ref(bo, &mt->bo); return &mt->base; } @@ -133,7 +137,7 @@ nv50_miptree_destroy(struct pipe_texture *pt) { struct nv50_miptree *mt = nv50_miptree(pt); - pipe_buffer_reference(&mt->buffer, NULL); + nouveau_bo_ref(NULL, &mt->bo); FREE(mt); } diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 9e70d4b78d..1788f76456 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -32,7 +32,8 @@ nv50_state_validate_fb(struct nv50_context *nv50) unsigned i, w, h, gw = 0; for (i = 0; i < fb->nr_cbufs; i++) { - struct nouveau_bo *bo = nouveau_bo(nv50_surface_buffer(fb->cbufs[i])); + struct pipe_texture *pt = fb->cbufs[i]->texture; + struct nouveau_bo *bo = nv50_miptree(pt)->bo; if (!gw) { w = fb->cbufs[i]->width; @@ -73,7 +74,8 @@ nv50_state_validate_fb(struct nv50_context *nv50) } if (fb->zsbuf) { - struct nouveau_bo *bo = nouveau_bo(nv50_surface_buffer(fb->zsbuf)); + struct pipe_texture *pt = fb->zsbuf->texture; + struct nouveau_bo *bo = nv50_miptree(pt)->bo; if (!gw) { w = fb->zsbuf->width; diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 936fe43561..8db3b6d344 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -54,7 +54,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) struct nv50_miptree *mt = nv50_miptree(ps->texture); struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_grobj *eng2d = screen->eng2d; - struct nouveau_bo *bo = nouveau_bo(nv50_miptree(ps->texture)->buffer); + struct nouveau_bo *bo = nv50_miptree(ps->texture)->bo; int format, mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; int flags = NOUVEAU_BO_VRAM | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 5539a796e8..8bb81392fd 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -29,8 +29,6 @@ static int nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, struct nv50_miptree *mt) { - struct nouveau_bo *bo = nouveau_bo(mt->buffer); - switch (mt->base.format) { case PIPE_FORMAT_A8R8G8B8_UNORM: so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | @@ -120,9 +118,9 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, return 1; } - so_reloc(so, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | + so_reloc(so, mt->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); - so_data (so, 0xd0005000 | bo->tile_mode << 22); + so_data (so, 0xd0005000 | mt->bo->tile_mode << 22); so_data (so, 0x00300000); so_data (so, mt->base.width[0]); so_data (so, (mt->base.last_level << 28) | diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index babb35a227..d0b7f0bef4 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -6,7 +6,7 @@ struct nv50_transfer { struct pipe_transfer base; - struct pipe_buffer *buffer; + struct nouveau_bo *bo; unsigned level_offset; int level_pitch; int level_width; @@ -16,9 +16,9 @@ struct nv50_transfer { }; static void -nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, +nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct nouveau_bo *src_bo, unsigned src_offset, int src_pitch, int sx, int sy, - int sw, int sh, struct pipe_buffer *dst, + int sw, int sh, struct nouveau_bo *dst_bo, unsigned dst_offset, int dst_pitch, int dx, int dy, int dw, int dh, int cpp, int width, int height, unsigned src_reloc, unsigned dst_reloc) @@ -26,8 +26,6 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, struct nv50_screen *screen = nv50_screen(pscreen); struct nouveau_channel *chan = screen->m2mf->channel; struct nouveau_grobj *m2mf = screen->m2mf; - struct nouveau_bo *src_bo = nouveau_bo(src); - struct nouveau_bo *dst_bo = nouveau_bo(dst); src_reloc |= NOUVEAU_BO_RD; dst_reloc |= NOUVEAU_BO_WR; @@ -107,10 +105,12 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, enum pipe_transfer_usage usage, unsigned x, unsigned y, unsigned w, unsigned h) { + struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct nv50_miptree *mt = nv50_miptree(pt); struct nv50_miptree_level *lvl = &mt->level[level]; struct nv50_transfer *tx; unsigned image = 0; + int ret; if (pt->target == PIPE_TEXTURE_CUBE) image = face; @@ -138,14 +138,17 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_offset = lvl->image_offset[image]; tx->level_x = x; tx->level_y = y; - tx->buffer = - pipe_buffer_create(pscreen, 0, NOUVEAU_BUFFER_USAGE_TRANSFER, - w * tx->base.block.size * h); + ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, + w * pt->block.size * h, &tx->bo); + if (ret) { + FREE(tx); + return NULL; + } if (usage != PIPE_TRANSFER_WRITE) { - nv50_transfer_rect_m2mf(pscreen, mt->buffer, tx->level_offset, + nv50_transfer_rect_m2mf(pscreen, mt->bo, tx->level_offset, tx->level_pitch, x, y, tx->level_width, - tx->level_height, tx->buffer, 0, + tx->level_height, tx->bo, 0, tx->base.stride, 0, 0, tx->base.width, tx->base.height, tx->base.block.size, w, h, @@ -164,9 +167,9 @@ nv50_transfer_del(struct pipe_transfer *ptx) if (ptx->usage != PIPE_TRANSFER_READ) { struct pipe_screen *pscreen = ptx->texture->screen; - nv50_transfer_rect_m2mf(pscreen, tx->buffer, 0, tx->base.stride, + nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, 0, 0, tx->base.width, tx->base.height, - mt->buffer, tx->level_offset, + mt->bo, tx->level_offset, tx->level_pitch, tx->level_x, tx->level_y, tx->level_width, tx->level_height, tx->base.block.size, @@ -175,7 +178,7 @@ nv50_transfer_del(struct pipe_transfer *ptx) NOUVEAU_BO_GART); } - pipe_buffer_reference(&tx->buffer, NULL); + nouveau_bo_ref(NULL, &tx->bo); pipe_texture_reference(&ptx->texture, NULL); FREE(ptx); } @@ -185,13 +188,17 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; unsigned flags = 0; + int ret; if (ptx->usage & PIPE_TRANSFER_WRITE) - flags |= PIPE_BUFFER_USAGE_CPU_WRITE; + flags |= NOUVEAU_BO_WR; if (ptx->usage & PIPE_TRANSFER_READ) - flags |= PIPE_BUFFER_USAGE_CPU_READ; + flags |= NOUVEAU_BO_RD; - return pipe_buffer_map(pscreen, tx->buffer, flags); + ret = nouveau_bo_map(tx->bo, flags); + if (ret) + return NULL; + return tx->bo->map; } static void @@ -199,7 +206,7 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; - pipe_buffer_unmap(pscreen, tx->buffer); + nouveau_bo_unmap(tx->bo); } void -- cgit v1.2.3 From a471497345bcd3aaaa52d3dc73f68367cb4af6a0 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 20:45:58 +1000 Subject: nv50: use nouveau_bo for query buffers --- src/gallium/drivers/nv50/nv50_query.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index f57540150a..940e04365f 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -26,7 +26,7 @@ #include "nv50_context.h" struct nv50_query { - struct pipe_buffer *buffer; + struct nouveau_bo *bo; unsigned type; boolean ready; uint64_t result; @@ -41,14 +41,16 @@ nv50_query(struct pipe_query *pipe) static struct pipe_query * nv50_query_create(struct pipe_context *pipe, unsigned type) { - struct pipe_screen *screen = pipe->screen; + struct nouveau_device *dev = nouveau_screen(pipe->screen)->device; struct nv50_query *q = CALLOC_STRUCT(nv50_query); + int ret; assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER); q->type = type; - q->buffer = screen->buffer_create(screen, 256, 0, 16); - if (!q->buffer) { + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 256, + 16, &q->bo); + if (ret) { FREE(q); return NULL; } @@ -62,7 +64,7 @@ nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) struct nv50_query *q = nv50_query(pq); if (q) { - pipe_buffer_reference(&q->buffer, NULL); + nouveau_bo_ref(NULL, &q->bo); FREE(q); } } @@ -90,12 +92,11 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) struct nouveau_channel *chan = nv50->screen->base.channel; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q = nv50_query(pq); - struct nouveau_bo *bo = nouveau_bo(q->buffer); WAIT_RING (chan, 5); BEGIN_RING(chan, tesla, 0x1b00, 4); - OUT_RELOCh(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - OUT_RELOCl(chan, bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); OUT_RING (chan, 0x00000000); OUT_RING (chan, 0x0100f002); FIRE_RING (chan); @@ -105,7 +106,6 @@ static boolean nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, boolean wait, uint64_t *result) { - struct pipe_screen *pscreen = pipe->screen; struct nv50_query *q = nv50_query(pq); /*XXX: Want to be able to return FALSE here instead of blocking @@ -113,11 +113,10 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq, */ if (!q->ready) { - uint32_t *map = pipe_buffer_map(pscreen, q->buffer, - PIPE_BUFFER_USAGE_CPU_READ); - q->result = map[1]; + nouveau_bo_map(q->bo, NOUVEAU_BO_RD); + q->result = ((uint32_t *)q->bo->map)[1]; q->ready = TRUE; - pipe_buffer_unmap(pscreen, q->buffer); + nouveau_bo_unmap(q->bo); } *result = q->result; -- cgit v1.2.3 From d06e380e022d938a61800cbbec0004ec9f1fecfd Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 5 Jun 2009 22:04:07 +1000 Subject: nv50: use larger tile sizes --- src/gallium/drivers/nv50/nv50_miptree.c | 11 +++++++++-- src/gallium/drivers/nv50/nv50_state_validate.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 2fbedb6779..6b605ba416 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -34,7 +34,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) struct pipe_texture *pt = &mt->base; unsigned width = tmp->width[0], height = tmp->height[0]; unsigned depth = tmp->depth[0]; - uint32_t tile_mode = 0, tile_flags = 0; + uint32_t tile_mode, tile_flags, tile_h; int ret, i, l; mt->base = *tmp; @@ -51,6 +51,13 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) break; } + if (pt->height[0] > 32) tile_mode = 4; + else if (pt->height[0] > 16) tile_mode = 3; + else if (pt->height[0] > 8) tile_mode = 2; + else if (pt->height[0] > 4) tile_mode = 1; + else tile_mode = 0; + tile_h = 1 << (tile_mode + 2); + switch (pt->target) { case PIPE_TEXTURE_3D: mt->image_nr = pt->depth[0]; @@ -87,7 +94,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) size = align(pt->width[l], 8) * pt->block.size; size = align(size, 64); - size *= align(pt->height[l], 8) * pt->block.size; + size *= align(pt->height[l], tile_h) * pt->block.size; lvl->image_offset[i] = mt->total_size; diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 1788f76456..a0106fc339 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -66,7 +66,7 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_data(so, 0xe6); break; } - so_data(so, 0x00000000); + so_data(so, bo->tile_mode << 4); so_data(so, 0x00000000); so_method(so, tesla, 0x1224, 1); @@ -104,7 +104,7 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_data(so, 0x16); break; } - so_data(so, 0x00000000); + so_data(so, bo->tile_mode << 4); so_data(so, 0x00000000); so_method(so, tesla, 0x1538, 1); -- cgit v1.2.3 From 4c034441a8f12e4bf60b8c5f58202d5ae00ff31d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 5 Jun 2009 15:00:15 +0200 Subject: mesa: Fix wglext.h prototypes. --- include/GL/wglext.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/GL/wglext.h b/include/GL/wglext.h index dffef25178..3c492dd634 100644 --- a/include/GL/wglext.h +++ b/include/GL/wglext.h @@ -714,9 +714,9 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWO #ifndef WGL_3DL_stereo_control #define WGL_3DL_stereo_control 1 #ifdef WGL_WGLEXT_PROTOTYPES -extern BOOL WINAPI wglSetStereoEmitterState3DL (, HDC, , UINT); +extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC, UINT); #endif /* WGL_WGLEXT_PROTOTYPES */ -typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) ( HDC, HDC hDC, UINT, UINT uState); +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); #endif #ifndef WGL_EXT_pixel_format_packed_float -- cgit v1.2.3 From 9e4590dff72b8739e787da7f0d86c7066f179186 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 5 Jun 2009 10:18:20 -0700 Subject: r300-gallium: Improve vs emit. --- src/gallium/drivers/r300/r300_emit.c | 20 ++++++++++++-------- src/gallium/drivers/r300/r300_reg.h | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 61b416663b..4a70f3afde 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -372,17 +372,22 @@ void r300_emit_vertex_shader(struct r300_context* r300, } if (constants->count) { - BEGIN_CS(16 + (vs->instruction_count * 4) + (constants->count * 4)); + BEGIN_CS(14 + (vs->instruction_count * 4) + (constants->count * 4)); } else { - BEGIN_CS(13 + (vs->instruction_count * 4)); + BEGIN_CS(11 + (vs->instruction_count * 4)); } - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) | + /* R300_VAP_PVS_CODE_CNTL_0 + * R300_VAP_PVS_CONST_CNTL + * R300_VAP_PVS_CODE_CNTL_1 + * See the r5xx docs for instructions on how to use these. + * XXX these could be optimized to select better values... */ + OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0, 3); + OUT_CS(R300_PVS_FIRST_INST(0) | + R300_PVS_XYZW_VALID_INST(vs->instruction_count - 1) | R300_PVS_LAST_INST(vs->instruction_count - 1)); - OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, vs->instruction_count - 1); - - /* XXX */ - OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x0); + OUT_CS(R300_PVS_MAX_CONST_ADDR(constants->count - 1)); + OUT_CS(vs->instruction_count - 1); OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0); OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4); @@ -412,7 +417,6 @@ void r300_emit_vertex_shader(struct r300_context* r300, R300_PVS_VF_MAX_VTX_NUM(12)); OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); END_CS; - } void r300_emit_viewport_state(struct r300_context* r300, diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 920584a59e..3bb9bc47b5 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -511,11 +511,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_PVS_XYZW_VALID_INST_SHIFT 10 # define R300_PVS_LAST_INST_SHIFT 20 # define R300_PVS_FIRST_INST(x) ((x) << 0) +# define R300_PVS_XYZW_VALID_INST(x) ((x) << 10) # define R300_PVS_LAST_INST(x) ((x) << 20) /* Addresses are relative the the vertex program parameters area. */ #define R300_VAP_PVS_CONST_CNTL 0x22D4 # define R300_PVS_CONST_BASE_OFFSET_SHIFT 0 # define R300_PVS_MAX_CONST_ADDR_SHIFT 16 +# define R300_PVS_MAX_CONST_ADDR(x) ((x) << 16) #define R300_VAP_PVS_CODE_CNTL_1 0x22D8 # define R300_PVS_LAST_VTX_SRC_INST_SHIFT 0 #define R300_VAP_PVS_FLOW_CNTL_OPC 0x22DC -- cgit v1.2.3 From 1a359d983512b39783ce9f4eb842d3ea4ec012a6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 5 Jun 2009 11:21:09 -0700 Subject: r300-gallium: Emit UCP. --- src/gallium/drivers/r300/r300_context.h | 37 ++++++++++++++++++--------------- src/gallium/drivers/r300/r300_emit.c | 26 +++++++++++++++++++++++ src/gallium/drivers/r300/r300_emit.h | 3 +++ src/gallium/drivers/r300/r300_state.c | 7 ++++--- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index a9dd041e08..27bc7fd1a9 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -117,23 +117,24 @@ struct r300_viewport_state { uint32_t vte_control; /* R300_VAP_VTE_CNTL: 0x20b0 */ }; -#define R300_NEW_BLEND 0x0000001 -#define R300_NEW_BLEND_COLOR 0x0000002 -#define R300_NEW_CONSTANTS 0x0000004 -#define R300_NEW_DSA 0x0000008 -#define R300_NEW_FRAMEBUFFERS 0x0000010 -#define R300_NEW_FRAGMENT_SHADER 0x0000020 -#define R300_NEW_RASTERIZER 0x0000040 -#define R300_NEW_RS_BLOCK 0x0000080 -#define R300_NEW_SAMPLER 0x0000100 -#define R300_ANY_NEW_SAMPLERS 0x000ff00 -#define R300_NEW_SCISSOR 0x0010000 -#define R300_NEW_TEXTURE 0x0020000 -#define R300_ANY_NEW_TEXTURES 0x1fe0000 -#define R300_NEW_VERTEX_FORMAT 0x2000000 -#define R300_NEW_VERTEX_SHADER 0x4000000 -#define R300_NEW_VIEWPORT 0x8000000 -#define R300_NEW_KITCHEN_SINK 0xfffffff +#define R300_NEW_BLEND 0x00000001 +#define R300_NEW_BLEND_COLOR 0x00000002 +#define R300_NEW_CLIP 0x00000004 +#define R300_NEW_CONSTANTS 0x00000008 +#define R300_NEW_DSA 0x00000010 +#define R300_NEW_FRAMEBUFFERS 0x00000020 +#define R300_NEW_FRAGMENT_SHADER 0x00000040 +#define R300_NEW_RASTERIZER 0x00000080 +#define R300_NEW_RS_BLOCK 0x00000100 +#define R300_NEW_SAMPLER 0x00000200 +#define R300_ANY_NEW_SAMPLERS 0x0001fe00 +#define R300_NEW_SCISSOR 0x00020000 +#define R300_NEW_TEXTURE 0x00040000 +#define R300_ANY_NEW_TEXTURES 0x03fc0000 +#define R300_NEW_VERTEX_FORMAT 0x04000000 +#define R300_NEW_VERTEX_SHADER 0x08000000 +#define R300_NEW_VIEWPORT 0x10000000 +#define R300_NEW_KITCHEN_SINK 0x1fffffff /* The next several objects are not pure Radeon state; they inherit from * various Gallium classes. */ @@ -292,6 +293,8 @@ struct r300_context { struct r300_blend_state* blend_state; /* Blend color state. */ struct r300_blend_color_state* blend_color_state; + /* User clip planes. */ + struct pipe_clip_state clip_state; /* Shader constants. */ struct r300_constant_buffer shader_constants[PIPE_SHADER_TYPES]; /* Depth, stencil, and alpha state. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 4a70f3afde..4c7370eee7 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -56,6 +56,27 @@ void r300_emit_blend_color_state(struct r300_context* r300, } } +void r300_emit_clip_state(struct r300_context* r300, + struct pipe_clip_state* clip) +{ + int i; + struct r300_screen* r300screen = r300_screen(r300->context.screen); + CS_LOCALS(r300); + + BEGIN_CS(3 + (6 * 4)); + OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, + (r300screen->caps->is_r500 ? + R500_PVS_UCP_START : R300_PVS_UCP_START)); + OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 6 * 4); + for (i = 0; i < 6; i++) { + OUT_CS_32F(clip->ucp[i][0]); + OUT_CS_32F(clip->ucp[i][1]); + OUT_CS_32F(clip->ucp[i][2]); + OUT_CS_32F(clip->ucp[i][3]); + } + END_CS; +} + void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa) { @@ -527,6 +548,11 @@ validate: r300->dirty_state &= ~R300_NEW_BLEND_COLOR; } + if (r300->dirty_state & R300_NEW_CLIP) { + r300_emit_clip_state(r300, &r300->clip_state); + r300->dirty_state &= ~R300_NEW_CLIP; + } + if (r300->dirty_state & R300_NEW_DSA) { r300_emit_dsa_state(r300, r300->dsa_state); r300->dirty_state &= ~R300_NEW_DSA; diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 36e14f69f7..946f625bd8 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -36,6 +36,9 @@ void r300_emit_blend_state(struct r300_context* r300, void r300_emit_blend_color_state(struct r300_context* r300, struct r300_blend_color_state* bc); +void r300_emit_clip_state(struct r300_context* r300, + struct pipe_clip_state* clip); + void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0461ffd681..29e721984f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -119,9 +119,10 @@ static void r300_set_clip_state(struct pipe_context* pipe, const struct pipe_clip_state* state) { struct r300_context* r300 = r300_context(pipe); - /* XXX add HW TCL clipping setup */ - draw_flush(r300->draw); - draw_set_clip_state(r300->draw, state); + + r300->clip_state = *state; + + r300->dirty_state |= R300_NEW_CLIP; } static void -- cgit v1.2.3 From b7aa5b1d10cbe2fd0b796538426f1f2910a4832c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 5 Jun 2009 13:46:59 -0700 Subject: r300-gallium: Use VAP_CLIP_CNTL. Makes tri-userclip work with HW TCL. --- src/gallium/drivers/r300/r300_emit.c | 5 ++++- src/gallium/drivers/r300/r300_state_invariant.c | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 4c7370eee7..d81abe4d0b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -63,7 +63,7 @@ void r300_emit_clip_state(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); - BEGIN_CS(3 + (6 * 4)); + BEGIN_CS(5 + (6 * 4)); OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, (r300screen->caps->is_r500 ? R500_PVS_UCP_START : R300_PVS_UCP_START)); @@ -74,6 +74,9 @@ void r300_emit_clip_state(struct r300_context* r300, OUT_CS_32F(clip->ucp[i][2]); OUT_CS_32F(clip->ucp[i][3]); } + + OUT_CS_REG(R300_VAP_CLIP_CNTL, ((1 << clip->nr) - 1) | + R300_PS_UCP_MODE_CLIP_AS_TRIFAN); END_CS; } diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 9dde662802..60eff08f2e 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -69,7 +69,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(77 + (caps->has_tcl ? 7 : 0)); + BEGIN_CS(75 + (caps->has_tcl ? 7 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -80,8 +80,6 @@ void r300_emit_invariant_state(struct r300_context* r300) /* XXX endian */ if (caps->has_tcl) { OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP); - OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE | - R300_PS_UCP_MODE_CLIP_AS_TRIFAN); OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4); OUT_CS_32F(1.0); OUT_CS_32F(1.0); -- cgit v1.2.3 From cfff2a6189b38f1ee8c8ca204e223574a5abf760 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 5 Jun 2009 17:16:47 -0600 Subject: mesa: bump version to 7.5-rc3 --- Makefile | 2 +- src/mesa/main/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d134c4c330..22334d6ee4 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,7 @@ ultrix-gcc: # Rules for making release tarballs -VERSION=7.5-rc2 +VERSION=7.5-rc3 DIRECTORY = Mesa-$(VERSION) LIB_NAME = MesaLib-$(VERSION) DEMO_NAME = MesaDemos-$(VERSION) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index e109f20df4..015ac71a17 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 5 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.5-rc2" +#define MESA_VERSION_STRING "7.5-rc3" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 6c1627a51c237428a79613fcda1412c4660780de Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sat, 6 Jun 2009 10:57:19 +1000 Subject: nv50: support non-normalized texture coords --- src/gallium/drivers/nv50/nv50_context.h | 7 ++++++- src/gallium/drivers/nv50/nv50_state.c | 6 ++++-- src/gallium/drivers/nv50/nv50_state_validate.c | 4 ++-- src/gallium/drivers/nv50/nv50_tex.c | 9 ++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index c3ffdcca9f..1a72baf305 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -63,6 +63,11 @@ struct nv50_rasterizer_stateobj { struct nouveau_stateobj *so; }; +struct nv50_sampler_stateobj { + bool normalized; + unsigned tsc[8]; +}; + struct nv50_miptree_level { int *image_offset; unsigned pitch; @@ -141,7 +146,7 @@ struct nv50_context { unsigned vtxbuf_nr; struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS]; unsigned vtxelt_nr; - unsigned *sampler[PIPE_MAX_SAMPLERS]; + struct nv50_sampler_stateobj *sampler[PIPE_MAX_SAMPLERS]; unsigned sampler_nr; struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS]; unsigned miptree_nr; diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 9d41ef55b0..116866a8e7 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -136,7 +136,8 @@ static void * nv50_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { - unsigned *tsc = CALLOC(8, sizeof(unsigned)); + struct nv50_sampler_stateobj *sso = CALLOC(1, sizeof(*sso)); + unsigned *tsc = sso->tsc; float limit; tsc[0] = (0x00026000 | @@ -209,7 +210,8 @@ nv50_sampler_state_create(struct pipe_context *pipe, tsc[2] |= ((int)CLAMP(cso->max_lod, 0.0, 15.0) << 20) | ((int)CLAMP(cso->min_lod, 0.0, 15.0) << 8); - return (void *)tsc; + sso->normalized = cso->normalized_coords; + return (void *)sso; } static void diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index a0106fc339..0caf4b4e91 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -295,12 +295,12 @@ viewport_uptodate: so_data (so, NV50_CB_TSC); so_method(so, tesla, 0x40000f04, nv50->sampler_nr * 8); for (i = 0; i < nv50->sampler_nr; i++) - so_datap (so, nv50->sampler[i], 8); + so_datap (so, nv50->sampler[i]->tsc, 8); so_ref(so, &nv50->state.tsc_upload); so_ref(NULL, &so); } - if (nv50->dirty & NV50_NEW_TEXTURE) + if (nv50->dirty & (NV50_NEW_TEXTURE | NV50_NEW_SAMPLER)) nv50_tex_validate(nv50); if (nv50->dirty & NV50_NEW_ARRAYS) diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 8bb81392fd..8f553f5346 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -27,7 +27,7 @@ static int nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, - struct nv50_miptree *mt) + struct nv50_miptree *mt, int unit) { switch (mt->base.format) { case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -120,7 +120,10 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, so_reloc(so, mt->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); - so_data (so, 0xd0005000 | mt->bo->tile_mode << 22); + if (nv50->sampler[unit]->normalized) + so_data (so, 0xd0005000 | mt->bo->tile_mode << 22); + else + so_data (so, 0x5001d000 | mt->bo->tile_mode << 22); so_data (so, 0x00300000); so_data (so, mt->base.width[0]); so_data (so, (mt->base.last_level << 28) | @@ -145,7 +148,7 @@ nv50_tex_validate(struct nv50_context *nv50) for (unit = 0; unit < nv50->miptree_nr; unit++) { struct nv50_miptree *mt = nv50->miptree[unit]; - if (nv50_tex_construct(nv50, so, mt)) { + if (nv50_tex_construct(nv50, so, mt, unit)) { NOUVEAU_ERR("failed tex validate\n"); so_ref(NULL, &so); return; -- cgit v1.2.3 From f1edfa09ea50e8833ddbf241da4d36fd38685e9d Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sat, 6 Jun 2009 14:00:45 +1000 Subject: nv50: fix multi-texturing --- src/gallium/drivers/nv50/nv50_context.h | 1 + src/gallium/drivers/nv50/nv50_screen.c | 2 -- src/gallium/drivers/nv50/nv50_tex.c | 18 +++++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 1a72baf305..9b8cc4d37d 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -114,6 +114,7 @@ struct nv50_state { unsigned viewport_bypass; struct nouveau_stateobj *tsc_upload; struct nouveau_stateobj *tic_upload; + unsigned miptree_nr; struct nouveau_stateobj *vertprog; struct nouveau_stateobj *fragprog; struct nouveau_stateobj *vtxfmt; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 7904b51f77..fd39fa738b 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -404,8 +404,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_method(so, screen->tesla, 0x1234, 1); so_data (so, 1); - so_method(so, screen->tesla, 0x1458, 1); - so_data (so, 1); so_emit(chan, so); so_ref (so, &screen->static_init); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 8f553f5346..ff40c2ad81 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -139,23 +139,35 @@ nv50_tex_validate(struct nv50_context *nv50) { struct nouveau_grobj *tesla = nv50->screen->tesla; struct nouveau_stateobj *so; - int unit; + int unit, push; - so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2); + push = nv50->miptree_nr * 9 + 2; + push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2; + + so = so_new(push, nv50->miptree_nr * 2); so_method(so, tesla, 0x0f00, 1); so_data (so, NV50_CB_TIC); - so_method(so, tesla, 0x40000f04, nv50->miptree_nr * 8); for (unit = 0; unit < nv50->miptree_nr; unit++) { struct nv50_miptree *mt = nv50->miptree[unit]; + so_method(so, tesla, 0x40000f04, 8); if (nv50_tex_construct(nv50, so, mt, unit)) { NOUVEAU_ERR("failed tex validate\n"); so_ref(NULL, &so); return; } + + so_method(so, tesla, 0x1458, 1); + so_data (so, (unit << 9) | (unit << 1) | 1); + } + + for (; unit < nv50->state.miptree_nr; unit++) { + so_method(so, tesla, 0x1458, 1); + so_data (so, (unit << 1) | 0); } so_ref(so, &nv50->state.tic_upload); so_ref(NULL, &so); + nv50->state.miptree_nr = nv50->miptree_nr; } -- cgit v1.2.3 From ab60a44331462b659f491dfb11e125daeb556973 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 27 May 2009 22:12:56 +0200 Subject: r300: always pass 4 color components to RS unit Even if we don't pass all 4 color components to vertex shader unit, the vertex program can generate the missing components. --- src/mesa/drivers/dri/r300/r300_state.c | 48 +++++----------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 582e8c27e3..bbe993429b 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1448,14 +1448,12 @@ union r300_outputs_written { static void r300SetupRSUnit(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; union r300_outputs_written OutputsWritten; GLuint InputsRead; int fp_reg, high_rr; int col_ip, tex_ip; int rs_tex_count = 0; - int i, count, col_fmt, hw_tcl_on; + int i, col_fmt, hw_tcl_on; hw_tcl_on = r300->options.hw_tcl_enabled; @@ -1483,15 +1481,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL0) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { - count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; - if (count == 4) - col_fmt = R300_RS_COL_FMT_RGBA; - else if (count == 3) - col_fmt = R300_RS_COL_FMT_RGB1; - else - col_fmt = R300_RS_COL_FMT_0001; - - r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(col_fmt); + r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R300_RS_INST_COL_ID(col_ip) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_COL0; ++col_ip; @@ -1503,15 +1493,7 @@ static void r300SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL1) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { - count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size; - if (count == 4) - col_fmt = R300_RS_COL_FMT_RGBA; - else if (count == 3) - col_fmt = R300_RS_COL_FMT_RGB1; - else - col_fmt = R300_RS_COL_FMT_0001; - - r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(col_fmt); + r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R300_RS_COL_PTR(col_ip) | R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R300_RS_INST_COL_ID(col_ip) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_COL1; ++col_ip; @@ -1581,14 +1563,12 @@ static void r300SetupRSUnit(GLcontext * ctx) static void r500SetupRSUnit(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; union r300_outputs_written OutputsWritten; GLuint InputsRead; int fp_reg, high_rr; int col_ip, tex_ip; int rs_tex_count = 0; - int i, count, col_fmt, hw_tcl_on; + int i, col_fmt, hw_tcl_on; hw_tcl_on = r300->options.hw_tcl_enabled; @@ -1616,15 +1596,7 @@ static void r500SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL0) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) { - count = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; - if (count == 4) - col_fmt = R300_RS_COL_FMT_RGBA; - else if (count == 3) - col_fmt = R300_RS_COL_FMT_RGB1; - else - col_fmt = R300_RS_COL_FMT_0001; - - r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(col_fmt); + r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R500_RS_INST_COL_ID(col_ip) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_COL0; ++col_ip; @@ -1636,15 +1608,7 @@ static void r500SetupRSUnit(GLcontext * ctx) if (InputsRead & FRAG_BIT_COL1) { if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) { - count = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->size; - if (count == 4) - col_fmt = R300_RS_COL_FMT_RGBA; - else if (count == 3) - col_fmt = R300_RS_COL_FMT_RGB1; - else - col_fmt = R300_RS_COL_FMT_0001; - - r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(col_fmt); + r300->hw.ri.cmd[R300_RI_INTERP_0 + col_ip] = R500_RS_COL_PTR(col_ip) | R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); r300->hw.rr.cmd[R300_RR_INST_0 + col_ip] = R500_RS_INST_COL_ID(col_ip) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_COL1; ++col_ip; -- cgit v1.2.3 From a27b689d08d88f99ebccf58bbba64d3cfc668866 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 27 May 2009 22:17:31 +0200 Subject: r300: fixup vertex attributes ordering Always allocate the vertex program input registers in the same order as the vertex attributes are passed in vertex arrays. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 949c0b499c..35e5ec0f8e 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -215,21 +215,8 @@ static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller) static unsigned long t_src_index(struct r300_vertex_program *vp, struct prog_src_register *src) { - int i; - int max_reg = -1; - if (src->File == PROGRAM_INPUT) { - if (vp->inputs[src->Index] != -1) - return vp->inputs[src->Index]; - - for (i = 0; i < VERT_ATTRIB_MAX; i++) - if (vp->inputs[i] > max_reg) - max_reg = vp->inputs[i]; - - vp->inputs[src->Index] = max_reg + 1; - - //vp_dump_inputs(vp, __FUNCTION__); - + assert(vp->inputs[src->Index] != -1); return vp->inputs[src->Index]; } else { if (src->Index < 0) { @@ -944,11 +931,17 @@ static GLuint *r300TranslateOpcodeXPD(struct r300_vertex_program *vp, static void t_inputs_outputs(struct r300_vertex_program *vp) { int i; - int cur_reg = 0; + int cur_reg; - for (i = 0; i < VERT_ATTRIB_MAX; i++) - vp->inputs[i] = -1; + cur_reg = -1; + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + if (vp->key.InputsRead & (1 << i)) + vp->inputs[i] = ++cur_reg; + else + vp->inputs[i] = -1; + } + cur_reg = 0; for (i = 0; i < VERT_RESULT_MAX; i++) vp->outputs[i] = -1; -- cgit v1.2.3 From e98082997c8cfe3bf9c1c1cdc40c23ee897d1007 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 13:28:47 +0200 Subject: r300: prepare for different vertex data type support --- src/mesa/drivers/dri/r300/r300_context.h | 32 +++++--- src/mesa/drivers/dri/r300/r300_render.h | 6 ++ src/mesa/drivers/dri/r300/r300_state.c | 58 ++++++++++++++ src/mesa/drivers/dri/r300/r300_state.h | 1 + src/mesa/drivers/dri/r300/r300_swtcl.c | 133 +++++++------------------------ src/mesa/drivers/dri/r300/r300_swtcl.h | 6 -- 6 files changed, 116 insertions(+), 120 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 2ea064ed45..7694fe4862 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -584,16 +584,6 @@ struct r300_swtcl_info { */ GLuint specoffset; - struct vertex_attribute{ - GLuint attr; - GLubyte format; - GLubyte dst_loc; - GLuint swizzle; - GLubyte write_mask; - } vert_attrs[VERT_ATTRIB_MAX]; - - GLubyte vertex_attr_count; - int sw_tcl_inputs[VERT_ATTRIB_MAX]; }; @@ -605,6 +595,27 @@ struct r300_vtable { void (* SetupPixelShader)(GLcontext *ctx); }; +struct r300_vertex_buffer { + struct vertex_attribute { + /* generic */ + GLubyte element; + GLvoid *data; + GLboolean free_needed; + GLuint stride; + GLuint dwords; + GLubyte size; /* number of components */ + + /* hw specific */ + uint32_t data_type:4; + uint32_t dst_loc:5; + uint32_t _signed:1; + uint32_t normalize:1; + uint32_t swizzle:12; + uint32_t write_mask:4; + } attribs[VERT_ATTRIB_MAX]; + + GLubyte num_attribs; +}; /** * \brief R300 context structure. @@ -632,6 +643,7 @@ struct r300_context { } options; struct r300_swtcl_info swtcl; + struct r300_vertex_buffer vbuf; GLboolean vap_flush_needed; uint32_t fallback; diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index 940d2566e2..002cd613dc 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -44,6 +44,12 @@ #define R300_FALLBACK_INVALID_BUFFERS (1 << 31) #define R300_RASTER_FALLBACK_MASK 0xffff0000 +#define MASK_XYZW (R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) +#define MASK_X R300_WRITE_ENA_X +#define MASK_Y R300_WRITE_ENA_Y +#define MASK_Z R300_WRITE_ENA_Z +#define MASK_W R300_WRITE_ENA_W + extern const struct tnl_pipeline_stage _r300_render_stage; extern const struct tnl_pipeline_stage _r300_tcl_stage; diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index bbe993429b..a04326fca9 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2216,6 +2216,64 @@ static void r500SetupPixelShader(GLcontext *ctx) bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, code->const_nr * 4); } +void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) +{ + r300ContextPtr rmesa = R300_CONTEXT( ctx ); + struct vertex_attribute *attrs = rmesa->vbuf.attribs; + int i, j, reg_count; + uint32_t *vir0 = &rmesa->hw.vir[0].cmd[1]; + uint32_t *vir1 = &rmesa->hw.vir[1].cmd[1]; + + for (i = 0; i < R300_VIR_CMDSIZE-1; ++i) + vir0[i] = vir1[i] = 0; + + for (i = 0, j = 0; i < rmesa->vbuf.num_attribs; ++i) { + int tmp; + + tmp = attrs[i].data_type | (attrs[i].dst_loc << R300_DST_VEC_LOC_SHIFT); + if (attrs[i]._signed) + tmp |= R300_SIGNED; + if (attrs[i].normalize) + tmp |= R300_NORMALIZE; + + if (i % 2 == 0) { + vir0[j] = tmp << R300_DATA_TYPE_0_SHIFT; + vir1[j] = attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT); + } else { + vir0[j] |= tmp << R300_DATA_TYPE_1_SHIFT; + vir1[j] |= (attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT; + ++j; + } + } + + reg_count = (rmesa->vbuf.num_attribs + 1) >> 1; + if (rmesa->vbuf.num_attribs % 2 != 0) { + vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT; + } else { + vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT; + } + + R300_STATECHANGE(rmesa, vir[0]); + R300_STATECHANGE(rmesa, vir[1]); + R300_STATECHANGE(rmesa, vof); + R300_STATECHANGE(rmesa, vic); + + if (rmesa->radeon.radeonScreen->kernel_mm) { + rmesa->hw.vir[0].cmd[0] &= 0xC000FFFF; + rmesa->hw.vir[1].cmd[0] &= 0xC000FFFF; + rmesa->hw.vir[0].cmd[0] |= (reg_count & 0x3FFF) << 16; + rmesa->hw.vir[1].cmd[0] |= (reg_count & 0x3FFF) << 16; + } else { + ((drm_r300_cmd_header_t *) rmesa->hw.vir[0].cmd)->packet0.count = reg_count; + ((drm_r300_cmd_header_t *) rmesa->hw.vir[1].cmd)->packet0.count = reg_count; + } + + rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); + rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead); + rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten); + rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten); +} + void r300UpdateShaderStates(r300ContextPtr rmesa) { GLcontext *ctx; diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h index cac639d7c6..2328289420 100644 --- a/src/mesa/drivers/dri/r300/r300_state.h +++ b/src/mesa/drivers/dri/r300/r300_state.h @@ -58,5 +58,6 @@ void r300UpdateShaderStates (r300ContextPtr rmesa); void r300InitState (r300ContextPtr r300); void r300InitStateFuncs (struct dd_function_table *functions); void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count); +void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten); #endif /* __R300_STATE_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 68e24dec8f..fd6312ae26 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_swtcl.h" #include "r300_emit.h" #include "r300_tex.h" +#include "r300_render.h" #define EMIT_ATTR( ATTR, STYLE ) \ do { \ @@ -54,107 +55,28 @@ do { \ rmesa->radeon.swtcl.vertex_attr_count++; \ } while (0) -#define ADD_ATTR(_attr, _format, _dst_loc, _swizzle, _write_mask) \ +#define ADD_ATTR(_attr, _format, _dst_loc, _swizzle, _write_mask, _normalize) \ do { \ - attrs[num_attrs].attr = (_attr); \ - attrs[num_attrs].format = (_format); \ + attrs[num_attrs].element = (_attr); \ + attrs[num_attrs].data_type = (_format); \ attrs[num_attrs].dst_loc = (_dst_loc); \ attrs[num_attrs].swizzle = (_swizzle); \ attrs[num_attrs].write_mask = (_write_mask); \ + attrs[num_attrs]._signed = 0; \ + attrs[num_attrs].normalize = (_normalize); \ ++num_attrs; \ } while (0) -static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten, GLuint vap_out_fmt_1) -{ - r300ContextPtr rmesa = R300_CONTEXT( ctx ); - struct vertex_attribute *attrs = rmesa->swtcl.vert_attrs; - int i, j, reg_count; - uint32_t *vir0 = &rmesa->hw.vir[0].cmd[1]; - uint32_t *vir1 = &rmesa->hw.vir[1].cmd[1]; - - for (i = 0; i < R300_VIR_CMDSIZE-1; ++i) - vir0[i] = vir1[i] = 0; - - for (i = 0, j = 0; i < rmesa->radeon.swtcl.vertex_attr_count; ++i) { - int tmp, data_format; - switch (attrs[i].format) { - case EMIT_1F: - data_format = R300_DATA_TYPE_FLOAT_1; - break; - case EMIT_2F: - data_format = R300_DATA_TYPE_FLOAT_2; - break; - case EMIT_3F: - data_format = R300_DATA_TYPE_FLOAT_3; - break; - case EMIT_4F: - data_format = R300_DATA_TYPE_FLOAT_4; - break; - case EMIT_4UB_4F_RGBA: - case EMIT_4UB_4F_ABGR: - data_format = R300_DATA_TYPE_BYTE | R300_NORMALIZE; - break; - default: - fprintf(stderr, "%s: Invalid data format type", __FUNCTION__); - _mesa_exit(-1); - break; - } - - tmp = data_format | (attrs[i].dst_loc << R300_DST_VEC_LOC_SHIFT); - if (i % 2 == 0) { - vir0[j] = tmp << R300_DATA_TYPE_0_SHIFT; - vir1[j] = attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT); - } else { - vir0[j] |= tmp << R300_DATA_TYPE_1_SHIFT; - vir1[j] |= (attrs[i].swizzle | (attrs[i].write_mask << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT; - ++j; - } - } - - reg_count = (rmesa->radeon.swtcl.vertex_attr_count + 1) >> 1; - if (rmesa->radeon.swtcl.vertex_attr_count % 2 != 0) { - vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT; - } else { - vir0[reg_count-1] |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT; - } - - R300_STATECHANGE(rmesa, vir[0]); - R300_STATECHANGE(rmesa, vir[1]); - R300_STATECHANGE(rmesa, vof); - R300_STATECHANGE(rmesa, vic); - - if (rmesa->radeon.radeonScreen->kernel_mm) { - rmesa->hw.vir[0].cmd[0] &= 0xC000FFFF; - rmesa->hw.vir[1].cmd[0] &= 0xC000FFFF; - rmesa->hw.vir[0].cmd[0] |= (reg_count & 0x3FFF) << 16; - rmesa->hw.vir[1].cmd[0] |= (reg_count & 0x3FFF) << 16; - } else { - ((drm_r300_cmd_header_t *) rmesa->hw.vir[0].cmd)->packet0.count = reg_count; - ((drm_r300_cmd_header_t *) rmesa->hw.vir[1].cmd)->packet0.count = reg_count; - } - - rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); - rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead); - rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten); - /** - * Can't use r300VAPOutputCntl1 function because it assumes - * that all texture coords have 4 components and that's the case - * for HW TCL path, but not for SW TCL. - */ - rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_out_fmt_1; -} - - static void r300SetVertexFormat( GLcontext *ctx ) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - int first_free_tex = 0, vap_out_fmt_1 = 0; + int first_free_tex = 0; GLuint InputsRead = 0; GLuint OutputsWritten = 0; int num_attrs = 0; - struct vertex_attribute *attrs = rmesa->swtcl.vert_attrs; + struct vertex_attribute *attrs = rmesa->vbuf.attribs; rmesa->swtcl.coloroffset = rmesa->swtcl.specoffset = 0; rmesa->radeon.swtcl.vertex_attr_count = 0; @@ -166,7 +88,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) InputsRead |= 1 << VERT_ATTRIB_POS; OutputsWritten |= 1 << VERT_RESULT_HPOS; EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); - ADD_ATTR(VERT_ATTRIB_POS, EMIT_4F, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW, 0); rmesa->swtcl.coloroffset = 4; } @@ -175,10 +97,10 @@ static void r300SetVertexFormat( GLcontext *ctx ) OutputsWritten |= 1 << VERT_RESULT_COL0; #if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA ); - ADD_ATTR(VERT_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_COLOR0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW, 1); #else EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR ); - ADD_ATTR(VERT_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_COLOR0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR0, SWIZZLE_XYZW, MASK_XYZW, 1); #endif } @@ -188,10 +110,10 @@ static void r300SetVertexFormat( GLcontext *ctx ) OutputsWritten |= 1 << VERT_RESULT_COL1; #if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4UB_4F_RGBA ); - ADD_ATTR(VERT_ATTRIB_COLOR1, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR1, swiz, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_COLOR1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR1, swiz, MASK_XYZW, 1); #else EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4UB_4F_ABGR ); - ADD_ATTR(VERT_ATTRIB_COLOR1, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR1, swiz, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_COLOR1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR1, swiz, MASK_XYZW, 1); #endif rmesa->swtcl.specoffset = rmesa->swtcl.coloroffset + 1; } @@ -201,20 +123,21 @@ static void r300SetVertexFormat( GLcontext *ctx ) OutputsWritten |= 1 << VERT_RESULT_BFC0; #if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA ); - ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1); #else EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR ); - ADD_ATTR(VERT_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1); #endif if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) { + VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->SecondaryColorPtr[1]; GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); OutputsWritten |= 1 << VERT_RESULT_BFC1; #if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA ); - ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_RGBA, SWTCL_OVM_COLOR3, swiz, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_GENERIC1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR3, swiz, MASK_XYZW, 1); #else EMIT_ATTR( _TNL_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR ); - ADD_ATTR(VERT_ATTRIB_GENERIC1, EMIT_4UB_4F_ABGR, SWTCL_OVM_COLOR3, swiz, MASK_XYZW); + ADD_ATTR(VERT_ATTRIB_GENERIC1, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR3, swiz, MASK_XYZW, 1); #endif } } @@ -224,7 +147,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) InputsRead |= 1 << VERT_ATTRIB_POINT_SIZE; OutputsWritten |= 1 << VERT_RESULT_PSIZ; EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F ); - ADD_ATTR(VERT_ATTRIB_POINT_SIZE, EMIT_1F, SWTCL_OVM_POINT_SIZE, swiz, MASK_X); + ADD_ATTR(VERT_ATTRIB_POINT_SIZE, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_POINT_SIZE, swiz, MASK_X, 0); } /** @@ -233,24 +156,28 @@ static void r300SetVertexFormat( GLcontext *ctx ) */ if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { int i; - GLuint swiz, format; + GLuint swiz, format, hw_format; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) { switch (VB->TexCoordPtr[i]->size) { case 1: format = EMIT_1F; + hw_format = R300_DATA_TYPE_FLOAT_1; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); break; case 2: format = EMIT_2F; + hw_format = R300_DATA_TYPE_FLOAT_2; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE); break; case 3: format = EMIT_3F; + hw_format = R300_DATA_TYPE_FLOAT_3; swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); break; case 4: format = EMIT_4F; + hw_format = R300_DATA_TYPE_FLOAT_4; swiz = SWIZZLE_XYZW; break; default: @@ -259,8 +186,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i); OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); EMIT_ATTR(_TNL_ATTRIB_TEX(i), format); - ADD_ATTR(VERT_ATTRIB_TEX0 + i, format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW); - vap_out_fmt_1 |= 4 << (i * 3); + ADD_ATTR(VERT_ATTRIB_TEX0 + i, hw_format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW, 0); ++first_free_tex; } } @@ -276,8 +202,7 @@ static void r300SetVertexFormat( GLcontext *ctx ) InputsRead |= 1 << (VERT_ATTRIB_TEX0 + first_free_tex); OutputsWritten |= 1 << (VERT_RESULT_TEX0 + first_free_tex); EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); - ADD_ATTR(VERT_ATTRIB_POS, EMIT_4F, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW); - vap_out_fmt_1 |= 4 << (first_free_tex * 3); + ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW, 0); ++first_free_tex; } @@ -291,12 +216,12 @@ static void r300SetVertexFormat( GLcontext *ctx ) OutputsWritten |= 1 << VERT_RESULT_FOGC; GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO); EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F ); - ADD_ATTR(VERT_ATTRIB_FOG, EMIT_1F, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_X); - vap_out_fmt_1 |= 1 << (first_free_tex * 3); + ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0); } R300_NEWPRIM(rmesa); - r300SwtclVAPSetup(ctx, InputsRead, OutputsWritten, vap_out_fmt_1); + rmesa->vbuf.num_attribs = num_attrs; + r300SetupVAP(ctx, InputsRead, OutputsWritten); rmesa->radeon.swtcl.vertex_size = _tnl_install_attrs( ctx, diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index 14826f0817..cebc895c47 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -39,12 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swrast/swrast.h" #include "r300_context.h" -#define MASK_XYZW (R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) -#define MASK_X R300_WRITE_ENA_X -#define MASK_Y R300_WRITE_ENA_Y -#define MASK_Z R300_WRITE_ENA_Z -#define MASK_W R300_WRITE_ENA_W - /* * Here are definitions of OVM locations of vertex attributes for non TCL hw */ -- cgit v1.2.3 From fd80128e15c6393fa85088577ab2ca320c6cb8ae Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 20:38:29 +0200 Subject: r300: add hw accelerated support for different vertex data formats --- src/mesa/drivers/dri/r300/Makefile | 1 + src/mesa/drivers/dri/r300/r300_context.c | 9 +- src/mesa/drivers/dri/r300/r300_context.h | 10 + src/mesa/drivers/dri/r300/r300_draw.c | 435 +++++++++++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_emit.c | 5 + src/mesa/drivers/dri/r300/r300_render.c | 77 ++---- src/mesa/drivers/dri/r300/r300_render.h | 5 +- 7 files changed, 485 insertions(+), 57 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/r300_draw.c diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 62715e3b50..bdb09624be 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -37,6 +37,7 @@ RADEON_COMMON_SOURCES = \ DRIVER_SOURCES = \ radeon_screen.c \ r300_context.c \ + r300_draw.c \ r300_ioctl.c \ r300_cmdbuf.c \ r300_state.c \ diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index dbd5ce589e..b7911f23cc 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -153,10 +153,6 @@ const struct dri_extension gl_20_extension[] = { static const struct tnl_pipeline_stage *r300_pipeline[] = { - /* Try and go straight to t&l - */ - &_r300_tcl_stage, - /* Catch any t&l fallbacks */ &_tnl_vertex_transform_stage, @@ -436,8 +432,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); - if (!r300->options.hw_tcl_enabled) + if (r300->options.hw_tcl_enabled) { + r300InitDraw(ctx); + } else { r300InitSwtcl(ctx); + } radeon_fbo_init(&r300->radeon); radeonInitSpanFuncs( ctx ); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 7694fe4862..11cfb55a9b 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -617,6 +617,13 @@ struct r300_vertex_buffer { GLubyte num_attribs; }; +struct r300_index_buffer { + GLvoid *ptr; + GLboolean is_32bit; + GLboolean free_needed; + GLuint count; +}; + /** * \brief R300 context structure. */ @@ -644,6 +651,7 @@ struct r300_context { struct r300_swtcl_info swtcl; struct r300_vertex_buffer vbuf; + struct r300_index_buffer ind_buf; GLboolean vap_flush_needed; uint32_t fallback; @@ -666,6 +674,8 @@ extern int r300VertexProgUpdateParams(GLcontext * ctx, extern void r300InitShaderFunctions(r300ContextPtr r300); +extern void r300InitDraw(GLcontext *ctx); + #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c new file mode 100644 index 0000000000..ba74878721 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -0,0 +1,435 @@ +/************************************************************************** + * + * Copyright 2009 Maciej Cencora + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#include "main/glheader.h" +#include "main/context.h" +#include "main/state.h" +#include "main/api_validate.h" +#include "main/enums.h" + +#include "r300_reg.h" +#include "r300_context.h" +#include "r300_emit.h" +#include "r300_render.h" +#include "r300_state.h" +#include "r300_tex.h" + +#include "tnl/tnl.h" +#include "tnl/t_vp_build.h" +#include "vbo/vbo_context.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" + +static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf, struct gl_buffer_object **bo, GLuint *nr_bo) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_index_buffer *ind_buf = &r300->ind_buf; + GLvoid *src_ptr; + + if (!mesa_ind_buf) { + ind_buf->ptr = NULL; + return; + } + + ind_buf->count = mesa_ind_buf->count; + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) { + bo[*nr_bo] = mesa_ind_buf->obj; + (*nr_bo)++; + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); + assert(mesa_ind_buf->obj->Pointer != NULL); + } + src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); + + if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) { + GLubyte *in = (GLubyte *)src_ptr; + GLuint *out = _mesa_malloc(sizeof(GLuint) * mesa_ind_buf->count); + int i; + + for (i = 0; i < mesa_ind_buf->count; ++i) { + out[i] = (GLuint) in[i]; + } + + ind_buf->ptr = out; + ind_buf->free_needed = GL_TRUE; + ind_buf->is_32bit = GL_TRUE; + } else if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) { + ind_buf->ptr = src_ptr; + ind_buf->free_needed = GL_FALSE; + ind_buf->is_32bit = GL_FALSE; + } else { + ind_buf->ptr = src_ptr; + ind_buf->free_needed = GL_FALSE; + ind_buf->is_32bit = GL_TRUE; + } +} + +static int getTypeSize(GLenum type) +{ + switch (type) { + case GL_DOUBLE: + return sizeof(GLdouble); + case GL_FLOAT: + return sizeof(GLfloat); + case GL_INT: + return sizeof(GLint); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + default: + assert(0); + return 0; + } +} + +#define CONVERT( TYPE, MACRO ) do { \ + GLuint i, j, sz; \ + sz = input->Size; \ + if (input->Normalized) { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = MACRO(*in); \ + in++; \ + } \ + src_ptr += input->StrideB; \ + } \ + } else { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = (GLfloat)(*in); \ + in++; \ + } \ + src_ptr += input->StrideB; \ + } \ + } \ +} while (0) + +static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const struct gl_client_array *input, struct gl_buffer_object **bo, GLuint *nr_bo) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_vertex_buffer *vbuf = &r300->vbuf; + struct vertex_attribute r300_attr; + const void *src_ptr; + GLenum type; + + if (input->BufferObj->Name) { + if (!input->BufferObj->Pointer) { + bo[*nr_bo] = input->BufferObj; + (*nr_bo)++; + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); + assert(input->BufferObj->Pointer != NULL); + } + + src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); + } else + src_ptr = input->Ptr; + + if (input->Type == GL_DOUBLE || ((getTypeSize(input->Type) * input->Size) % 4 > 0)) { + if (RADEON_DEBUG & DEBUG_FALLBACKS) { + fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type); + fprintf(stderr, "stride %d, components %d\n", input->StrideB, input->Size); + } + + GLfloat *dst_ptr, *tmp; + tmp = dst_ptr = _mesa_malloc(sizeof(GLfloat) * input->Size * count); + + switch (input->Type) { + case GL_DOUBLE: + CONVERT(GLdouble, (GLfloat)); + break; + case GL_UNSIGNED_INT: + CONVERT(GLuint, UINT_TO_FLOAT); + break; + case GL_INT: + CONVERT(GLint, INT_TO_FLOAT); + break; + case GL_UNSIGNED_SHORT: + CONVERT(GLushort, USHORT_TO_FLOAT); + break; + case GL_SHORT: + CONVERT(GLshort, SHORT_TO_FLOAT); + break; + case GL_UNSIGNED_BYTE: + assert(input->Format != GL_BGRA); + CONVERT(GLubyte, UBYTE_TO_FLOAT); + break; + case GL_BYTE: + CONVERT(GLbyte, BYTE_TO_FLOAT); + break; + } + + type = GL_FLOAT; + r300_attr.free_needed = GL_TRUE; + r300_attr.data = tmp; + r300_attr.stride = sizeof(GLfloat) * input->Size; + r300_attr.dwords = input->Size; + } else { + type = input->Type; + r300_attr.free_needed = GL_FALSE; + r300_attr.data = (GLvoid *)src_ptr; + r300_attr.stride = input->StrideB; + r300_attr.dwords = getTypeSize(type) * input->Size / 4; + } + + r300_attr.size = input->Size; + r300_attr.element = attr; + r300_attr.dst_loc = vbuf->num_attribs; + + switch (type) { + case GL_FLOAT: + switch (input->Size) { + case 1: r300_attr.data_type = R300_DATA_TYPE_FLOAT_1; break; + case 2: r300_attr.data_type = R300_DATA_TYPE_FLOAT_2; break; + case 3: r300_attr.data_type = R300_DATA_TYPE_FLOAT_3; break; + case 4: r300_attr.data_type = R300_DATA_TYPE_FLOAT_4; break; + } + r300_attr._signed = 0; + r300_attr.normalize = 0; + break; + case GL_SHORT: + r300_attr._signed = 1; + r300_attr.normalize = input->Normalized; + if (input->Size == 2) + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + else if (input->Size == 4) + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + else + assert(0); + break; + case GL_BYTE: + assert(input->Size == 4); + r300_attr._signed = 1; + r300_attr.normalize = input->Normalized; + r300_attr.data_type = R300_DATA_TYPE_BYTE; + break; + case GL_UNSIGNED_SHORT: + r300_attr._signed = 0; + r300_attr.normalize = input->Normalized; + if (input->Size == 2) + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + else if (input->Size == 4) + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + else + assert(0); + break; + case GL_UNSIGNED_BYTE: + assert(input->Size == 4); + r300_attr._signed = 0; + r300_attr.normalize = input->Normalized; + if (input->Format == GL_BGRA) + r300_attr.data_type = R300_DATA_TYPE_D3DCOLOR; + else + r300_attr.data_type = R300_DATA_TYPE_BYTE; + break; + + default: + case GL_DOUBLE: + case GL_INT: + case GL_UNSIGNED_INT: + assert(0); + break; + } + + switch (input->Size) { + case 4: + r300_attr.swizzle = SWIZZLE_XYZW; + break; + case 3: + r300_attr.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); + break; + case 2: + r300_attr.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ONE); + break; + case 1: + r300_attr.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); + break; + } + + r300_attr.write_mask = MASK_XYZW; + + vbuf->attribs[vbuf->num_attribs] = r300_attr; + ++vbuf->num_attribs; +} + +static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count, struct gl_buffer_object **bo, GLuint *nr_bo) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_vertex_buffer *vbuf = &r300->vbuf; + + { + int i, tmp; + + tmp = r300->selected_vp->key.InputsRead; + i = 0; + vbuf->num_attribs = 0; + while (tmp) { + /* find first enabled bit */ + while (!(tmp & 1)) { + tmp >>= 1; + ++i; + } + + r300TranslateAttrib(ctx, i, count, arrays[i], bo, nr_bo); + + tmp >>= 1; + ++i; + } + } + + r300SwitchFallback(ctx, R300_FALLBACK_AOS_LIMIT, vbuf->num_attribs > R300_MAX_AOS_ARRAYS); + if (r300->fallback) + return; + + { + int i; + + for (i = 0; i < vbuf->num_attribs; i++) { + rcommon_emit_vector(ctx, &r300->radeon.tcl.aos[i], + vbuf->attribs[i].data, vbuf->attribs[i].dwords, + vbuf->attribs[i].stride, count); + } + + r300->radeon.tcl.aos_count = vbuf->num_attribs; + } +} + +static void r300FreeData(GLcontext *ctx, struct gl_buffer_object **bo, GLuint nr_bo) +{ + { + struct r300_vertex_buffer *vbuf = &R300_CONTEXT(ctx)->vbuf; + int i; + + for (i = 0; i < vbuf->num_attribs; i++) { + if (vbuf->attribs[i].free_needed) + _mesa_free(vbuf->attribs[i].data); + } + } + + { + struct r300_index_buffer *ind_buf = &R300_CONTEXT(ctx)->ind_buf; + if (ind_buf->free_needed) + _mesa_free(ind_buf->ptr); + } + + { + int i; + + for (i = 0; i < nr_bo; ++i) { + ctx->Driver.UnmapBuffer(ctx, 0, bo[i]); + } + } +} + +static GLboolean r300TryDrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index ) +{ + struct r300_context *r300 = R300_CONTEXT(ctx); + struct gl_buffer_object *bo[VERT_ATTRIB_MAX+1]; + GLuint i, nr_bo = 0; + + if (ctx->NewState) + _mesa_update_state( ctx ); + + if (r300->options.hw_tcl_enabled) + _tnl_UpdateFixedFunctionProgram(ctx); + + r300UpdateShaders(r300); + + r300SwitchFallback(ctx, R300_FALLBACK_INVALID_BUFFERS, !r300ValidateBuffers(ctx)); + + r300FixupIndexBuffer(ctx, ib, bo, &nr_bo); + + r300SetVertexFormat(ctx, arrays, max_index + 1, bo, &nr_bo); + + if (r300->fallback) + return GL_FALSE; + + r300SetupVAP(ctx, r300->selected_vp->key.InputsRead, r300->selected_vp->key.OutputsWritten); + + r300UpdateShaderStates(r300); + + r300EmitCacheFlush(r300); + radeonEmitState(&r300->radeon); + + for (i = 0; i < nr_prims; ++i) { + r300RunRenderPrimitive(ctx, prim[i].start, prim[i].start + prim[i].count, prim[i].mode); + } + + r300EmitCacheFlush(r300); + + radeonReleaseArrays(ctx, ~0); + + r300FreeData(ctx, bo, nr_bo); + + return GL_TRUE; +} + +/* TODO: rebase if number of indices in any of primitives is > 8192 for 32bit indices or 16384 for 16bit indices */ + +static void r300DrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index) +{ + GLboolean retval; + + if (min_index) { + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims ); + return; + } + + /* Make an attempt at drawing */ + retval = r300TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); + + /* If failed run tnl pipeline - it should take care of fallbacks */ + if (!retval) + _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); +} + +void r300InitDraw(GLcontext *ctx) +{ + struct vbo_context *vbo = vbo_context(ctx); + + vbo->draw_prims = r300DrawPrims; +} diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 1e79a76b47..d6c29ea388 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -337,6 +337,11 @@ void r300EmitArrays(GLcontext * ctx) r300VAPOutputCntl1(ctx, OutputsWritten); rmesa->radeon.tcl.aos_count = nr; + + /* Fill index buffer info */ + rmesa->ind_buf.ptr = vb->Elts; + rmesa->ind_buf.is_32bit = GL_TRUE; + rmesa->ind_buf.free_needed = GL_FALSE; } void r300EmitCacheFlush(r300ContextPtr rmesa) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 92310a0264..4982bc63b9 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -172,16 +172,19 @@ int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim) return num_verts - verts_off; } -static void r300EmitElts(GLcontext * ctx, void *elts, unsigned long n_elts) +static void r300EmitElts(GLcontext * ctx, unsigned long n_elts) { r300ContextPtr rmesa = R300_CONTEXT(ctx); void *out; + GLbyte el_size; + + el_size = rmesa->ind_buf.is_32bit ? 4 : 2; radeonAllocDmaRegion(&rmesa->radeon, &rmesa->radeon.tcl.elt_dma_bo, - &rmesa->radeon.tcl.elt_dma_offset, n_elts * 4, 4); + &rmesa->radeon.tcl.elt_dma_offset, n_elts * el_size, 4); radeon_bo_map(rmesa->radeon.tcl.elt_dma_bo, 1); out = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset; - memcpy(out, elts, n_elts * 4); + memcpy(out, rmesa->ind_buf.ptr, n_elts * el_size); radeon_bo_unmap(rmesa->radeon.tcl.elt_dma_bo); } @@ -191,12 +194,20 @@ static void r300FireEB(r300ContextPtr rmesa, int vertex_count, int type) r300_emit_scissor(rmesa->radeon.glCtx); if (vertex_count > 0) { + int size; + BEGIN_BATCH(10); OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0); - OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | - ((vertex_count + 0) << 16) | - type | + if (rmesa->ind_buf.is_32bit) { + size = vertex_count; + OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | + ((vertex_count + 0) << 16) | type | R300_VAP_VF_CNTL__INDEX_SIZE_32bit); + } else { + size = (vertex_count + 1) >> 1; + OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | + ((vertex_count + 0) << 16) | type); + } if (!rmesa->radeon.radeonScreen->kernel_mm) { OUT_BATCH_PACKET3(R300_PACKET3_INDX_BUFFER, 2); @@ -206,13 +217,13 @@ static void r300FireEB(r300ContextPtr rmesa, int vertex_count, int type) rmesa->radeon.tcl.elt_dma_bo, rmesa->radeon.tcl.elt_dma_offset, RADEON_GEM_DOMAIN_GTT, 0, 0); - OUT_BATCH(vertex_count); + OUT_BATCH(size); } else { OUT_BATCH_PACKET3(R300_PACKET3_INDX_BUFFER, 2); OUT_BATCH(R300_INDX_BUFFER_ONE_REG_WR | (0 << R300_INDX_BUFFER_SKIP_SHIFT) | (R300_VAP_PORT_IDX0 >> 2)); OUT_BATCH(rmesa->radeon.tcl.elt_dma_offset); - OUT_BATCH(vertex_count); + OUT_BATCH(size); radeon_cs_write_reloc(rmesa->radeon.cmdbuf.cs, rmesa->radeon.tcl.elt_dma_bo, RADEON_GEM_DOMAIN_GTT, 0, 0); @@ -337,12 +348,10 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) END_BATCH(); } -static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, - int start, int end, int prim) +void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) { + r300ContextPtr rmesa = R300_CONTEXT(ctx); int type, num_verts; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; type = r300PrimitiveType(rmesa, prim); num_verts = r300NumVerts(rmesa, end - start, prim); @@ -356,7 +365,7 @@ static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, */ rcommonEnsureCmdBufSpace(&rmesa->radeon, 64, __FUNCTION__); - if (vb->Elts) { + if (rmesa->ind_buf.ptr) { if (num_verts > 65535) { /* not implemented yet */ WARN_ONCE("Too many elts\n"); @@ -373,7 +382,7 @@ static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, * allocating the index array might actually evict the vertex * arrays. *sigh* */ - r300EmitElts(ctx, vb->Elts, num_verts); + r300EmitElts(ctx, num_verts); r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start); r300FireEB(rmesa, num_verts, type); } else { @@ -383,8 +392,7 @@ static void r300RunRenderPrimitive(r300ContextPtr rmesa, GLcontext * ctx, COMMIT_BATCH(); } -static void r300RunRender(GLcontext * ctx, - struct tnl_pipeline_stage *stage) +static void r300RunRender(GLcontext * ctx, struct tnl_pipeline_stage *stage) { r300ContextPtr rmesa = R300_CONTEXT(ctx); int i; @@ -406,7 +414,7 @@ static void r300RunRender(GLcontext * ctx, GLuint prim = _tnl_translate_prim(&vb->Primitive[i]); GLuint start = vb->Primitive[i].start; GLuint end = vb->Primitive[i].start + vb->Primitive[i].count; - r300RunRenderPrimitive(rmesa, ctx, start, end, prim); + r300RunRenderPrimitive(ctx, start, end, prim); } r300EmitCacheFlush(rmesa); @@ -436,6 +444,8 @@ static const char *getFallbackString(uint32_t bit) return "render mode != GL_RENDER"; case R300_FALLBACK_FRAGMENT_PROGRAM: return "fragment program"; + case R300_FALLBACK_AOS_LIMIT: + return "aos limit"; case R300_FALLBACK_INVALID_BUFFERS: return "invalid buffers"; default: @@ -504,30 +514,6 @@ static GLboolean r300RunNonTCLRender(GLcontext * ctx, return GL_FALSE; } -static GLboolean r300RunTCLRender(GLcontext * ctx, - struct tnl_pipeline_stage *stage) -{ - r300ContextPtr rmesa = R300_CONTEXT(ctx); - - if (RADEON_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "%s\n", __FUNCTION__); - - if (rmesa->options.hw_tcl_enabled == GL_FALSE) - return GL_TRUE; - - /* Call it here so we can fallback early */ - r300UpdateShaders(rmesa); - - r300SwitchFallback(ctx, R300_FALLBACK_INVALID_BUFFERS, !r300ValidateBuffers(ctx)); - - if (rmesa->fallback) - return GL_TRUE; - - r300RunRender(ctx, stage); - - return GL_FALSE; -} - const struct tnl_pipeline_stage _r300_render_stage = { "r300 Hardware Rasterization", NULL, @@ -536,12 +522,3 @@ const struct tnl_pipeline_stage _r300_render_stage = { NULL, r300RunNonTCLRender }; - -const struct tnl_pipeline_stage _r300_tcl_stage = { - "r300 Hardware Transform, Clipping and Lighting", - NULL, - NULL, - NULL, - NULL, - r300RunTCLRender -}; diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index 002cd613dc..192d738f5f 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -41,6 +41,7 @@ #define R300_FALLBACK_STENCIL_TWOSIDE (1 << 21) #define R300_FALLBACK_RENDER_MODE (1 << 22) #define R300_FALLBACK_FRAGMENT_PROGRAM (1 << 23) +#define R300_FALLBACK_AOS_LIMIT (1 << 30) #define R300_FALLBACK_INVALID_BUFFERS (1 << 31) #define R300_RASTER_FALLBACK_MASK 0xffff0000 @@ -52,8 +53,8 @@ extern const struct tnl_pipeline_stage _r300_render_stage; -extern const struct tnl_pipeline_stage _r300_tcl_stage; - extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); +extern void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim); + #endif -- cgit v1.2.3 From 365799caea2fce684ac9c10ff14211b5d13cc46f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 13:19:07 +0200 Subject: r300: enable EXT_vertex_array_bgra extensions --- src/mesa/drivers/dri/r300/r300_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index b7911f23cc..9004a3ffab 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -124,6 +124,7 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_texture_lod_bias", NULL}, {"GL_EXT_texture_mirror_clamp", NULL}, {"GL_EXT_texture_rectangle", NULL}, + {"GL_EXT_vertex_array_bgra", NULL}, {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, {"GL_ATI_texture_env_combine3", NULL}, {"GL_ATI_texture_mirror_once", NULL}, -- cgit v1.2.3 From 6cd0628f9f35cc4529b94310e5356d15080a9d04 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 15:09:19 +0200 Subject: r300: prepare for some code duplication removal --- src/mesa/drivers/dri/r300/r300_swtcl.c | 19 ++++++++++++++----- src/mesa/drivers/dri/r300/r300_swtcl.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index fd6312ae26..ecc837745d 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -67,7 +67,7 @@ do { \ ++num_attrs; \ } while (0) -static void r300SetVertexFormat( GLcontext *ctx ) +void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten) { r300ContextPtr rmesa = R300_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -219,8 +219,19 @@ static void r300SetVertexFormat( GLcontext *ctx ) ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0); } - R300_NEWPRIM(rmesa); rmesa->vbuf.num_attribs = num_attrs; + *_InputsRead = InputsRead; + *_OutputsWritten = OutputsWritten; + + RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset); +} + +static void r300PrepareVertices(GLcontext *ctx) +{ + r300ContextPtr rmesa = R300_CONTEXT(ctx); + GLuint InputsRead, OutputsWritten; + + r300ChooseSwtclVertexFormat(ctx, &InputsRead, &OutputsWritten); r300SetupVAP(ctx, InputsRead, OutputsWritten); rmesa->radeon.swtcl.vertex_size = @@ -230,8 +241,6 @@ static void r300SetVertexFormat( GLcontext *ctx ) NULL, 0 ); rmesa->radeon.swtcl.vertex_size /= 4; - - RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset); } @@ -487,7 +496,7 @@ void r300RenderStart(GLcontext *ctx) r300ContextPtr rmesa = R300_CONTEXT( ctx ); r300ChooseRenderState(ctx); - r300SetVertexFormat(ctx); + r300PrepareVertices(ctx); r300ValidateBuffers(ctx); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.h b/src/mesa/drivers/dri/r300/r300_swtcl.h index cebc895c47..c271d26546 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.h +++ b/src/mesa/drivers/dri/r300/r300_swtcl.h @@ -50,6 +50,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SWTCL_OVM_TEX(n) ((n) + 6) #define SWTCL_OVM_POINT_SIZE 15 +extern void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *InputsRead, GLuint *OutputsWritten); extern void r300InitSwtcl( GLcontext *ctx ); extern void r300DestroySwtcl( GLcontext *ctx ); -- cgit v1.2.3 From 72c78b99926aab6af38248b5aa6b0fb1f9d42005 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 13:50:50 +0200 Subject: r300: rewrite vertex setup for software T&L path using functions from software TCL path --- src/mesa/drivers/dri/r300/r300_emit.c | 230 ++++---------------------------- src/mesa/drivers/dri/r300/r300_emit.h | 5 +- src/mesa/drivers/dri/r300/r300_render.c | 19 +++ src/mesa/drivers/dri/r300/r300_render.h | 9 ++ 4 files changed, 54 insertions(+), 209 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index d6c29ea388..cf31596d9b 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \file * * \author Keith Whitwell + * \author Maciej Cencora */ #include "main/glheader.h" @@ -49,74 +50,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_state.h" #include "r300_emit.h" #include "r300_ioctl.h" - - -#if SWIZZLE_X != R300_INPUT_ROUTE_SELECT_X || \ - SWIZZLE_Y != R300_INPUT_ROUTE_SELECT_Y || \ - SWIZZLE_Z != R300_INPUT_ROUTE_SELECT_Z || \ - SWIZZLE_W != R300_INPUT_ROUTE_SELECT_W || \ - SWIZZLE_ZERO != R300_INPUT_ROUTE_SELECT_ZERO || \ - SWIZZLE_ONE != R300_INPUT_ROUTE_SELECT_ONE -#error Cannot change these! -#endif - -#define DEBUG_ALL DEBUG_VERTS - -#define DW_SIZE(x) ((inputs[tab[(x)]] << R300_DST_VEC_LOC_SHIFT) | \ - (attribptr[tab[(x)]]->size - 1) << R300_DATA_TYPE_0_SHIFT) - -GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, - int *inputs, GLint * tab, GLuint nr) -{ - GLuint i, dw; - - /* type, inputs, stop bit, size */ - for (i = 0; i < nr; i += 2) { - /* make sure input is valid, would lockup the gpu */ - assert(inputs[tab[i]] != -1); - dw = (R300_SIGNED | DW_SIZE(i)); - if (i + 1 == nr) { - dw |= R300_LAST_VEC << R300_DATA_TYPE_0_SHIFT; - } else { - assert(inputs[tab[i + 1]] != -1); - dw |= (R300_SIGNED | - DW_SIZE(i + 1)) << R300_DATA_TYPE_1_SHIFT; - if (i + 2 == nr) { - dw |= R300_LAST_VEC << R300_DATA_TYPE_1_SHIFT; - } - } - dst[i >> 1] = dw; - } - - return (nr + 1) >> 1; -} - -static GLuint r300VAPInputRoute1Swizzle(int swizzle[4]) -{ - return (swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) | - (swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) | - (swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) | - (swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT); -} - -GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr) -{ - GLuint i, dw; - - for (i = 0; i < nr; i += 2) { - dw = (r300VAPInputRoute1Swizzle(swizzle[i]) | - ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | - R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE0_SHIFT; - if (i + 1 < nr) { - dw |= (r300VAPInputRoute1Swizzle(swizzle[i + 1]) | - ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | - R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) << R300_SWIZZLE1_SHIFT; - } - dst[i >> 1] = dw; - } - - return (nr + 1) >> 1; -} +#include "r300_render.h" +#include "r300_swtcl.h" GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead) { @@ -194,154 +129,39 @@ GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten) return ret; } -/* Emit vertex data to GART memory - * Route inputs to the vertex processor - */ -void r300EmitArrays(GLcontext * ctx) +GLboolean r300EmitArrays(GLcontext * ctx) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - GLuint nr; - GLuint count = vb->Count; - GLuint i; - GLuint InputsRead = 0, OutputsWritten = 0; - int *inputs = NULL; - int vir_inputs[VERT_ATTRIB_MAX]; - GLint tab[VERT_ATTRIB_MAX]; - int swizzle[VERT_ATTRIB_MAX][4]; - struct r300_vertex_program *prog = rmesa->selected_vp; - - if (rmesa->options.hw_tcl_enabled) { - inputs = prog->inputs; - InputsRead = prog->key.InputsRead; - OutputsWritten = prog->key.OutputsWritten; - } else { - inputs = rmesa->swtcl.sw_tcl_inputs; - - DECLARE_RENDERINPUTS(render_inputs_bitset); - RENDERINPUTS_COPY(render_inputs_bitset, tnl->render_inputs_bitset); - - vb->AttribPtr[VERT_ATTRIB_POS] = vb->ClipPtr; - - assert(RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_POS)); - assert(RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_NORMAL) == 0); - - if (RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_POS)) { - InputsRead |= 1 << VERT_ATTRIB_POS; - OutputsWritten |= 1 << VERT_RESULT_HPOS; - } + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct r300_vertex_buffer *vbuf = &r300->vbuf; + GLuint InputsRead, OutputsWritten; - if (RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_COLOR0)) { - InputsRead |= 1 << VERT_ATTRIB_COLOR0; - OutputsWritten |= 1 << VERT_RESULT_COL0; - } - - if (RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_COLOR1)) { - InputsRead |= 1 << VERT_ATTRIB_COLOR1; - OutputsWritten |= 1 << VERT_RESULT_COL1; - } - - for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (RENDERINPUTS_TEST(render_inputs_bitset, _TNL_ATTRIB_TEX(i))) { - InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i); - OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); - } - } - - for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++) { - if (InputsRead & (1 << i)) { - inputs[i] = nr++; - } else { - inputs[i] = -1; - } - } + r300ChooseSwtclVertexFormat(ctx, &InputsRead, &OutputsWritten); - /* Fixed, apply to vir0 only */ - memcpy(vir_inputs, inputs, VERT_ATTRIB_MAX * sizeof(int)); - inputs = vir_inputs; - if (InputsRead & VERT_ATTRIB_POS) - inputs[VERT_ATTRIB_POS] = 0; - if (InputsRead & (1 << VERT_ATTRIB_COLOR0)) - inputs[VERT_ATTRIB_COLOR0] = 2; - if (InputsRead & (1 << VERT_ATTRIB_COLOR1)) - inputs[VERT_ATTRIB_COLOR1] = 3; - for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) - if (InputsRead & (1 << i)) - inputs[i] = 6 + (i - VERT_ATTRIB_TEX0); - - RENDERINPUTS_COPY(rmesa->render_inputs_bitset, render_inputs_bitset); - } + r300SwitchFallback(ctx, R300_FALLBACK_AOS_LIMIT, vbuf->num_attribs > R300_MAX_AOS_ARRAYS); + if (r300->fallback & R300_RASTER_FALLBACK_MASK) + return GL_FALSE; - assert(InputsRead); - assert(OutputsWritten); + { + struct vertex_buffer *mesa_vb = &TNL_CONTEXT(ctx)->vb; + GLuint attr, i; - for (i = 0, nr = 0; i < VERT_ATTRIB_MAX; i++) { - if (InputsRead & (1 << i)) { - tab[nr++] = i; + for (i = 0; i < vbuf->num_attribs; i++) { + attr = vbuf->attribs[i].element; + rcommon_emit_vector(ctx, &r300->radeon.tcl.aos[i], mesa_vb->AttribPtr[attr]->data, + mesa_vb->AttribPtr[attr]->size, mesa_vb->AttribPtr[attr]->stride, mesa_vb->Count); } - } - - assert(nr <= R300_MAX_AOS_ARRAYS); - for (i = 0; i < nr; i++) { - int ci; + r300->radeon.tcl.aos_count = vbuf->num_attribs; - swizzle[i][0] = SWIZZLE_ZERO; - swizzle[i][1] = SWIZZLE_ZERO; - swizzle[i][2] = SWIZZLE_ZERO; - swizzle[i][3] = SWIZZLE_ONE; - - for (ci = 0; ci < vb->AttribPtr[tab[i]]->size; ci++) { - swizzle[i][ci] = ci; - } - rcommon_emit_vector(ctx, &rmesa->radeon.tcl.aos[i], - vb->AttribPtr[tab[i]]->data, - vb->AttribPtr[tab[i]]->size, - vb->AttribPtr[tab[i]]->stride, count); + /* Fill index buffer info */ + r300->ind_buf.ptr = mesa_vb->Elts; + r300->ind_buf.is_32bit = GL_TRUE; + r300->ind_buf.free_needed = GL_FALSE; } - /* Setup INPUT_ROUTE. */ - if (rmesa->radeon.radeonScreen->kernel_mm) { - R300_STATECHANGE(rmesa, vir[0]); - rmesa->hw.vir[0].cmd[0] &= 0xC000FFFF; - rmesa->hw.vir[1].cmd[0] &= 0xC000FFFF; - rmesa->hw.vir[0].cmd[0] |= - (r300VAPInputRoute0(&rmesa->hw.vir[0].cmd[R300_VIR_CNTL_0], - vb->AttribPtr, inputs, tab, nr) & 0x3FFF) << 16; - R300_STATECHANGE(rmesa, vir[1]); - rmesa->hw.vir[1].cmd[0] |= - (r300VAPInputRoute1(&rmesa->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle, - nr) & 0x3FFF) << 16; - } else { - R300_STATECHANGE(rmesa, vir[0]); - ((drm_r300_cmd_header_t *) rmesa->hw.vir[0].cmd)->packet0.count = - r300VAPInputRoute0(&rmesa->hw.vir[0].cmd[R300_VIR_CNTL_0], - vb->AttribPtr, inputs, tab, nr); - R300_STATECHANGE(rmesa, vir[1]); - ((drm_r300_cmd_header_t *) rmesa->hw.vir[1].cmd)->packet0.count = - r300VAPInputRoute1(&rmesa->hw.vir[1].cmd[R300_VIR_CNTL_0], swizzle, - nr); - } - - /* Setup INPUT_CNTL. */ - R300_STATECHANGE(rmesa, vic); - rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); - rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead); - - /* Setup OUTPUT_VTX_FMT. */ - R300_STATECHANGE(rmesa, vof); - rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = - r300VAPOutputCntl0(ctx, OutputsWritten); - rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = - r300VAPOutputCntl1(ctx, OutputsWritten); - - rmesa->radeon.tcl.aos_count = nr; + r300SetupVAP(ctx, InputsRead, OutputsWritten); - /* Fill index buffer info */ - rmesa->ind_buf.ptr = vb->Elts; - rmesa->ind_buf.is_32bit = GL_TRUE; - rmesa->ind_buf.free_needed = GL_FALSE; + return GL_TRUE; } void r300EmitCacheFlush(r300ContextPtr rmesa) diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index e6485e9bd7..d88914ce95 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -216,16 +216,13 @@ void static INLINE cp_wait(radeonContextPtr radeon, unsigned char flags) } } -extern void r300EmitArrays(GLcontext * ctx); +extern GLboolean r300EmitArrays(GLcontext * ctx); extern int r300PrimitiveType(r300ContextPtr rmesa, int prim); extern int r300NumVerts(r300ContextPtr rmesa, int num_verts, int prim); extern void r300EmitCacheFlush(r300ContextPtr rmesa); -extern GLuint r300VAPInputRoute0(uint32_t * dst, GLvector4f ** attribptr, - int *inputs, GLint * tab, GLuint nr); -extern GLuint r300VAPInputRoute1(uint32_t * dst, int swizzle[][4], GLuint nr); extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 4982bc63b9..adda92467a 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -466,6 +466,16 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) fallback_warn |= bit; } rmesa->fallback |= bit; + + /* update only if we change from no tcl fallbacks to some tcl fallbacks */ + if (rmesa->options.hw_tcl_enabled) { + if (((old_fallback & R300_TCL_FALLBACK_MASK) == 0) && + ((bit & R300_TCL_FALLBACK_MASK) > 0)) { + R300_STATECHANGE(rmesa, vap_cntl_status); + rmesa->hw.vap_cntl_status.cmd[1] |= R300_VAP_TCL_BYPASS; + } + } + /* update only if we change from no raster fallbacks to some raster fallbacks */ if (((old_fallback & R300_RASTER_FALLBACK_MASK) == 0) && ((bit & R300_RASTER_FALLBACK_MASK) > 0)) { @@ -476,6 +486,15 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) } } else { rmesa->fallback &= ~bit; + + /* update only if we have disabled all tcl fallbacks */ + if (rmesa->options.hw_tcl_enabled) { + if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) { + R300_STATECHANGE(rmesa, vap_cntl_status); + rmesa->hw.vap_cntl_status.cmd[1] &= ~R300_VAP_TCL_BYPASS; + } + } + /* update only if we have disabled all raster fallbacks */ if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) { _swrast_flush( ctx ); diff --git a/src/mesa/drivers/dri/r300/r300_render.h b/src/mesa/drivers/dri/r300/r300_render.h index 192d738f5f..ec785474a6 100644 --- a/src/mesa/drivers/dri/r300/r300_render.h +++ b/src/mesa/drivers/dri/r300/r300_render.h @@ -51,6 +51,15 @@ #define MASK_Z R300_WRITE_ENA_Z #define MASK_W R300_WRITE_ENA_W +#if SWIZZLE_X != R300_INPUT_ROUTE_SELECT_X || \ + SWIZZLE_Y != R300_INPUT_ROUTE_SELECT_Y || \ + SWIZZLE_Z != R300_INPUT_ROUTE_SELECT_Z || \ + SWIZZLE_W != R300_INPUT_ROUTE_SELECT_W || \ + SWIZZLE_ZERO != R300_INPUT_ROUTE_SELECT_ZERO || \ + SWIZZLE_ONE != R300_INPUT_ROUTE_SELECT_ONE +#error Cannot change these! +#endif + extern const struct tnl_pipeline_stage _r300_render_stage; extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode); -- cgit v1.2.3 From a8c7c96be717fb65d23aea7a21f9f3969c4de53f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 30 May 2009 16:12:53 +0200 Subject: r300: remove unused code --- src/mesa/drivers/dri/r300/r300_context.h | 2 -- src/mesa/drivers/dri/r300/r300_state.c | 5 +--- src/mesa/drivers/dri/r300/r300_vertprog.c | 48 ------------------------------- src/mesa/drivers/dri/r300/r300_vertprog.h | 1 - 4 files changed, 1 insertion(+), 55 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 11cfb55a9b..026c33c67c 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -583,8 +583,6 @@ struct r300_swtcl_info { * Offset of the 3UB specular color data within a hardware (swtcl) vertex. */ GLuint specoffset; - - int sw_tcl_inputs[VERT_ATTRIB_MAX]; }; struct r300_vtable { diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index a04326fca9..2fff89c473 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -2295,10 +2295,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) rmesa->vtbl.SetupRSUnit(ctx); if (rmesa->options.hw_tcl_enabled) { - if (rmesa->fallback & R300_FALLBACK_VERTEX_PROGRAM) - r300SetupSwtclVertexProgram(rmesa); - else - r300SetupVertexProgram(rmesa); + r300SetupVertexProgram(rmesa); } } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 35e5ec0f8e..a74b9156cf 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -1492,54 +1492,6 @@ static void r300EmitVertexProgram(r300ContextPtr r300, int dest, struct r300_ver } } -void r300SetupSwtclVertexProgram(r300ContextPtr rmesa) -{ - struct r300_vertex_shader_hw_code *hw_code; - GLuint o_reg = 0; - GLuint i_reg = 0; - int i; - int inst_count = 0; - int param_count = 0; - int program_end = 0; - - /* Reset state, in case we don't use something */ - ((drm_r300_cmd_header_t *) rmesa->hw.vpp.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t *) rmesa->hw.vpi.cmd)->vpu.count = 0; - ((drm_r300_cmd_header_t *) rmesa->hw.vps.cmd)->vpu.count = 0; - - hw_code = _mesa_malloc(sizeof(struct r300_vertex_shader_hw_code)); - - for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) { - if (rmesa->swtcl.sw_tcl_inputs[i] != -1) { - hw_code->body.d[program_end + 0] = PVS_OP_DST_OPERAND(VE_MULTIPLY, GL_FALSE, GL_FALSE, o_reg++, VSF_FLAG_ALL, PVS_DST_REG_OUT); - hw_code->body.d[program_end + 1] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - hw_code->body.d[program_end + 2] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - hw_code->body.d[program_end + 3] = PVS_SRC_OPERAND(rmesa->swtcl.sw_tcl_inputs[i], PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, - PVS_SRC_SELECT_FORCE_1, PVS_SRC_SELECT_FORCE_1, PVS_SRC_REG_INPUT, VSF_FLAG_NONE); - program_end += 4; - i_reg++; - } - } - - hw_code->length = program_end; - - r300EmitVertexProgram(rmesa, R300_PVS_CODE_START, hw_code); - inst_count = (hw_code->length / 4) - 1; - - r300VapCntl(rmesa, i_reg, o_reg, 0); - - R300_STATECHANGE(rmesa, pvs); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] = (0 << R300_PVS_FIRST_INST_SHIFT) | (inst_count << R300_PVS_XYZW_VALID_INST_SHIFT) | - (inst_count << R300_PVS_LAST_INST_SHIFT); - - rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] = (0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | (param_count << R300_PVS_MAX_CONST_ADDR_SHIFT); - rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] = (inst_count << R300_PVS_LAST_VTX_SRC_INST_SHIFT); - - _mesa_free(hw_code); -} - void r300SetupVertexProgram(r300ContextPtr rmesa) { GLcontext *ctx = rmesa->radeon.glCtx; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.h b/src/mesa/drivers/dri/r300/r300_vertprog.h index 44b5f981a9..b552e3fb1b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.h +++ b/src/mesa/drivers/dri/r300/r300_vertprog.h @@ -33,6 +33,5 @@ #endif void r300SetupVertexProgram(r300ContextPtr rmesa); -void r300SetupSwtclVertexProgram(r300ContextPtr rmesa); #endif -- cgit v1.2.3 From ca13937ef97c7779f639dcfc95b3798a11de01bd Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 31 May 2009 23:00:57 +0200 Subject: r300: GL_(U)SHORT and GL_(U)BYTE with < 4 components can also be HW accelerated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also when index format is GL_UBYTE, convert it to GL_USHORT not GL_UINT. Fix license header too. Reported by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/r300_draw.c | 49 +++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index ba74878721..c9588fbb21 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -17,7 +17,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL THE AUTHOR(S) AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -67,16 +67,16 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) { GLubyte *in = (GLubyte *)src_ptr; - GLuint *out = _mesa_malloc(sizeof(GLuint) * mesa_ind_buf->count); + GLushort *out = _mesa_malloc(sizeof(GLushort) * mesa_ind_buf->count); int i; for (i = 0; i < mesa_ind_buf->count; ++i) { - out[i] = (GLuint) in[i]; + out[i] = (GLushort) in[i]; } ind_buf->ptr = out; ind_buf->free_needed = GL_TRUE; - ind_buf->is_32bit = GL_TRUE; + ind_buf->is_32bit = GL_FALSE; } else if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) { ind_buf->ptr = src_ptr; ind_buf->free_needed = GL_FALSE; @@ -157,7 +157,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st } else src_ptr = input->Ptr; - if (input->Type == GL_DOUBLE || ((getTypeSize(input->Type) * input->Size) % 4 > 0)) { + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || input->StrideB < 4){ if (RADEON_DEBUG & DEBUG_FALLBACKS) { fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type); fprintf(stderr, "stride %d, components %d\n", input->StrideB, input->Size); @@ -189,6 +189,9 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st case GL_BYTE: CONVERT(GLbyte, BYTE_TO_FLOAT); break; + default: + assert(0); + break; } type = GL_FLOAT; @@ -201,7 +204,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st r300_attr.free_needed = GL_FALSE; r300_attr.data = (GLvoid *)src_ptr; r300_attr.stride = input->StrideB; - r300_attr.dwords = getTypeSize(type) * input->Size / 4; + r300_attr.dwords = (getTypeSize(type) * input->Size + 3)/ 4; } r300_attr.size = input->Size; @@ -222,15 +225,18 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st case GL_SHORT: r300_attr._signed = 1; r300_attr.normalize = input->Normalized; - if (input->Size == 2) - r300_attr.data_type = R300_DATA_TYPE_SHORT_2; - else if (input->Size == 4) - r300_attr.data_type = R300_DATA_TYPE_SHORT_4; - else - assert(0); + switch (input->Size) { + case 1: + case 2: + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + break; + case 3: + case 4: + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + break; + } break; case GL_BYTE: - assert(input->Size == 4); r300_attr._signed = 1; r300_attr.normalize = input->Normalized; r300_attr.data_type = R300_DATA_TYPE_BYTE; @@ -238,15 +244,18 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st case GL_UNSIGNED_SHORT: r300_attr._signed = 0; r300_attr.normalize = input->Normalized; - if (input->Size == 2) - r300_attr.data_type = R300_DATA_TYPE_SHORT_2; - else if (input->Size == 4) - r300_attr.data_type = R300_DATA_TYPE_SHORT_4; - else - assert(0); + switch (input->Size) { + case 1: + case 2: + r300_attr.data_type = R300_DATA_TYPE_SHORT_2; + break; + case 3: + case 4: + r300_attr.data_type = R300_DATA_TYPE_SHORT_4; + break; + } break; case GL_UNSIGNED_BYTE: - assert(input->Size == 4); r300_attr._signed = 0; r300_attr.normalize = input->Normalized; if (input->Format == GL_BGRA) -- cgit v1.2.3 From 58982f8af1496c4860fb7bf3e815977ed4a753ff Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 17:58:04 +0200 Subject: r300: vertex array stride = 0 means that data are tightly packed in the array --- src/mesa/drivers/dri/r300/r300_draw.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index c9588fbb21..684b1d0ef8 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -123,7 +123,7 @@ static int getTypeSize(GLenum type) *dst_ptr++ = MACRO(*in); \ in++; \ } \ - src_ptr += input->StrideB; \ + src_ptr += stride; \ } \ } else { \ for (i = 0; i < count; i++) { \ @@ -132,7 +132,7 @@ static int getTypeSize(GLenum type) *dst_ptr++ = (GLfloat)(*in); \ in++; \ } \ - src_ptr += input->StrideB; \ + src_ptr += stride; \ } \ } \ } while (0) @@ -144,6 +144,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st struct vertex_attribute r300_attr; const void *src_ptr; GLenum type; + GLuint stride; if (input->BufferObj->Name) { if (!input->BufferObj->Pointer) { @@ -157,10 +158,12 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st } else src_ptr = input->Ptr; - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || input->StrideB < 4){ + stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size : input->StrideB; + + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || stride < 4){ if (RADEON_DEBUG & DEBUG_FALLBACKS) { fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type); - fprintf(stderr, "stride %d, components %d\n", input->StrideB, input->Size); + fprintf(stderr, "stride %d, components %d\n", stride, input->Size); } GLfloat *dst_ptr, *tmp; @@ -203,7 +206,7 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st type = input->Type; r300_attr.free_needed = GL_FALSE; r300_attr.data = (GLvoid *)src_ptr; - r300_attr.stride = input->StrideB; + r300_attr.stride = stride; r300_attr.dwords = (getTypeSize(type) * input->Size + 3)/ 4; } -- cgit v1.2.3 From e2aedfa62079ff1a333e1f4e56faea303cc36edb Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 4 Jun 2009 08:42:29 +0200 Subject: r300: Endianness fixes for recent vertex path changes. Signed-off-by: Maciej Cencora --- src/mesa/drivers/dri/r300/r300_draw.c | 38 ++++++++++++++++++++++++++++----- src/mesa/drivers/dri/r300/r300_render.c | 8 +++---- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index 684b1d0ef8..cc5650fb7c 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -67,19 +67,43 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) { GLubyte *in = (GLubyte *)src_ptr; - GLushort *out = _mesa_malloc(sizeof(GLushort) * mesa_ind_buf->count); + GLuint *out = _mesa_malloc(sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1)); int i; - for (i = 0; i < mesa_ind_buf->count; ++i) { - out[i] = (GLushort) in[i]; + ind_buf->ptr = out; + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) { + *out++ = in[i]; } - ind_buf->ptr = out; ind_buf->free_needed = GL_TRUE; ind_buf->is_32bit = GL_FALSE; } else if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) { +#if MESA_BIG_ENDIAN + GLushort *in = (GLushort *)src_ptr; + GLuint *out = _mesa_malloc(sizeof(GLushort) * + ((mesa_ind_buf->count + 1) & ~1)); + int i; + + ind_buf->ptr = out; + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) { + *out++ = in[i]; + } + + ind_buf->free_needed = GL_TRUE; +#else ind_buf->ptr = src_ptr; ind_buf->free_needed = GL_FALSE; +#endif ind_buf->is_32bit = GL_FALSE; } else { ind_buf->ptr = src_ptr; @@ -160,7 +184,11 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size : input->StrideB; - if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || stride < 4){ + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || +#if MESA_BIG_ENDIAN + getTypeSize(input->Type) != 4 || +#endif + stride < 4) { if (RADEON_DEBUG & DEBUG_FALLBACKS) { fprintf(stderr, "%s: Converting vertex attributes, attribute data format %x,", __FUNCTION__, input->Type); fprintf(stderr, "stride %d, components %d\n", stride, input->Size); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index adda92467a..dfbd79a389 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -176,15 +176,15 @@ static void r300EmitElts(GLcontext * ctx, unsigned long n_elts) { r300ContextPtr rmesa = R300_CONTEXT(ctx); void *out; - GLbyte el_size; + GLuint size; - el_size = rmesa->ind_buf.is_32bit ? 4 : 2; + size = ((rmesa->ind_buf.is_32bit ? 4 : 2) * n_elts + 3) & ~3; radeonAllocDmaRegion(&rmesa->radeon, &rmesa->radeon.tcl.elt_dma_bo, - &rmesa->radeon.tcl.elt_dma_offset, n_elts * el_size, 4); + &rmesa->radeon.tcl.elt_dma_offset, size, 4); radeon_bo_map(rmesa->radeon.tcl.elt_dma_bo, 1); out = rmesa->radeon.tcl.elt_dma_bo->ptr + rmesa->radeon.tcl.elt_dma_offset; - memcpy(out, rmesa->ind_buf.ptr, n_elts * el_size); + memcpy(out, rmesa->ind_buf.ptr, size); radeon_bo_unmap(rmesa->radeon.tcl.elt_dma_bo); } -- cgit v1.2.3 From 1a7739ae26fba54608c0eeaade8888aabbf34d9c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 7 Jun 2009 19:29:29 +1000 Subject: nouveau: forgotten makefile... --- src/gallium/drivers/nouveau/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/gallium/drivers/nouveau/Makefile diff --git a/src/gallium/drivers/nouveau/Makefile b/src/gallium/drivers/nouveau/Makefile new file mode 100644 index 0000000000..dbe8a6e7bf --- /dev/null +++ b/src/gallium/drivers/nouveau/Makefile @@ -0,0 +1,8 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = nouveau + +C_SOURCES = nouveau_screen.c + +include ../../Makefile.template -- cgit v1.2.3 From db63f638974f90557a52c66b0f2e9d5a92e697d0 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 7 Jun 2009 22:51:46 +0200 Subject: r300: fix regression caused by 056bc77547c304021a0faf204897ed238a5cf424 Fixes GPU hangs in software TCL path --- src/mesa/drivers/dri/r300/r300_swtcl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index ecc837745d..4a82064814 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -219,6 +219,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0); } + R300_NEWPRIM(rmesa); rmesa->vbuf.num_attribs = num_attrs; *_InputsRead = InputsRead; *_OutputsWritten = OutputsWritten; -- cgit v1.2.3 From 8064a517b24169fa2b03f27bf70e3d62f54c830d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 8 Jun 2009 18:17:21 +1000 Subject: llvm: fix compile on gcc 4.4 --- src/gallium/auxiliary/gallivm/instructionssoa.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/instructionssoa.cpp b/src/gallium/auxiliary/gallivm/instructionssoa.cpp index 925e948763..2d2af3085e 100644 --- a/src/gallium/auxiliary/gallivm/instructionssoa.cpp +++ b/src/gallium/auxiliary/gallivm/instructionssoa.cpp @@ -24,6 +24,8 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ + +#include #include "instructionssoa.h" #include "storagesoa.h" -- cgit v1.2.3 From 78dad275646b720511dac31ca6ba0535568af81f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 4 Jun 2009 10:34:02 -0700 Subject: Revert "scons: Less aggressive optimizations for MSVC 64bit compiler." This reverts commit fc7f92478286041a018ac4e72d2ccedeea7c0eca. --- scons/gallium.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index 0d5843603e..5b3c9752bc 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -362,23 +362,8 @@ def generate(env): '/GL-', # disable whole program optimization ] else: - if env['machine'] == 'x86_64': - cflags += [ - # Same as /O2, but without global optimizations or auto-inlining - # http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx - '/Ob1', # enable inline expansion, disable auto-inlining - '/Oi', # enable intrinsic functions - '/Ot', # favors fast code - '/Oy', # omit frame pointer - '/Gs', # enable stack probes - '/GF', # eliminate duplicate strings - '/Gy', # enable function-level linking - ] - else: - cflags += [ - '/O2', # optimize for speed - ] cflags += [ + '/O2', # optimize for speed #'/fp:fast', # fast floating point ] if env['profile']: -- cgit v1.2.3 From 283e84bfb3066a3e3d778d4065b448ddd288fbb4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 3 Jun 2009 16:33:56 +0200 Subject: progs/tests: Add some scissor tests --- progs/tests/.gitignore | 2 + progs/tests/Makefile | 2 + progs/tests/SConscript | 2 + progs/tests/scissor-viewport.c | 138 +++++++++++++++++++++++++++++++++ progs/tests/scissor.c | 168 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 312 insertions(+) create mode 100644 progs/tests/scissor-viewport.c create mode 100644 progs/tests/scissor.c diff --git a/progs/tests/.gitignore b/progs/tests/.gitignore index 959ddcc51f..d6a8538767 100644 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@ -62,6 +62,8 @@ readrate readtex.c readtex.h rubberband +scissor +scissor-viewport seccolor shader_api shaderutil.c diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 628ca41535..7604b22788 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -70,6 +70,8 @@ SOURCES = \ random.c \ readrate.c \ rubberband.c \ + scissor.c \ + scissor-viewport.c \ seccolor.c \ shader_api.c \ sharedtex.c \ diff --git a/progs/tests/SConscript b/progs/tests/SConscript index 453fcecd9c..9d89ff6a0d 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -95,6 +95,8 @@ progs = [ 'random', 'readrate', 'rubberband', + 'scissor', + 'scissor-viewport', 'seccolor', 'shader_api', 'stencil_twoside', diff --git a/progs/tests/scissor-viewport.c b/progs/tests/scissor-viewport.c new file mode 100644 index 0000000000..582e65fb72 --- /dev/null +++ b/progs/tests/scissor-viewport.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * Copyright (c) 2009 VMware, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +struct program +{ + unsigned width; + unsigned height; + int i; +}; + +struct program prog; + +static void init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); + + prog.i = 0; +} + +static void reshape(int width, int height) +{ + glViewport(0, 0, 100, 100); + + prog.width = width; + prog.height = height; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + glutPostRedisplay(); + return; + } +} + +static void drawQuad(void) +{ + glBegin(GL_QUADS); + glVertex2d(-1.0, -1.0); + glVertex2d( 1.0, -1.0); + glVertex2d( 1.0, 1.0); + glVertex2d(-1.0, 1.0); + glEnd(); +} + +static void draw(void) +{ + int i; + + glClearColor(0.0, 0.0, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + i = prog.i++; + if (prog.i >= 3) + prog.i = 0; + + glEnable(GL_SCISSOR_TEST); + + { + glColor4d(1.0, 0.0, 0.0, 1.0); + + glScissor(i, i, 10 - 2*i, 10 - 2*i); + drawQuad(); + } + + glDisable(GL_SCISSOR_TEST); + + //glutSwapBuffers(); + glFlush(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + prog.width = 200; + prog.height = 200; + + glutInitWindowPosition(100, 0); + glutInitWindowSize(prog.width, prog.height); + + //type = GLUT_RGB | GLUT_DOUBLE; + type = GLUT_RGB | GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + init(); + + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutDisplayFunc(draw); + glutMainLoop(); + return 0; +} diff --git a/progs/tests/scissor.c b/progs/tests/scissor.c new file mode 100644 index 0000000000..2dfd2174e8 --- /dev/null +++ b/progs/tests/scissor.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. + * Copyright (c) 2009 VMware, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the name of + * Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF + * ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +struct program +{ + unsigned width; + unsigned height; + unsigned quads; +}; + +struct program prog; + +static void init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + fflush(stderr); +} + +static void reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + prog.width = width; + prog.height = height; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + prog.quads = !prog.quads; + glutPostRedisplay(); + return; + } +} + +static void drawQuad(void) +{ + + if (prog.quads) { + glBegin(GL_QUADS); + glVertex2d(-1.0, -1.0); + glVertex2d( 1.0, -1.0); + glVertex2d( 1.0, 1.0); + glVertex2d(-1.0, 1.0); + glEnd(); + } else { + glClear(GL_COLOR_BUFFER_BIT); + } +} + +static void draw(void) +{ + glClearColor(0.0, 0.0, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + printf("drawing with %s\n", prog.quads ? "quads" : "clears"); + + glEnable(GL_SCISSOR_TEST); + + { + glClearColor(1.0, 0.0, 0.0, 1.0); + glColor4d(1.0, 0.0, 0.0, 1.0); + + glScissor(1, 1, 10, 10); + drawQuad(); + glScissor(1, prog.height - 11, 10, 10); + drawQuad(); + glScissor(prog.width - 11, prog.height - 11, 10, 10); + drawQuad(); + } + + { + glClearColor(0.0, 1.0, 0.0, 1.0); + glColor4d(0.0, 1.0, 0.0, 1.0); + + glScissor(12, 1, 10, 10); + drawQuad(); + glScissor(12, prog.height - 11, 10, 10); + drawQuad(); + glScissor(prog.width - 22, prog.height - 11, 10, 10); + drawQuad(); + } + + { + glClearColor(1.0, 1.0, 0.0, 1.0); + glColor4d(1.0, 1.0, 0.0, 1.0); + + glScissor(1, 12, 10, 10); + drawQuad(); + glScissor(1, prog.height - 22, 10, 10); + drawQuad(); + glScissor(prog.width - 11, prog.height - 22, 10, 10); + drawQuad(); + } + + glDisable(GL_SCISSOR_TEST); + + //glutSwapBuffers(); + glFlush(); +} + +int main(int argc, char **argv) +{ + GLenum type; + + glutInit(&argc, argv); + + prog.width = 200; + prog.height = 200; + + glutInitWindowPosition(100, 0); + glutInitWindowSize(prog.width, prog.height); + + //type = GLUT_RGB | GLUT_DOUBLE; + type = GLUT_RGB | GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(*argv) == GL_FALSE) { + exit(1); + } + + init(); + + glutReshapeFunc(reshape); + glutKeyboardFunc(key); + glutDisplayFunc(draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 4d9d0e62306ce1a046ff724936016a4f080cf21a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 Jun 2009 14:34:16 +0200 Subject: stw: If stfb not set don't call into mesa --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index de37d135df..f27f4cda21 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -118,7 +118,8 @@ stw_call_window_proc( * be called from any thread. */ pipe_mutex_lock( fb->mutex ); - st_resize_framebuffer( fb->stfb, width, height ); + if (fb->stfb) + st_resize_framebuffer( fb->stfb, width, height ); pipe_mutex_unlock( fb->mutex ); } } -- cgit v1.2.3 From 8d2324d355e243b350a03b6d1a9b47f8986e496b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 Jun 2009 14:33:55 +0200 Subject: trace/rbug: Sleep on windows when blocked --- src/gallium/drivers/trace/tr_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index dd5cca58dd..b845a649b8 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -131,7 +131,9 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) pipe_condvar_wait(tr_ctx->draw_cond, tr_ctx->draw_mutex); #else pipe_mutex_unlock(tr_ctx->draw_mutex); - /* TODO sleep or use conditional */ +#ifdef PIPE_SUBSYSTEM_WINDOWS_USER + Sleep(1); +#endif pipe_mutex_lock(tr_ctx->draw_mutex); #endif } -- cgit v1.2.3 From 4adb190a162c5ed0684a8616331344caadba4010 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 8 Jun 2009 07:23:56 -0600 Subject: mesa: EXT_vertex_array_bgra fixes 1) Pass the correct format when calling update_array in _mesa_VertexAttribPointerARB. 2) glVertexAttribPointerNV accepts GL_BGRA format too. 3) raise INVALID_VALUE error when format is BGRA and normalized is false in glVertexAttribPointerARB --- src/mesa/main/varray.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index ff3128b8be..f04c137c6d 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -529,6 +529,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, { GLboolean normalized = GL_FALSE; GLsizei elementSize; + GLenum format; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -552,6 +553,21 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } + if (size == GL_BGRA) { + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerNV(GL_BGRA/type)"); + return; + } + + format = GL_BGRA; + size = 4; + normalized = GL_TRUE; + } + else { + format = GL_RGBA; + } + /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: @@ -574,7 +590,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -621,9 +637,14 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, "glVertexAttribPointerARB(GL_BGRA/type)"); return; } + if (normalized != GL_TRUE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerARB(GL_BGRA/normalized)"); + return; + } + format = GL_BGRA; size = 4; - normalized = GL_TRUE; } else { format = GL_RGBA; @@ -668,7 +689,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr); -- cgit v1.2.3 From fce4ee12a620de4ece35cef62a4562bbd4895557 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 07:25:24 -0600 Subject: mesa: EXT_vertex_array_bgra fixes 1) Pass the correct format when calling update_array in _mesa_VertexAttribPointerARB. 2) glVertexAttribPointerNV accepts GL_BGRA format too. 3) raise INVALID_VALUE error when format is BGRA and normalized is false in glVertexAttribPointerARB (cherry picked from commit 4adb190a162c5ed0684a8616331344caadba4010) --- src/mesa/main/varray.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 72b3e834b3..0882e8f37a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -534,6 +534,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, { GLboolean normalized = GL_FALSE; GLsizei elementSize; + GLenum format; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -557,6 +558,21 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } + if (size == GL_BGRA) { + if (type != GL_UNSIGNED_BYTE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerNV(GL_BGRA/type)"); + return; + } + + format = GL_BGRA; + size = 4; + normalized = GL_TRUE; + } + else { + format = GL_RGBA; + } + /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: @@ -579,7 +595,7 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); @@ -621,9 +637,14 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, "glVertexAttribPointerARB(GL_BGRA/type)"); return; } + if (normalized != GL_TRUE) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glVertexAttribPointerARB(GL_BGRA/normalized)"); + return; + } + format = GL_BGRA; size = 4; - normalized = GL_TRUE; } else { format = GL_RGBA; @@ -668,7 +689,7 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, GL_RGBA, stride, normalized, ptr); + elementSize, size, type, format, stride, normalized, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr); -- cgit v1.2.3 From 0d3c8fbf12289a8cc081c2d68e810c4bf29d1f8d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 8 Jun 2009 16:11:29 +0100 Subject: mesa/vbo: drop all references to vbo on destroy We were adding references to the input arrays, but failing to drop them on destruction. This could lead to a 64kb buffer being leaked each context destruction. --- src/mesa/vbo/vbo_exec_api.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 5d35ec9c11..a8a09859a0 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -727,19 +727,32 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) { - if (exec->vtx.bufferobj->Name) { - /* using a real VBO for vertex data */ - GLcontext *ctx = exec->ctx; - _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); - } - else { - /* just using malloc'd space for vertex data */ - if (exec->vtx.buffer_map) { + /* using a real VBO for vertex data */ + GLcontext *ctx = exec->ctx; + unsigned i; + + /* True VBOs should already be unmapped + */ + if (exec->vtx.buffer_map) { + assert (exec->vtx.bufferobj->Name == 0); + if (exec->vtx.bufferobj->Name == 0) { ALIGN_FREE(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; exec->vtx.buffer_ptr = NULL; } } + + /* Drop any outstanding reference to the vertex buffer + */ + for (i = 0; i < Elements(exec->vtx.arrays); i++) { + _mesa_reference_buffer_object(ctx, + &exec->vtx.arrays[i].BufferObj, + NULL); + } + + /* Free the vertex buffer: + */ + _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } void vbo_exec_BeginVertices( GLcontext *ctx ) -- cgit v1.2.3 From 0bced6a326e3520d2b280b4f6cdaadf843ce1d2d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 09:42:04 -0600 Subject: mesa: bump MAX_PROGRAM_ENV_PARAMS from 128 to 256 Also, MAX_NV_VERTEX_PROGRAM_PARAMS should be 96, not 128 (or 256). --- src/mesa/main/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 2a9fdf9ca0..bd66a4c231 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -180,7 +180,7 @@ /*@{*/ #define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) #define MAX_PROGRAM_LOCAL_PARAMS 256 /**< per-program constants (power of two) */ -#define MAX_PROGRAM_ENV_PARAMS 128 +#define MAX_PROGRAM_ENV_PARAMS 256 /**< per-context constants (power of two) */ #define MAX_PROGRAM_MATRICES 8 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 #define MAX_PROGRAM_CALL_DEPTH 8 @@ -197,7 +197,7 @@ /*@{*/ #define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 #define MAX_NV_VERTEX_PROGRAM_TEMPS 12 -#define MAX_NV_VERTEX_PROGRAM_PARAMS MAX_PROGRAM_ENV_PARAMS +#define MAX_NV_VERTEX_PROGRAM_PARAMS 96 #define MAX_NV_VERTEX_PROGRAM_INPUTS 16 #define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 /*@}*/ -- cgit v1.2.3 From 33d63277706aede31559a24c0db76b37609e76ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 09:52:31 -0600 Subject: mesa: better error message for invalid texture unit index --- src/mesa/shader/arbprogparse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index c7a031067e..bb4c5b38d4 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1014,7 +1014,10 @@ parse_teximage_num (GLcontext * ctx, const GLubyte ** inst, GLint i = parse_integer (inst, Program); if ((i < 0) || (i >= (int)ctx->Const.MaxTextureImageUnits)) { - program_error(ctx, Program->Position, "Invalid texture image index"); + char s[100]; + _mesa_snprintf(s, sizeof(s), "Invalid texture image index %d (%u is max)", + i, ctx->Const.MaxTextureImageUnits); + program_error(ctx, Program->Position, s); return 1; } -- cgit v1.2.3 From 42678dba941b5a734e6aa03b530653d9c5341a70 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 8 Jun 2009 16:27:59 +0100 Subject: mesa: Allocate tokens from the heap. The recent increase ST_MAX_SHADER_TOKENS to 8K causes stack overflows on windows. Failure to allocate is not being propagated to the caller. This is not a regression since the previous _mesa_malloc result wasn't being checked as well. Unfortunately it is not easy to fix, as the callers of these functions do not have failure propagation mechanism either, and so on. So leaving a just fixme note for now. --- src/mesa/state_tracker/st_program.c | 40 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 34926101ed..06030f6cd8 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -55,20 +55,6 @@ #define TGSI_DEBUG 0 -/** XXX we should use the version of this from u_memory.h but including - * that header causes symbol collisions. - */ -static INLINE void * -mem_dup(const void *src, uint size) -{ - void *dup = _mesa_malloc(size); - if (dup) - _mesa_memcpy(dup, src, size); - return dup; -} - - - /** * Translate a Mesa vertex shader into a TGSI shader. * \param outputMapping to map vertex program output registers (VERT_RESULT_x) @@ -84,7 +70,7 @@ st_translate_vertex_program(struct st_context *st, const ubyte *outputSemanticIndex) { struct pipe_context *pipe = st->pipe; - struct tgsi_token tokens[ST_MAX_SHADER_TOKENS]; + struct tgsi_token *tokens; GLuint defaultOutputMapping[VERT_RESULT_MAX]; struct pipe_shader_state vs; GLuint attr, i; @@ -102,6 +88,13 @@ st_translate_vertex_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; + tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens); + if(!tokens) { + /* FIXME: propagate error to the caller */ + assert(0); + return; + } + memset(&vs, 0, sizeof(vs)); memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); @@ -347,7 +340,9 @@ st_translate_vertex_program(struct st_context *st, assert(num_tokens < ST_MAX_SHADER_TOKENS); vs.tokens = (struct tgsi_token *) - mem_dup(tokens, num_tokens * sizeof(tokens[0])); + _mesa_realloc(tokens, + ST_MAX_SHADER_TOKENS * sizeof *tokens, + num_tokens * sizeof *tokens); stvp->num_inputs = vs_num_inputs; stvp->state = vs; /* struct copy */ @@ -375,7 +370,7 @@ st_translate_fragment_program(struct st_context *st, const GLuint inputMapping[]) { struct pipe_context *pipe = st->pipe; - struct tgsi_token tokens[ST_MAX_SHADER_TOKENS]; + struct tgsi_token *tokens; GLuint outputMapping[FRAG_RESULT_MAX]; GLuint defaultInputMapping[FRAG_ATTRIB_MAX]; struct pipe_shader_state fs; @@ -395,6 +390,13 @@ st_translate_fragment_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; + tokens = (struct tgsi_token *)MALLOC(ST_MAX_SHADER_TOKENS * sizeof *tokens); + if(!tokens) { + /* FIXME: propagate error to the caller */ + assert(0); + return; + } + memset(&fs, 0, sizeof(fs)); memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); @@ -536,7 +538,9 @@ st_translate_fragment_program(struct st_context *st, assert(num_tokens < ST_MAX_SHADER_TOKENS); fs.tokens = (struct tgsi_token *) - mem_dup(tokens, num_tokens * sizeof(tokens[0])); + _mesa_realloc(tokens, + ST_MAX_SHADER_TOKENS * sizeof *tokens, + num_tokens * sizeof *tokens); stfp->state = fs; /* struct copy */ stfp->driver_shader = pipe->create_fs_state(pipe, &fs); -- cgit v1.2.3 From e09f78d8dc7f20bb11f84206b6f1d71418332d8a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 8 Jun 2009 16:29:46 +0100 Subject: mesa: Use matching signedness for the counter as upper bound. --- src/mesa/main/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 2eabcdaf49..b54e47919d 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -282,7 +282,7 @@ write_texture_image(struct gl_texture_object *texObj) case MESA_FORMAT_RGB565: { GLubyte *buf2 = (GLubyte *) _mesa_malloc(img->Width * img->Height * 3); - GLint i; + GLuint i; for (i = 0; i < img->Width * img->Height; i++) { GLint r, g, b; GLushort s = ((GLushort *) img->Data)[i]; -- cgit v1.2.3 From b6753adbc71a2d13e8ec095251f62cb267429de7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:44:48 -0600 Subject: st/mesa: remove invalid assertion It's legal for ARB_vertex_program programs to not write to result.position. The results are undefined in that case. This assertion was causing us to abort/exit though. --- src/mesa/state_tracker/st_program.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 06030f6cd8..72ca852458 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -290,9 +290,6 @@ st_translate_vertex_program(struct st_context *st, } } - assert(vs_output_semantic_name[0] == TGSI_SEMANTIC_POSITION); - - if (outputMapping) { /* find max output slot referenced to compute vs_num_outputs */ GLuint maxSlot = 0; -- cgit v1.2.3 From a6f266361693c6b9a5639ba7176925feb26f64c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:52:16 -0600 Subject: mesa: new MESA_EXTENSION_OVERRIDE env var Can be used to enable/disable extensions as reported by glGetString(GL_EXTENSIONS). If a name is preceeded by '-' it's disabled. Otherwise, the named extension is enabled. Intended for debug/test purposes. --- src/mesa/main/extensions.c | 112 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 101 insertions(+), 11 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index aa9513a550..490110a6d2 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -442,8 +442,9 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) /** * Either enable or disable the named extension. + * \return GL_TRUE for success, GL_FALSE if invalid extension name */ -static void +static GLboolean set_extension( GLcontext *ctx, const char *name, GLboolean state ) { GLboolean *base = (GLboolean *) &ctx->Extensions; @@ -452,7 +453,7 @@ set_extension( GLcontext *ctx, const char *name, GLboolean state ) if (ctx->Extensions.String) { /* The string was already queried - can't change it now! */ _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name); - return; + return GL_FALSE; } for (i = 0 ; i < Elements(default_extensions) ; i++) { @@ -461,10 +462,10 @@ set_extension( GLcontext *ctx, const char *name, GLboolean state ) GLboolean *enabled = base + default_extensions[i].flag_offset; *enabled = state; } - return; + return GL_TRUE; } } - _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); + return GL_FALSE; } @@ -475,7 +476,8 @@ set_extension( GLcontext *ctx, const char *name, GLboolean state ) void _mesa_enable_extension( GLcontext *ctx, const char *name ) { - set_extension(ctx, name, GL_TRUE); + if (!set_extension(ctx, name, GL_TRUE)) + _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); } @@ -486,7 +488,8 @@ _mesa_enable_extension( GLcontext *ctx, const char *name ) void _mesa_disable_extension( GLcontext *ctx, const char *name ) { - set_extension(ctx, name, GL_FALSE); + if (!set_extension(ctx, name, GL_FALSE)) + _mesa_problem(ctx, "Trying to disable unknown extension: %s", name); } @@ -510,6 +513,80 @@ _mesa_extension_is_enabled( GLcontext *ctx, const char *name ) } +/** + * Append string 'b' onto string 'a'. Free 'a' and return new string. + */ +static char * +append(const char *a, const char *b) +{ + const GLuint aLen = a ? _mesa_strlen(a) : 0; + const GLuint bLen = b ? _mesa_strlen(b) : 0; + char *s = _mesa_calloc(aLen + bLen + 1); + if (s) { + if (a) + _mesa_memcpy(s, a, aLen); + if (b) + _mesa_memcpy(s + aLen, b, bLen); + s[aLen + bLen] = '\0'; + } + if (a) + _mesa_free((void *) a); + return s; +} + + +/** + * Check the MESA_EXTENSION_OVERRIDE env var. + * For extension names that are recognized, turn them on. For extension + * names that are recognized and prefixed with '-', turn them off. + * Return a string of the unknown/leftover names. + */ +static const char * +get_extension_override( GLcontext *ctx ) +{ + const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE"); + char *extraExt = NULL; + char ext[1000]; + GLuint extLen = 0; + GLuint i; + GLboolean disableExt = GL_FALSE; + + if (!envExt) + return NULL; + + for (i = 0; ; i++) { + if (envExt[i] == '\0' || envExt[i] == ' ') { + /* terminate/process 'ext' if extLen > 0 */ + if (extLen > 0) { + assert(extLen < sizeof(ext)); + /* enable extension named by 'ext' */ + ext[extLen] = 0; + if (!set_extension(ctx, ext, !disableExt)) { + /* unknown extension name, append it to extraExt */ + if (extraExt) { + extraExt = append(extraExt, " "); + } + extraExt = append(extraExt, ext); + } + extLen = 0; + disableExt = GL_FALSE; + } + if (envExt[i] == '\0') + break; + } + else if (envExt[i] == '-') { + disableExt = GL_TRUE; + } + else { + /* accumulate this non-space character */ + ext[extLen++] = envExt[i]; + } + } + + return extraExt; +} + + /** * Run through the default_extensions array above and set the * ctx->Extensions.ARB/EXT_* flags accordingly. @@ -538,8 +615,9 @@ GLubyte * _mesa_make_extension_string( GLcontext *ctx ) { const GLboolean *base = (const GLboolean *) &ctx->Extensions; + const char *extraExt = get_extension_override(ctx); GLuint extStrLen = 0; - GLubyte *s; + char *s; GLuint i; /* first, compute length of the extension string */ @@ -549,7 +627,14 @@ _mesa_make_extension_string( GLcontext *ctx ) extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; } } - s = (GLubyte *) _mesa_malloc(extStrLen); + + if (extraExt) + extStrLen += _mesa_strlen(extraExt) + 1; /* +1 for space */ + + /* allocate the extension string */ + s = (char *) _mesa_malloc(extStrLen); + if (!s) + return NULL; /* second, build the extension string */ extStrLen = 0; @@ -559,13 +644,18 @@ _mesa_make_extension_string( GLcontext *ctx ) GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); extStrLen += len; - s[extStrLen] = (GLubyte) ' '; + s[extStrLen] = ' '; extStrLen++; } } ASSERT(extStrLen > 0); - s[extStrLen - 1] = 0; + s[extStrLen - 1] = 0; /* -1 to overwrite trailing the ' ' */ - return s; + if (extraExt) { + s = append(s, " "); + s = append(s, extraExt); + } + + return (GLubyte *) s; } -- cgit v1.2.3 From f9c0ce0e073cd60f632de3a0588a111b92a602dd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:55:34 -0600 Subject: softpipe: advertise PIPE_CAP_MAX_TEXTURE_ANISOTROPY as 16.0 Note that this doesn't have any real significance since PIPE_CAP_ANISOTROPIC_FILTER still returns 0. --- src/gallium/drivers/softpipe/sp_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index ce6d8ebd12..692deeb8fd 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -106,7 +106,7 @@ softpipe_get_paramf(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_POINT_WIDTH_AA: return 255.0; /* arbitrary */ case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: - return 0.0; + return 16.0; /* not actually signficant at this time */ case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: return 16.0; /* arbitrary */ default: -- cgit v1.2.3 From cc26e2774615d5e18a0e19270a40b7dd1e4e99df Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:56:51 -0600 Subject: docs: document MESA_EXTENSION_OVERRIDE env var --- docs/envvars.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/envvars.html b/docs/envvars.html index 7fd9fe7c0a..6d7a321da9 100644 --- a/docs/envvars.html +++ b/docs/envvars.html @@ -25,6 +25,9 @@ fragment programs (intended for developers only)
      • MESA_TNL_PROG - if set, implement conventional vertex transformation operations with vertex programs (intended for developers only). Setting this variable automatically sets the MESA_TEX_PROG variable as well. +
      • MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions. +A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension +and disable the GL_EXT_bar extension.

      -- cgit v1.2.3 From 854151ba62e4b1cb6a755f6c131ee2e0f680f39b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 10:58:04 -0600 Subject: glsl: preprocessor debug code (disabled) --- src/mesa/shader/slang/slang_preprocess.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index ff913ad883..c3df76ded5 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1319,6 +1319,11 @@ _slang_preprocess_directives(slang_string *output, success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas); grammar_destroy (eid); grammar_destroy (pid); + if (0) { + _mesa_printf("Post-processed shader:\n"); + _mesa_printf("%s", output->data); + _mesa_printf("----------------------\n"); + } return success; } -- cgit v1.2.3 From 77c329a2773820c57e7b286858e80a596f89ef94 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 Jun 2009 16:46:06 +0200 Subject: pipebuffer: Silence out of heap space debug print --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c index 5a342fbf3b..d8decba49d 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c @@ -200,8 +200,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr, mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0); if(!mm_buf->block) { - debug_printf("warning: heap full\n"); #if 0 + debug_printf("warning: heap full\n"); mmDumpMemInfo(mm->heap); #endif FREE(mm_buf); -- cgit v1.2.3 From 19a54d9f1055c366fd77026dd67007a8d5921f58 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 8 Jun 2009 20:52:47 +0200 Subject: glsl: Fix preprocessor define argument parsing for dead sections. --- src/mesa/shader/slang/slang_preprocess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index c3df76ded5..c16a111132 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1035,11 +1035,11 @@ preprocess_source (slang_string *output, const char *source, /* Parse optional macro parameters. */ while (prod[i++] != PARAM_END) { - if (state.cond.top->effective) { - pp_symbol *param; + pp_symbol *param; - id = (const char *) (&prod[i]); - idlen = _mesa_strlen (id); + id = (const char *) (&prod[i]); + idlen = _mesa_strlen (id); + if (state.cond.top->effective) { pp_annotate (output, "%s, ", id); param = pp_symbols_push (&symbol->parameters); if (param == NULL) -- cgit v1.2.3 From 304ba4bba44057aa21f0ae434e49b1e09ab7d039 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 13:53:33 -0600 Subject: glsl: Fix preprocessor define argument parsing for dead sections. (cherry picked from master, commit 19a54d9f1055c366fd77026dd67007a8d5921f58) --- src/mesa/shader/slang/slang_preprocess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index ff913ad883..fd98fae360 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1035,11 +1035,11 @@ preprocess_source (slang_string *output, const char *source, /* Parse optional macro parameters. */ while (prod[i++] != PARAM_END) { - if (state.cond.top->effective) { - pp_symbol *param; + pp_symbol *param; - id = (const char *) (&prod[i]); - idlen = _mesa_strlen (id); + id = (const char *) (&prod[i]); + idlen = _mesa_strlen (id); + if (state.cond.top->effective) { pp_annotate (output, "%s, ", id); param = pp_symbols_push (&symbol->parameters); if (param == NULL) -- cgit v1.2.3 From 7eed6ab5b525b75f690d05042c90d05827253114 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 8 Jun 2009 16:02:18 +0100 Subject: Cygwin build fixes Fix mklib to deal with NOPREFIX and use --enable-auto-image-base for cygwin Teach configure.ac some basic facts about cygwin Signed-off-by: Jon TURNEY --- bin/mklib | 19 ++++++++++++++++--- configure.ac | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/mklib b/bin/mklib index 2fd95ba775..2444945006 100755 --- a/bin/mklib +++ b/bin/mklib @@ -885,6 +885,17 @@ case $ARCH in CYGWIN*) # GCC-based environment + if [ $NOPREFIX = 1 ] ; then + # No "lib" or ".so" part + echo "mklib: Making CYGWIN shared library: " ${LIBNAME} + OPTS="-shared -Wl,--enable-auto-image-base" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS=${LIBNAME} + else CYGNAME="cyg${LIBNAME}" # prefix with "cyg" LIBNAME="lib${LIBNAME}" # prefix with "lib" @@ -901,11 +912,11 @@ case $ARCH in # finish up FINAL_LIBS=${LIBNAME}.a else - OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" + OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi - echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll + echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll if [ $CPLUSPLUS = 1 ] ; then LINK="g++" @@ -914,7 +925,8 @@ case $ARCH in fi # rm any old libs - rm -f ${LIBNAME}-${MAJOR}.dll + rm -f ${CYGNAME}-${MAJOR}.dll + rm -f ${LIBNAME}-${MAJOR}.dll.a rm -f ${LIBNAME}.dll.a rm -f ${LIBNAME}.a @@ -927,6 +939,7 @@ case $ARCH in # special case for installing in bin FINAL_BINS="${CYGNAME}-${MAJOR}.dll" fi + fi ;; 'example') diff --git a/configure.ac b/configure.ac index 48b8022736..2a9ac1ed9c 100644 --- a/configure.ac +++ b/configure.ac @@ -222,6 +222,8 @@ else case "$host_os" in darwin* ) LIB_EXTENSION='dylib' ;; + cygwin* ) + LIB_EXTENSION='dll' ;; * ) LIB_EXTENSION='so' ;; esac @@ -1073,6 +1075,9 @@ if test "x$APP_LIB_DEPS" = x; then solaris*) APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" ;; + cygwin*) + APP_LIB_DEPS="-lX11" + ;; *) APP_LIB_DEPS="-lm" ;; -- cgit v1.2.3 From 34bb024cf2d02d5d5cb672ead05fa131bdff6dd8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 16:11:17 -0600 Subject: st/mesa: fix incorrect bufObj Length assignment, remove unneeded assertion --- src/mesa/state_tracker/st_cb_bufferobjects.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index a94e11fff1..fbe6aa25de 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -251,7 +251,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); if(obj->Pointer) { obj->Offset = 0; - obj->Length = obj->Size; + obj->Length = length; map += offset; } @@ -270,7 +270,6 @@ st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, /* Subrange is relative to mapped range */ assert(offset >= 0); assert(length >= 0); - assert(offset < obj->Length); assert(offset + length <= obj->Length); pipe_buffer_flush_mapped_range(pipe->screen, st_obj->buffer, -- cgit v1.2.3 From ffa1972efb2100fd9a58e3add856852321c3c8ca Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 8 Jun 2009 19:55:33 -0700 Subject: r300-gallium: Don't emit UCP planes for SW TCL. --- src/gallium/drivers/r300/r300_emit.c | 4 ++++ src/gallium/drivers/r300/r300_state.c | 10 +++++++--- src/gallium/drivers/r300/r300_state_invariant.c | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index d81abe4d0b..818880cd38 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -63,6 +63,10 @@ void r300_emit_clip_state(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); + if (!r300screen->caps->has_tcl) { + return; + } + BEGIN_CS(5 + (6 * 4)); OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, (r300screen->caps->is_r500 ? diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 29e721984f..01e2b51153 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -120,9 +120,13 @@ static void r300_set_clip_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - r300->clip_state = *state; - - r300->dirty_state |= R300_NEW_CLIP; + if (r300_screen(pipe->screen)->caps->has_tcl) { + r300->clip_state = *state; + r300->dirty_state |= R300_NEW_CLIP; + } else { + draw_flush(r300->draw); + draw_set_clip_state(r300->draw, state); + } } static void diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 60eff08f2e..e438114010 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -69,7 +69,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(75 + (caps->has_tcl ? 7 : 0)); + BEGIN_CS(77 + (caps->has_tcl ? 5 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); -- cgit v1.2.3 From cb3b91f2d633ded4fb3e0c595a2c34ee139e9b10 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 8 Jun 2009 20:01:57 -0700 Subject: r300-gallium: Make UCP and clip work again for SW TCL. SW TCL: tri-clip works, tri-userclip works HW TCL: tri-clip fails, tri-userclip works That is a 200% improvement over the previous situation. Woot. --- src/gallium/drivers/r300/r300_context.c | 4 ++-- src/gallium/drivers/r300/r300_emit.c | 36 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 21c0fe2b80..233a32b53c 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -149,8 +149,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->draw = draw_create(); /* Enable our renderer. */ draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); - /* Tell Draw that we can always do non-UCP clipping. */ - draw_set_driver_clipping(r300->draw, TRUE); + /* Disable Draw's clipping if TCL is present. */ + draw_set_driver_clipping(r300->draw, r300_screen(screen)->caps->has_tcl); /* Force Draw to never do viewport transform, since (again) we can do * transform in hardware, always. */ draw_set_viewport_state(r300->draw, &r300_viewport_identity); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 818880cd38..8b9fcd75e2 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -63,25 +63,27 @@ void r300_emit_clip_state(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); - if (!r300screen->caps->has_tcl) { - return; - } - - BEGIN_CS(5 + (6 * 4)); - OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, - (r300screen->caps->is_r500 ? - R500_PVS_UCP_START : R300_PVS_UCP_START)); - OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 6 * 4); - for (i = 0; i < 6; i++) { - OUT_CS_32F(clip->ucp[i][0]); - OUT_CS_32F(clip->ucp[i][1]); - OUT_CS_32F(clip->ucp[i][2]); - OUT_CS_32F(clip->ucp[i][3]); + if (r300screen->caps->has_tcl) { + BEGIN_CS(5 + (6 * 4)); + OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, + (r300screen->caps->is_r500 ? + R500_PVS_UCP_START : R300_PVS_UCP_START)); + OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 6 * 4); + for (i = 0; i < 6; i++) { + OUT_CS_32F(clip->ucp[i][0]); + OUT_CS_32F(clip->ucp[i][1]); + OUT_CS_32F(clip->ucp[i][2]); + OUT_CS_32F(clip->ucp[i][3]); + } + OUT_CS_REG(R300_VAP_CLIP_CNTL, ((1 << clip->nr) - 1) | + R300_PS_UCP_MODE_CLIP_AS_TRIFAN); + END_CS; + } else { + BEGIN_CS(2); + OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE); + END_CS; } - OUT_CS_REG(R300_VAP_CLIP_CNTL, ((1 << clip->nr) - 1) | - R300_PS_UCP_MODE_CLIP_AS_TRIFAN); - END_CS; } void r300_emit_dsa_state(struct r300_context* r300, -- cgit v1.2.3 From c534604800e2ea14991acb83fe4c68ffcdb7b661 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 8 Jun 2009 20:23:34 -0700 Subject: r300-gallium: HW TCL glxgears. (Read the rest of the log.) Um. So, yeah. Two massive WTF moments here. The first one is that, somehow, I never actually hooked up vertex shader emission, so the only time that the VAP gets set up is during surface_copy/surface_fill. That's why acidgears was happening. The second one is that, somehow, once I actually hooked it up, glxgears just magically worked. Without any actual, real testing, I somehow accidentally made the shader compiler work. Go figure. --- src/gallium/drivers/r300/r300_emit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 8b9fcd75e2..93cf6909a3 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -632,6 +632,11 @@ validate: r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT; } + if (r300->dirty_state & R300_NEW_VERTEX_SHADER) { + r300_emit_vertex_shader(r300, r300->vs); + r300->dirty_state &= ~R300_NEW_VERTEX_SHADER; + } + /* Finally, emit the VBO. */ r300_emit_vertex_buffer(r300); -- cgit v1.2.3 From 18b3cbcede292ce7b90b818b6abb064869072ff3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 9 Jun 2009 13:52:58 +1000 Subject: radeon: fix mipmap_limits crasher. This gets the correct srclvl image map when uploading images to the new mipmap. --- src/mesa/drivers/dri/radeon/radeon_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 564da19f58..0d87f152e9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -830,7 +830,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag * In fact, that memcpy() could be done by the hardware in many * cases, provided that we have a proper memory manager. */ - radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel]; + radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel-image->mt->firstLevel]; assert(srclvl->size == dstlvl->size); assert(srclvl->rowstride == dstlvl->rowstride); -- cgit v1.2.3 From ef8caec29ae73bb2bbeb48f0578d839ef29348cd Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 9 Jun 2009 12:14:40 +0200 Subject: glsl: Expand nested preprocessor macros. --- src/mesa/shader/slang/slang_preprocess.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index c16a111132..f9390f7504 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1012,6 +1012,8 @@ preprocess_source (slang_string *output, const char *source, case TOKEN_DEFINE: { pp_symbol *symbol = NULL; + slang_string replacement; + expand_state es; /* Parse macro name. */ id = (const char *) (&prod[i]); @@ -1054,9 +1056,20 @@ preprocess_source (slang_string *output, const char *source, idlen = _mesa_strlen (id); if (state.cond.top->effective) { pp_annotate (output, ") %s", id); - slang_string_pushs (&symbol->replacement, id, idlen); } + slang_string_init(&replacement); + slang_string_pushs(&replacement, id, idlen); i += idlen + 1; + + /* Expand macro replacement. */ + es.output = &symbol->replacement; + es.input = slang_string_cstr(&replacement); + es.state = &state; + if (!expand(&es, &state.symbols)) { + slang_string_free(&replacement); + goto error; + } + slang_string_free(&replacement); } break; -- cgit v1.2.3 From a81097c545f089610326d528296d8f1f25ac06a7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 15:27:10 -0600 Subject: mesa: reorder fields, update comments for gl_buffer_object --- src/mesa/main/mtypes.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 26ec8d5595..46020eb210 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1498,14 +1498,17 @@ struct gl_buffer_object { GLint RefCount; GLuint Name; - GLenum Usage; - GLenum Access; - GLvoid *Pointer; /**< Only valid while buffer is mapped */ - GLintptr Offset; /**< mapped offset */ - GLsizeiptr Length; /**< mapped length */ - GLsizeiptrARB Size; /**< Size of storage in bytes */ - GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ - GLboolean Written; /**< Ever written to? (for debugging) */ + GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ + GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ + GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ + /** Fields describing a mapped buffer */ + /*@{*/ + GLenum Access; /**< GL_READ_ONLY_ARB, GL_WRITE_ONLY_ARB, etc. */ + GLvoid *Pointer; /**< User-space address of mapping */ + GLintptr Offset; /**< Mapped offset */ + GLsizeiptr Length; /**< Mapped length */ + /*@}*/ + GLboolean Written; /**< Ever written to? (for debugging) */ }; -- cgit v1.2.3 From 42e9bde0fa2276b8f5bb434328eea7665794b127 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 8 Jun 2009 14:41:54 -0600 Subject: intel: remove extra \n from warning string --- src/mesa/drivers/dri/intel/intel_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 6521b4ef31..53782c5604 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -247,7 +247,7 @@ intel_get_param(__DRIscreenPrivate *psp, int param, int *value) ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); if (ret) { - _mesa_warning(NULL, "drm_i915_getparam: %d\n", ret); + _mesa_warning(NULL, "drm_i915_getparam: %d", ret); return GL_FALSE; } -- cgit v1.2.3 From f0c21c02945f8379decfa3b2f294651d6b5af8ef Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 9 Jun 2009 15:58:14 +0100 Subject: rbug: Extend context info and block ops --- src/gallium/auxiliary/rbug/rbug_context.c | 228 ++++++++++++++++++++++++++++ src/gallium/auxiliary/rbug/rbug_context.h | 56 +++++++ src/gallium/auxiliary/rbug/rbug_demarshal.c | 6 + src/gallium/auxiliary/rbug/rbug_proto.h | 3 + 4 files changed, 293 insertions(+) diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index 787f650f71..55e049f313 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.c +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -274,6 +274,100 @@ int rbug_send_context_flush(struct rbug_connection *__con, return __ret; } +int rbug_send_context_rule_add(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(8); /* vertex */ + LEN(8); /* fragment */ + LEN(8); /* texture */ + LEN(8); /* surface */ + LEN(4); /* block */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(8, rbug_shader_t, vertex); /* vertex */ + WRITE(8, rbug_shader_t, fragment); /* fragment */ + WRITE(8, rbug_texture_t, texture); /* texture */ + WRITE(8, rbug_texture_t, surface); /* surface */ + WRITE(4, rbug_block_t, block); /* block */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + +int rbug_send_context_rule_delete(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_rule_t rule, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(8); /* context */ + LEN(8); /* rule */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_DELETE)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(8, rbug_context_t, context); /* context */ + WRITE(8, rbug_block_rule_t, rule); /* rule */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_DELETE, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + int rbug_send_context_list_reply(struct rbug_connection *__con, uint32_t serial, rbug_context_t *contexts, @@ -320,6 +414,8 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, uint32_t serial, rbug_shader_t vertex, rbug_shader_t fragment, + rbug_texture_t *texs, + uint32_t texs_len, rbug_texture_t *cbufs, uint32_t cbufs_len, rbug_texture_t zsbuf, @@ -336,6 +432,7 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, LEN(4); /* serial */ LEN(8); /* vertex */ LEN(8); /* fragment */ + LEN_ARRAY(8, texs); /* texs */ LEN_ARRAY(8, cbufs); /* cbufs */ LEN(8); /* zsbuf */ LEN(4); /* blocker */ @@ -353,6 +450,7 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, WRITE(4, uint32_t, serial); /* serial */ WRITE(8, rbug_shader_t, vertex); /* vertex */ WRITE(8, rbug_shader_t, fragment); /* fragment */ + WRITE_ARRAY(8, rbug_texture_t, texs); /* texs */ WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ WRITE(8, rbug_texture_t, zsbuf); /* zsbuf */ WRITE(4, rbug_block_t, blocker); /* blocker */ @@ -373,6 +471,47 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, return __ret; } +int rbug_send_context_rule_add_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_block_rule_t rule, + uint32_t *__serial) +{ + uint32_t __len = 0; + uint32_t __pos = 0; + uint8_t *__data = NULL; + int __ret = 0; + + LEN(8); /* header */ + LEN(4); /* serial */ + LEN(8); /* rule */ + + /* align */ + PAD(__len, 8); + + __data = (uint8_t*)MALLOC(__len); + if (!__data) + return -ENOMEM; + + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY)); + WRITE(4, uint32_t, ((uint32_t)(__len / 4))); + WRITE(4, uint32_t, serial); /* serial */ + WRITE(8, rbug_block_rule_t, rule); /* rule */ + + /* final pad */ + PAD(__pos, 8); + + if (__pos != __len) { + __ret = -EINVAL; + } else { + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD_REPLY, __len); + rbug_connection_write(__con, __data, __len); + __ret = rbug_connection_send_finish(__con, __serial); + } + + FREE(__data); + return __ret; +} + int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -579,6 +718,66 @@ struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto return ret; } +struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_rule_add *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(8, rbug_shader_t, vertex); /* vertex */ + READ(8, rbug_shader_t, fragment); /* fragment */ + READ(8, rbug_texture_t, texture); /* texture */ + READ(8, rbug_texture_t, surface); /* surface */ + READ(4, rbug_block_t, block); /* block */ + + return ret; +} + +struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_rule_delete *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_DELETE) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(8, rbug_context_t, context); /* context */ + READ(8, rbug_block_rule_t, rule); /* rule */ + + return ret; +} + struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header) { uint32_t len = 0; @@ -632,6 +831,7 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct READ(4, uint32_t, serial); /* serial */ READ(8, rbug_shader_t, vertex); /* vertex */ READ(8, rbug_shader_t, fragment); /* fragment */ + READ_ARRAY(8, rbug_texture_t, texs); /* texs */ READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */ READ(8, rbug_texture_t, zsbuf); /* zsbuf */ READ(4, rbug_block_t, blocker); /* blocker */ @@ -640,6 +840,34 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct return ret; } +struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header) +{ + uint32_t len = 0; + uint32_t pos = 0; + uint8_t *data = NULL; + struct rbug_proto_context_rule_add_reply *ret; + + if (!header) + return NULL; + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY) + return NULL; + + pos = 0; + len = header->length * 4; + data = (uint8_t*)&header[1]; + ret = MALLOC(sizeof(*ret)); + if (!ret) + return NULL; + + ret->header.__message = header; + ret->header.opcode = header->opcode; + + READ(4, uint32_t, serial); /* serial */ + READ(8, rbug_block_rule_t, rule); /* rule */ + + return ret; +} + struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header) { uint32_t len = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h index 9f1726d64d..178a3bce24 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.h +++ b/src/gallium/auxiliary/rbug/rbug_context.h @@ -41,6 +41,8 @@ #include "rbug/rbug_proto.h" #include "rbug/rbug_core.h" +typedef uint64_t rbug_block_rule_t; + typedef enum { RBUG_BLOCK_BEFORE = 1, @@ -86,6 +88,24 @@ struct rbug_proto_context_flush int32_t flags; }; +struct rbug_proto_context_rule_add +{ + struct rbug_header header; + rbug_context_t context; + rbug_shader_t vertex; + rbug_shader_t fragment; + rbug_texture_t texture; + rbug_texture_t surface; + rbug_block_t block; +}; + +struct rbug_proto_context_rule_delete +{ + struct rbug_header header; + rbug_context_t context; + rbug_block_rule_t rule; +}; + struct rbug_proto_context_list_reply { struct rbug_header header; @@ -100,6 +120,8 @@ struct rbug_proto_context_info_reply uint32_t serial; rbug_shader_t vertex; rbug_shader_t fragment; + rbug_texture_t *texs; + uint32_t texs_len; rbug_texture_t *cbufs; uint32_t cbufs_len; rbug_texture_t zsbuf; @@ -107,6 +129,13 @@ struct rbug_proto_context_info_reply rbug_block_t blocked; }; +struct rbug_proto_context_rule_add_reply +{ + struct rbug_header header; + uint32_t serial; + rbug_block_rule_t rule; +}; + struct rbug_proto_context_draw_blocked { struct rbug_header header; @@ -141,6 +170,20 @@ int rbug_send_context_flush(struct rbug_connection *__con, int32_t flags, uint32_t *__serial); +int rbug_send_context_rule_add(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial); + +int rbug_send_context_rule_delete(struct rbug_connection *__con, + rbug_context_t context, + rbug_block_rule_t rule, + uint32_t *__serial); + int rbug_send_context_list_reply(struct rbug_connection *__con, uint32_t serial, rbug_context_t *contexts, @@ -151,6 +194,8 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, uint32_t serial, rbug_shader_t vertex, rbug_shader_t fragment, + rbug_texture_t *texs, + uint32_t texs_len, rbug_texture_t *cbufs, uint32_t cbufs_len, rbug_texture_t zsbuf, @@ -158,6 +203,11 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, rbug_block_t blocked, uint32_t *__serial); +int rbug_send_context_rule_add_reply(struct rbug_connection *__con, + uint32_t serial, + rbug_block_rule_t rule, + uint32_t *__serial); + int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -175,10 +225,16 @@ struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(str struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); +struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header); + +struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header); + struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); +struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header); + struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header); #endif diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index 80894f4a64..b3929b9cb4 100644 --- a/src/gallium/auxiliary/rbug/rbug_demarshal.c +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -67,10 +67,16 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) return (struct rbug_header *)rbug_demarshal_context_draw_unblock(header); case RBUG_OP_CONTEXT_FLUSH: return (struct rbug_header *)rbug_demarshal_context_flush(header); + case RBUG_OP_CONTEXT_RULE_ADD: + return (struct rbug_header *)rbug_demarshal_context_rule_add(header); + case RBUG_OP_CONTEXT_RULE_DELETE: + return (struct rbug_header *)rbug_demarshal_context_rule_delete(header); case RBUG_OP_CONTEXT_LIST_REPLY: return (struct rbug_header *)rbug_demarshal_context_list_reply(header); case RBUG_OP_CONTEXT_INFO_REPLY: return (struct rbug_header *)rbug_demarshal_context_info_reply(header); + case RBUG_OP_CONTEXT_RULE_ADD_REPLY: + return (struct rbug_header *)rbug_demarshal_context_rule_add_reply(header); case RBUG_OP_CONTEXT_DRAW_BLOCKED: return (struct rbug_header *)rbug_demarshal_context_draw_blocked(header); case RBUG_OP_SHADER_LIST: diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h index db9fa68500..5ef345d72d 100644 --- a/src/gallium/auxiliary/rbug/rbug_proto.h +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -56,8 +56,11 @@ enum rbug_opcode RBUG_OP_CONTEXT_DRAW_STEP = 515, RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516, RBUG_OP_CONTEXT_FLUSH = 518, + RBUG_OP_CONTEXT_RULE_ADD = 521, + RBUG_OP_CONTEXT_RULE_DELETE = 522, RBUG_OP_CONTEXT_LIST_REPLY = -512, RBUG_OP_CONTEXT_INFO_REPLY = -513, + RBUG_OP_CONTEXT_RULE_ADD_REPLY = -521, RBUG_OP_CONTEXT_DRAW_BLOCKED = 517, RBUG_OP_SHADER_LIST = 768, RBUG_OP_SHADER_INFO = 769, -- cgit v1.2.3 From b71a254f057269f8eca162a729830dde5981e138 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 9 Jun 2009 15:59:29 +0100 Subject: trace/rbug: Return textures currently bound to context --- src/gallium/drivers/trace/tr_context.c | 9 +++++++-- src/gallium/drivers/trace/tr_context.h | 3 +++ src/gallium/drivers/trace/tr_rbug.c | 8 +++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index b845a649b8..7a39bdb42c 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -915,12 +915,17 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe, struct pipe_texture **textures) { struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_texture *tr_tex; struct pipe_context *pipe = tr_ctx->pipe; struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS]; unsigned i; - for(i = 0; i < num_textures; ++i) - unwrapped_textures[i] = trace_texture_unwrap(tr_ctx, textures[i]); + tr_ctx->curr.num_texs = num_textures; + for(i = 0; i < num_textures; ++i) { + tr_tex = trace_texture(textures[i]); + tr_ctx->curr.tex[i] = tr_tex; + unwrapped_textures[i] = tr_tex ? tr_tex->texture : NULL; + } textures = unwrapped_textures; trace_dump_call_begin("pipe_context", "set_sampler_textures"); diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 0c2bf27689..ff86b6d105 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -51,6 +51,9 @@ struct trace_context struct trace_shader *fs; struct trace_shader *vs; + struct trace_texture *tex[PIPE_MAX_SAMPLERS]; + unsigned num_texs; + unsigned nr_cbufs; struct trace_texture *cbufs[PIPE_MAX_COLOR_BUFS]; struct trace_texture *zsbuf; diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index e2de108009..68184e9a5d 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -296,6 +296,7 @@ trace_rbug_context_info(struct trace_rbug *tr_rbug, struct rbug_header *header, struct trace_screen *tr_scr = tr_rbug->tr_scr; struct trace_context *tr_ctx = NULL; rbug_texture_t cbufs[PIPE_MAX_COLOR_BUFS]; + rbug_texture_t texs[PIPE_MAX_SAMPLERS]; int i; pipe_mutex_lock(tr_scr->list_mutex); @@ -313,9 +314,14 @@ trace_rbug_context_info(struct trace_rbug *tr_rbug, struct rbug_header *header, for (i = 0; i < tr_ctx->curr.nr_cbufs; i++) cbufs[i] = VOID2U64(tr_ctx->curr.cbufs[i]); + for (i = 0; i < tr_ctx->curr.num_texs; i++) + texs[i] = VOID2U64(tr_ctx->curr.tex[i]); + rbug_send_context_info_reply(tr_rbug->con, serial, VOID2U64(tr_ctx->curr.vs), VOID2U64(tr_ctx->curr.fs), - cbufs, tr_ctx->curr.nr_cbufs, VOID2U64(tr_ctx->curr.zsbuf), + texs, tr_ctx->curr.num_texs, + cbufs, tr_ctx->curr.nr_cbufs, + VOID2U64(tr_ctx->curr.zsbuf), tr_ctx->draw_blocker, tr_ctx->draw_blocked, NULL); trace_dump_call_unlock(); -- cgit v1.2.3 From f3cf3d2fc2c0cb09cb1c18c08a135009904166b7 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 9 Jun 2009 19:22:40 +0100 Subject: rbug: Change block protocol around a bit --- src/gallium/auxiliary/rbug/rbug_context.c | 188 ++++------------------------ src/gallium/auxiliary/rbug/rbug_context.h | 60 +++------ src/gallium/auxiliary/rbug/rbug_demarshal.c | 8 +- src/gallium/auxiliary/rbug/rbug_proto.h | 6 +- 4 files changed, 45 insertions(+), 217 deletions(-) diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c index 55e049f313..1832425658 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.c +++ b/src/gallium/auxiliary/rbug/rbug_context.c @@ -233,55 +233,14 @@ int rbug_send_context_draw_unblock(struct rbug_connection *__con, return __ret; } -int rbug_send_context_flush(struct rbug_connection *__con, - rbug_context_t context, - int32_t flags, - uint32_t *__serial) -{ - uint32_t __len = 0; - uint32_t __pos = 0; - uint8_t *__data = NULL; - int __ret = 0; - - LEN(8); /* header */ - LEN(8); /* context */ - LEN(4); /* flags */ - - /* align */ - PAD(__len, 8); - - __data = (uint8_t*)MALLOC(__len); - if (!__data) - return -ENOMEM; - - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH)); - WRITE(4, uint32_t, ((uint32_t)(__len / 4))); - WRITE(8, rbug_context_t, context); /* context */ - WRITE(4, int32_t, flags); /* flags */ - - /* final pad */ - PAD(__pos, 8); - - if (__pos != __len) { - __ret = -EINVAL; - } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len); - rbug_connection_write(__con, __data, __len); - __ret = rbug_connection_send_finish(__con, __serial); - } - - FREE(__data); - return __ret; -} - -int rbug_send_context_rule_add(struct rbug_connection *__con, - rbug_context_t context, - rbug_shader_t vertex, - rbug_shader_t fragment, - rbug_texture_t texture, - rbug_texture_t surface, - rbug_block_t block, - uint32_t *__serial) +int rbug_send_context_draw_rule(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial) { uint32_t __len = 0; uint32_t __pos = 0; @@ -303,7 +262,7 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_RULE)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ WRITE(8, rbug_shader_t, vertex); /* vertex */ @@ -318,7 +277,7 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_RULE, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -327,10 +286,10 @@ int rbug_send_context_rule_add(struct rbug_connection *__con, return __ret; } -int rbug_send_context_rule_delete(struct rbug_connection *__con, - rbug_context_t context, - rbug_block_rule_t rule, - uint32_t *__serial) +int rbug_send_context_flush(struct rbug_connection *__con, + rbug_context_t context, + int32_t flags, + uint32_t *__serial) { uint32_t __len = 0; uint32_t __pos = 0; @@ -339,7 +298,7 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, LEN(8); /* header */ LEN(8); /* context */ - LEN(8); /* rule */ + LEN(4); /* flags */ /* align */ PAD(__len, 8); @@ -348,10 +307,10 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, if (!__data) return -ENOMEM; - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_DELETE)); + WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH)); WRITE(4, uint32_t, ((uint32_t)(__len / 4))); WRITE(8, rbug_context_t, context); /* context */ - WRITE(8, rbug_block_rule_t, rule); /* rule */ + WRITE(4, int32_t, flags); /* flags */ /* final pad */ PAD(__pos, 8); @@ -359,7 +318,7 @@ int rbug_send_context_rule_delete(struct rbug_connection *__con, if (__pos != __len) { __ret = -EINVAL; } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_DELETE, __len); + rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len); rbug_connection_write(__con, __data, __len); __ret = rbug_connection_send_finish(__con, __serial); } @@ -471,47 +430,6 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, return __ret; } -int rbug_send_context_rule_add_reply(struct rbug_connection *__con, - uint32_t serial, - rbug_block_rule_t rule, - uint32_t *__serial) -{ - uint32_t __len = 0; - uint32_t __pos = 0; - uint8_t *__data = NULL; - int __ret = 0; - - LEN(8); /* header */ - LEN(4); /* serial */ - LEN(8); /* rule */ - - /* align */ - PAD(__len, 8); - - __data = (uint8_t*)MALLOC(__len); - if (!__data) - return -ENOMEM; - - WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY)); - WRITE(4, uint32_t, ((uint32_t)(__len / 4))); - WRITE(4, uint32_t, serial); /* serial */ - WRITE(8, rbug_block_rule_t, rule); /* rule */ - - /* final pad */ - PAD(__pos, 8); - - if (__pos != __len) { - __ret = -EINVAL; - } else { - rbug_connection_send_start(__con, RBUG_OP_CONTEXT_RULE_ADD_REPLY, __len); - rbug_connection_write(__con, __data, __len); - __ret = rbug_connection_send_finish(__con, __serial); - } - - FREE(__data); - return __ret; -} - int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -690,44 +608,16 @@ struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(str return ret; } -struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header) -{ - uint32_t len = 0; - uint32_t pos = 0; - uint8_t *data = NULL; - struct rbug_proto_context_flush *ret; - - if (!header) - return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) - return NULL; - - pos = 0; - len = header->length * 4; - data = (uint8_t*)&header[1]; - ret = MALLOC(sizeof(*ret)); - if (!ret) - return NULL; - - ret->header.__message = header; - ret->header.opcode = header->opcode; - - READ(8, rbug_context_t, context); /* context */ - READ(4, int32_t, flags); /* flags */ - - return ret; -} - -struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header) +struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_rule_add *ret; + struct rbug_proto_context_draw_rule *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_RULE) return NULL; pos = 0; @@ -750,16 +640,16 @@ struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug return ret; } -struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header) +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header) { uint32_t len = 0; uint32_t pos = 0; uint8_t *data = NULL; - struct rbug_proto_context_rule_delete *ret; + struct rbug_proto_context_flush *ret; if (!header) return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_DELETE) + if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH) return NULL; pos = 0; @@ -773,7 +663,7 @@ struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struc ret->header.opcode = header->opcode; READ(8, rbug_context_t, context); /* context */ - READ(8, rbug_block_rule_t, rule); /* rule */ + READ(4, int32_t, flags); /* flags */ return ret; } @@ -840,34 +730,6 @@ struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct return ret; } -struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header) -{ - uint32_t len = 0; - uint32_t pos = 0; - uint8_t *data = NULL; - struct rbug_proto_context_rule_add_reply *ret; - - if (!header) - return NULL; - if (header->opcode != (int16_t)RBUG_OP_CONTEXT_RULE_ADD_REPLY) - return NULL; - - pos = 0; - len = header->length * 4; - data = (uint8_t*)&header[1]; - ret = MALLOC(sizeof(*ret)); - if (!ret) - return NULL; - - ret->header.__message = header; - ret->header.opcode = header->opcode; - - READ(4, uint32_t, serial); /* serial */ - READ(8, rbug_block_rule_t, rule); /* rule */ - - return ret; -} - struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header) { uint32_t len = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_context.h b/src/gallium/auxiliary/rbug/rbug_context.h index 178a3bce24..da61c2365b 100644 --- a/src/gallium/auxiliary/rbug/rbug_context.h +++ b/src/gallium/auxiliary/rbug/rbug_context.h @@ -41,12 +41,12 @@ #include "rbug/rbug_proto.h" #include "rbug/rbug_core.h" -typedef uint64_t rbug_block_rule_t; - typedef enum { RBUG_BLOCK_BEFORE = 1, RBUG_BLOCK_AFTER = 2, + RBUG_BLOCK_RULE = 4, + RBUG_BLOCK_MASK = 7, } rbug_block_t; struct rbug_proto_context_list @@ -81,14 +81,7 @@ struct rbug_proto_context_draw_unblock rbug_block_t unblock; }; -struct rbug_proto_context_flush -{ - struct rbug_header header; - rbug_context_t context; - int32_t flags; -}; - -struct rbug_proto_context_rule_add +struct rbug_proto_context_draw_rule { struct rbug_header header; rbug_context_t context; @@ -99,11 +92,11 @@ struct rbug_proto_context_rule_add rbug_block_t block; }; -struct rbug_proto_context_rule_delete +struct rbug_proto_context_flush { struct rbug_header header; rbug_context_t context; - rbug_block_rule_t rule; + int32_t flags; }; struct rbug_proto_context_list_reply @@ -129,13 +122,6 @@ struct rbug_proto_context_info_reply rbug_block_t blocked; }; -struct rbug_proto_context_rule_add_reply -{ - struct rbug_header header; - uint32_t serial; - rbug_block_rule_t rule; -}; - struct rbug_proto_context_draw_blocked { struct rbug_header header; @@ -165,25 +151,20 @@ int rbug_send_context_draw_unblock(struct rbug_connection *__con, rbug_block_t unblock, uint32_t *__serial); +int rbug_send_context_draw_rule(struct rbug_connection *__con, + rbug_context_t context, + rbug_shader_t vertex, + rbug_shader_t fragment, + rbug_texture_t texture, + rbug_texture_t surface, + rbug_block_t block, + uint32_t *__serial); + int rbug_send_context_flush(struct rbug_connection *__con, rbug_context_t context, int32_t flags, uint32_t *__serial); -int rbug_send_context_rule_add(struct rbug_connection *__con, - rbug_context_t context, - rbug_shader_t vertex, - rbug_shader_t fragment, - rbug_texture_t texture, - rbug_texture_t surface, - rbug_block_t block, - uint32_t *__serial); - -int rbug_send_context_rule_delete(struct rbug_connection *__con, - rbug_context_t context, - rbug_block_rule_t rule, - uint32_t *__serial); - int rbug_send_context_list_reply(struct rbug_connection *__con, uint32_t serial, rbug_context_t *contexts, @@ -203,11 +184,6 @@ int rbug_send_context_info_reply(struct rbug_connection *__con, rbug_block_t blocked, uint32_t *__serial); -int rbug_send_context_rule_add_reply(struct rbug_connection *__con, - uint32_t serial, - rbug_block_rule_t rule, - uint32_t *__serial); - int rbug_send_context_draw_blocked(struct rbug_connection *__con, rbug_context_t context, rbug_block_t block, @@ -223,18 +199,14 @@ struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rb struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header); -struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); - -struct rbug_proto_context_rule_add * rbug_demarshal_context_rule_add(struct rbug_proto_header *header); +struct rbug_proto_context_draw_rule * rbug_demarshal_context_draw_rule(struct rbug_proto_header *header); -struct rbug_proto_context_rule_delete * rbug_demarshal_context_rule_delete(struct rbug_proto_header *header); +struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header); struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header); struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header); -struct rbug_proto_context_rule_add_reply * rbug_demarshal_context_rule_add_reply(struct rbug_proto_header *header); - struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header); #endif diff --git a/src/gallium/auxiliary/rbug/rbug_demarshal.c b/src/gallium/auxiliary/rbug/rbug_demarshal.c index b3929b9cb4..47390fbcee 100644 --- a/src/gallium/auxiliary/rbug/rbug_demarshal.c +++ b/src/gallium/auxiliary/rbug/rbug_demarshal.c @@ -65,18 +65,14 @@ struct rbug_header * rbug_demarshal(struct rbug_proto_header *header) return (struct rbug_header *)rbug_demarshal_context_draw_step(header); case RBUG_OP_CONTEXT_DRAW_UNBLOCK: return (struct rbug_header *)rbug_demarshal_context_draw_unblock(header); + case RBUG_OP_CONTEXT_DRAW_RULE: + return (struct rbug_header *)rbug_demarshal_context_draw_rule(header); case RBUG_OP_CONTEXT_FLUSH: return (struct rbug_header *)rbug_demarshal_context_flush(header); - case RBUG_OP_CONTEXT_RULE_ADD: - return (struct rbug_header *)rbug_demarshal_context_rule_add(header); - case RBUG_OP_CONTEXT_RULE_DELETE: - return (struct rbug_header *)rbug_demarshal_context_rule_delete(header); case RBUG_OP_CONTEXT_LIST_REPLY: return (struct rbug_header *)rbug_demarshal_context_list_reply(header); case RBUG_OP_CONTEXT_INFO_REPLY: return (struct rbug_header *)rbug_demarshal_context_info_reply(header); - case RBUG_OP_CONTEXT_RULE_ADD_REPLY: - return (struct rbug_header *)rbug_demarshal_context_rule_add_reply(header); case RBUG_OP_CONTEXT_DRAW_BLOCKED: return (struct rbug_header *)rbug_demarshal_context_draw_blocked(header); case RBUG_OP_SHADER_LIST: diff --git a/src/gallium/auxiliary/rbug/rbug_proto.h b/src/gallium/auxiliary/rbug/rbug_proto.h index 5ef345d72d..d273be0166 100644 --- a/src/gallium/auxiliary/rbug/rbug_proto.h +++ b/src/gallium/auxiliary/rbug/rbug_proto.h @@ -55,12 +55,10 @@ enum rbug_opcode RBUG_OP_CONTEXT_DRAW_BLOCK = 514, RBUG_OP_CONTEXT_DRAW_STEP = 515, RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516, - RBUG_OP_CONTEXT_FLUSH = 518, - RBUG_OP_CONTEXT_RULE_ADD = 521, - RBUG_OP_CONTEXT_RULE_DELETE = 522, + RBUG_OP_CONTEXT_DRAW_RULE = 518, + RBUG_OP_CONTEXT_FLUSH = 519, RBUG_OP_CONTEXT_LIST_REPLY = -512, RBUG_OP_CONTEXT_INFO_REPLY = -513, - RBUG_OP_CONTEXT_RULE_ADD_REPLY = -521, RBUG_OP_CONTEXT_DRAW_BLOCKED = 517, RBUG_OP_SHADER_LIST = 768, RBUG_OP_SHADER_INFO = 769, -- cgit v1.2.3 From 41482a6461fadc0113f39f0e81f9fb91248faa8a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 9 Jun 2009 19:24:06 +0100 Subject: trace/rbug: Add support for draw block rule --- src/gallium/drivers/trace/tr_context.c | 33 +++++++++++++++++++++- src/gallium/drivers/trace/tr_context.h | 10 +++++++ src/gallium/drivers/trace/tr_rbug.c | 51 ++++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 7a39bdb42c..24e4e3e09b 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -116,13 +116,44 @@ trace_context_set_edgeflags(struct pipe_context *_pipe, static INLINE void trace_context_draw_block(struct trace_context *tr_ctx, int flag) { + int k; + pipe_mutex_lock(tr_ctx->draw_mutex); if (tr_ctx->draw_blocker & flag) { tr_ctx->draw_blocked |= flag; + } else if ((tr_ctx->draw_rule.blocker & flag) && + (tr_ctx->draw_blocker & 4)) { + boolean block = FALSE; + debug_printf("%s (%lu %lu) (%lu %lu) (%lu %u) (%lu %u)\n", __func__, + tr_ctx->draw_rule.fs, tr_ctx->curr.fs, + tr_ctx->draw_rule.vs, tr_ctx->curr.vs, + tr_ctx->draw_rule.surf, 0, + tr_ctx->draw_rule.tex, 0); + if (tr_ctx->draw_rule.fs && + tr_ctx->draw_rule.fs == tr_ctx->curr.fs) + block = TRUE; + if (tr_ctx->draw_rule.vs && + tr_ctx->draw_rule.vs == tr_ctx->curr.vs) + block = TRUE; + if (tr_ctx->draw_rule.surf && + tr_ctx->draw_rule.surf == tr_ctx->curr.zsbuf) + block = TRUE; + if (tr_ctx->draw_rule.surf) + for (k = 0; k < tr_ctx->curr.nr_cbufs; k++) + if (tr_ctx->draw_rule.surf == tr_ctx->curr.cbufs[k]) + block = TRUE; + if (tr_ctx->draw_rule.tex) + for (k = 0; k < tr_ctx->curr.num_texs; k++) + if (tr_ctx->draw_rule.tex == tr_ctx->curr.tex[k]) + block = TRUE; + + if (block) + tr_ctx->draw_blocked |= (flag | 4); + } + if (tr_ctx->draw_blocked) trace_rbug_notify_draw_blocked(tr_ctx); - } /* wait for rbug to clear the blocked flag */ while (tr_ctx->draw_blocked & flag) { diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index ff86b6d105..6febe4b411 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -59,6 +59,16 @@ struct trace_context struct trace_texture *zsbuf; } curr; + struct { + struct trace_shader *fs; + struct trace_shader *vs; + + struct trace_texture *tex; + struct trace_texture *surf; + + int blocker; + } draw_rule; + unsigned draw_num_rules; pipe_condvar draw_cond; pipe_mutex draw_mutex; int draw_blocker; diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index 68184e9a5d..e85ac15edc 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -374,7 +374,12 @@ trace_rbug_context_draw_step(struct trace_rbug *tr_rbug, struct rbug_header *hea } pipe_mutex_lock(tr_ctx->draw_mutex); - tr_ctx->draw_blocked &= ~step->step; + if (tr_ctx->draw_blocked & RBUG_BLOCK_RULE) { + if (step->step & RBUG_BLOCK_RULE) + tr_ctx->draw_blocked &= ~RBUG_BLOCK_MASK; + } else { + tr_ctx->draw_blocked &= ~step->step; + } pipe_mutex_unlock(tr_ctx->draw_mutex); #ifdef PIPE_THREAD_HAVE_CONDVAR @@ -403,7 +408,12 @@ trace_rbug_context_draw_unblock(struct trace_rbug *tr_rbug, struct rbug_header * } pipe_mutex_lock(tr_ctx->draw_mutex); - tr_ctx->draw_blocked &= ~unblock->unblock; + if (tr_ctx->draw_blocked & RBUG_BLOCK_RULE) { + if (unblock->unblock & RBUG_BLOCK_RULE) + tr_ctx->draw_blocked &= ~RBUG_BLOCK_MASK; + } else { + tr_ctx->draw_blocked &= ~unblock->unblock; + } tr_ctx->draw_blocker &= ~unblock->unblock; pipe_mutex_unlock(tr_ctx->draw_mutex); @@ -416,6 +426,40 @@ trace_rbug_context_draw_unblock(struct trace_rbug *tr_rbug, struct rbug_header * return 0; } +static int +trace_rbug_context_draw_rule(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) +{ + struct rbug_proto_context_draw_rule *rule = (struct rbug_proto_context_draw_rule *)header; + + struct trace_screen *tr_scr = tr_rbug->tr_scr; + struct trace_context *tr_ctx = NULL; + + pipe_mutex_lock(tr_scr->list_mutex); + tr_ctx = trace_rbug_get_context_locked(tr_scr, rule->context); + + if (!tr_ctx) { + pipe_mutex_unlock(tr_scr->list_mutex); + return -ESRCH; + } + + pipe_mutex_lock(tr_ctx->draw_mutex); + tr_ctx->draw_rule.vs = U642VOID(rule->vertex); + tr_ctx->draw_rule.fs = U642VOID(rule->fragment); + tr_ctx->draw_rule.tex = U642VOID(rule->texture); + tr_ctx->draw_rule.surf = U642VOID(rule->surface); + tr_ctx->draw_rule.blocker = rule->block; + tr_ctx->draw_blocker |= RBUG_BLOCK_RULE; + pipe_mutex_unlock(tr_ctx->draw_mutex); + +#ifdef PIPE_THREAD_HAVE_CONDVAR + pipe_condvar_broadcast(tr_ctx->draw_cond); +#endif + + pipe_mutex_unlock(tr_scr->list_mutex); + + return 0; +} + static int trace_rbug_context_flush(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) { @@ -679,6 +723,9 @@ trace_rbug_header(struct trace_rbug *tr_rbug, struct rbug_header *header, uint32 case RBUG_OP_CONTEXT_DRAW_UNBLOCK: ret = trace_rbug_context_draw_unblock(tr_rbug, header, serial); break; + case RBUG_OP_CONTEXT_DRAW_RULE: + ret = trace_rbug_context_draw_rule(tr_rbug, header, serial); + break; case RBUG_OP_CONTEXT_FLUSH: ret = trace_rbug_context_flush(tr_rbug, header, serial); break; -- cgit v1.2.3 From 4a7fd6323afde7cbe22097ba71a149876a75bc58 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 11:53:19 -0600 Subject: mesa: added a simple bounds checker to glMap/UnmapBuffer() (disabled) --- src/mesa/main/bufferobj.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 3e011ef5b2..a49da3d3b5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -39,6 +39,11 @@ #include "bufferobj.h" +/* Debug flags */ +/*#define VBO_DEBUG*/ +/*#define BOUNDS_CHECK*/ + + #ifdef FEATURE_OES_mapbuffer #define DEFAULT_ACCESS GL_WRITE_ONLY; #else @@ -1019,6 +1024,9 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, bufObj->Name, size, data, usage); #endif +#ifdef BOUNDS_CHECK + size += 100; +#endif /* Give the buffer object to the driver! may be null! */ ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj ); } @@ -1119,6 +1127,17 @@ _mesa_MapBufferARB(GLenum target, GLenum access) } #endif +#ifdef BOUNDS_CHECK + { + GLubyte *buf = (GLubyte *) bufObj->Pointer; + GLuint i; + /* buffer is 100 bytes larger than requested, fill with magic value */ + for (i = 0; i < 100; i++) { + buf[bufObj->Size - i - 1] = 123; + } + } +#endif + return bufObj->Pointer; } @@ -1145,6 +1164,22 @@ _mesa_UnmapBufferARB(GLenum target) return GL_FALSE; } +#ifdef BOUNDS_CHECK + if (bufObj->Access != GL_READ_ONLY_ARB) { + GLubyte *buf = (GLubyte *) bufObj->Pointer; + GLuint i; + /* check that last 100 bytes are still = magic value */ + for (i = 0; i < 100; i++) { + GLuint pos = bufObj->Size - i - 1; + if (buf[pos] != 123) { + _mesa_warning(ctx, "Out of bounds buffer object write detected" + " at position %d (value = %u)\n", + pos, buf[pos]); + } + } + } +#endif + #ifdef VBO_DEBUG if (bufObj->Access == GL_WRITE_ONLY_ARB) { GLuint i, unchanged = 0; -- cgit v1.2.3 From c55f1a6c9917a87cc6b29808b4132b83cf516e05 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 12:17:19 -0600 Subject: vbo: more glDrawElements debug code (disabled) --- src/mesa/vbo/vbo_exec_array.c | 77 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 4109fbbb3c..f4b9b2f744 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -510,6 +510,63 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) } +/** + * Map GL_ELEMENT_ARRAY_BUFFER and print contents. + */ +static void +dump_element_buffer(GLcontext *ctx, GLenum type) +{ + const GLvoid *map = ctx->Driver.MapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + ctx->Array.ElementArrayBufferObj); + switch (type) { + case GL_UNSIGNED_BYTE: + { + const GLubyte *us = (const GLubyte *) map; + GLuint i; + for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) { + _mesa_printf("%02x ", us[i]); + if (i % 32 == 31) + _mesa_printf("\n"); + } + _mesa_printf("\n"); + } + break; + case GL_UNSIGNED_SHORT: + { + const GLushort *us = (const GLushort *) map; + GLuint i; + for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) { + _mesa_printf("%04x ", us[i]); + if (i % 16 == 15) + _mesa_printf("\n"); + } + _mesa_printf("\n"); + } + break; + case GL_UNSIGNED_INT: + { + const GLuint *us = (const GLuint *) map; + GLuint i; + for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) { + _mesa_printf("%08x ", us[i]); + if (i % 8 == 7) + _mesa_printf("\n"); + } + _mesa_printf("\n"); + } + break; + default: + ; + } + + ctx->Driver.UnmapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + ctx->Array.ElementArrayBufferObj); +} + + static void GLAPIENTRY vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, @@ -528,13 +585,27 @@ vbo_exec_DrawRangeElements(GLenum mode, if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " - "type 0x%x) index=%u is out of bounds (max=%u)", - start, end, count, type, end, - ctx->Array.ArrayObj->_MaxElement - 1); + "type 0x%x, indices=%p)\n" + "\tindex=%u is out of bounds (max=%u) " + "Element Buffer %u (size %d)", + start, end, count, type, indices, end, + ctx->Array.ArrayObj->_MaxElement - 1, + ctx->Array.ElementArrayBufferObj->Name, + ctx->Array.ElementArrayBufferObj->Size); + + if (0) + dump_element_buffer(ctx, type); + if (0) _mesa_print_arrays(ctx); return; } + else if (0) { + _mesa_printf("glDraw[Range]Elements" + "(start %u, end %u, type 0x%x, count %d) ElemBuf %u\n", + start, end, type, count, + ctx->Array.ElementArrayBufferObj->Name); + } #if 0 check_draw_elements_data(ctx, count, type, indices); -- cgit v1.2.3 From 4eb9e58bbb3b2b9db4c795134b2daa2ecf29fd20 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 13:09:05 -0600 Subject: intel: whitespace clean-ups --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 6 +----- src/mesa/drivers/dri/intel/intel_tex_image.c | 13 ++++--------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 673b8fa6a1..6603bcf9a2 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -169,9 +169,6 @@ do_copy_texsubimage(struct intel_context *intel, } - - - void intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLenum internalFormat, @@ -218,6 +215,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, width, border); } + void intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLenum internalFormat, @@ -291,7 +289,6 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, } - void intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -305,7 +302,6 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, _mesa_select_tex_image(ctx, texObj, target, level); GLenum internalFormat = texImage->InternalFormat; - /* Need to check texture is compatible with source format. */ diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index ddbb13e74a..ff5f614988 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -248,7 +248,6 @@ try_pbo_upload(struct intel_context *intel, } - static GLboolean try_pbo_zcopy(struct intel_context *intel, struct intel_texture_image *intelImage, @@ -293,10 +292,6 @@ try_pbo_zcopy(struct intel_context *intel, } - - - - static void intelTexImage(GLcontext * ctx, GLint dims, @@ -463,8 +458,6 @@ intelTexImage(GLcontext * ctx, DBG("pbo upload failed\n"); } - - /* intelCopyTexImage calls this function with pixels == NULL, with * the expectation that the mipmap tree will be set up but nothing * more will be done. This is where those calls return: @@ -557,6 +550,7 @@ intelTexImage(GLcontext * ctx, } } + void intelTexImage3D(GLcontext * ctx, GLenum target, GLint level, @@ -589,6 +583,7 @@ intelTexImage2D(GLcontext * ctx, format, type, pixels, unpack, texObj, texImage, 0, 0); } + void intelTexImage1D(GLcontext * ctx, GLenum target, GLint level, @@ -604,6 +599,7 @@ intelTexImage1D(GLcontext * ctx, format, type, pixels, unpack, texObj, texImage, 0, 0); } + void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, @@ -616,6 +612,7 @@ void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, 1); } + /** * Need to map texture image into memory before copying image data, * then unmap it. @@ -680,8 +677,6 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, { intel_get_tex_image(ctx, target, level, format, type, pixels, texObj, texImage, 0); - - } void -- cgit v1.2.3 From 89205a8760b8a4651962b1ff0206699cbcd78d75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 13:21:22 -0600 Subject: intel: make a bunch of glTexImage-related functions static --- src/mesa/drivers/dri/intel/intel_context.c | 3 + src/mesa/drivers/dri/intel/intel_tex.c | 16 ---- src/mesa/drivers/dri/intel/intel_tex.h | 111 ++---------------------- src/mesa/drivers/dri/intel/intel_tex_copy.c | 18 +++- src/mesa/drivers/dri/intel/intel_tex_image.c | 39 ++++++--- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 28 +++--- 6 files changed, 66 insertions(+), 149 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index fa931d7f62..3a94843993 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -550,6 +550,9 @@ intelInitDriverFunctions(struct dd_function_table *functions) functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; intelInitTextureFuncs(functions); + intelInitTextureImageFuncs(functions); + intelInitTextureSubImageFuncs(functions); + intelInitTextureCopyImageFuncs(functions); intelInitStateFuncs(functions); intelInitClearFuncs(functions); intelInitBufferFuncs(functions); diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index fbd6e1d0c3..df63f29a42 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -162,24 +162,8 @@ void intelInitTextureFuncs(struct dd_function_table *functions) { functions->ChooseTextureFormat = intelChooseTextureFormat; - functions->TexImage1D = intelTexImage1D; - functions->TexImage2D = intelTexImage2D; - functions->TexImage3D = intelTexImage3D; - functions->TexSubImage1D = intelTexSubImage1D; - functions->TexSubImage2D = intelTexSubImage2D; - functions->TexSubImage3D = intelTexSubImage3D; - functions->CopyTexImage1D = intelCopyTexImage1D; - functions->CopyTexImage2D = intelCopyTexImage2D; - functions->CopyTexSubImage1D = intelCopyTexSubImage1D; - functions->CopyTexSubImage2D = intelCopyTexSubImage2D; - functions->GetTexImage = intelGetTexImage; functions->GenerateMipmap = intel_generate_mipmap; - /* compressed texture functions */ - functions->CompressedTexImage2D = intelCompressedTexImage2D; - functions->CompressedTexSubImage2D = intelCompressedTexSubImage2D; - functions->GetCompressedTexImage = intelGetCompressedTexImage; - functions->NewTextureObject = intelNewTextureObject; functions->NewTextureImage = intelNewTextureImage; functions->DeleteTexture = intelDeleteTextureObject; diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index f5372d82fb..471aa2a240 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -35,116 +35,17 @@ void intelInitTextureFuncs(struct dd_function_table *functions); +void intelInitTextureImageFuncs(struct dd_function_table *functions); + +void intelInitTextureSubImageFuncs(struct dd_function_table *functions); + +void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); + const struct gl_texture_format *intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type); - -void intelTexImage3D(GLcontext * ctx, - GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint depth, - GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelTexSubImage3D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelTexImage2D(GLcontext * ctx, - GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelTexSubImage2D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelTexImage1D(GLcontext * ctx, - GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, const void *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelTexSubImage1D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, - GLsizei width, - GLenum format, GLenum type, - const GLvoid * pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLint border); - -void intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border); - -void intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width); - -void intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height); - -void intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid * pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - -void intelCompressedTexSubImage2D(GLcontext * ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLsizei imageSize, - const GLvoid * pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - -void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, - GLvoid *pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage); - void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); void intelSetTexBuffer(__DRIcontext *pDRICtx, diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 6603bcf9a2..260235b1eb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -169,7 +169,7 @@ do_copy_texsubimage(struct intel_context *intel, } -void +static void intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) @@ -216,7 +216,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, } -void +static void intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, @@ -264,7 +264,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, } -void +static void intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { @@ -289,7 +289,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, } -void +static void intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -316,3 +316,13 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, xoffset, yoffset, x, y, width, height); } } + + +void +intelInitTextureCopyImageFuncs(struct dd_function_table *functions) +{ + functions->CopyTexImage1D = intelCopyTexImage1D; + functions->CopyTexImage2D = intelCopyTexImage2D; + functions->CopyTexSubImage1D = intelCopyTexSubImage1D; + functions->CopyTexSubImage2D = intelCopyTexSubImage2D; +} diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index ff5f614988..f8f3920794 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -551,7 +551,7 @@ intelTexImage(GLcontext * ctx, } -void +static void intelTexImage3D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, @@ -568,7 +568,7 @@ intelTexImage3D(GLcontext * ctx, } -void +static void intelTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, @@ -584,7 +584,7 @@ intelTexImage2D(GLcontext * ctx, } -void +static void intelTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, @@ -600,12 +600,13 @@ intelTexImage1D(GLcontext * ctx, } -void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLsizei imageSize, const GLvoid *data, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) +static void +intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, + GLint internalFormat, + GLint width, GLint height, GLint border, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ) { intelTexImage(ctx, 2, target, level, internalFormat, width, height, 1, border, @@ -669,7 +670,8 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, } } -void + +static void intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, @@ -679,7 +681,8 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, texObj, texImage, 0); } -void + +static void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, GLvoid *pixels, struct gl_texture_object *texObj, @@ -689,6 +692,7 @@ intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, texObj, texImage, 1); } + void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch) @@ -797,3 +801,16 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) */ intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); } + + +void +intelInitTextureImageFuncs(struct dd_function_table *functions) +{ + functions->TexImage1D = intelTexImage1D; + functions->TexImage2D = intelTexImage2D; + functions->TexImage3D = intelTexImage3D; + functions->GetTexImage = intelGetTexImage; + + functions->CompressedTexImage2D = intelCompressedTexImage2D; + functions->GetCompressedTexImage = intelGetCompressedTexImage; +} diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 48104de2a9..1f27131dac 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -117,10 +117,7 @@ intelTexSubimage(GLcontext * ctx, } - - - -void +static void intelTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, @@ -132,18 +129,15 @@ intelTexSubImage3D(GLcontext * ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - intelTexSubimage(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, packing, texObj, texImage); - } - -void +static void intelTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, @@ -155,17 +149,15 @@ intelTexSubImage2D(GLcontext * ctx, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - intelTexSubimage(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, type, pixels, packing, texObj, texImage); - } -void +static void intelTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, @@ -182,10 +174,9 @@ intelTexSubImage1D(GLcontext * ctx, xoffset, 0, 0, width, 1, 1, format, type, pixels, packing, texObj, texImage); - } -void +static void intelCompressedTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, @@ -199,3 +190,14 @@ intelCompressedTexSubImage2D(GLcontext * ctx, fprintf(stderr, "stubbed CompressedTexSubImage2D: %dx%d@%dx%d\n", width, height, xoffset, yoffset); } + + + +void +intelInitTextureSubImageFuncs(struct dd_function_table *functions) +{ + functions->TexSubImage1D = intelTexSubImage1D; + functions->TexSubImage2D = intelTexSubImage2D; + functions->TexSubImage3D = intelTexSubImage3D; + functions->CompressedTexSubImage2D = intelCompressedTexSubImage2D; +} -- cgit v1.2.3 From b38dbc51793b9007de147eff452d535410ef7c55 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 13:28:20 -0600 Subject: intel: use GLboolean, not int, for compressed parameter --- src/mesa/drivers/dri/intel/intel_tex_image.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index f8f3920794..7339015d75 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -302,7 +302,8 @@ intelTexImage(GLcontext * ctx, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *unpack, struct gl_texture_object *texObj, - struct gl_texture_image *texImage, GLsizei imageSize, int compressed) + struct gl_texture_image *texImage, GLsizei imageSize, + GLboolean compressed) { struct intel_context *intel = intel_context(ctx); struct intel_texture_object *intelObj = intel_texture_object(texObj); @@ -564,7 +565,7 @@ intelTexImage3D(GLcontext * ctx, { intelTexImage(ctx, 3, target, level, internalFormat, width, height, depth, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE); } @@ -580,7 +581,7 @@ intelTexImage2D(GLcontext * ctx, { intelTexImage(ctx, 2, target, level, internalFormat, width, height, 1, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE); } @@ -596,7 +597,7 @@ intelTexImage1D(GLcontext * ctx, { intelTexImage(ctx, 1, target, level, internalFormat, width, 1, 1, border, - format, type, pixels, unpack, texObj, texImage, 0, 0); + format, type, pixels, unpack, texObj, texImage, 0, GL_FALSE); } @@ -610,7 +611,7 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, { intelTexImage(ctx, 2, target, level, internalFormat, width, height, 1, border, - 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, 1); + 0, 0, data, &ctx->Unpack, texObj, texImage, imageSize, GL_TRUE); } @@ -622,7 +623,7 @@ static void intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels, struct gl_texture_object *texObj, - struct gl_texture_image *texImage, int compressed) + struct gl_texture_image *texImage, GLboolean compressed) { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); @@ -678,7 +679,7 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { intel_get_tex_image(ctx, target, level, format, type, pixels, - texObj, texImage, 0); + texObj, texImage, GL_FALSE); } @@ -689,7 +690,7 @@ intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { intel_get_tex_image(ctx, target, level, 0, 0, pixels, - texObj, texImage, 1); + texObj, texImage, GL_TRUE); } -- cgit v1.2.3 From 139f2ddde4fcfdaa7d8bbb86e946274be3733e71 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 14:03:25 -0600 Subject: tests: quick and dirty glGetTexImage() test program --- progs/tests/Makefile | 3 +- progs/tests/getteximage.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 progs/tests/getteximage.c diff --git a/progs/tests/Makefile b/progs/tests/Makefile index 628ca41535..1a3ba4f181 100644 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@ -48,7 +48,8 @@ SOURCES = \ fptest1.c \ fptexture.c \ getprocaddress.c \ - glutfx \ + getteximage.c \ + glutfx.c \ interleave.c \ invert.c \ jkrahntest.c \ diff --git a/progs/tests/getteximage.c b/progs/tests/getteximage.c new file mode 100644 index 0000000000..c8705d5052 --- /dev/null +++ b/progs/tests/getteximage.c @@ -0,0 +1,123 @@ +/** + * Test glGetTexImage() + * Brian Paul + * 9 June 2009 + */ + + +#include +#include +#include +#include + +static int Win; + + +static void +TestGetTexImage(void) +{ + GLuint iter; + + for (iter = 0; iter < 20; iter++) { + GLint p = (iter % 6) + 4; + GLint w = (1 << p); + GLint h = (1 << p); + GLubyte data[512*512*4]; + GLubyte data2[512*512*4]; + GLuint i; + GLint level = 0; + + printf("Testing %d x %d tex image\n", w, h); + /* fill data */ + for (i = 0; i < w * h * 4; i++) { + data[i] = i & 0xff; + data2[i] = 0; + } + + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, data); + + glBegin(GL_POINTS); + glVertex2f(0, 0); + glEnd(); + + /* get */ + glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_UNSIGNED_BYTE, data2); + + /* compare */ + for (i = 0; i < w * h * 4; i++) { + if (data2[i] != data[i]) { + printf("Failure!\n"); + abort(); + } + } + } + printf("Passed\n"); + glutDestroyWindow(Win); + exit(0); +} + + +static void +Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + TestGetTexImage(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glEnable(GL_TEXTURE_2D); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 400); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + Init(); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 073c20befa28177cf1276bfb8c75f6638d588580 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 15:05:36 -0600 Subject: tests: also test glGetTexImage with render to texture Also, adjust texture dims for the original test. And use GLEW. --- progs/tests/getteximage.c | 114 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 103 insertions(+), 11 deletions(-) diff --git a/progs/tests/getteximage.c b/progs/tests/getteximage.c index c8705d5052..f0160f5863 100644 --- a/progs/tests/getteximage.c +++ b/progs/tests/getteximage.c @@ -8,6 +8,7 @@ #include #include #include +#include #include static int Win; @@ -17,17 +18,22 @@ static void TestGetTexImage(void) { GLuint iter; + GLubyte *data = (GLubyte *) malloc(1024 * 1024 * 4); + GLubyte *data2 = (GLubyte *) malloc(1024 * 1024 * 4); - for (iter = 0; iter < 20; iter++) { - GLint p = (iter % 6) + 4; + glEnable(GL_TEXTURE_2D); + + printf("glTexImage2D + glGetTexImage:\n"); + + for (iter = 0; iter < 8; iter++) { + GLint p = (iter % 8) + 3; GLint w = (1 << p); GLint h = (1 << p); - GLubyte data[512*512*4]; - GLubyte data2[512*512*4]; GLuint i; GLint level = 0; - printf("Testing %d x %d tex image\n", w, h); + printf(" Testing %d x %d tex image\n", w, h); + /* fill data */ for (i = 0; i < w * h * 4; i++) { data[i] = i & 0xff; @@ -47,17 +53,100 @@ TestGetTexImage(void) /* compare */ for (i = 0; i < w * h * 4; i++) { if (data2[i] != data[i]) { - printf("Failure!\n"); + printf("glTexImage + glGetTexImage failure!\n"); + printf("Expected value %d, found %d\n", data[i], data2[i]); abort(); } } } + printf("Passed\n"); - glutDestroyWindow(Win); - exit(0); + glDisable(GL_TEXTURE_2D); + free(data); + free(data2); +} + + +static GLboolean +ColorsEqual(const GLubyte ref[4], const GLubyte act[4]) +{ + if (abs((int) ref[0] - (int) act[0]) > 1 || + abs((int) ref[1] - (int) act[1]) > 1 || + abs((int) ref[2] - (int) act[2]) > 1 || + abs((int) ref[3] - (int) act[3]) > 1) { + printf("expected %d %d %d %d\n", ref[0], ref[1], ref[2], ref[3]); + printf("found %d %d %d %d\n", act[0], act[1], act[2], act[3]); + return GL_FALSE; + } + return GL_TRUE; } +static void +TestGetTexImageRTT(void) +{ + GLuint iter; + GLuint fb, tex; + GLint w = 512; + GLint h = 256; + GLint level = 0; + + glGenTextures(1, &tex); + glGenFramebuffersEXT(1, &fb); + + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + + glBindFramebuffer(GL_FRAMEBUFFER_EXT, fb); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, tex, level); + + printf("Render to texture + glGetTexImage:\n"); + printf(" Testing %d x %d tex image\n", w, h); + for (iter = 0; iter < 8; iter++) { + GLubyte color[4]; + GLubyte *data2 = (GLubyte *) malloc(w * h * 4); + GLuint i; + + /* random clear color */ + for (i = 0; i < 4; i++) { + color[i] = rand() % 256; + } + + glClearColor(color[0] / 255.0, + color[1] / 255.0, + color[2] / 255.0, + color[3] / 255.0); + + glClear(GL_COLOR_BUFFER_BIT); + + /* get */ + glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_UNSIGNED_BYTE, data2); + + /* compare */ + for (i = 0; i < w * h; i += 4) { + if (!ColorsEqual(color, data2 + i * 4)) { + printf("Render to texture failure!\n"); + abort(); + } + } + + free(data2); + } + + glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); + glDeleteFramebuffersEXT(1, &fb); + glDeleteTextures(1, &tex); + + printf("Passed\n"); +} + + + + static void Draw(void) { @@ -65,6 +154,11 @@ Draw(void) TestGetTexImage(); + TestGetTexImageRTT(); + + glutDestroyWindow(Win); + exit(0); + glutSwapBuffers(); } @@ -100,9 +194,6 @@ Key(unsigned char key, int x, int y) static void Init(void) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEnable(GL_TEXTURE_2D); } @@ -114,6 +205,7 @@ main(int argc, char *argv[]) glutInitWindowSize(400, 400); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Draw); -- cgit v1.2.3 From 29c79a03a42365b4bf828c81ab8676e3e42cfbaf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 15:06:41 -0600 Subject: tests: check for GL_EXT/ARB_framebuffer_object --- progs/tests/getteximage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/progs/tests/getteximage.c b/progs/tests/getteximage.c index f0160f5863..e4818a8fab 100644 --- a/progs/tests/getteximage.c +++ b/progs/tests/getteximage.c @@ -154,7 +154,9 @@ Draw(void) TestGetTexImage(); - TestGetTexImageRTT(); + if (glutExtensionSupported("GL_EXT_framebuffer_object") || + glutExtensionSupported("GL_ARB_framebuffer_object")) + TestGetTexImageRTT(); glutDestroyWindow(Win); exit(0); -- cgit v1.2.3 From a03b349153660e449daf4f56d750f1caef23b1a5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 15:07:39 -0600 Subject: i965: added intelFlush() call in intel_get_tex_image() Fixes the render-to-texture test in progs/tests/getteximage.c --- src/mesa/drivers/dri/intel/intel_tex_image.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 7339015d75..e9a3823078 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -628,6 +628,12 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); + /* If we're reading from a texture that has been rendered to, need to + * make sure rendering is complete. + * We could probably predicate this on texObj->_RenderToTexture + */ + intelFlush(ctx); + /* Map */ if (intelImage->mt) { /* Image is stored in hardware format in a buffer managed by the -- cgit v1.2.3 From 2d57e9640819c7889304d1de9dd5500a1a0f66de Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 5 Jun 2009 15:14:15 +0000 Subject: intel: Fix intel_region_unmap to do unmap, not map. Thanks to Shuang He for catching this. --- src/mesa/drivers/dri/intel/intel_regions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index fd9bf7b174..49bcb3c1dd 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -132,7 +132,7 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region) _DBG("%s %p\n", __FUNCTION__, region); if (!--region->map_refcount) { if (intel->intelScreen->kernel_exec_fencing) - drm_intel_gem_bo_map_gtt(region->buffer); + drm_intel_gem_bo_unmap_gtt(region->buffer); else dri_bo_unmap(region->buffer); region->map = NULL; -- cgit v1.2.3 From 13624848401679f7ee904aa731d520792a5e523e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Jun 2009 00:52:21 +0000 Subject: intel: Base tri clearing depth on Y tiling, not IS_I965(). Y tiling is why the 965 check was there, but I wanted to experiment with Y on pre-965 as well. --- src/mesa/drivers/dri/intel/intel_clear.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 4dfaee8a4a..309ac1923b 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -53,6 +53,7 @@ #include "intel_clear.h" #include "intel_fbo.h" #include "intel_pixel.h" +#include "intel_regions.h" #define FILE_DEBUG_FLAG DEBUG_BLIT @@ -312,7 +313,6 @@ static const char *buffer_names[] = { static void intelClear(GLcontext *ctx, GLbitfield mask) { - struct intel_context *intel = intel_context(ctx); const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); GLbitfield tri_mask = 0; GLbitfield blit_mask = 0; @@ -340,7 +340,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) = intel_get_rb_region(fb, BUFFER_STENCIL); if (stencilRegion) { /* have hw stencil */ - if (IS_965(intel->intelScreen->deviceID) || + if (stencilRegion->tiling == I915_TILING_Y || (ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { /* We have to use the 3D engine if we're clearing a partial mask * of the stencil buffer, or if we're on a 965 which has a tiled @@ -357,9 +357,10 @@ intelClear(GLcontext *ctx, GLbitfield mask) /* HW depth */ if (mask & BUFFER_BIT_DEPTH) { + const struct intel_region *irb = intel_get_rb_region(fb, BUFFER_DEPTH); + /* clear depth with whatever method is used for stencil (see above) */ - if (IS_965(intel->intelScreen->deviceID) || - tri_mask & BUFFER_BIT_STENCIL) + if (irb->tiling == I915_TILING_Y || tri_mask & BUFFER_BIT_STENCIL) tri_mask |= BUFFER_BIT_DEPTH; else blit_mask |= BUFFER_BIT_DEPTH; -- cgit v1.2.3 From 38eddf04ed04966db09b67de4cdabef681dc2696 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Jun 2009 07:22:00 +0000 Subject: intel: Remove an unneeded hunk that slipped in with texture tiling. intel_miptree_pitch_align does this later on. --- src/mesa/drivers/dri/intel/intel_tex_layout.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index b8be7ef41a..2c1b722b7f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -88,11 +88,6 @@ void i945_miptree_layout_2d( struct intel_context *intel, if (mip1_width > mt->pitch) { mt->pitch = mip1_width; - - if (tiling == I915_TILING_X) - mt->pitch = ALIGN(mt->pitch * mt->cpp, 512) / mt->cpp; - if (tiling == I915_TILING_Y) - mt->pitch = ALIGN(mt->pitch * mt->cpp, 128) / mt->cpp; } } -- cgit v1.2.3 From b30dc2c66aeaad6661eef515a08a3da89aa07cb2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 9 Jun 2009 16:12:43 -0700 Subject: i915: Add an option for testing the effect of early Z in classic mode. The early Z stuff is supposed to be unsafe without some more work in the enable/disable path (in particular, how do we want to get it disabled on the way out to the X Server?), but at the moment is 6% in OA. --- src/mesa/drivers/dri/i915/i915_reg.h | 1 + src/mesa/drivers/dri/i915/i915_vtbl.c | 9 +++++++++ src/mesa/drivers/dri/intel/intel_context.c | 1 + src/mesa/drivers/dri/intel/intel_context.h | 1 + src/mesa/drivers/dri/intel/intel_screen.c | 6 +++++- 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h index b02e2c7628..84db58ea95 100644 --- a/src/mesa/drivers/dri/i915/i915_reg.h +++ b/src/mesa/drivers/dri/i915/i915_reg.h @@ -141,6 +141,7 @@ /* p161 */ #define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16)) /* Dword 1 */ +#define CLASSIC_EARLY_DEPTH (1<<31) #define TEX_DEFAULT_COLOR_OGL (0<<30) #define TEX_DEFAULT_COLOR_D3D (1<<30) #define ZR_EARLY_DEPTH (1<<29) diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 6ecbc4709b..2fca247af1 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -42,6 +42,7 @@ #include "intel_regions.h" #include "intel_tris.h" #include "intel_fbo.h" +#include "intel_chipset.h" #include "i915_reg.h" #include "i915_context.h" @@ -611,6 +612,14 @@ i915_state_draw_region(struct intel_context *intel, } } + /* This isn't quite safe, thus being hidden behind an option. When changing + * the value of this bit, the pipeline needs to be MI_FLUSHed. And it + * can only be set when a depth buffer is already defined. + */ + if (IS_945(intel->intelScreen->deviceID) && intel->use_early_z && + depth_region->tiling != I915_TILING_NONE) + value |= CLASSIC_EARLY_DEPTH; + if (depth_region && depth_region->cpp == 4) { value |= DEPTH_FRMT_24_FIXED_8_OTHER; } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 3a94843993..f88b37d0f3 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -729,6 +729,7 @@ intelInitContext(struct intel_context *intel, } intel->use_texture_tiling = driQueryOptionb(&intel->optionCache, "texture_tiling"); + intel->use_early_z = driQueryOptionb(&intel->optionCache, "early_z"); intel->prim.primitive = ~0; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 4e45f1a91f..7d3c80bb21 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -306,6 +306,7 @@ struct intel_context GLboolean is_front_buffer_rendering; GLboolean use_texture_tiling; + GLboolean use_early_z; drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */ diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 53782c5604..8da96ede64 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -75,6 +75,10 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_TEXTURE_TILING(true) #endif + DRI_CONF_OPT_BEGIN(early_z, bool, false) + DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") + DRI_CONF_OPT_END + DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_FORCE_S3TC_ENABLE(false) @@ -87,7 +91,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 9; +const GLuint __driNConfigOptions = 10; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -- cgit v1.2.3 From 1b334587e998ea84fd0fa9276e3373e3ecef1e5b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 10 Jun 2009 11:56:38 +0200 Subject: trace: __func__ --> __FUNCTION__. --- src/gallium/drivers/trace/tr_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 24e4e3e09b..4ab718f233 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -125,7 +125,7 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) } else if ((tr_ctx->draw_rule.blocker & flag) && (tr_ctx->draw_blocker & 4)) { boolean block = FALSE; - debug_printf("%s (%lu %lu) (%lu %lu) (%lu %u) (%lu %u)\n", __func__, + debug_printf("%s (%lu %lu) (%lu %lu) (%lu %u) (%lu %u)\n", __FUNCTION__, tr_ctx->draw_rule.fs, tr_ctx->curr.fs, tr_ctx->draw_rule.vs, tr_ctx->curr.vs, tr_ctx->draw_rule.surf, 0, -- cgit v1.2.3 From 03760a3903028759032efe9806ea39804db7fba0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 10 Jun 2009 12:01:13 +0200 Subject: winsys/gdi: Link to ws2_32 library. --- src/gallium/winsys/gdi/SConscript | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/winsys/gdi/SConscript b/src/gallium/winsys/gdi/SConscript index aabab95f3a..86eb9ef55e 100644 --- a/src/gallium/winsys/gdi/SConscript +++ b/src/gallium/winsys/gdi/SConscript @@ -15,6 +15,7 @@ if env['platform'] == 'windows': 'gdi32', 'user32', 'kernel32', + 'ws2_32', ]) sources = [ -- cgit v1.2.3 From d9617deb008b75f4a605a30408aeb1948139c33e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 10 Jun 2009 12:15:13 +0200 Subject: glsl: Fix symbol replacement handling in preprocessor. --- src/mesa/shader/slang/slang_preprocess.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index f9390f7504..15cd1ece7d 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1012,8 +1012,6 @@ preprocess_source (slang_string *output, const char *source, case TOKEN_DEFINE: { pp_symbol *symbol = NULL; - slang_string replacement; - expand_state es; /* Parse macro name. */ id = (const char *) (&prod[i]); @@ -1055,21 +1053,25 @@ preprocess_source (slang_string *output, const char *source, id = (const char *) (&prod[i]); idlen = _mesa_strlen (id); if (state.cond.top->effective) { + slang_string replacement; + expand_state es; + pp_annotate (output, ") %s", id); - } - slang_string_init(&replacement); - slang_string_pushs(&replacement, id, idlen); - i += idlen + 1; - /* Expand macro replacement. */ - es.output = &symbol->replacement; - es.input = slang_string_cstr(&replacement); - es.state = &state; - if (!expand(&es, &state.symbols)) { + slang_string_init(&replacement); + slang_string_pushs(&replacement, id, idlen); + + /* Expand macro replacement. */ + es.output = &symbol->replacement; + es.input = slang_string_cstr(&replacement); + es.state = &state; + if (!expand(&es, &state.symbols)) { + slang_string_free(&replacement); + goto error; + } slang_string_free(&replacement); - goto error; } - slang_string_free(&replacement); + i += idlen + 1; } break; -- cgit v1.2.3 From cb549775a577cc5c86fefdc7e208b9d5e1d25217 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 09:14:38 -0600 Subject: glsl: Expand nested preprocessor macros. (cherry picked from master, commit ef8caec29ae73bb2bbeb48f0578d839ef29348cd) --- src/mesa/shader/slang/slang_preprocess.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index fd98fae360..0e95cdb525 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1012,6 +1012,8 @@ preprocess_source (slang_string *output, const char *source, case TOKEN_DEFINE: { pp_symbol *symbol = NULL; + slang_string replacement; + expand_state es; /* Parse macro name. */ id = (const char *) (&prod[i]); @@ -1054,9 +1056,20 @@ preprocess_source (slang_string *output, const char *source, idlen = _mesa_strlen (id); if (state.cond.top->effective) { pp_annotate (output, ") %s", id); - slang_string_pushs (&symbol->replacement, id, idlen); } + slang_string_init(&replacement); + slang_string_pushs(&replacement, id, idlen); i += idlen + 1; + + /* Expand macro replacement. */ + es.output = &symbol->replacement; + es.input = slang_string_cstr(&replacement); + es.state = &state; + if (!expand(&es, &state.symbols)) { + slang_string_free(&replacement); + goto error; + } + slang_string_free(&replacement); } break; -- cgit v1.2.3 From 9192347443bc3db9ebeb4b5cc090133b63396b04 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 9 Jun 2009 16:35:55 +0100 Subject: stw: ignore swapbuffer requests on singlebuffer Return TRUE in this case. Returning FALSE seems to result in mis-rendering -- possibly opengl32.dll is trying to compensate by doing a software blit?? --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index f27f4cda21..a601fc5646 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -380,6 +380,9 @@ stw_swap_buffers( if (fb == NULL) return FALSE; + if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) + return TRUE; + pipe_mutex_lock( fb->mutex ); /* If we're swapping the buffer associated with the current context -- cgit v1.2.3 From 76a1017e978f8e51114d765c8c98ff25da13042b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 9 Jun 2009 18:32:18 +0100 Subject: mesa/st: fix tracking of mapped buffer ranges In st_bufferobj_map_range(), set obj->Offset consistently with its usage elsewhere. --- src/mesa/state_tracker/st_cb_bufferobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index fbe6aa25de..19a0e67362 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -250,7 +250,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, map = obj->Pointer = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags); if(obj->Pointer) { - obj->Offset = 0; + obj->Offset = offset; obj->Length = length; map += offset; } -- cgit v1.2.3 From 316598b96f07a38752c0c0f534feb025ee2a3235 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 10 Jun 2009 14:59:33 +0200 Subject: r300: make sure indexed rendering doesn't try to use more than the num of vertices When with memory manager we need to make sure the GPU won't try to access beyond vertex buffer size, do so by enforcing that the maximun index is the last vertex of the buffer. --- src/mesa/drivers/dri/r300/r300_render.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index dfbd79a389..c2c532a9a8 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -351,6 +351,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int vertex_count, int type) void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) { r300ContextPtr rmesa = R300_CONTEXT(ctx); + BATCH_LOCALS(&rmesa->radeon); int type, num_verts; type = r300PrimitiveType(rmesa, prim); @@ -384,6 +385,12 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) */ r300EmitElts(ctx, num_verts); r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start); + if (rmesa->radeon.radeonScreen->kernel_mm) { + BEGIN_BATCH_NO_AUTOSTATE(2); + OUT_BATCH_REGSEQ(R300_VAP_VF_MAX_VTX_INDX, 1); + OUT_BATCH(num_verts); + END_BATCH(); + } r300FireEB(rmesa, num_verts, type); } else { r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start); -- cgit v1.2.3 From aebc08b5ccc6ac2a7c6673e93c63b097c7734e6d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 11:10:09 -0600 Subject: gallium: updated PIPE_CAP_x comments --- src/gallium/include/pipe/p_defines.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 47c24f3086..9924046cb2 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -273,9 +273,8 @@ enum pipe_transfer_usage { /** - * Implementation capabilities/limits - * Passed to pipe->get_param() - * XXX this will need some fine tuning... + * Implementation capabilities/limits which are queried through + * pipe_screen::get_param() and pipe_screen::get_paramf(). */ #define PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS 1 #define PIPE_CAP_NPOT_TEXTURES 2 -- cgit v1.2.3 From 8bfbb7ec8b978d4b56ad6be7dca0290a96e91e6a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 15:31:12 +0100 Subject: gallium: Shorthand functions for computing stride and sizes for a rect. --- src/gallium/include/pipe/p_format.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index a279eefef9..187377f92a 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -536,6 +536,18 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height); } +static INLINE size_t +pf_get_stride(const struct pipe_format_block *block, unsigned width) +{ + return pf_get_nblocksx(block, width)*block->size; +} + +static INLINE size_t +pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height) +{ + return pf_get_nblocksy(block, height)*stride; +} + static INLINE boolean pf_is_depth_stencil( enum pipe_format format ) { -- cgit v1.2.3 From 52411a1951da10bebc439a30c02c7ca99bc27c9c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 15:39:02 +0100 Subject: mesa: Pure software accum buffer. The existing implementation was already implemented on software, but relied on the pipe driver to always support the R16G16B16A16_SNORM format. This patch eliminates that, without prejudice against a future hardware-only implementation. It also avoids some of the short <-> float conversions, and only does a read transfer of the color buffer on GL_RETURN if absolutely necessary. --- src/mesa/state_tracker/st_cb_accum.c | 244 +++++++++++++------------------- src/mesa/state_tracker/st_cb_fbo.c | 147 +++++++++---------- src/mesa/state_tracker/st_cb_fbo.h | 13 +- src/mesa/state_tracker/st_framebuffer.c | 17 +-- 4 files changed, 187 insertions(+), 234 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 7f793cf08d..95181578f6 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -48,10 +48,6 @@ #include "util/u_tile.h" -#define UNCLAMPED_FLOAT_TO_SHORT(us, f) \ - us = ( (short) ( CLAMP((f), -1.0, 1.0) * 32767.0F) ) - - /** * For hardware that supports deep color buffers, we could accelerate * most/all the accum operations with blending/texturing. @@ -59,74 +55,20 @@ */ -/** - * Wrapper for pipe_get_tile_rgba(). Do format/cpp override to make the - * tile util function think the surface is 16bit/channel, even if it's not. - * See also: st_renderbuffer_alloc_storage() - */ -static void -acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt, - uint x, uint y, uint w, uint h, float *p) -{ - const enum pipe_format f = acc_pt->format; - const struct pipe_format_block b = acc_pt->block; - - acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT; - acc_pt->block.size = 8; - acc_pt->block.width = 1; - acc_pt->block.height = 1; - - pipe_get_tile_rgba(acc_pt, x, y, w, h, p); - - acc_pt->format = f; - acc_pt->block = b; -} - - -/** - * Wrapper for pipe_put_tile_rgba(). Do format/cpp override to make the - * tile util function think the surface is 16bit/channel, even if it's not. - * See also: st_renderbuffer_alloc_storage() - */ -static void -acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_transfer *acc_pt, - uint x, uint y, uint w, uint h, const float *p) -{ - enum pipe_format f = acc_pt->format; - const struct pipe_format_block b = acc_pt->block; - - acc_pt->format = DEFAULT_ACCUM_PIPE_FORMAT; - acc_pt->block.size = 8; - acc_pt->block.width = 1; - acc_pt->block.height = 1; - - pipe_put_tile_rgba(acc_pt, x, y, w, h, p); - - acc_pt->format = f; - acc_pt->block = b; -} - - - void st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *acc_strb = st_renderbuffer(rb); - struct pipe_transfer *acc_pt; - struct pipe_screen *screen = ctx->st->pipe->screen; const GLint xpos = ctx->DrawBuffer->_Xmin; const GLint ypos = ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - xpos; const GLint height = ctx->DrawBuffer->_Ymax - ypos; - GLubyte *map; - - acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture, - 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); - map = screen->transfer_map(screen, acc_pt); + size_t stride = acc_strb->stride; + GLubyte *data = acc_strb->data; - /* note acc_strb->format might not equal acc_pt->format */ + if(!data) + return; + switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { @@ -136,7 +78,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]); int i, j; for (i = 0; i < height; i++) { - GLshort *dst = (GLshort *) (map + i * acc_pt->stride + xpos * 8); + GLshort *dst = (GLshort *) (data + (ypos + i) * stride + xpos * 8); for (j = 0; j < width; j++) { dst[0] = r; dst[1] = g; @@ -150,9 +92,6 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) default: _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()"); } - - screen->transfer_unmap(screen, acc_pt); - screen->tex_transfer_destroy(acc_pt); } @@ -162,27 +101,18 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb) { - struct pipe_screen *screen = ctx->st->pipe->screen; - struct pipe_transfer *acc_pt; - GLubyte *map; - - acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ_WRITE, - xpos, ypos, - width, height); - map = screen->transfer_map(screen, acc_pt); - - /* note acc_strb->format might not equal acc_pt->format */ + size_t stride = acc_strb->stride; + GLubyte *data = acc_strb->data; + switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { int i, j; for (i = 0; i < height; i++) { - GLshort *acc = (GLshort *) (map + (ypos + i) * acc_pt->stride + xpos * 8); + GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8); for (j = 0; j < width * 4; j++) { - float val = SHORT_TO_FLOAT(acc[j]) * scale + bias; - acc[j] = FLOAT_TO_SHORT(val); + float val = SHORT_TO_FLOAT(*acc) * scale + bias; + *acc++ = FLOAT_TO_SHORT(val); } } } @@ -190,9 +120,6 @@ accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, default: _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - - screen->transfer_unmap(screen, acc_pt); - screen->tex_transfer_destroy(acc_pt); } @@ -204,39 +131,39 @@ accum_accum(struct st_context *st, GLfloat value, { struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_transfer *acc_trans, *color_trans; - GLfloat *colorBuf, *accBuf; - GLint i; - - acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); + struct pipe_transfer *color_trans; + size_t stride = acc_strb->stride; + GLubyte *data = acc_strb->data; + GLfloat *buf; color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, width, height); - colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_trans, 0, 0, width, height, colorBuf); - acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf); + pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); - for (i = 0; i < 4 * width * height; i++) { - accBuf[i] = accBuf[i] + colorBuf[i] * value; + switch (acc_strb->format) { + case PIPE_FORMAT_R16G16B16A16_SNORM: + { + const GLfloat *color = buf; + int i, j; + for (i = 0; i < height; i++) { + GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8); + for (j = 0; j < width * 4; j++) { + float val = *color++ * value; + *acc++ += FLOAT_TO_SHORT(val); + } + } + } + break; + default: + _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - screen->tex_transfer_destroy(acc_trans); - acc_trans = st_no_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); - - acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf); - - _mesa_free(colorBuf); - _mesa_free(accBuf); - screen->tex_transfer_destroy(acc_trans); + _mesa_free(buf); screen->tex_transfer_destroy(color_trans); } @@ -249,13 +176,10 @@ accum_load(struct st_context *st, GLfloat value, { struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_transfer *acc_trans, *color_trans; + struct pipe_transfer *color_trans; + size_t stride = acc_strb->stride; + GLubyte *data = acc_strb->data; GLfloat *buf; - GLint i; - - acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, xpos, ypos, - width, height); color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, 0, 0, 0, @@ -266,14 +190,25 @@ accum_load(struct st_context *st, GLfloat value, pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); - for (i = 0; i < 4 * width * height; i++) { - buf[i] = buf[i] * value; + switch (acc_strb->format) { + case PIPE_FORMAT_R16G16B16A16_SNORM: + { + const GLfloat *color = buf; + int i, j; + for (i = 0; i < height; i++) { + GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8); + for (j = 0; j < width * 4; j++) { + float val = *color++ * value; + *acc++ = FLOAT_TO_SHORT(val); + } + } + } + break; + default: + _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, buf); - _mesa_free(buf); - screen->tex_transfer_destroy(acc_trans); screen->tex_transfer_destroy(color_trans); } @@ -287,48 +222,58 @@ accum_return(GLcontext *ctx, GLfloat value, struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; const GLubyte *colormask = ctx->Color.ColorMask; - struct pipe_transfer *acc_trans, *color_trans; - GLfloat *abuf, *cbuf = NULL; - GLint i, ch; - - abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + enum pipe_transfer_usage usage; + struct pipe_transfer *color_trans; + size_t stride = acc_strb->stride; + const GLubyte *data = acc_strb->data; + GLfloat *buf; - acc_trans = st_cond_flush_get_tex_transfer(st_context(ctx), - acc_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ, xpos, ypos, - width, height); + buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) + usage = PIPE_TRANSFER_READ_WRITE; + else + usage = PIPE_TRANSFER_WRITE; + color_trans = st_cond_flush_get_tex_transfer(st_context(ctx), color_strb->texture, 0, 0, 0, - PIPE_TRANSFER_READ_WRITE, + usage, xpos, ypos, width, height); - acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf); - - if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) { - cbuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); - pipe_get_tile_rgba(color_trans, 0, 0, width, height, cbuf); - } + if (usage != PIPE_TRANSFER_WRITE) + pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); - for (i = 0; i < width * height; i++) { - for (ch = 0; ch < 4; ch++) { - if (colormask[ch]) { - GLfloat val = abuf[i * 4 + ch] * value; - abuf[i * 4 + ch] = CLAMP(val, 0.0f, 1.0f); - } - else { - abuf[i * 4 + ch] = cbuf[i * 4 + ch]; + switch (acc_strb->format) { + case PIPE_FORMAT_R16G16B16A16_SNORM: + { + GLfloat *color = buf; + int i, j, ch; + for (i = 0; i < height; i++) { + const GLshort *acc = (const GLshort *) (data + (ypos + i) * stride + xpos * 8); + for (j = 0; j < width; j++) { + for (ch = 0; ch < 4; ch++) { + if (colormask[ch]) { + GLfloat val = SHORT_TO_FLOAT(*acc * value); + *color = CLAMP(val, 0.0f, 1.0f); + } + else { + /* No change */ + } + ++acc; + ++color; + } + } } } + break; + default: + _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } - pipe_put_tile_rgba(color_trans, 0, 0, width, height, abuf); + pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf); - _mesa_free(abuf); - if (cbuf) - _mesa_free(cbuf); - screen->tex_transfer_destroy(acc_trans); + _mesa_free(buf); screen->tex_transfer_destroy(color_trans); } @@ -347,6 +292,9 @@ st_Accum(GLcontext *ctx, GLenum op, GLfloat value) const GLint width = ctx->DrawBuffer->_Xmax - xpos; const GLint height = ctx->DrawBuffer->_Ymax - ypos; + if(!acc_strb->data) + return; + /* make sure color bufs aren't cached */ st_flush( st, PIPE_FLUSH_RENDER_CACHE, NULL ); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index e003b6db5c..21ddf2fc7a 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -88,91 +88,90 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, { struct pipe_context *pipe = ctx->st->pipe; struct st_renderbuffer *strb = st_renderbuffer(rb); - struct pipe_texture template; - unsigned surface_usage; - - /* Free the old surface and texture - */ - pipe_surface_reference( &strb->surface, NULL ); - pipe_texture_reference( &strb->texture, NULL ); - - /* Setup new texture template. - */ - memset(&template, 0, sizeof(template)); - template.target = PIPE_TEXTURE_2D; - if (strb->format != PIPE_FORMAT_NONE) { - template.format = strb->format; - } - else { - template.format = st_choose_renderbuffer_format(pipe, internalFormat); - } - pf_get_block(template.format, &template.block); - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; - template.last_level = 0; - template.nr_samples = rb->NumSamples; - if (pf_is_depth_stencil(template.format)) { - template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; - } - else { - template.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET | - PIPE_TEXTURE_USAGE_RENDER_TARGET); - } + enum pipe_format format; + if (strb->format != PIPE_FORMAT_NONE) + format = strb->format; + else + format = st_choose_renderbuffer_format(pipe, internalFormat); + /* init renderbuffer fields */ strb->Base.Width = width; strb->Base.Height = height; - init_renderbuffer_bits(strb, template.format); - - /* Probably need dedicated flags for surface usage too: - */ - surface_usage = (PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); -#if 0 - PIPE_BUFFER_USAGE_CPU_READ | - PIPE_BUFFER_USAGE_CPU_WRITE); -#endif - - strb->texture = pipe->screen->texture_create( pipe->screen, - &template ); + init_renderbuffer_bits(strb, format); + + if(strb->software) { + struct pipe_format_block block; + size_t size; + + _mesa_free(strb->data); + + assert(strb->format != PIPE_FORMAT_NONE); + pf_get_block(strb->format, &block); + + strb->stride = pf_get_stride(&block, width); + size = pf_get_2d_size(&block, strb->stride, height); + + strb->data = _mesa_malloc(size); + + return strb->data != NULL; + } + else { + struct pipe_texture template; + unsigned surface_usage; + + /* Free the old surface and texture + */ + pipe_surface_reference( &strb->surface, NULL ); + pipe_texture_reference( &strb->texture, NULL ); - /* Special path for accum buffers. - * - * Try a different surface format. Since accum buffers are s/w - * only for now, the surface pixel format doesn't really matter, - * only that the buffer is large enough. - */ - if (!strb->texture && template.format == DEFAULT_ACCUM_PIPE_FORMAT) - { - /* Actually, just setting this usage value should be sufficient - * to tell the driver to go ahead and allocate the buffer, even - * if HW doesn't support the format. + /* Setup new texture template. + */ + memset(&template, 0, sizeof(template)); + template.target = PIPE_TEXTURE_2D; + template.format = format; + pf_get_block(format, &template.block); + template.width[0] = width; + template.height[0] = height; + template.depth[0] = 1; + template.last_level = 0; + template.nr_samples = rb->NumSamples; + if (pf_is_depth_stencil(format)) { + template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + } + else { + template.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET | + PIPE_TEXTURE_USAGE_RENDER_TARGET); + } + + /* Probably need dedicated flags for surface usage too: */ - template.tex_usage = 0; - surface_usage = (PIPE_BUFFER_USAGE_CPU_READ | + surface_usage = (PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); +#if 0 + PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE); +#endif strb->texture = pipe->screen->texture_create( pipe->screen, &template ); - } - - if (!strb->texture) - return FALSE; + if (!strb->texture) + return FALSE; - strb->surface = pipe->screen->get_tex_surface( pipe->screen, - strb->texture, - 0, 0, 0, - surface_usage ); + strb->surface = pipe->screen->get_tex_surface( pipe->screen, + strb->texture, + 0, 0, 0, + surface_usage ); - assert(strb->surface->texture); - assert(strb->surface->format); - assert(strb->surface->width == width); - assert(strb->surface->height == height); + assert(strb->surface->texture); + assert(strb->surface->format); + assert(strb->surface->width == width); + assert(strb->surface->height == height); - return strb->surface != NULL; + return strb->surface != NULL; + } } @@ -186,6 +185,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) ASSERT(strb); pipe_surface_reference(&strb->surface, NULL); pipe_texture_reference(&strb->texture, NULL); + _mesa_free(strb->data); _mesa_free(strb); } @@ -242,7 +242,7 @@ st_new_renderbuffer(GLcontext *ctx, GLuint name) * renderbuffer). The window system code determines the format. */ struct gl_renderbuffer * -st_new_renderbuffer_fb(enum pipe_format format, int samples) +st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) { struct st_renderbuffer *strb; @@ -256,7 +256,8 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples) strb->Base.ClassID = 0x4242; /* just a unique value */ strb->Base.NumSamples = samples; strb->format = format; - + strb->software = sw; + switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_B8G8R8A8_UNORM: @@ -287,7 +288,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples) strb->Base.InternalFormat = GL_STENCIL_INDEX8_EXT; strb->Base._BaseFormat = GL_STENCIL_INDEX; break; - case DEFAULT_ACCUM_PIPE_FORMAT: /*PIPE_FORMAT_R16G16B16A16_SNORM*/ + case PIPE_FORMAT_R16G16B16A16_SNORM: strb->Base.InternalFormat = GL_RGBA16; strb->Base._BaseFormat = GL_RGBA; break; diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 44fa9fe9a4..9a199550d9 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -30,10 +30,6 @@ #define ST_CB_FBO_H -#define DEFAULT_ACCUM_PIPE_FORMAT PIPE_FORMAT_R16G16B16A16_SNORM - - - /** * Derived renderbuffer class. Just need to add a pointer to the * pipe surface. @@ -45,6 +41,13 @@ struct st_renderbuffer struct pipe_surface *surface; /* temporary view into texture */ enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */ + /** + * Used only when hardware accumulation buffers are not supported. + */ + boolean software; + size_t stride; + void *data; + struct st_texture_object *rtt; /**< GL render to texture's texture */ int rtt_level, rtt_face, rtt_slice; @@ -62,7 +65,7 @@ st_renderbuffer(struct gl_renderbuffer *rb) extern struct gl_renderbuffer * -st_new_renderbuffer_fb(enum pipe_format format, int samples); +st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw); extern void st_init_fbo_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index daaad65cca..331575660d 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -63,20 +63,20 @@ st_create_framebuffer( const __GLcontextModes *visual, /* XXX allocation should only happen in the unusual case it's actually needed */ struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(colorFormat, samples); + = st_new_renderbuffer_fb(colorFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); } if (visual->doubleBufferMode) { struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(colorFormat, samples); + = st_new_renderbuffer_fb(colorFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb); } if (depthFormat == stencilFormat && depthFormat != PIPE_FORMAT_NONE) { /* combined depth/stencil buffer */ struct gl_renderbuffer *depthStencilRb - = st_new_renderbuffer_fb(depthFormat, samples); + = st_new_renderbuffer_fb(depthFormat, samples, FALSE); /* note: bind RB to two attachment points */ _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb); _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, depthStencilRb); @@ -87,34 +87,35 @@ st_create_framebuffer( const __GLcontextModes *visual, if (visual->depthBits == 32) { /* 32-bit depth buffer */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat, samples); + = st_new_renderbuffer_fb(depthFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } else if (visual->depthBits == 24) { /* 24-bit depth buffer, ignore stencil bits */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat, samples); + = st_new_renderbuffer_fb(depthFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } else if (visual->depthBits > 0) { /* 16-bit depth buffer */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat, samples); + = st_new_renderbuffer_fb(depthFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } if (visual->stencilBits > 0) { /* 8-bit stencil */ struct gl_renderbuffer *stencilRb - = st_new_renderbuffer_fb(stencilFormat, samples); + = st_new_renderbuffer_fb(stencilFormat, samples, FALSE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, stencilRb); } } if (visual->accumRedBits > 0) { /* 16-bit/channel accum */ + /* TODO: query the pipe screen for accumulation buffer format support */ struct gl_renderbuffer *accumRb - = st_new_renderbuffer_fb(DEFAULT_ACCUM_PIPE_FORMAT, 0); /* XXX accum isn't multisampled right? */ + = st_new_renderbuffer_fb(PIPE_FORMAT_R16G16B16A16_SNORM, 0, TRUE); _mesa_add_renderbuffer(&stfb->Base, BUFFER_ACCUM, accumRb); } -- cgit v1.2.3 From 978bca8b2a7869e875fc205f29751d31178d2281 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 15:39:34 +0100 Subject: mesa: Single precision constants. --- src/mesa/state_tracker/st_cb_readpixels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 7a4bbf5ce3..86baf3ddef 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -112,7 +112,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, case PIPE_FORMAT_S8Z24_UNORM: if (format == GL_DEPTH_STENCIL) { const uint *src = (uint *) (stmap + srcY * pt->stride); - const GLfloat scale = 1.0 / (0xffffff); + const GLfloat scale = 1.0f / (0xffffff); GLint k; for (k = 0; k < width; k++) { sValues[k] = src[k] >> 24; @@ -130,7 +130,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, case PIPE_FORMAT_Z24S8_UNORM: if (format == GL_DEPTH_STENCIL) { const uint *src = (uint *) (stmap + srcY * pt->stride); - const GLfloat scale = 1.0 / (0xffffff); + const GLfloat scale = 1.0f / (0xffffff); GLint k; for (k = 0; k < width; k++) { sValues[k] = src[k] & 0xff; -- cgit v1.2.3 From 4d16eb5e180734638fac38a8ce88541926f75c21 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 15:39:47 +0100 Subject: util: Single precision constants. --- src/gallium/auxiliary/util/u_gen_mipmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 6fa13a8ce1..ca797486a0 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1385,7 +1385,7 @@ set_vertex_data(struct gen_mipmap_state *ctx, * Not +/-1 to avoid cube face selection ambiguity near the edges, * though that can still sometimes happen with this scale factor... */ - const float scale = 0.9999; + const float scale = 0.9999f; const float sc = (2.0f * st[i][0] - 1.0f) * scale; const float tc = (2.0f * st[i][1] - 1.0f) * scale; -- cgit v1.2.3 From 5450281ff75eab0cccdf7a926aed7e04132d3c95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Jun 2009 11:56:12 -0600 Subject: docs: document GLSL preprocessor fixes --- docs/relnotes-7.5.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index d47b21d827..663626cb05 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -74,6 +74,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0

      Bug fixes

      • Lots of i965 driver bug fixes +
      • Fixed some GLSL preprocessor bugs
      -- cgit v1.2.3 From 6f50c9865d96a704cf47f59c3c21b4686bddf1f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 08:39:10 -0600 Subject: mesa: disable texture unit error check in _mesa_MatrixMode() See comments for details. --- src/mesa/main/matrix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 39b4967a58..ebc3cbd59c 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -160,11 +160,21 @@ _mesa_MatrixMode( GLenum mode ) ctx->CurrentStack = &ctx->ProjectionMatrixStack; break; case GL_TEXTURE: + /* This error check is disabled because if we're called from + * glPopAttrib() when the active texture unit is >= MaxTextureCoordUnits + * we'll generate an unexpected error. + * From the GL_ARB_vertex_shader spec it sounds like we should instead + * do error checking in other places when we actually try to access + * texture matrices beyond MaxTextureCoordUnits. + */ +#if 0 if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid tex unit %d)", ctx->Texture.CurrentUnit); return; } +#endif + ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->TextureMatrixStack)); ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; break; case GL_COLOR: -- cgit v1.2.3 From 506989b20e18be0d2b849ad17710108832040207 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 08:39:58 -0600 Subject: glsl: Fix symbol replacement handling in preprocessor. (cherry picked from master, commit d9617deb008b75f4a605a30408aeb1948139c33e) --- src/mesa/shader/slang/slang_preprocess.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 0e95cdb525..f73400dbc6 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1012,8 +1012,6 @@ preprocess_source (slang_string *output, const char *source, case TOKEN_DEFINE: { pp_symbol *symbol = NULL; - slang_string replacement; - expand_state es; /* Parse macro name. */ id = (const char *) (&prod[i]); @@ -1055,21 +1053,25 @@ preprocess_source (slang_string *output, const char *source, id = (const char *) (&prod[i]); idlen = _mesa_strlen (id); if (state.cond.top->effective) { + slang_string replacement; + expand_state es; + pp_annotate (output, ") %s", id); - } - slang_string_init(&replacement); - slang_string_pushs(&replacement, id, idlen); - i += idlen + 1; - /* Expand macro replacement. */ - es.output = &symbol->replacement; - es.input = slang_string_cstr(&replacement); - es.state = &state; - if (!expand(&es, &state.symbols)) { + slang_string_init(&replacement); + slang_string_pushs(&replacement, id, idlen); + + /* Expand macro replacement. */ + es.output = &symbol->replacement; + es.input = slang_string_cstr(&replacement); + es.state = &state; + if (!expand(&es, &state.symbols)) { + slang_string_free(&replacement); + goto error; + } slang_string_free(&replacement); - goto error; } - slang_string_free(&replacement); + i += idlen + 1; } break; -- cgit v1.2.3 From 88527220e44fd36c317f73e667bc6abebb0af112 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 09:18:22 -0600 Subject: swrast: fix state validation bug for changing program constants Add _NEW_PROGRAM_CONSTANTS to _SWRAST_NEW_DERIVED. This makes sure that we update the fragment shader's constants when state vars (such as point size) changes. Fixes the progs/glsl/points.c demo. --- src/mesa/swrast/s_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index f24f4fc59b..e7c2ace32c 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -289,6 +289,7 @@ _swrast_update_specular_vertex_add(GLcontext *ctx) #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ + _NEW_PROGRAM_CONSTANTS | \ _NEW_TEXTURE | \ _NEW_HINT | \ _NEW_POLYGON ) -- cgit v1.2.3 From cc22620e4b11425997f3bc1fc70f4c88cec22d2e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 10 Jun 2009 19:45:00 +0200 Subject: glsl: Handle continuation characters in preprocessor. --- src/mesa/shader/slang/slang_preprocess.c | 65 +++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 15cd1ece7d..749bb8c0f6 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1300,6 +1300,44 @@ error: } +/* + * Remove the continuation characters from the input string. + * This is the very first step in preprocessing and is effective + * even inside comment blocks. + * If there is a whitespace between a backslash and a newline, + * this is not considered as a line continuation. + */ +GLboolean +_slang_preprocess_backslashes(slang_string *output, + const char *input) +{ + while (*input) { + if (input[0] == '\\') { + /* If a newline follows, eat the backslash and the newline. */ + if (input[1] == '\r') { + if (input[2] == '\n') { + input += 3; + } else { + input += 2; + } + } else if (input[1] == '\n') { + if (input[2] == '\r') { + input += 3; + } else { + input += 2; + } + } else { + /* Leave the backslash alone. */ + slang_string_pushc(output, *input++); + } + } else { + slang_string_pushc(output, *input++); + } + } + return TRUE; +} + + /** * Run preprocessor on source code. * \param extensions indicates which GL extensions are enabled @@ -1319,6 +1357,7 @@ _slang_preprocess_directives(slang_string *output, { grammar pid, eid; GLboolean success; + slang_string without_backslashes; pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn)); if (pid == 0) { @@ -1331,14 +1370,36 @@ _slang_preprocess_directives(slang_string *output, grammar_destroy (pid); return GL_FALSE; } - success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas); + + slang_string_init(&without_backslashes); + success = _slang_preprocess_backslashes(&without_backslashes, input); + + if (0) { + _mesa_printf("Pre-processed shader:\n"); + _mesa_printf("%s", slang_string_cstr(&without_backslashes)); + _mesa_printf("----------------------\n"); + } + + if (success) { + success = preprocess_source(output, + slang_string_cstr(&without_backslashes), + pid, + eid, + elog, + extensions, + pragmas); + } + + slang_string_free(&without_backslashes); grammar_destroy (eid); grammar_destroy (pid); + if (0) { _mesa_printf("Post-processed shader:\n"); - _mesa_printf("%s", output->data); + _mesa_printf("%s", slang_string_cstr(output)); _mesa_printf("----------------------\n"); } + return success; } -- cgit v1.2.3 From 7fdd64ab29576e607434fb8c82ddfa61e8ea6aa8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 12:16:15 -0600 Subject: glsl: fix warnings, update comments, s/TRUE/GL_TRUE/ --- src/mesa/shader/slang/slang_preprocess.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 749bb8c0f6..e9a24cc009 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1300,14 +1300,15 @@ error: } -/* +/** * Remove the continuation characters from the input string. * This is the very first step in preprocessing and is effective * even inside comment blocks. * If there is a whitespace between a backslash and a newline, * this is not considered as a line continuation. + * \return GL_TRUE for success, GL_FALSE otherwise. */ -GLboolean +static GLboolean _slang_preprocess_backslashes(slang_string *output, const char *input) { @@ -1334,7 +1335,7 @@ _slang_preprocess_backslashes(slang_string *output, slang_string_pushc(output, *input++); } } - return TRUE; + return GL_TRUE; } -- cgit v1.2.3 From 9225b67383ee5c5b511b84838fd248b85403bd92 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 12:21:56 -0600 Subject: glsl: Handle continuation characters in preprocessor. (cherry picked from master, commit cc22620e4b11425997f3bc1fc70f4c88cec22d2e) --- src/mesa/shader/slang/slang_preprocess.c | 68 +++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index f73400dbc6..749bb8c0f6 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1300,6 +1300,44 @@ error: } +/* + * Remove the continuation characters from the input string. + * This is the very first step in preprocessing and is effective + * even inside comment blocks. + * If there is a whitespace between a backslash and a newline, + * this is not considered as a line continuation. + */ +GLboolean +_slang_preprocess_backslashes(slang_string *output, + const char *input) +{ + while (*input) { + if (input[0] == '\\') { + /* If a newline follows, eat the backslash and the newline. */ + if (input[1] == '\r') { + if (input[2] == '\n') { + input += 3; + } else { + input += 2; + } + } else if (input[1] == '\n') { + if (input[2] == '\r') { + input += 3; + } else { + input += 2; + } + } else { + /* Leave the backslash alone. */ + slang_string_pushc(output, *input++); + } + } else { + slang_string_pushc(output, *input++); + } + } + return TRUE; +} + + /** * Run preprocessor on source code. * \param extensions indicates which GL extensions are enabled @@ -1319,6 +1357,7 @@ _slang_preprocess_directives(slang_string *output, { grammar pid, eid; GLboolean success; + slang_string without_backslashes; pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn)); if (pid == 0) { @@ -1331,9 +1370,36 @@ _slang_preprocess_directives(slang_string *output, grammar_destroy (pid); return GL_FALSE; } - success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas); + + slang_string_init(&without_backslashes); + success = _slang_preprocess_backslashes(&without_backslashes, input); + + if (0) { + _mesa_printf("Pre-processed shader:\n"); + _mesa_printf("%s", slang_string_cstr(&without_backslashes)); + _mesa_printf("----------------------\n"); + } + + if (success) { + success = preprocess_source(output, + slang_string_cstr(&without_backslashes), + pid, + eid, + elog, + extensions, + pragmas); + } + + slang_string_free(&without_backslashes); grammar_destroy (eid); grammar_destroy (pid); + + if (0) { + _mesa_printf("Post-processed shader:\n"); + _mesa_printf("%s", slang_string_cstr(output)); + _mesa_printf("----------------------\n"); + } + return success; } -- cgit v1.2.3 From dbab657fe7842c9ea5315189f31fb3c7238c0158 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 12:22:36 -0600 Subject: glsl: fix warnings, update comments, s/TRUE/GL_TRUE/ (cherry picked from master, commit 7fdd64ab29576e607434fb8c82ddfa61e8ea6aa8) --- src/mesa/shader/slang/slang_preprocess.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c index 749bb8c0f6..e9a24cc009 100644 --- a/src/mesa/shader/slang/slang_preprocess.c +++ b/src/mesa/shader/slang/slang_preprocess.c @@ -1300,14 +1300,15 @@ error: } -/* +/** * Remove the continuation characters from the input string. * This is the very first step in preprocessing and is effective * even inside comment blocks. * If there is a whitespace between a backslash and a newline, * this is not considered as a line continuation. + * \return GL_TRUE for success, GL_FALSE otherwise. */ -GLboolean +static GLboolean _slang_preprocess_backslashes(slang_string *output, const char *input) { @@ -1334,7 +1335,7 @@ _slang_preprocess_backslashes(slang_string *output, slang_string_pushc(output, *input++); } } - return TRUE; + return GL_TRUE; } -- cgit v1.2.3 From 0a4fcabe4451af6472245e2630f8c8834aa9d351 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 19:58:54 +0100 Subject: mesa: Fix draw_stencil_pixels for PIPE_FORMAT_Z24S8_UNORM. Reversed component order. This fixes glean depthStencil test failures for PIPE_FORMAT_Z24S8_UNORM visuals. --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 89725cfe8d..d92d29e961 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -718,7 +718,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; for (k = 0; k < spanWidth; k++) { - dest[k] = zValues[k] | (sValues[k] << 24); + dest[k] = (zValues[k] << 8) | (sValues[k] & 0xff); } } else { -- cgit v1.2.3 From 8fa8669aeba45d1b57f3cc41429578d55cad378a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 21:25:54 +0100 Subject: mesa: Fix typo in bitmask. --- src/mesa/main/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 332febf91f..01fbe40a03 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -2872,7 +2872,7 @@ extract_uint_indexes(GLuint n, GLuint indexes[], } else { for (i = 0; i < n; i++) - indexes[i] = s[i] & 0xfff; /* lower 8 bits */ + indexes[i] = s[i] & 0xff; /* lower 8 bits */ } } break; -- cgit v1.2.3 From 337f559cd2d98a858719cb963450fef2256e83f7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 10 Jun 2009 21:29:25 +0100 Subject: mesa: Reverse s8z24 into z24s8 as required by EXT_packed_depth_stencil. Actually, after spotting this problem, I realized this is unreachable code. However don't bother to enable this fast path now, given the normal path is working just fine. --- src/mesa/state_tracker/st_cb_readpixels.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 86baf3ddef..ccf1a0b563 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -445,11 +445,16 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } else { - /* untested, but simple: */ + /* XXX: unreachable code -- should be before st_read_stencil_pixels */ assert(format == GL_DEPTH_STENCIL_EXT); for (i = 0; i < height; i++) { + GLuint *zshort = (GLuint *)dst; pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); y += yStep; + /* Reverse into 24/8 */ + for (j = 0; j < width; j++) { + zshort[j] = (zshort[j] << 8) | (zshort[j] >> 24); + } dst += dstStride; } } @@ -472,7 +477,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } else { - /* untested, but simple: */ + /* XXX: unreachable code -- should be before st_read_stencil_pixels */ assert(format == GL_DEPTH_STENCIL_EXT); for (i = 0; i < height; i++) { pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0); -- cgit v1.2.3 From 3885b708fdbb7bbd5dd3a247c41fb9a75ee7c057 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 11 Jun 2009 12:09:10 +0200 Subject: intel: intel_texture_drawpixels() can't handle GL_DEPTH_STENCIL. Fixes glean depthStencil test. --- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 7cda6adb32..46d27f1a93 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -96,7 +96,7 @@ intel_texture_drawpixels(GLcontext * ctx, /* We don't have a way to generate fragments with stencil values which * will set the resulting stencil value. */ - if (format == GL_STENCIL_INDEX) + if (format == GL_STENCIL_INDEX || format == GL_DEPTH_STENCIL) return GL_FALSE; /* Check that we can load in a texture this big. */ -- cgit v1.2.3 From 550a2fe1b70ae8bd3126c19cc41629296936d211 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 11 Jun 2009 12:11:37 +0200 Subject: scons: Indent abbreviated command line strings, so command messages stand out. Also add ASPPCOMSTR. --- scons/gallium.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scons/gallium.py b/scons/gallium.py index 5b3c9752bc..6e924da303 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -42,17 +42,18 @@ import SCons.Scanner def quietCommandLines(env): # Quiet command lines # See also http://www.scons.org/wiki/HidingCommandLinesInOutput - env['ASCOMSTR'] = "Assembling $SOURCE ..." - env['CCCOMSTR'] = "Compiling $SOURCE ..." - env['SHCCCOMSTR'] = "Compiling $SOURCE ..." - env['CXXCOMSTR'] = "Compiling $SOURCE ..." - env['SHCXXCOMSTR'] = "Compiling $SOURCE ..." - env['ARCOMSTR'] = "Archiving $TARGET ..." - env['RANLIBCOMSTR'] = "Indexing $TARGET ..." - env['LINKCOMSTR'] = "Linking $TARGET ..." - env['SHLINKCOMSTR'] = "Linking $TARGET ..." - env['LDMODULECOMSTR'] = "Linking $TARGET ..." - env['SWIGCOMSTR'] = "Generating $TARGET ..." + env['ASCOMSTR'] = " Assembling $SOURCE ..." + env['ASPPCOMSTR'] = " Assembling $SOURCE ..." + env['CCCOMSTR'] = " Compiling $SOURCE ..." + env['SHCCCOMSTR'] = " Compiling $SOURCE ..." + env['CXXCOMSTR'] = " Compiling $SOURCE ..." + env['SHCXXCOMSTR'] = " Compiling $SOURCE ..." + env['ARCOMSTR'] = " Archiving $TARGET ..." + env['RANLIBCOMSTR'] = " Indexing $TARGET ..." + env['LINKCOMSTR'] = " Linking $TARGET ..." + env['SHLINKCOMSTR'] = " Linking $TARGET ..." + env['LDMODULECOMSTR'] = " Linking $TARGET ..." + env['SWIGCOMSTR'] = " Generating $TARGET ..." def createConvenienceLibBuilder(env): -- cgit v1.2.3 From 0d2ac7a10b2904eda70794534a9a73b3f4b654cf Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 11 Jun 2009 00:54:06 +0200 Subject: dri st: Don't require the PIPE_TEXTURE_USAGE_RENDER_TARGET property for depth- and stencil renderbuffers. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/dri/dri_drawable.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 865cc8d0b6..09cd3091d2 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -243,7 +243,6 @@ dri_create_buffer(__DRIscreenPrivate * sPriv, if (visual->depthBits) { if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) depthFormat = PIPE_FORMAT_Z24S8_UNORM; else @@ -254,7 +253,6 @@ dri_create_buffer(__DRIscreenPrivate * sPriv, if (visual->stencilBits) { if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) stencilFormat = PIPE_FORMAT_Z24S8_UNORM; else -- cgit v1.2.3 From b445e5486804581ba4a7d1fce80c3ad2ed773325 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 11 Jun 2009 11:06:14 +0200 Subject: r300: fix indexed primitive rendering when using memory manager --- src/mesa/drivers/dri/r300/r300_render.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index c2c532a9a8..1356305a21 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -364,7 +364,7 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) * This is supposed to ensure that we can get all rendering * commands into a single command buffer. */ - rcommonEnsureCmdBufSpace(&rmesa->radeon, 64, __FUNCTION__); + rcommonEnsureCmdBufSpace(&rmesa->radeon, 128, __FUNCTION__); if (rmesa->ind_buf.ptr) { if (num_verts > 65535) { @@ -388,7 +388,7 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) if (rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH_NO_AUTOSTATE(2); OUT_BATCH_REGSEQ(R300_VAP_VF_MAX_VTX_INDX, 1); - OUT_BATCH(num_verts); + OUT_BATCH(rmesa->radeon.tcl.aos[0].count); END_BATCH(); } r300FireEB(rmesa, num_verts, type); -- cgit v1.2.3 From 96aca15c9d5b6f03fc9b407f02d6966fffeb4f5d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 11:47:20 +0100 Subject: meas: Use a read/write transfer when writing stencil component, but not touching the depth component. --- src/mesa/state_tracker/st_cb_drawpixels.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index d92d29e961..588daf79b2 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -630,6 +630,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct st_renderbuffer *strb; + enum pipe_transfer_usage usage; struct pipe_transfer *pt; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; GLint skipPixels; @@ -642,8 +643,14 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, y = ctx->DrawBuffer->Height - y - height; } + if(format == GL_DEPTH_STENCIL && + pf_get_component_bits( strb->format, PIPE_FORMAT_COMP_Z ) != 0) + usage = PIPE_TRANSFER_READ_WRITE; + else + usage = PIPE_TRANSFER_WRITE; + pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, x, y, + usage, x, y, width, height); stmap = screen->transfer_map(screen, pt); @@ -694,6 +701,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, case PIPE_FORMAT_S8_UNORM: { ubyte *dest = stmap + spanY * pt->stride + spanX; + assert(usage == PIPE_TRANSFER_WRITE); memcpy(dest, sValues, spanWidth); } break; @@ -701,6 +709,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, if (format == GL_DEPTH_STENCIL) { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; + assert(usage == PIPE_TRANSFER_WRITE); for (k = 0; k < spanWidth; k++) { dest[k] = zValues[k] | (sValues[k] << 24); } @@ -708,6 +717,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, else { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; + assert(usage == PIPE_TRANSFER_READ_WRITE); for (k = 0; k < spanWidth; k++) { dest[k] = (dest[k] & 0xffffff) | (sValues[k] << 24); } @@ -717,6 +727,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, if (format == GL_DEPTH_STENCIL) { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; + assert(usage == PIPE_TRANSFER_WRITE); for (k = 0; k < spanWidth; k++) { dest[k] = (zValues[k] << 8) | (sValues[k] & 0xff); } @@ -724,6 +735,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, else { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; + assert(usage == PIPE_TRANSFER_READ_WRITE); for (k = 0; k < spanWidth; k++) { dest[k] = (dest[k] & 0xffffff00) | (sValues[k] & 0xff); } @@ -811,6 +823,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, { struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer); struct pipe_screen *screen = ctx->st->pipe->screen; + enum pipe_transfer_usage usage; struct pipe_transfer *ptDraw; ubyte *drawMap; ubyte *buffer; @@ -827,9 +840,14 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &ctx->DefaultPacking, buffer); + if(pf_get_component_bits( ptDraw->format, PIPE_FORMAT_COMP_Z ) != 0) + usage = PIPE_TRANSFER_READ_WRITE; + else + usage = PIPE_TRANSFER_WRITE; + ptDraw = st_cond_flush_get_tex_transfer(st_context(ctx), rbDraw->texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, dstx, dsty, + usage, dstx, dsty, width, height); assert(ptDraw->block.width == 1); @@ -859,6 +877,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, { uint *dst4 = (uint *) dst; int j; + assert(usage == PIPE_TRANSFER_READ_WRITE); for (j = 0; j < width; j++) { *dst4 = (*dst4 & 0xffffff) | (src[j] << 24); dst4++; @@ -869,6 +888,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, { uint *dst4 = (uint *) dst; int j; + assert(usage == PIPE_TRANSFER_READ_WRITE); for (j = 0; j < width; j++) { *dst4 = (*dst4 & 0xffffff00) | (src[j] & 0xff); dst4++; @@ -876,6 +896,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } break; case PIPE_FORMAT_S8_UNORM: + assert(usage == PIPE_TRANSFER_WRITE); memcpy(dst, src, width); break; default: -- cgit v1.2.3 From 48d816b8fff5d01b8c35bd2f933220e41d976e4c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 12:23:09 +0100 Subject: mesa: Take the format from the right structure. --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 588daf79b2..b674e6b74a 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -840,7 +840,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &ctx->DefaultPacking, buffer); - if(pf_get_component_bits( ptDraw->format, PIPE_FORMAT_COMP_Z ) != 0) + if(pf_get_component_bits( rbDraw->format, PIPE_FORMAT_COMP_Z ) != 0) usage = PIPE_TRANSFER_READ_WRITE; else usage = PIPE_TRANSFER_WRITE; -- cgit v1.2.3 From e3f14f2f3bdd66400d02f0f9076593db609874a8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 13:19:34 +0100 Subject: progs: Port fp programs to GLEW. --- progs/fp/SConscript | 19 ++++++++++++++++--- progs/fp/fp-tri.c | 2 +- progs/fp/point-position.c | 7 ++++--- progs/fp/tri-depth.c | 9 ++++----- progs/fp/tri-depth2.c | 7 ++++--- progs/fp/tri-depthwrite.c | 6 ++++-- progs/fp/tri-depthwrite2.c | 6 ++++-- progs/fp/tri-inv.c | 6 ++++-- progs/fp/tri-param.c | 8 +++++--- progs/fp/tri-tex.c | 6 ++++-- 10 files changed, 50 insertions(+), 26 deletions(-) diff --git a/progs/fp/SConscript b/progs/fp/SConscript index 553799758b..a78318542c 100644 --- a/progs/fp/SConscript +++ b/progs/fp/SConscript @@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [ env.Prepend(LIBS = ['$GLUT_LIB']) -env.Program( - target = 'fp-tri', - source = ['fp-tri.c'], +progs = [ + 'fp-tri', + 'tri-depth', + 'tri-depth2', + 'tri-depthwrite', + 'tri-depthwrite2', + 'tri-inv', + 'tri-param', + 'tri-tex', + 'point-position', +] + +for prog in progs: + env.Program( + target = prog, + source = [prog + '.c'], ) diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 6c15540d38..52a8fcfc22 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -89,7 +89,7 @@ static void Init( void ) } fprintf(stderr, "%.*s\n", sz, buf); - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c index c352a939cb..c0963d7a0b 100644 --- a/progs/fp/point-position.c +++ b/progs/fp/point-position.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -17,7 +16,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -109,6 +108,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c index a1f0579c8e..5488469e80 100644 --- a/progs/fp/tri-depth.c +++ b/progs/fp/tri-depth.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -19,7 +18,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -89,8 +88,6 @@ int main(int argc, char **argv) glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); type = GLUT_RGB; @@ -101,6 +98,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c index f309628283..6ed2307115 100644 --- a/progs/fp/tri-depth2.c +++ b/progs/fp/tri-depth2.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -21,7 +20,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -106,6 +105,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c index fedeec4577..8e4f3e6245 100644 --- a/progs/fp/tri-depthwrite.c +++ b/progs/fp/tri-depthwrite.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -16,7 +16,7 @@ static void Init(void) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -97,6 +97,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c index 5547092ec9..3c0b4d30c9 100644 --- a/progs/fp/tri-depthwrite2.c +++ b/progs/fp/tri-depthwrite2.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -16,7 +16,7 @@ static void Init(void) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -97,6 +97,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c index e902332386..7e8d8c5ce2 100644 --- a/progs/fp/tri-inv.c +++ b/progs/fp/tri-inv.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -17,7 +17,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -99,6 +99,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c index f3e55af3f1..57443d71bd 100644 --- a/progs/fp/tri-param.c +++ b/progs/fp/tri-param.c @@ -2,9 +2,9 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" + static void Init( void ) { @@ -15,7 +15,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -104,6 +104,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c index 87f63894ce..1dbbb201ce 100644 --- a/progs/fp/tri-tex.c +++ b/progs/fp/tri-tex.c @@ -3,7 +3,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include #include "readtex.c" @@ -23,7 +23,7 @@ static void Init( void ) GLuint modulateProg; GLuint Texture; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -120,6 +120,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); -- cgit v1.2.3 From 41cf68153568d4e75ff3cda627293d101f8a8003 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 11 Jun 2009 15:37:53 +0100 Subject: mesa: Only do read write when we don't have a depth value to write --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index b674e6b74a..04cf673f63 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -643,7 +643,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, y = ctx->DrawBuffer->Height - y - height; } - if(format == GL_DEPTH_STENCIL && + if(format != GL_DEPTH_STENCIL && pf_get_component_bits( strb->format, PIPE_FORMAT_COMP_Z ) != 0) usage = PIPE_TRANSFER_READ_WRITE; else -- cgit v1.2.3 From cc09724a50a4cabb68b7c5f5b8d3812d38f65391 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 16:21:00 +0100 Subject: python/tests: Test sampling from a depth texture. --- .../state_trackers/python/tests/texture_sample.py | 223 ++++++++++++++++++++- 1 file changed, 216 insertions(+), 7 deletions(-) diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py index a382424667..06130ea1c9 100755 --- a/src/gallium/state_trackers/python/tests/texture_sample.py +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -99,7 +99,7 @@ def is_pot(n): return n & (n - 1) == 0 -class TextureTest(TestCase): +class TextureColorSampleTest(TestCase): tags = ( 'target', @@ -286,6 +286,206 @@ class TextureTest(TestCase): self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) +class TextureDepthSampleTest(TestCase): + + tags = ( + 'target', + 'format', + 'width', + 'height', + 'depth', + 'last_level', + 'face', + 'level', + 'zslice', + ) + + def test(self): + dev = self.dev + + target = self.target + format = self.format + width = self.width + height = self.height + depth = self.depth + last_level = self.last_level + face = self.face + level = self.level + zslice = self.zslice + + tex_usage = PIPE_TEXTURE_USAGE_SAMPLER + geom_flags = 0 + if width != height: + geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE + if not is_pot(width) or not is_pot(height) or not is_pot(depth): + geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO + + if not dev.is_format_supported(format, target, tex_usage, geom_flags): + raise TestSkip + + ctx = self.dev.context_create() + + # disabled blending/masking + blend = Blend() + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO + blend.colormask = PIPE_MASK_RGBA + ctx.set_blend(blend) + + # depth/stencil/alpha + depth_stencil_alpha = DepthStencilAlpha() + depth_stencil_alpha.depth.enabled = 1 + depth_stencil_alpha.depth.writemask = 1 + depth_stencil_alpha.depth.func = PIPE_FUNC_LESS + ctx.set_depth_stencil_alpha(depth_stencil_alpha) + + # rasterizer + rasterizer = Rasterizer() + rasterizer.front_winding = PIPE_WINDING_CW + rasterizer.cull_mode = PIPE_WINDING_NONE + rasterizer.bypass_vs_clip_and_viewport = 1 + ctx.set_rasterizer(rasterizer) + + # samplers + sampler = Sampler() + sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE + sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE + sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST + sampler.normalized_coords = 1 + sampler.min_lod = 0 + sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1 + ctx.set_sampler(0, sampler) + + # texture + texture = dev.texture_create( + target = target, + format = format, + width = width, + height = height, + depth = depth, + last_level = last_level, + tex_usage = tex_usage, + ) + + expected_rgba = FloatArray(height*width*4) + texture.get_surface( + face = face, + level = level, + zslice = zslice, + ).sample_rgba(expected_rgba) + + ctx.set_sampler_texture(0, texture) + + # framebuffer + cbuf_tex = dev.texture_create( + PIPE_FORMAT_A8R8G8B8_UNORM, + width, + height, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + + zsbuf_tex = dev.texture_create( + PIPE_FORMAT_Z24X8_UNORM, + width, + height, + tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET, + ) + + cbuf = cbuf_tex.get_surface() + zsbuf = zsbuf_tex.get_surface() + fb = Framebuffer() + fb.width = width + fb.height = height + fb.nr_cbufs = 1 + fb.set_cbuf(0, cbuf) + fb.set_zsbuf(zsbuf) + ctx.set_framebuffer(fb) + rgba = FloatArray(4); + rgba[0] = 0.5 + rgba[1] = 0.5 + rgba[2] = 0.5 + rgba[3] = 0.5 + ctx.clear(PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0) + del fb + + # vertex shader + vs = Shader(''' + VERT1.1 + DCL IN[0], POSITION, CONSTANT + DCL IN[1], GENERIC, CONSTANT + DCL OUT[0], POSITION, CONSTANT + DCL OUT[1], GENERIC, CONSTANT + 0:MOV OUT[0], IN[0] + 1:MOV OUT[1], IN[1] + 2:END + ''') + #vs.dump() + ctx.set_vertex_shader(vs) + + # fragment shader + op = { + PIPE_TEXTURE_1D: "1D", + PIPE_TEXTURE_2D: "2D", + PIPE_TEXTURE_3D: "3D", + PIPE_TEXTURE_CUBE: "CUBE", + }[target] + fs = Shader(''' + FRAG1.1 + DCL IN[0], GENERIC[0], LINEAR + DCL SAMP[0], CONSTANT + DCL OUT[0].z, POSITION + 0:TEX OUT[0].z, IN[0], SAMP[0], %s + 1:END + ''' % op) + #fs.dump() + ctx.set_fragment_shader(fs) + + nverts = 4 + nattrs = 2 + verts = FloatArray(nverts * nattrs * 4) + + x = 0 + y = 0 + w, h = minify((width, height), level) + + pos = [ + [x, y], + [x+w, y], + [x+w, y+h], + [x, y+h], + ] + + tex = tex_coords(texture, face, level, zslice) + + for i in range(0, 4): + j = 8*i + verts[j + 0] = pos[i][0] # x + verts[j + 1] = pos[i][1] # y + verts[j + 2] = 0.0 # z + verts[j + 3] = 1.0 # w + verts[j + 4] = tex[i][0] # s + verts[j + 5] = tex[i][1] # r + verts[j + 6] = tex[i][2] # q + verts[j + 7] = 1.0 + + ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN, + nverts, + nattrs, + verts) + + ctx.flush() + + zsbuf = zsbuf_tex.get_surface() + + self.assert_rgba(zsbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85) + + + def main(): dev = Device() @@ -304,11 +504,10 @@ def main(): PIPE_FORMAT_R5G6B5_UNORM, PIPE_FORMAT_A1R5G5B5_UNORM, PIPE_FORMAT_A4R4G4B4_UNORM, - #PIPE_FORMAT_Z32_UNORM, - #PIPE_FORMAT_Z24S8_UNORM, - #PIPE_FORMAT_Z24X8_UNORM, - #PIPE_FORMAT_Z16_UNORM, - #PIPE_FORMAT_S8_UNORM, + PIPE_FORMAT_Z32_UNORM, + PIPE_FORMAT_Z24S8_UNORM, + PIPE_FORMAT_Z24X8_UNORM, + PIPE_FORMAT_Z16_UNORM, PIPE_FORMAT_A8_UNORM, PIPE_FORMAT_L8_UNORM, PIPE_FORMAT_YCBCR, @@ -347,7 +546,17 @@ def main(): for level in range(0, last_level + 1): zslice = 0 while zslice < depth >> level: - test = TextureTest( + if format in ( + PIPE_FORMAT_Z32_UNORM, + PIPE_FORMAT_Z24S8_UNORM, + PIPE_FORMAT_Z24X8_UNORM, + PIPE_FORMAT_Z16_UNORM, + ): + klass = TextureDepthSampleTest + else: + klass = TextureColorSampleTest + + test = klass( dev = dev, target = target, format = format, -- cgit v1.2.3 From 9d5479eeeb84a0a8d909e329b1e8e9888d424900 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Jun 2009 13:00:35 -0600 Subject: vbo: fix assertion, #define IMM_BUFFER_NAME This was sometimes seen when Glean exited upon test failure when using Gallium. --- src/mesa/vbo/vbo_exec_api.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index a8a09859a0..34e849aaab 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -51,6 +51,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #endif +/** ID/name for immediate-mode VBO */ +#define IMM_BUFFER_NAME 0xaabbccdd + + static void reset_attrfv( struct vbo_exec_context *exec ); @@ -665,7 +669,7 @@ void vbo_use_buffer_objects(GLcontext *ctx) /* Any buffer name but 0 can be used here since this bufferobj won't * go into the bufferobj hashtable. */ - GLuint bufName = 0xaabbccdd; + GLuint bufName = IMM_BUFFER_NAME; GLenum target = GL_ARRAY_BUFFER_ARB; GLenum usage = GL_STREAM_DRAW_ARB; GLsizei size = VBO_VERT_BUFFER_SIZE; @@ -734,7 +738,8 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) /* True VBOs should already be unmapped */ if (exec->vtx.buffer_map) { - assert (exec->vtx.bufferobj->Name == 0); + ASSERT(exec->vtx.bufferobj->Name == 0 || + exec->vtx.bufferobj->Name == IMM_BUFFER_NAME); if (exec->vtx.bufferobj->Name == 0) { ALIGN_FREE(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; -- cgit v1.2.3 From bb0b954f1265bd6e50ef1fdade7917863477fa8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Jun 2009 10:40:19 -0600 Subject: st/mesa: fix typo s/BFC0/BFC1/ --- src/mesa/state_tracker/st_atom_shader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index fc1ff5be04..cb869c98a3 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -237,8 +237,8 @@ find_translated_vp(struct st_context *st, } if (emitBFC1) { xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++; - xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR; - xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 1; + xvp->output_to_semantic_name[VERT_RESULT_BFC1] = TGSI_SEMANTIC_COLOR; + xvp->output_to_semantic_index[VERT_RESULT_BFC1] = 1; } /* Unneeded vertex program outputs will go to this slot. -- cgit v1.2.3 From 862c7b8cd34ff5606465b97b09fd5fafda50c33b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 18:50:36 +0100 Subject: mesa: Remove dead code. --- src/mesa/state_tracker/st_cb_drawpixels.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 04cf673f63..2027b713ce 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -769,7 +769,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, struct st_vertex_program *stvp; struct st_context *st = ctx->st; struct pipe_surface *ps; - GLuint bufferFormat; const GLfloat *color; if (format == GL_STENCIL_INDEX || @@ -797,8 +796,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, color = NULL; } - bufferFormat = ps->format; - /* draw with textured quad */ { struct pipe_texture *pt -- cgit v1.2.3 From 7cafd49c936ba9727c3077af8c84afe81b6fa0b4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 18:52:17 +0100 Subject: mesa: Use PIPE_TEXTURE_USAGE_DEPTH_STENCIL for any depth or stencil format. --- src/mesa/state_tracker/st_format.c | 14 +++++++++----- src/mesa/state_tracker/st_format.h | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index d507e3e58d..b243c249e3 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -392,7 +392,7 @@ default_depth_format(struct pipe_screen *screen, * or PIPE_TEXTURE_USAGE_SAMPLER */ enum pipe_format -st_choose_format(struct pipe_context *pipe, GLint internalFormat, +st_choose_format(struct pipe_context *pipe, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage) { struct pipe_screen *screen = pipe->screen; @@ -594,9 +594,13 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat, static GLboolean -is_stencil_format(GLenum format) +is_depth_or_stencil_format(GLenum internalFormat) { - switch (format) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: @@ -614,10 +618,10 @@ is_stencil_format(GLenum format) * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces. */ enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat) +st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) { uint usage; - if (is_stencil_format(internalFormat)) + if (is_depth_or_stencil_format(internalFormat)) usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; else usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 7bbbe2d570..9d9e02fe9b 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -64,11 +64,11 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat); extern enum pipe_format -st_choose_format(struct pipe_context *pipe, GLint internalFormat, +st_choose_format(struct pipe_context *pipe, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage); extern enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat); +st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); extern const struct gl_texture_format * -- cgit v1.2.3 From 3f2e006b759705abd7c409d30f9aeb1f2a75b83f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 18:53:23 +0100 Subject: gallium: New pf_is_depth_and_stencil / pf_is_depth_or_stencil inlines. --- src/gallium/include/pipe/p_format.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 187377f92a..e31538c95f 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -549,12 +549,22 @@ pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned he } static INLINE boolean -pf_is_depth_stencil( enum pipe_format format ) +pf_is_depth_or_stencil( enum pipe_format format ) { return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) + pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0; } +static INLINE boolean +pf_is_depth_and_stencil( enum pipe_format format ) +{ + return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) != 0 && + pf_get_component_bits( format, PIPE_FORMAT_COMP_S ) != 0); +} + +/** DEPRECATED: For backwards compatibility */ +#define pf_is_depth_stencil pf_is_depth_or_stencil + static INLINE boolean pf_is_compressed( enum pipe_format format ) { -- cgit v1.2.3 From de413b1ba9f30771bceacdbc160192d964a1ca63 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 18:53:47 +0100 Subject: mesa: Use new pf_is_depth_and_stencil inline. --- src/mesa/state_tracker/st_cb_clear.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 880e83108c..668acbccb8 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -103,20 +103,6 @@ st_destroy_clear(struct st_context *st) } -static GLboolean -is_depth_stencil_format(enum pipe_format pipeFormat) -{ - switch (pipeFormat) { - case PIPE_FORMAT_S8Z24_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - - /** * Draw a screen-aligned quadrilateral. * Coords are window coords with y=0=bottom. These will be passed @@ -331,7 +317,7 @@ static INLINE GLboolean check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLboolean isDS = is_depth_stencil_format(strb->surface->format); + const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); if (ctx->Scissor.Enabled) return TRUE; @@ -351,7 +337,7 @@ static INLINE GLboolean check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLboolean isDS = is_depth_stencil_format(strb->surface->format); + const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); const GLuint stencilMax = (1 << rb->StencilBits) - 1; const GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; -- cgit v1.2.3 From d5ba39ad08f098f377fd258edb904aa7d64ab434 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 19:05:46 +0100 Subject: wgl: Fix prototype. --- src/gallium/state_trackers/wgl/shared/stw_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c index a601fc5646..58f1830319 100644 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c @@ -45,7 +45,7 @@ #include "stw_tls.h" -struct stw_framebuffer * +static INLINE struct stw_framebuffer * stw_framebuffer_from_hwnd_locked( HWND hwnd ) { -- cgit v1.2.3 From e1700009b7cfc5f9a136649d7fd6e0f13ae4e7ad Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 19:24:48 +0100 Subject: python/retrace: Interpret is_texture_referenced/is_buffer_referenced. --- src/gallium/state_trackers/python/retrace/interpreter.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 5d4d04498b..7374904554 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -577,6 +577,14 @@ class Context(Object): self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count) self._set_dirty() + def is_texture_referenced(self, texture, face, level): + #return self.real.is_texture_referenced(format, texture, face, level) + pass + + def is_buffer_referenced(self, buf): + #return self.real.is_buffer_referenced(format, buf) + pass + def _set_dirty(self): if self.interpreter.options.step: self._present() -- cgit v1.2.3 From 0ddc38309a4ecbe7db4a9e6055d7855d00e6ab7b Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 20:46:07 +0100 Subject: python/retrace: Show the contents of the depth/stencil and surfaces before/after transfers. --- .../state_trackers/python/retrace/interpreter.py | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 7374904554..5885e162c2 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -43,19 +43,27 @@ except ImportError: return struct.unpack(fmt, buf[offset:offset + size]) -def make_image(surface): +def make_image(surface, x=None, y=None, w=None, h=None): + if x is None: + x = 0 + if y is None: + y = 0 + if w is None: + w = surface.width - x + if h is None: + h = surface.height - y data = surface.get_tile_rgba8(0, 0, surface.width, surface.height) import Image outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1) return outimage -def save_image(filename, surface): - outimage = make_image(surface) +def save_image(filename, surface, x=None, y=None, w=None, h=None): + outimage = make_image(surface, x, y, w, h) outimage.save(filename, "PNG") -def show_image(surface, title): - outimage = make_image(surface) +def show_image(surface, title, x=None, y=None, w=None, h=None): + outimage = make_image(surface, x, y, w, h) import Tkinter as tk from PIL import Image, ImageTk @@ -305,7 +313,11 @@ class Screen(Object): def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h): if texture is None: return None - return Transfer(texture.get_surface(face, level, zslice), x, y, w, h) + transfer = Transfer(texture.get_surface(face, level, zslice), x, y, w, h) + if transfer and usage != gallium.PIPE_TRANSFER_WRITE: + if self.interpreter.options.all: + self.interpreter.present(transfer.surface, 'transf_read', x, y, w, h) + return transfer def tex_transfer_destroy(self, transfer): self.interpreter.unregister_object(transfer) @@ -314,6 +326,8 @@ class Screen(Object): if transfer is None: return transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride) + if self.interpreter.options.all: + self.interpreter.present(transfer.surface, 'transf_write', transfer.x, transfer.y, transfer.w, transfer.h) def user_buffer_create(self, data, size): # We don't really care to distinguish between user and regular buffers @@ -610,6 +624,9 @@ class Context(Object): if self.cbufs and self.cbufs[0]: self.interpreter.present(self.cbufs[0], "cbuf") + if self.zsbuf: + if self.interpreter.options.all: + self.interpreter.present(self.zsbuf, "zsbuf") class Interpreter(parser.TraceDumper): @@ -679,16 +696,16 @@ class Interpreter(parser.TraceDumper): def verbosity(self, level): return self.options.verbosity >= level - def present(self, surface, description): + def present(self, surface, description, x=None, y=None, w=None, h=None): if self.call_no < self.options.start: return if self.options.images: - filename = '%s_%04u.png' % (description, self.call_no) - save_image(filename, surface) + filename = '%04u_%s.png' % (self.call_no, description) + save_image(filename, surface, x, y, w, h) else: title = '%u. %s' % (self.call_no, description) - show_image(surface, title) + show_image(surface, title, x, y, w, h) class Main(parser.Main): @@ -698,6 +715,7 @@ class Main(parser.Main): optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages") optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level") optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them") + optparser.add_option("-a", "--all", action="store_true", dest="all", default=False, help="show depth, stencil, and transfers") optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw") optparser.add_option("-f", "--from", action="store", type="int", dest="start", default=0, help="from call no") optparser.add_option("-t", "--to", action="store", type="int", dest="stop", default=0, help="until call no") -- cgit v1.2.3 From 322e8556b91ceb80d4a53129cbb5db99087085f1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Jun 2009 14:55:14 -0600 Subject: mesa: add default function for ctx->Driver.CheckQuery() hook --- src/mesa/drivers/common/driverfuncs.c | 1 + src/mesa/main/queryobj.c | 16 +++++++++++++++- src/mesa/main/queryobj.h | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 276da41f4e..6a98c29a3d 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -231,6 +231,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->BeginQuery = _mesa_begin_query; driver->EndQuery = _mesa_end_query; driver->WaitQuery = _mesa_wait_query; + driver->CheckQuery = _mesa_check_query; /* APPLE_vertex_array_object */ driver->NewArrayObject = _mesa_new_array_object; diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 554e0b0d18..c25b31af02 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -83,12 +83,26 @@ void _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) { /* For software drivers, _mesa_end_query() should have completed the query. - * For real hardware, implement a proper WaitQuery() driver function. + * For real hardware, implement a proper WaitQuery() driver function, + * which may require issuing a flush. */ assert(q->Ready); } +/** + * Check if a query results are ready. Software driver fallback. + * Called via ctx->Driver.CheckQuery(). + */ +void +_mesa_check_query(GLcontext *ctx, struct gl_query_object *q) +{ + /* No-op for sw rendering. + * HW drivers may need to flush at this time. + */ +} + + /** * Delete a query object. Called via ctx->Driver.DeleteQuery(). * Not removed from hash table here. diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index 9a9774641b..bc02b65b54 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -48,6 +48,9 @@ _mesa_end_query(GLcontext *ctx, struct gl_query_object *q); extern void _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q); +extern void +_mesa_check_query(GLcontext *ctx, struct gl_query_object *q); + extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); -- cgit v1.2.3 From 3754c4135cb29e23bd81d573af458742e9a624b2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 11 Jun 2009 14:55:25 -0600 Subject: mesa: rework vertex shader output / fragment shader input attribute matching Before, if a vertex shader's outputs didn't exactly match a fragment shader's inputs we could wind up with invalid TGSI shader declarations. For example: Before patch: DCL OUT[0], POSITION DCL OUT[1], COLOR[1] DCL OUT[2], GENERIC[0] DCL OUT[3], GENERIC[0] <- note duplicate [0] DCL OUT[4], GENERIC[2] After patch: DCL OUT[0], POSITION DCL OUT[1], COLOR[1] DCL OUT[2], GENERIC[0] DCL OUT[3], GENERIC[1] DCL OUT[4], GENERIC[2] --- src/mesa/state_tracker/st_atom_shader.c | 53 ++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index cb869c98a3..ee649be885 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -175,11 +175,12 @@ find_translated_vp(struct st_context *st, /* See if we need to translate vertex program to TGSI form */ if (xvp->serialNo != stvp->serialNo) { - GLuint outAttr, dummySlot; + GLuint outAttr; const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten; GLuint numVpOuts = 0; GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE; - GLint maxGeneric; + GLbitfield usedGenerics = 0x0; + GLbitfield usedOutputSlots = 0x0; /* Compute mapping of vertex program outputs to slots, which depends * on the fragment program's input->slot mapping. @@ -192,10 +193,12 @@ find_translated_vp(struct st_context *st, if (outAttr == VERT_RESULT_HPOS) { /* always put xformed position into slot zero */ - xvp->output_to_slot[VERT_RESULT_HPOS] = 0; + GLuint slot = 0; + xvp->output_to_slot[VERT_RESULT_HPOS] = slot; xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_POSITION; xvp->output_to_semantic_index[outAttr] = 0; numVpOuts++; + usedOutputSlots |= (1 << slot); } else if (outputsWritten & (1 << outAttr)) { /* see if the frag prog wants this vert output */ @@ -209,6 +212,12 @@ find_translated_vp(struct st_context *st, xvp->output_to_semantic_name[outAttr] = stfp->input_semantic_name[fpInSlot]; xvp->output_to_semantic_index[outAttr] = stfp->input_semantic_index[fpInSlot]; numVpOuts++; + usedOutputSlots |= (1 << vpOutSlot); + } + else { +#if 0 /*debug*/ + printf("VP output %d not used by FP\n", outAttr); +#endif } } else if (outAttr == VERT_RESULT_PSIZ) @@ -226,45 +235,49 @@ find_translated_vp(struct st_context *st, /* must do these last */ if (emitPntSize) { - xvp->output_to_slot[VERT_RESULT_PSIZ] = numVpOuts++; + GLuint slot = numVpOuts++; + xvp->output_to_slot[VERT_RESULT_PSIZ] = slot; xvp->output_to_semantic_name[VERT_RESULT_PSIZ] = TGSI_SEMANTIC_PSIZE; xvp->output_to_semantic_index[VERT_RESULT_PSIZ] = 0; + usedOutputSlots |= (1 << slot); } if (emitBFC0) { - xvp->output_to_slot[VERT_RESULT_BFC0] = numVpOuts++; + GLuint slot = numVpOuts++; + xvp->output_to_slot[VERT_RESULT_BFC0] = slot; xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR; xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 0; + usedOutputSlots |= (1 << slot); } if (emitBFC1) { - xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++; + GLuint slot = numVpOuts++; + xvp->output_to_slot[VERT_RESULT_BFC1] = slot; xvp->output_to_semantic_name[VERT_RESULT_BFC1] = TGSI_SEMANTIC_COLOR; xvp->output_to_semantic_index[VERT_RESULT_BFC1] = 1; + usedOutputSlots |= (1 << slot); } - /* Unneeded vertex program outputs will go to this slot. - * We could use this info to do dead code elimination in the - * vertex program. - */ - dummySlot = numVpOuts; - - /* find max GENERIC slot index */ - maxGeneric = -1; + /* build usedGenerics mask */ + usedGenerics = 0x0; for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) { if (xvp->output_to_semantic_name[outAttr] == TGSI_SEMANTIC_GENERIC) { - maxGeneric = MAX2(maxGeneric, - xvp->output_to_semantic_index[outAttr]); + usedGenerics |= (1 << xvp->output_to_semantic_index[outAttr]); } } - /* Map vert program outputs that aren't used to the dummy slot - * (and an unused generic attribute slot). + /* For each vertex program output that doesn't match up to a fragment + * program input, map the vertex program output to a free slot and + * free generic attribute. */ for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) { if (outputsWritten & (1 << outAttr)) { if (xvp->output_to_slot[outAttr] == UNUSED) { - xvp->output_to_slot[outAttr] = dummySlot; + GLint freeGeneric = _mesa_ffs(~usedGenerics) - 1; + GLint freeSlot = _mesa_ffs(~usedOutputSlots) - 1; + usedGenerics |= (1 << freeGeneric); + usedOutputSlots |= (1 << freeSlot); + xvp->output_to_slot[outAttr] = freeSlot; xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_GENERIC; - xvp->output_to_semantic_index[outAttr] = maxGeneric + 1; + xvp->output_to_semantic_index[outAttr] = freeGeneric; } } -- cgit v1.2.3 From b4ebd1c191e6760b334c35fa1df025ad129cc449 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 18:00:58 +0200 Subject: r300: hw doesn't support saturation for tex instructions --- src/mesa/drivers/dri/r300/r300_fragprog.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index ea530fd00e..55c1cfe631 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -140,6 +140,8 @@ GLboolean r300_transform_TEX( inst.DstReg.Index = tempreg; inst.DstReg.WriteMask = WRITEMASK_XYZW; destredirect = GL_TRUE; + } else if (inst.SaturateMode) { + destredirect = GL_TRUE; } } @@ -219,6 +221,7 @@ GLboolean r300_transform_TEX( tgt->Opcode = OPCODE_MOV; tgt->DstReg = orig_inst->DstReg; + tgt->SaturateMode = inst.SaturateMode; tgt->SrcReg[0].File = PROGRAM_TEMPORARY; tgt->SrcReg[0].Index = inst.DstReg.Index; } -- cgit v1.2.3 From 28724b575d2c003d7f10f55dcb03ac969df94389 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 18:14:15 +0200 Subject: r300: fix output register allocation for vertex shaders If the vertex program wrote secondary color without primary color, the secondary color output register index would be 0 which resulted in overwriting vertex position in some cases. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index a74b9156cf..1cacebf366 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -955,26 +955,36 @@ static void t_inputs_outputs(struct r300_vertex_program *vp) vp->outputs[VERT_RESULT_PSIZ] = cur_reg++; } + /* If we're writing back facing colors we need to send + * four colors to make front/back face colors selection work. + * If the vertex program doesn't write all 4 colors, lets + * pretend it does by skipping output index reg so the colors + * get written into appropriate output vectors. + */ if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL0)) { vp->outputs[VERT_RESULT_COL0] = cur_reg++; + } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0) || + vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + cur_reg++; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_COL1)) { - vp->outputs[VERT_RESULT_COL1] = - vp->outputs[VERT_RESULT_COL0] + 1; - cur_reg = vp->outputs[VERT_RESULT_COL1] + 1; + vp->outputs[VERT_RESULT_COL1] = cur_reg++; + } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0) || + vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + cur_reg++; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { - vp->outputs[VERT_RESULT_BFC0] = - vp->outputs[VERT_RESULT_COL0] + 2; - cur_reg = vp->outputs[VERT_RESULT_BFC0] + 2; + vp->outputs[VERT_RESULT_BFC0] = cur_reg++; + } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { + cur_reg++; } if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) { - vp->outputs[VERT_RESULT_BFC1] = - vp->outputs[VERT_RESULT_COL0] + 3; - cur_reg = vp->outputs[VERT_RESULT_BFC1] + 1; + vp->outputs[VERT_RESULT_BFC1] = cur_reg++; + } else if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) { + cur_reg++; } for (i = VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++) { -- cgit v1.2.3 From 52645c46475bf959f43adb2a8244568b2f607f98 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 18:23:55 +0200 Subject: r300: print vertex program when debugging is enabled --- src/mesa/drivers/dri/r300/r300_vertprog.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 1cacebf366..46e1527ba2 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "shader/program.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" +#include "shader/prog_print.h" #include "shader/prog_statevars.h" #include "tnl/tnl.h" @@ -1383,6 +1384,12 @@ static struct r300_vertex_program *build_program(struct r300_vertex_program_key pos_as_texcoord(vp, &mesa_vp->Base); } + if (RADEON_DEBUG & DEBUG_VERTS) { + fprintf(stderr, "Vertex program after native rewrite:\n"); + _mesa_print_program(&mesa_vp->Base); + fflush(stdout); + } + assert(mesa_vp->Base.NumInstructions); vp->num_temporaries = mesa_vp->Base.NumTemporaries; r300TranslateVertexShader(vp, mesa_vp->Base.Instructions); @@ -1456,7 +1463,12 @@ void r300SelectVertexShader(r300ContextPtr r300) r300->selected_vp = vp; return; } - //_mesa_print_program(&vpc->mesa_program.Base); + + if (RADEON_DEBUG & DEBUG_VERTS) { + fprintf(stderr, "Initial vertex program:\n"); + _mesa_print_program(&vpc->mesa_program.Base); + fflush(stdout); + } vp = build_program(&wanted_key, &vpc->mesa_program, wpos_idx); vp->next = vpc->progs; @@ -1518,8 +1530,7 @@ void r300SetupVertexProgram(r300ContextPtr rmesa) param_count = r300VertexProgUpdateParams(ctx, (struct r300_vertex_program_cont *) ctx->VertexProgram._Current, - (float *)&rmesa->hw.vpp. - cmd[R300_VPP_PARAM_0]); + (float *)&rmesa->hw.vpp.cmd[R300_VPP_PARAM_0]); bump_vpu_count(rmesa->hw.vpp.cmd, param_count); param_count /= 4; -- cgit v1.2.3 From 2611e92da59ed3aedb0627889e185b63d4e5a532 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 18:27:00 +0200 Subject: r300: move some code for easier debugging --- src/mesa/drivers/dri/r300/r300_vertprog.c | 54 +++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 46e1527ba2..66750b1c65 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -1185,23 +1185,6 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp, } } - /* Some outputs may be artificially added, to match the inputs - of the fragment program. Blank the outputs here. */ - for (i = 0; i < VERT_RESULT_MAX; i++) { - if (vp->key.OutputsAdded & (1 << i)) { - inst[0] = PVS_OP_DST_OPERAND(VE_ADD, - GL_FALSE, - GL_FALSE, - vp->outputs[i], - VSF_FLAG_ALL, - PVS_DST_REG_OUT); - inst[1] = __CONST(0, SWIZZLE_ZERO); - inst[2] = __CONST(0, SWIZZLE_ZERO); - inst[3] = __CONST(0, SWIZZLE_ZERO); - inst += 4; - } - } - vp->hw_code.length = (inst - vp->hw_code.body.d); if (vp->hw_code.length >= VSF_MAX_FRAGMENT_LENGTH) { vp->error = GL_TRUE; @@ -1390,6 +1373,43 @@ static struct r300_vertex_program *build_program(struct r300_vertex_program_key fflush(stdout); } + /* Some outputs may be artificially added, to match the inputs of the fragment program. + * Issue 16 of vertex program spec says that all vertex attributes that are unwritten by + * vertex program are undefined, so just use MOV [vertex_result], CONST[0] + */ + { + int i, count = 0; + for (i = 0; i < VERT_RESULT_MAX; ++i) { + if (vp->key.OutputsAdded & (1 << i)) { + ++count; + } + } + + if (count > 0) { + struct prog_instruction *inst; + + _mesa_insert_instructions(&mesa_vp->Base, mesa_vp->Base.NumInstructions - 1, count); + inst = &mesa_vp->Base.Instructions[mesa_vp->Base.NumInstructions - 1 - count]; + + for (i = 0; i < VERT_RESULT_MAX; ++i) { + if (vp->key.OutputsAdded & (1 << i)) { + inst->Opcode = OPCODE_MOV; + + inst->DstReg.File = PROGRAM_OUTPUT; + inst->DstReg.Index = i; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->DstReg.CondMask = COND_TR; + + inst->SrcReg[0].File = PROGRAM_CONSTANT; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = SWIZZLE_XYZW; + + ++inst; + } + } + } + } + assert(mesa_vp->Base.NumInstructions); vp->num_temporaries = mesa_vp->Base.NumTemporaries; r300TranslateVertexShader(vp, mesa_vp->Base.Instructions); -- cgit v1.2.3 From de19eb0b0dba08b2ad3829b7ced94931139af843 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 5 Jun 2009 18:32:05 +0200 Subject: r300: fix vertex program bug If the vertex program didn't write position attribute, the position invariant function would add necessary instructions, but the vertex position would be overwritten by artificial outputs insts added to satisfy fragment program requirements. Fixes "whole screen is gray" problem for HW TCL path in sauerbraten when shaders are enabled, and whole slew of wine d3d9 tests. --- src/mesa/drivers/dri/r300/r300_vertprog.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 66750b1c65..c41a8fdd62 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -1456,7 +1456,12 @@ void r300SelectVertexShader(r300ContextPtr r300) wpos_idx = i; } - add_outputs(&wanted_key, VERT_RESULT_HPOS); + if (vpc->mesa_program.IsPositionInvariant) { + wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS); + wanted_key.OutputsWritten |= (1 << VERT_RESULT_HPOS); + } else { + add_outputs(&wanted_key, VERT_RESULT_HPOS); + } if (InputsRead & FRAG_BIT_COL0) { add_outputs(&wanted_key, VERT_RESULT_COL0); @@ -1466,17 +1471,16 @@ void r300SelectVertexShader(r300ContextPtr r300) add_outputs(&wanted_key, VERT_RESULT_COL1); } + if (InputsRead & FRAG_BIT_FOGC) { + add_outputs(&wanted_key, VERT_RESULT_FOGC); + } + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (InputsRead & (FRAG_BIT_TEX0 << i)) { add_outputs(&wanted_key, VERT_RESULT_TEX0 + i); } } - if (vpc->mesa_program.IsPositionInvariant) { - /* we wan't position don't we ? */ - wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS); - } - for (vp = vpc->progs; vp; vp = vp->next) if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key)) == 0) { -- cgit v1.2.3 From 9abc72d1fc0aada59a76bd602ebc36db9a729b5b Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 7 Jun 2009 21:34:44 +0200 Subject: r300: fix a GPU lock up Sending from VAP more texture coordinates than RS expects results in GPU hang. Fixes BumpSelfShadow from DirectX8 SDK. --- src/mesa/drivers/dri/r300/r300_emit.c | 33 ++++++++++++++++++--------------- src/mesa/drivers/dri/r300/r300_emit.h | 4 ++-- src/mesa/drivers/dri/r300/r300_state.c | 8 ++++---- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index cf31596d9b..4017224b10 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -81,49 +81,52 @@ GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead) return vic_1; } -GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten) +GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) { GLuint ret = 0; - if (OutputsWritten & (1 << VERT_RESULT_HPOS)) + if (vp_writes & (1 << VERT_RESULT_HPOS)) ret |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; - if (OutputsWritten & (1 << VERT_RESULT_COL0)) + if (vp_writes & (1 << VERT_RESULT_COL0) && fp_reads & FRAG_BIT_COL0) ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT; - if (OutputsWritten & (1 << VERT_RESULT_COL1)) + if (vp_writes & (1 << VERT_RESULT_COL1) && fp_reads & FRAG_BIT_COL1) ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT; - if (OutputsWritten & (1 << VERT_RESULT_BFC0) - || OutputsWritten & (1 << VERT_RESULT_BFC1)) - ret |= - R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT | - R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT | - R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT; + /* Two sided lighting works only if all 4 colors are written */ + if (vp_writes & (1 << VERT_RESULT_BFC0) || vp_writes & (1 << VERT_RESULT_BFC1)) + ret |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT | + R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT; - if (OutputsWritten & (1 << VERT_RESULT_PSIZ)) + if (vp_writes & (1 << VERT_RESULT_PSIZ)) ret |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; return ret; } -GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten) +GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) { GLuint i, ret = 0, first_free_texcoord = 0; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (OutputsWritten & (1 << (VERT_RESULT_TEX0 + i))) { + if (vp_writes & (1 << (VERT_RESULT_TEX0 + i)) && fp_reads & FRAG_BIT_TEX(i)) { ret |= (4 << (3 * i)); ++first_free_texcoord; } } - if (OutputsWritten & (1 << VERT_RESULT_FOGC)) { + if (fp_reads & FRAG_BIT_WPOS) { + ret |= (4 << (3 * first_free_texcoord)); + ++first_free_texcoord; + } + + if (vp_writes & (1 << VERT_RESULT_FOGC) && fp_reads & FRAG_BIT_FOGC) { if (first_free_texcoord > 8) { fprintf(stderr, "\tout of free texcoords to write fog coord\n"); _mesa_exit(-1); } - ret |= 1 << (3 * first_free_texcoord); + ret |= 4 << (3 * first_free_texcoord); } return ret; diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index d88914ce95..2fb8b82d3a 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -225,7 +225,7 @@ extern void r300EmitCacheFlush(r300ContextPtr rmesa); extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead); extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead); -extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint OutputsWritten); -extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten); +extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads); +extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads); #endif diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 2fff89c473..b509c13b43 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1536,7 +1536,7 @@ static void r300SetupRSUnit(GLcontext * ctx) r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_Q(R300_RS_SEL_K1) | R300_RS_TEX_PTR(rs_tex_count); r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_FOGC; - rs_tex_count += 1; + rs_tex_count += 4; ++tex_ip; ++fp_reg; } else { @@ -1662,7 +1662,7 @@ static void r500SetupRSUnit(GLcontext * ctx) r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R500_RS_INST_TEX_ID(tex_ip) | R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_reg); InputsRead &= ~FRAG_BIT_FOGC; - rs_tex_count += 1; + rs_tex_count += 4; ++tex_ip; ++fp_reg; } else { @@ -2270,8 +2270,8 @@ void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten) rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead); rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead); - rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten); - rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten); + rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten, ctx->FragmentProgram._Current->Base.InputsRead); + rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten, ctx->FragmentProgram._Current->Base.InputsRead); } void r300UpdateShaderStates(r300ContextPtr rmesa) -- cgit v1.2.3 From e21e82f42549aa78214f3339a13b79791406dde0 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 7 Jun 2009 21:27:52 +0200 Subject: radeon: increase max bo count --- src/mesa/drivers/dri/radeon/radeon_common_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index e995062657..061168fe96 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -378,7 +378,7 @@ typedef void (*radeon_line_func) (radeonContextPtr, typedef void (*radeon_point_func) (radeonContextPtr, radeonVertex *); -#define RADEON_MAX_BOS 24 +#define RADEON_MAX_BOS 32 struct radeon_state { struct radeon_colorbuffer_state color; struct radeon_depthbuffer_state depth; -- cgit v1.2.3 From 34cb4b6be36ccb03b4c0c76ecc3587984dd284dc Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 10 Jun 2009 04:09:33 +0200 Subject: r300: r500 fragment program fixes - when rewriting per component negate swizzle, first instruction should get not negated source - KIL instruction ignores swizzles TODO: - tex instructions does not support saturation - tex instructions cannot read from consant memory --- src/mesa/drivers/dri/r300/r500_fragprog.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 8f0b70ad3a..4d58cf2162 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -196,22 +196,20 @@ GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) if (reg.Abs) return GL_FALSE; + if (opcode == OPCODE_KIL && (reg.Swizzle != SWIZZLE_NOOP || reg.Negate != NEGATE_NONE)) + return GL_FALSE; + if (reg.Negate) reg.Negate ^= NEGATE_XYZW; - if (opcode == OPCODE_KIL) { - if (reg.Swizzle != SWIZZLE_NOOP) - return GL_FALSE; - } else { - for(i = 0; i < 4; ++i) { - GLuint swz = GET_SWZ(reg.Swizzle, i); - if (swz == SWIZZLE_NIL) { - reg.Negate &= ~(1 << i); - continue; - } - if (swz >= 4) - return GL_FALSE; + for(i = 0; i < 4; ++i) { + GLuint swz = GET_SWZ(reg.Swizzle, i); + if (swz == SWIZZLE_NIL) { + reg.Negate &= ~(1 << i); + continue; } + if (swz >= 4) + return GL_FALSE; } if (reg.Negate) @@ -273,6 +271,7 @@ void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, inst->DstReg = dst; inst->DstReg.WriteMask = negatebase[i]; inst->SrcReg[0] = src; + inst->SrcReg[0].Negate = (i == 0) ? NEGATE_NONE : NEGATE_XYZW; inst++; s->IP++; } -- cgit v1.2.3 From 2b5f8d2b5514cf6239e822b8fd24a752e35cf7eb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 11 Jun 2009 00:43:55 +0200 Subject: r300: fix RS setup when no colors and textures are sent to FP RS_COL_FMT field is part of RS_IP_* reg not RS_INST_* --- src/mesa/drivers/dri/r300/r300_state.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index b509c13b43..06dba2a650 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1546,7 +1546,8 @@ static void r300SetupRSUnit(GLcontext * ctx) /* Setup default color if no color or tex was set */ if (rs_tex_count == 0 && col_ip == 0) { - r300->hw.rr.cmd[R300_RR_INST_0] = R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(0) | R300_RS_COL_FMT(R300_RS_COL_FMT_0001); + r300->hw.rr.cmd[R300_RR_INST_0] = R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_ADDR(0); + r300->hw.ri.cmd[R300_RI_INTERP_0] = R300_RS_COL_PTR(0) | R300_RS_COL_FMT(R300_RS_COL_FMT_0001); ++col_ip; } @@ -1672,13 +1673,14 @@ static void r500SetupRSUnit(GLcontext * ctx) /* Setup default color if no color or tex was set */ if (rs_tex_count == 0 && col_ip == 0) { - r300->hw.rr.cmd[R300_RR_INST_0] |= R500_RS_INST_COL_ID(0) | R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(0) | R500_RS_COL_FMT(R300_RS_COL_FMT_0001); + r300->hw.rr.cmd[R300_RR_INST_0] = R500_RS_INST_COL_ID(0) | R500_RS_INST_COL_ADDR(0); + r300->hw.ri.cmd[R300_RI_INTERP_0] = R500_RS_COL_PTR(0) | R500_RS_COL_FMT(R300_RS_COL_FMT_0001); ++col_ip; } high_rr = (col_ip > tex_ip) ? col_ip : tex_ip; - r300->hw.rc.cmd[1] |= (rs_tex_count << R300_IT_COUNT_SHIFT) | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; - r300->hw.rc.cmd[2] |= 0xC0 | (high_rr - 1); + r300->hw.rc.cmd[1] = (rs_tex_count << R300_IT_COUNT_SHIFT) | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; + r300->hw.rc.cmd[2] = 0xC0 | (high_rr - 1); r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_INST_0, high_rr); -- cgit v1.2.3 From b5d49cb195eef4c0bf8288c3d675513244b46dbb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 10 Jun 2009 16:04:35 +0200 Subject: r300: send only RS_IP_* regs that we are going to use --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 12 ++---------- src/mesa/drivers/dri/r300/r300_state.c | 2 ++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index b949c3b5b2..0261a5b1d8 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -479,7 +479,6 @@ void r300InitCmdBuf(r300ContextPtr r300) int mtu; int has_tcl; int is_r500 = 0; - int i; has_tcl = r300->options.hw_tcl_enabled; @@ -589,19 +588,12 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0); r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_COUNT, 2); if (is_r500) { - ALLOC_STATE(ri, always, R500_RI_CMDSIZE, 0); + ALLOC_STATE(ri, variable, R500_RI_CMDSIZE, 0); r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_IP_0, 16); - for (i = 0; i < 8; i++) { - r300->hw.ri.cmd[R300_RI_CMD_0 + i +1] = - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | - (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT); - } ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_INST_0, 1); } else { - ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0); + ALLOC_STATE(ri, variable, R300_RI_CMDSIZE, 0); r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_IP_0, 8); ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0); r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, 1); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 06dba2a650..c0eda977db 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1556,6 +1556,7 @@ static void r300SetupRSUnit(GLcontext * ctx) r300->hw.rc.cmd[2] |= high_rr - 1; r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, high_rr); + r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_IP_0, high_rr); if (InputsRead) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); @@ -1683,6 +1684,7 @@ static void r500SetupRSUnit(GLcontext * ctx) r300->hw.rc.cmd[2] = 0xC0 | (high_rr - 1); r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_INST_0, high_rr); + r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R500_RS_IP_0, high_rr); if (InputsRead) WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead); -- cgit v1.2.3 From 8d728b8fe73d935308275ad0a21c67e2e22029c4 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 10 Jun 2009 16:56:51 +0200 Subject: r300: don't send unused attributes for SW TCL path --- src/mesa/drivers/dri/r300/r300_swtcl.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 4a82064814..f3171c081e 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -76,6 +76,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ GLuint InputsRead = 0; GLuint OutputsWritten = 0; int num_attrs = 0; + GLuint fp_reads = ctx->FragmentProgram._Current->Base.InputsRead; struct vertex_attribute *attrs = rmesa->vbuf.attribs; rmesa->swtcl.coloroffset = rmesa->swtcl.specoffset = 0; @@ -84,15 +85,14 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ /* We always want non Ndc coords format */ VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr; - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_POS)) { - InputsRead |= 1 << VERT_ATTRIB_POS; - OutputsWritten |= 1 << VERT_RESULT_HPOS; - EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); - ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW, 0); - rmesa->swtcl.coloroffset = 4; - } + /* Always write position vector */ + InputsRead |= 1 << VERT_ATTRIB_POS; + OutputsWritten |= 1 << VERT_RESULT_HPOS; + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F ); + ADD_ATTR(VERT_ATTRIB_POS, R300_DATA_TYPE_FLOAT_4, SWTCL_OVM_POS, SWIZZLE_XYZW, MASK_XYZW, 0); + rmesa->swtcl.coloroffset = 4; - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0)) { + if (fp_reads & FRAG_BIT_COL0) { InputsRead |= 1 << VERT_ATTRIB_COLOR0; OutputsWritten |= 1 << VERT_RESULT_COL0; #if MESA_LITTLE_ENDIAN @@ -104,7 +104,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ #endif } - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) { + if (fp_reads & FRAG_BIT_COL1) { GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); InputsRead |= 1 << VERT_ATTRIB_COLOR1; OutputsWritten |= 1 << VERT_RESULT_COL1; @@ -128,7 +128,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_ABGR ); ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1); #endif - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 )) { + if (fp_reads & FRAG_BIT_COL1) { VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->SecondaryColorPtr[1]; GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); OutputsWritten |= 1 << VERT_RESULT_BFC1; @@ -154,11 +154,11 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ * Sending only one texcoord component may lead to lock up, * so for all textures always output 4 texcoord components to RS. */ - if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) { + { int i; GLuint swiz, format, hw_format; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) { + if (fp_reads & FRAG_BIT_TEX(i)) { switch (VB->TexCoordPtr[i]->size) { case 1: format = EMIT_1F; @@ -193,7 +193,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ } /* RS can't put fragment position on the pixel stack, so stuff it in texcoord if needed */ - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_POS) && (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_WPOS)) { + if (fp_reads & FRAG_BIT_WPOS) { if (first_free_tex >= ctx->Const.MaxTextureUnits) { fprintf(stderr, "\tout of free texcoords to write w pos\n"); _mesa_exit(-1); @@ -206,7 +206,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ ++first_free_tex; } - if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_FOG)) { + if (fp_reads & FRAG_BIT_FOGC) { if (first_free_tex >= ctx->Const.MaxTextureUnits) { fprintf(stderr, "\tout of free texcoords to write fog coordinate\n"); _mesa_exit(-1); -- cgit v1.2.3 From 234797564dea00c1463faa7a7791df466f52a91b Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 10 Jun 2009 16:58:15 +0200 Subject: r300: fix for SW TCL path We shouldn't use i variable for SWTCL_OVM_TEX because textures doesn't have to be enabled in "packed" order. We could have tex1,tex3 and fog which would receive 7,9,8 OVM locations instead of 6,7,8. --- src/mesa/drivers/dri/r300/r300_swtcl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index f3171c081e..ce4179208e 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -186,7 +186,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ InputsRead |= 1 << (VERT_ATTRIB_TEX0 + i); OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i); EMIT_ATTR(_TNL_ATTRIB_TEX(i), format); - ADD_ATTR(VERT_ATTRIB_TEX0 + i, hw_format, SWTCL_OVM_TEX(i), swiz, MASK_XYZW, 0); + ADD_ATTR(VERT_ATTRIB_TEX0 + i, hw_format, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0); ++first_free_tex; } } -- cgit v1.2.3 From 67bbfb9c68d0bf459f706a4cb50caf8245a37a34 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 10 Jun 2009 17:05:38 +0200 Subject: r300: fix VAP setup If GL context had e.g. tex0, tex2 and fog the VAPOutputCntl1 returned 0x104 instead of 0x124 - that meaned we're sending only 8 texcoords (instead of 12) which ended up in GPU hang. --- src/mesa/drivers/dri/r300/r300_emit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 4017224b10..c3817721dc 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -111,7 +111,7 @@ GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (vp_writes & (1 << (VERT_RESULT_TEX0 + i)) && fp_reads & FRAG_BIT_TEX(i)) { - ret |= (4 << (3 * i)); + ret |= (4 << (3 * first_free_texcoord)); ++first_free_texcoord; } } @@ -122,13 +122,14 @@ GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes, GLuint fp_reads) } if (vp_writes & (1 << VERT_RESULT_FOGC) && fp_reads & FRAG_BIT_FOGC) { - if (first_free_texcoord > 8) { - fprintf(stderr, "\tout of free texcoords to write fog coord\n"); - _mesa_exit(-1); - } ret |= 4 << (3 * first_free_texcoord); } + if (first_free_texcoord > 8) { + fprintf(stderr, "\tout of free texcoords\n"); + _mesa_exit(-1); + } + return ret; } -- cgit v1.2.3 From a5d92d7ed208d20c788889640503fa61b2d38851 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Jun 2009 11:35:10 +1000 Subject: radeon/r200/r300: fix max texture levels assert use the actual value set in the context --- src/mesa/drivers/dri/r300/r300_context.c | 5 +---- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 9004a3ffab..394521a051 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -265,10 +265,7 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units"); ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits); - /* FIXME: When no memory manager is available we should set this - * to some reasonable value based on texture memory pool size */ - /* FIXME: r5xx limit is 4096 */ - ctx->Const.MaxTextureLevels = 12; + ctx->Const.MaxTextureMaxAnisotropy = 16.0; ctx->Const.MaxTextureLodBias = 16.0; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 8d1ba1cdba..55aa4502da 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -141,7 +141,7 @@ static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_ GLuint face; numLevels = mt->lastLevel - mt->firstLevel + 1; - assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); + assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; for(face = 0; face < mt->faces; face++) { @@ -165,7 +165,7 @@ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_ GLuint i; numLevels = mt->lastLevel - mt->firstLevel + 1; - assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); + assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; for(i = 0; i < numLevels; i++) { -- cgit v1.2.3 From d0fab94842b18dbd4027f5565804ca6884646240 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Jun 2009 11:37:13 +1000 Subject: radeon: fix size of mipmap texture array --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h index 697010bc02..7ece688493 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h @@ -47,6 +47,8 @@ struct _radeon_mipmap_level { radeon_mipmap_image faces[6]; }; +/* store the max possible in the miptree */ +#define RADEON_MIPTREE_MAX_TEXTURE_LEVELS 13 /** * A mipmap tree contains texture images in the layout that the hardware @@ -77,7 +79,7 @@ struct _radeon_mipmap_tree { GLuint tilebits; /** RADEON_TXO_xxx_TILE */ GLuint compressed; /** MESA_FORMAT_xxx indicating a compressed format, or 0 if uncompressed */ - radeon_mipmap_level levels[RADEON_MAX_TEXTURE_LEVELS]; + radeon_mipmap_level levels[RADEON_MIPTREE_MAX_TEXTURE_LEVELS]; }; radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *t, -- cgit v1.2.3 From 279143c6e808b37c333321b696d80df77f709a04 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 6 Jun 2009 14:46:22 -0400 Subject: Disable SGI_swap_control extension for DRI2 We currently don't have support for SGI_swap_control for direct contexts with DRI2, so disable reporting the extension. Reporting the extension, and then having glXSwapIntervalSGI() "succeed" but do nothing can confuse applications. https://bugs.freedesktop.org/show_bug.cgi?id=22123 --- src/glx/x11/dri_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/glx/x11/dri_common.c b/src/glx/x11/dri_common.c index 90c3d8c7d9..6de4111113 100644 --- a/src/glx/x11/dri_common.c +++ b/src/glx/x11/dri_common.c @@ -345,7 +345,9 @@ driBindExtensions(__GLXscreenConfigs *psc, int dri2) #endif #ifdef __DRI_SWAP_CONTROL - if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { + /* No DRI2 support for swap_control at the moment, since SwapBuffers + * is done by the X server */ + if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0 && !dri2) { psc->swapControl = (__DRIswapControlExtension *) extensions[i]; __glXEnableDirectExtension(psc, "GLX_SGI_swap_control"); __glXEnableDirectExtension(psc, "GLX_MESA_swap_control"); -- cgit v1.2.3 From c6de08fff483911953692693c501bc200c235dce Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 11 Jun 2009 19:26:55 +0100 Subject: mesa: Enable uploads of only depth to z24s8 textures --- src/mesa/main/texstore.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f3739f950b..bfced1b3f4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2689,12 +2689,45 @@ GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS) { const GLfloat depthScale = (GLfloat) 0xffffff; + const GLint srcRowStride + = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) + / sizeof(GLuint); + GLint img, row; ASSERT(dstFormat == &_mesa_texformat_z24_s8); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); - ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); + ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); - if (ctx->Pixel.DepthScale == 1.0f && + /* In case we only upload depth we need to preserve the stencil */ + if (srcFormat == GL_DEPTH_COMPONENT) { + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLuint depth[MAX_WIDTH]; + GLint i; + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + depth, /* dst addr */ + depthScale, + srcType, src, srcPacking); + + for (i = 0; i < srcWidth; i++) + dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF); + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } + } + } + else if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes) { /* simple path */ -- cgit v1.2.3 From 1cd0afffc9edbcac690f8ab436aecfced26b0aba Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 12 Jun 2009 14:55:04 +0100 Subject: progs/rbug: Add binary to bmp converter program --- progs/rbug/.gitignore | 2 + progs/rbug/Makefile | 1 + progs/rbug/bin_to_bmp.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 progs/rbug/bin_to_bmp.c diff --git a/progs/rbug/.gitignore b/progs/rbug/.gitignore index 317290bbb3..26a561c829 100644 --- a/progs/rbug/.gitignore +++ b/progs/rbug/.gitignore @@ -1,3 +1,4 @@ +bin_to_bmp simple_client simple_server shdr_info @@ -7,3 +8,4 @@ ctx_info tex_dump tex_info *.bmp +*.bin diff --git a/progs/rbug/Makefile b/progs/rbug/Makefile index 8df03dd4e1..718f7a2bb5 100644 --- a/progs/rbug/Makefile +++ b/progs/rbug/Makefile @@ -15,6 +15,7 @@ LINKS = \ $(PROG_LINKS) SOURCES = \ + bin_to_bmp.c \ simple_client.c \ simple_server.c \ shdr_info.c \ diff --git a/progs/rbug/bin_to_bmp.c b/progs/rbug/bin_to_bmp.c new file mode 100644 index 0000000000..cdae3486ce --- /dev/null +++ b/progs/rbug/bin_to_bmp.c @@ -0,0 +1,110 @@ +/* + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" +#include "util/u_debug.h" +#include "util/u_network.h" +#include "util/u_tile.h" + +static uint8_t* read(const char *filename, unsigned size); +static void dump(unsigned src_width, unsigned src_height, + unsigned src_stride, enum pipe_format src_format, + uint8_t *data, unsigned src_size); + +int main(int argc, char** argv) +{ + /* change these */ + unsigned width = 64; + unsigned height = 64; + unsigned stride = width * 4; + unsigned size = stride * height; + const char *filename = "mybin.bin"; + enum pipe_format format = PIPE_FORMAT_A8R8G8B8_UNORM; + + dump(width, height, stride, format, read(filename, size), size); + + return 0; +} + +static void dump(unsigned width, unsigned height, + unsigned src_stride, enum pipe_format src_format, + uint8_t *data, unsigned src_size) +{ + struct pipe_format_block src_block; + + enum pipe_format dst_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + struct pipe_format_block dst_block; + unsigned dst_stride; + unsigned dst_size; + float *rgba; + int i; + char filename[512]; + + { + pf_get_block(src_format, &src_block); + assert(src_stride >= pf_get_stride(&src_block, width)); + assert(src_size >= pf_get_2d_size(&src_block, src_stride, width)); + } + { + pf_get_block(dst_format, &dst_block); + dst_stride = pf_get_stride(&dst_block, width); + dst_size = pf_get_2d_size(&dst_block, dst_stride, width); + rgba = MALLOC(dst_size); + } + + util_snprintf(filename, 512, "%s.bmp", pf_name(src_format)); + + if (pf_is_compressed(src_format)) { + debug_printf("skipping: %s\n", filename); + return; + } + + debug_printf("saving: %s\n", filename); + + for (i = 0; i < height; i++) { + pipe_tile_raw_to_rgba(src_format, data + src_stride * i, + width, 1, + &rgba[width*4*i], dst_stride); + } + + debug_dump_float_rgba_bmp(filename, width, height, rgba, width); + + FREE(rgba); +} + +static uint8_t* read(const char *filename, unsigned size) +{ + uint8_t *data; + FILE *file = fopen(filename, "rb"); + + data = MALLOC(size); + + fread(data, 1, size, file); + fclose(file); + + return data; +} -- cgit v1.2.3