summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c2
-rw-r--r--src/mesa/main/api_exec.c4
-rw-r--r--src/mesa/main/get.c8
-rw-r--r--src/mesa/main/get_gen.py10
-rw-r--r--src/mesa/shader/grammar/grammar_crt.c10
-rw-r--r--src/mesa/shader/slang/slang_codegen.c6
-rw-r--r--src/mesa/vbo/vbo_exec_api.c10
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c19
10 files changed, 53 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 8759826e83..9de05408ba 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -1024,6 +1024,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
case OPCODE_ADD:
brw_ADD(p, dst, args[0], args[1]);
break;
+ case OPCODE_COS:
+ emit_math1(c, BRW_MATH_FUNCTION_COS, dst, args[0], BRW_MATH_PRECISION_FULL);
+ break;
case OPCODE_DP3:
brw_DP3(p, dst, args[0], args[1]);
break;
@@ -1089,6 +1092,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
case OPCODE_SEQ:
emit_seq(p, dst, args[0], args[1]);
break;
+ case OPCODE_SIN:
+ emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, args[0], BRW_MATH_PRECISION_FULL);
+ break;
case OPCODE_SNE:
emit_sne(p, dst, args[0], args[1]);
break;
@@ -1155,7 +1161,10 @@ void brw_vs_emit(struct brw_vs_compile *c )
case OPCODE_ENDSUB:
break;
default:
- _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode);
+ _mesa_printf("Unsupported opcode %i (%s) in vertex shader\n",
+ inst->Opcode, inst->Opcode < MAX_OPCODE ?
+ _mesa_opcode_string(inst->Opcode) :
+ "unknown");
break;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index f1c14c98f9..58c78c4b2c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -1302,8 +1302,10 @@ void brw_wm_emit( struct brw_wm_compile *c )
break;
default:
- _mesa_printf("unsupport opcode %d in fragment program\n",
- inst->opcode);
+ _mesa_printf("Unsupported opcode %i (%s) in fragment shader\n",
+ inst->opcode, inst->opcode < MAX_OPCODE ?
+ _mesa_opcode_string(inst->opcode) :
+ "unknown");
}
for (i = 0; i < 4; i++)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 3677dd41d9..fce5e36b9d 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -540,7 +540,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
DBG("Render to DEPTH16 texture OK\n");
- } else if (texImage->TexFormat == &_mesa_texformat_z24_s8) {
+ } else if (texImage->TexFormat == &_mesa_texformat_s8_z24) {
irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
DBG("Render to DEPTH_STENCIL texture OK\n");
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 8ebe4a3e4a..0c3c9c4de4 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -74,7 +74,7 @@
#include "eval.h"
#endif
#include "get.h"
-#if FEATURE_feadback
+#if FEATURE_feedback
#include "feedback.h"
#endif
#include "fog.h"
@@ -222,7 +222,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_CopyPixels(exec, _mesa_CopyPixels);
SET_DrawPixels(exec, _mesa_DrawPixels);
#endif
-#if FEATURE_feadback
+#if FEATURE_feedback
SET_InitNames(exec, _mesa_InitNames);
SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
SET_LoadName(exec, _mesa_LoadName);
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 5202c3ddac..f72aa6a288 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1092,7 +1092,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
- params[i] = ENUM_TO_INT(formats[i]);
+ params[i] = ENUM_TO_BOOLEAN(formats[i]);
}
break;
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
@@ -2137,7 +2137,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits);
break;
case GL_DEPTH_CLEAR_VALUE:
- params[0] = (GLfloat)ctx->Depth.Clear;
+ params[0] = ctx->Depth.Clear;
break;
case GL_DEPTH_FUNC:
params[0] = ENUM_TO_FLOAT(ctx->Depth.Func);
@@ -2940,7 +2940,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
- params[i] = (GLfloat)(ENUM_TO_INT(formats[i]));
+ params[i] = ENUM_TO_FLOAT(formats[i]);
}
break;
case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT:
@@ -3985,7 +3985,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = ctx->DrawBuffer->Visual.depthBits;
break;
case GL_DEPTH_CLEAR_VALUE:
- params[0] = IROUND(ctx->Depth.Clear);
+ params[0] = FLOAT_TO_INT(ctx->Depth.Clear);
break;
case GL_DEPTH_FUNC:
params[0] = ENUM_TO_INT(ctx->Depth.Func);
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index decc9dd52a..152e378b4f 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -50,7 +50,8 @@ TypeStrings = {
# - the GL state name, such as GL_CURRENT_COLOR
# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
# - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
-# - optional extra code or empty string
+# - optional extra code or empty string. If present, "CONVERSION" will be
+# replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc.
# - optional extensions to check, or None
#
StateVars = [
@@ -179,7 +180,7 @@ StateVars = [
( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
"", None ),
- ( "GL_DEPTH_CLEAR_VALUE", GLfloat, ["ctx->Depth.Clear"], "", None ),
+ ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["ctx->Depth.Clear"], "", None ),
( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
( "GL_DEPTH_RANGE", GLfloatN,
[ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
@@ -532,7 +533,7 @@ StateVars = [
GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
ASSERT(n <= 100);
for (i = 0; i < n; i++)
- params[i] = ENUM_TO_INT(formats[i]);""",
+ params[i] = CONVERSION(formats[i]);""",
["ARB_texture_compression"] ),
# GL_EXT_compiled_vertex_array
@@ -1083,10 +1084,11 @@ def EmitGetFunction(stateVars, returnType):
assert len(extensions) == 4
print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
(extensions[0], extensions[1], extensions[2], extensions[3], function))
+ conversion = ConversionFunc(varType, returnType)
if optionalCode:
+ optionalCode = string.replace(optionalCode, "CONVERSION", conversion);
print " {"
print " " + optionalCode
- conversion = ConversionFunc(varType, returnType)
n = len(state)
for i in range(n):
if conversion:
diff --git a/src/mesa/shader/grammar/grammar_crt.c b/src/mesa/shader/grammar/grammar_crt.c
index bdf2da9b2e..d2c95d1c8e 100644
--- a/src/mesa/shader/grammar/grammar_crt.c
+++ b/src/mesa/shader/grammar/grammar_crt.c
@@ -10,17 +10,17 @@ void grammar_alloc_free (void *ptr)
free (ptr);
}
-void *grammar_alloc_malloc (unsigned int size)
+void *grammar_alloc_malloc (size_t size)
{
return malloc (size);
}
-void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
+void *grammar_alloc_realloc (void *ptr, size_t old_size, size_t size)
{
return realloc (ptr, size);
}
-void *grammar_memory_copy (void *dst, const void * src, unsigned int size)
+void *grammar_memory_copy (void *dst, const void * src, size_t size)
{
return memcpy (dst, src, size);
}
@@ -30,7 +30,7 @@ int grammar_string_compare (const byte *str1, const byte *str2)
return strcmp ((const char *) str1, (const char *) str2);
}
-int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n)
+int grammar_string_compare_n (const byte *str1, const byte *str2, size_t n)
{
return strncmp ((const char *) str1, (const char *) str2, n);
}
@@ -40,7 +40,7 @@ byte *grammar_string_copy (byte *dst, const byte *src)
return (byte *) strcpy ((char *) dst, (const char *) src);
}
-byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n)
+byte *grammar_string_copy_n (byte *dst, const byte *src, size_t n)
{
return (byte *) strncpy ((char *) dst, (const char *) src, n);
}
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 7006e86958..72a3c0ef9e 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2439,7 +2439,11 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
/*assert(!var->declared);*/
var->declared = GL_TRUE;
- assert(!is_sampler_type(&var->type));
+ if(is_sampler_type(&var->type)) {
+ slang_info_log_error(A->log, "redeclaration of sampler '%s'",
+ (char*) var->a_name);
+ return NULL;
+ }
n = new_node0(IR_VAR_DECL);
if (n) {
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index d70b4bb1a1..fdb0c5a9a4 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -700,8 +700,8 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
&exec->vtx.bufferobj,
ctx->Array.NullBufferObj);
+ ASSERT(!exec->vtx.buffer_map);
exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64);
-
vbo_exec_vtxfmt_init( exec );
/* Hook our functions into the dispatch table.
@@ -726,13 +726,13 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
if (exec->vtx.bufferobj->Name) {
- ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, exec->vtx.bufferobj);
- ctx->Driver.DeleteBuffer(ctx, exec->vtx.bufferobj);
- exec->vtx.bufferobj = NULL;
+ /* 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) {
ALIGN_FREE(exec->vtx.buffer_map);
exec->vtx.buffer_map = NULL;
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 7ec431a237..92356ba977 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -200,7 +200,6 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
/* Ptr into ordinary app memory */
arrays[attr].Ptr = (void *) data;
}
-
arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
@@ -243,8 +242,11 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
*/
vbo_exec_bind_arrays( ctx );
- ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
- exec->vtx.buffer_map = NULL;
+ /* if using a real VBO, unmap it before drawing */
+ if (exec->vtx.bufferobj->Name) {
+ ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj);
+ exec->vtx.buffer_map = NULL;
+ }
vbo_context(ctx)->draw_prims( ctx,
exec->vtx.inputs,
@@ -254,11 +256,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec )
0,
exec->vtx.vert_count - 1);
- /* Get new data:
- */
- ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
- exec->vtx.buffer_map
- = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ /* If using a real VBO, get new storage */
+ if (exec->vtx.bufferobj->Name) {
+ ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj);
+ exec->vtx.buffer_map =
+ ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj);
+ }
}
}