From 8d249ca620f6995cc5824d95c29bda7043bbdf8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Sep 2008 15:35:56 -0600 Subject: gallium: if we run out of memory in st_TexImage, flush and try again. If the driver buffers a scene flushing should release old textures and make space for new ones. Fixes problem with texdown.c test. --- src/mesa/state_tracker/st_cb_texture.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 2e1ad93942..958f88bf2c 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -481,8 +481,15 @@ st_TexImage(GLcontext * ctx, if (!stObj->pt) { guess_and_alloc_texture(ctx->st, stObj, stImage); if (!stObj->pt) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); - return; + /* Probably out of memory. + * Try flushing any pending rendering, then retry. + */ + st_finish(ctx->st); + guess_and_alloc_texture(ctx->st, stObj, stImage); + if (!stObj->pt) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + return; + } } } -- cgit v1.2.3 From a9004cc79cd9287305f36254194e2477ce871765 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Sep 2008 15:36:17 -0600 Subject: destroy window on exit --- progs/tests/mipmap_view.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/progs/tests/mipmap_view.c b/progs/tests/mipmap_view.c index 117e201718..54607b8939 100644 --- a/progs/tests/mipmap_view.c +++ b/progs/tests/mipmap_view.c @@ -21,6 +21,8 @@ static int TexWidth = 256, TexHeight = 256; static int WinWidth = 1044, WinHeight = 900; static GLfloat Bias = 0.0; static GLboolean ScaleQuads = GL_FALSE; +static GLint Win = 0; + static void @@ -145,6 +147,7 @@ Key(unsigned char key, int x, int y) ScaleQuads = !ScaleQuads; break; case 27: + glutDestroyWindow(Win); exit(0); break; } @@ -238,7 +241,7 @@ main(int argc, char *argv[]) glutInitWindowPosition(0, 0); glutInitWindowSize(WinWidth, WinHeight); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - glutCreateWindow(argv[0]); + Win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Display); -- cgit v1.2.3 From 866a2c3ccb6b62966ce1da796498a62e276570d1 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 19 Sep 2008 12:43:02 +0200 Subject: mesa: Update ignores a bit --- progs/fp/.gitignore | 1 + progs/vpglsl/.gitignore | 1 + src/glu/.gitignore | 1 + 3 files changed, 3 insertions(+) create mode 100644 progs/vpglsl/.gitignore create mode 100644 src/glu/.gitignore diff --git a/progs/fp/.gitignore b/progs/fp/.gitignore index b265f1fed7..aa51f76c9b 100644 --- a/progs/fp/.gitignore +++ b/progs/fp/.gitignore @@ -40,3 +40,4 @@ tri-swz tri-swz2 tri-tex tri-xpd +fp-tri diff --git a/progs/vpglsl/.gitignore b/progs/vpglsl/.gitignore new file mode 100644 index 0000000000..a5ff993525 --- /dev/null +++ b/progs/vpglsl/.gitignore @@ -0,0 +1 @@ +vp-tris diff --git a/src/glu/.gitignore b/src/glu/.gitignore new file mode 100644 index 0000000000..279ea7d434 --- /dev/null +++ b/src/glu/.gitignore @@ -0,0 +1 @@ +exptmp -- cgit v1.2.3 From 0576e837f18ad9925d732f883f4922c907d7bafb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 19 Sep 2008 13:04:52 +0200 Subject: mesa: Fix arb parse constants --- src/mesa/shader/arbprogparse.c | 37 +++++++++++++++++++++++++++++++- src/mesa/state_tracker/st_mesa_to_tgsi.c | 10 ++------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 26ccdc7395..5e81477592 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -30,6 +30,27 @@ * \author Karl Rasche */ +/** +Notes on program parameters, etc. + +The instructions we emit will use six kinds of source registers: + + PROGRAM_INPUT - input registers + PROGRAM_TEMPORARY - temp registers + PROGRAM_ADDRESS - address/indirect register + PROGRAM_SAMPLER - texture sampler + PROGRAM_CONSTANT - indexes into program->Parameters, a known constant/literal + PROGRAM_STATE_VAR - indexes into program->Parameters, and may actually be: + + a state variable, like "state.fog.color", or + + a pointer to a "program.local[k]" parameter, or + + a pointer to a "program.env[k]" parameter + +Basically, all the program.local[] and program.env[] values will get mapped +into the unified gl_program->Parameters array. This solves the problem of +having three separate program parameter arrays. +*/ + + #include "main/glheader.h" #include "main/imports.h" #include "shader/grammar/grammar_mesa.h" @@ -1871,7 +1892,11 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, const_values, 4); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; - param_var->param_binding_type = PROGRAM_CONSTANT; + 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++; Program->Base.NumParameters++; break; @@ -2578,6 +2603,16 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, return 1; } + if (*File == PROGRAM_STATE_VAR) { + /* If we're referencing the Program->Parameters[] array, check if the + * parameter is really a constant/literal. If so, set File to CONSTANT. + */ + assert(*Index < Program->Base.Parameters->NumParameters); + enum register_file file = Program->Base.Parameters->Parameters[*Index].Type; + if (file == PROGRAM_CONSTANT) + *File = PROGRAM_CONSTANT; + } + /* Add attributes to InputsRead only if they are used the program. * This avoids the handling of unused ATTRIB declarations in the drivers. */ if (*File == PROGRAM_INPUT) diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index b9807bb807..524d8890b5 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -77,6 +77,7 @@ map_register_file( case PROGRAM_CONSTANT: if (indirectAccess) return TGSI_FILE_CONSTANT; + assert(immediateMapping[index] != ~0); return TGSI_FILE_IMMEDIATE; case PROGRAM_INPUT: return TGSI_FILE_INPUT; @@ -118,6 +119,7 @@ map_register_file_index( case TGSI_FILE_IMMEDIATE: if (indirectAccess) return index; + assert(immediateMapping[index] != ~0); return immediateMapping[index]; default: @@ -242,14 +244,6 @@ compile_instruction( immediateMapping, indirectAccess ); - /** - * This not at all the correct solution. - * FIXME: Roll this up in the above map functions - */ - if (fullsrc->SrcRegister.File == TGSI_FILE_IMMEDIATE && fullsrc->SrcRegister.Index == ~0) { - fullsrc->SrcRegister.File = TGSI_FILE_CONSTANT; - fullsrc->SrcRegister.Index = inst->SrcReg[i].Index; - } /* swizzle (ext swizzle also depends on negation) */ { -- cgit v1.2.3 From 8701e5f702a0b15d44395268e2422c196d8f4efd Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 19 Sep 2008 19:11:37 +0200 Subject: mesa: Fix compiler error. --- src/mesa/shader/arbprogparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 5e81477592..466ae48bef 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2604,11 +2604,13 @@ parse_src_reg (GLcontext * ctx, const GLubyte ** inst, } if (*File == PROGRAM_STATE_VAR) { + enum register_file file; + /* If we're referencing the Program->Parameters[] array, check if the * parameter is really a constant/literal. If so, set File to CONSTANT. */ assert(*Index < Program->Base.Parameters->NumParameters); - enum register_file file = Program->Base.Parameters->Parameters[*Index].Type; + file = Program->Base.Parameters->Parameters[*Index].Type; if (file == PROGRAM_CONSTANT) *File = PROGRAM_CONSTANT; } -- cgit v1.2.3