summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_generatemipmap.c21
-rw-r--r--src/mesa/main/enable.c7
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/texrender.c13
-rw-r--r--src/mesa/shader/nvprogram.c72
-rw-r--r--src/mesa/shader/nvprogram.h6
-rw-r--r--src/mesa/shader/nvvertparse.c26
-rw-r--r--src/mesa/shader/prog_parameter.c1
-rw-r--r--src/mesa/vbo/vbo_exec_array.c44
13 files changed, 170 insertions, 29 deletions
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 6cf45cded23..3c61357eba8 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -82,7 +82,7 @@ softpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 13; /* max 4Kx4K */
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 8; /* max 128x128x128 */
+ return 9; /* max 256x256x256 */
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 13; /* max 4Kx4K */
case PIPE_CAP_TGSI_CONT_SUPPORTED:
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 3c5b8483197..c300c33adce 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -125,6 +125,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
/* We want the GLSL compiler to emit code that uses condition codes */
ctx->Shader.EmitCondCodes = GL_TRUE;
+ ctx->Shader.EmitNVTempInitialization = GL_TRUE;
ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024);
ctx->Const.VertexProgram.MaxAluInstructions = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 0b0e6931a06..4be6c77aa1e 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -248,6 +248,9 @@ static void prepare_constant_buffer(struct brw_context *brw)
GLuint offset = brw->curbe.vs_start * 16;
GLuint nr = brw->vs.prog_data->nr_params / 4;
+ if (brw->vertex_program->IsNVProgram)
+ _mesa_load_tracked_matrices(ctx);
+
/* Updates the ParamaterValues[i] pointers for all parameters of the
* basic type of PROGRAM_STATE_VAR.
*/
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index e3111c66800..f0c79efbd96 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -90,8 +90,6 @@ static void brw_upload_vs_prog(struct brw_context *brw)
struct brw_vertex_program *vp =
(struct brw_vertex_program *)brw->vertex_program;
- assert (vp && !vp->program.IsNVProgram);
-
memset(&key, 0, sizeof(key));
/* Just upload the program verbatim for now. Always send it all
diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c
index 237754d4695..5958b36c971 100644
--- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c
+++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c
@@ -125,6 +125,8 @@ intel_generate_mipmap_2d(GLcontext *ctx,
GLuint fb_name;
GLboolean success = GL_FALSE;
struct gl_framebuffer *saved_fbo = NULL;
+ struct gl_buffer_object *saved_array_buffer = NULL;
+ struct gl_buffer_object *saved_element_buffer = NULL;
_mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT |
GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT |
@@ -133,6 +135,16 @@ intel_generate_mipmap_2d(GLcontext *ctx,
old_active_texture = ctx->Texture.CurrentUnit;
_mesa_reference_framebuffer(&saved_fbo, ctx->DrawBuffer);
+ /* use default array/index buffers */
+ _mesa_reference_buffer_object(ctx, &saved_array_buffer,
+ ctx->Array.ArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+ _mesa_reference_buffer_object(ctx, &saved_element_buffer,
+ ctx->Array.ElementArrayBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+
_mesa_Disable(GL_POLYGON_STIPPLE);
_mesa_Disable(GL_DEPTH_TEST);
_mesa_Disable(GL_STENCIL_TEST);
@@ -205,6 +217,15 @@ fail:
meta_restore_fragment_program(&intel->meta);
meta_restore_vertex_program(&intel->meta);
+ /* restore array/index buffers */
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
+ saved_array_buffer);
+ _mesa_reference_buffer_object(ctx, &saved_array_buffer, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
+ saved_element_buffer);
+ _mesa_reference_buffer_object(ctx, &saved_element_buffer, NULL);
+
+
_mesa_DeleteFramebuffersEXT(1, &fb_name);
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
if (saved_fbo)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 4c1f46102d1..8e6b01f73b9 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -233,7 +233,7 @@ enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit)
const GLbitfield newenabled = state
? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
- if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled)
+ if (texUnit->Enabled == newenabled)
return GL_FALSE;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
@@ -935,11 +935,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
/* GL_EXT_depth_bounds_test */
case GL_DEPTH_BOUNDS_TEST_EXT:
CHECK_EXTENSION(EXT_depth_bounds_test, cap);
- if (state && ctx->DrawBuffer->Visual.depthBits == 0) {
- _mesa_warning(ctx,
- "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer");
- return;
- }
if (ctx->Depth.BoundsTest == state)
return;
FLUSH_VERTICES(ctx, _NEW_DEPTH);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ae169fb9db6..54fa8981ddd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2080,6 +2080,7 @@ struct gl_shader_state
GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */
GLboolean EmitCondCodes; /**< Use condition codes? */
GLboolean EmitComments; /**< Annotated instructions */
+ GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */
void *MemPool;
GLbitfield Flags; /**< Mask of GLSL_x flags */
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index cc74d58fbd1..53be83b05ce 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -398,6 +398,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
static void
+store_nop(struct gl_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ const void *texel)
+{
+}
+
+
+static void
delete_texture_wrapper(struct gl_renderbuffer *rb)
{
ASSERT(rb->RefCount == 0);
@@ -462,7 +470,10 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
ASSERT(trb->TexImage);
trb->Store = trb->TexImage->TexFormat->StoreTexel;
- ASSERT(trb->Store);
+ if (!trb->Store) {
+ /* we'll never draw into some textures (compressed formats) */
+ trb->Store = store_nop;
+ }
if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
trb->Yoffset = att->Zoffset;
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index d6469b17bea..471a7358a2f 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -509,7 +509,79 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer)
*pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr;
}
+void
+_mesa_emit_nv_temp_initialization(GLcontext *ctx,
+ struct gl_program *program)
+{
+ struct prog_instruction *inst;
+ int i;
+
+ if (!ctx->Shader.EmitNVTempInitialization)
+ return;
+
+ /* We'll swizzle up a zero temporary so we can use it for the
+ * ARL.
+ */
+ if (program->NumTemporaries == 0)
+ program->NumTemporaries = 1;
+
+ _mesa_insert_instructions(program, 0, program->NumTemporaries + 1);
+
+ for (i = 0; i < program->NumTemporaries; i++) {
+ struct prog_instruction *inst = &program->Instructions[i];
+
+ inst->Opcode = OPCODE_SWZ;
+ inst->DstReg.File = PROGRAM_TEMPORARY;
+ inst->DstReg.Index = i;
+ inst->DstReg.WriteMask = WRITEMASK_XYZW;
+ inst->SrcReg[0].File = PROGRAM_TEMPORARY;
+ inst->SrcReg[0].Index = 0;
+ inst->SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO,
+ SWIZZLE_ZERO,
+ SWIZZLE_ZERO,
+ SWIZZLE_ZERO);
+ }
+
+ inst = &program->Instructions[i];
+ inst->Opcode = OPCODE_ARL;
+ inst->DstReg.File = PROGRAM_ADDRESS;
+ inst->DstReg.Index = 0;
+ inst->DstReg.WriteMask = WRITEMASK_XYZW;
+ inst->SrcReg[0].File = PROGRAM_TEMPORARY;
+ inst->SrcReg[0].Index = 0;
+ inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
+
+ if (program->NumAddressRegs == 0)
+ program->NumAddressRegs = 1;
+}
+
+void
+_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program)
+{
+ int i;
+ program->NumTemporaries = 0;
+ for (i = 0; i < program->NumInstructions; i++) {
+ struct prog_instruction *inst = &program->Instructions[i];
+
+ if (inst->DstReg.File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->DstReg.Index + 1);
+ }
+ if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[0].Index + 1);
+ }
+ if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[1].Index + 1);
+ }
+ if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) {
+ program->NumTemporaries = MAX2(program->NumTemporaries,
+ inst->SrcReg[2].Index + 1);
+ }
+ }
+}
/**
* Load/parse/compile a program.
diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/shader/nvprogram.h
index bfac165b5ed..8ee59661bd0 100644
--- a/src/mesa/shader/nvprogram.h
+++ b/src/mesa/shader/nvprogram.h
@@ -103,5 +103,11 @@ extern void GLAPIENTRY
_mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name,
GLdouble *params);
+extern void
+_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program);
+
+extern void
+_mesa_emit_nv_temp_initialization(GLcontext *ctx,
+ struct gl_program *program);
#endif
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index f5e2df26708..6ab8a14cb9b 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_parameter.h"
#include "prog_print.h"
#include "program.h"
@@ -1345,6 +1346,9 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
if (Parse_Program(&parseState, instBuffer)) {
+ gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0};
+ int i;
+
/* successful parse! */
if (parseState.isStateProgram) {
@@ -1398,6 +1402,28 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
_mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0);
_mesa_printf("------------------------------\n");
#endif
+
+ if (program->Base.Parameters)
+ _mesa_free_parameter_list(program->Base.Parameters);
+
+ program->Base.Parameters = _mesa_new_parameter_list ();
+ program->Base.NumParameters = 0;
+
+ state_tokens[0] = STATE_VERTEX_PROGRAM;
+ state_tokens[1] = STATE_ENV;
+ /* Add refs to all of the potential params, in order. If we want to not
+ * upload everything, _mesa_layout_parameters is the answer.
+ */
+ for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) {
+ state_tokens[2] = i;
+ int index = _mesa_add_state_reference(program->Base.Parameters,
+ state_tokens);
+ assert(index == i);
+ }
+ program->Base.NumParameters = program->Base.Parameters->NumParameters;
+
+ _mesa_setup_nv_temporary_count(ctx, &program->Base);
+ _mesa_emit_nv_temp_initialization(ctx, &program->Base);
}
else {
/* Error! */
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 6b9e73b2cbd..2f029b02e50 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -100,6 +100,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
* \param type type of parameter, such as
* \param name the parameter name, will be duplicated/copied!
* \param size number of elements in 'values' vector (1..4, or more)
+ * \param datatype GL_FLOAT, GL_FLOAT_VECx, GL_INT, GL_INT_VECx or GL_NONE.
* \param values initial parameter value, up to 4 GLfloats, or NULL
* \param state state indexes, or NULL
* \return index of new parameter in the list, or -1 if error (out of mem)
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 668dc6eb24c..774cffc451b 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -672,6 +672,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
const GLvoid *indices,
GLint basevertex)
{
+ static GLuint warnCount = 0;
GET_CURRENT_CONTEXT(ctx);
if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
@@ -686,15 +687,19 @@ vbo_exec_DrawRangeElementsBaseVertex(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, indices %p, base %d)\n"
- "\tend is out of bounds (max=%u) "
- "Element Buffer %u (size %d)\n"
- "\tThis should probably be fixed in the application.",
- start, end, count, type, indices, basevertex,
- ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- ctx->Array.ElementArrayBufferObj->Size);
+ warnCount++;
+
+ if (warnCount < 10) {
+ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, "
+ "type 0x%x, indices=%p)\n"
+ "\tend is out of bounds (max=%u) "
+ "Element Buffer %u (size %d)\n"
+ "\tThis should probably be fixed in the application.",
+ start, end, count, type, indices,
+ ctx->Array.ArrayObj->_MaxElement - 1,
+ ctx->Array.ElementArrayBufferObj->Name,
+ ctx->Array.ElementArrayBufferObj->Size);
+ }
if (0)
dump_element_buffer(ctx, type);
@@ -711,16 +716,17 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
GLuint max = _mesa_max_buffer_index(ctx, count, type, indices,
ctx->Array.ElementArrayBufferObj);
if (max >= ctx->Array.ArrayObj->_MaxElement) {
- _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
- "count %d, type 0x%x, indices %p, base %p)\n"
- "\tindex=%u is out of bounds (max=%u) "
- "Element Buffer %u (size %d)\n"
- "\tSkipping the glDrawRangeElements() call",
- start, end, count, type, indices, basevertex,
- max,
- ctx->Array.ArrayObj->_MaxElement - 1,
- ctx->Array.ElementArrayBufferObj->Name,
- ctx->Array.ElementArrayBufferObj->Size);
+ if (warnCount < 10) {
+ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, "
+ "count %d, type 0x%x, indices=%p)\n"
+ "\tindex=%u is out of bounds (max=%u) "
+ "Element Buffer %u (size %d)\n"
+ "\tSkipping the glDrawRangeElements() call",
+ start, end, count, type, indices, max,
+ ctx->Array.ArrayObj->_MaxElement - 1,
+ ctx->Array.ElementArrayBufferObj->Name,
+ ctx->Array.ElementArrayBufferObj->Size);
+ }
return;
}
/* XXX we could also find the min index and compare to 'start'