summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c7
-rw-r--r--src/mesa/shader/prog_statevars.c43
-rw-r--r--src/mesa/shader/slang/slang_codegen.c15
-rw-r--r--src/mesa/shader/slang/slang_compile.c1
-rw-r--r--src/mesa/shader/slang/slang_emit.c3
5 files changed, 56 insertions, 13 deletions
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 1ddea33e35..80746950c7 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -56,11 +56,13 @@ wmesa_free_framebuffer(HDC hdc)
prev = pwfb;
}
if (pwfb) {
+ struct gl_framebuffer *fb;
if (pwfb == FirstFramebuffer)
FirstFramebuffer = pwfb->next;
else
prev->next = pwfb->next;
- _mesa_unreference_framebuffer(&pwfb->Base);
+ fb = &pwfb->Base;
+ _mesa_unreference_framebuffer(&fb);
}
}
@@ -1503,6 +1505,9 @@ WMesaContext WMesaCreateContext(HDC hDC,
ctx = &c->gl_ctx;
_mesa_initialize_context(ctx, visual, NULL, &functions, (void *)c);
+ /* visual no longer needed - it was copied by _mesa_initialize_context() */
+ _mesa_destroy_visual(visual);
+
_mesa_enable_sw_extensions(ctx);
_mesa_enable_1_3_extensions(ctx);
_mesa_enable_1_4_extensions(ctx);
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 34c4741350..88fca19835 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -631,6 +631,9 @@ append(char *dst, const char *src)
}
+/**
+ * Convert token 'k' to a string, append it only 'dst' string.
+ */
static void
append_token(char *dst, gl_state_index k)
{
@@ -763,11 +766,30 @@ append_token(char *dst, gl_state_index k)
case STATE_LOCAL:
append(dst, "local");
break;
+ /* BEGIN internal state vars */
+ case STATE_INTERNAL:
+ append(dst, "(internal)");
+ break;
case STATE_NORMAL_SCALE:
append(dst, "normalScale");
break;
- case STATE_INTERNAL:
- append(dst, "(internal)");
+ case STATE_TEXRECT_SCALE:
+ append(dst, "texrectScale");
+ break;
+ case STATE_FOG_PARAMS_OPTIMIZED:
+ append(dst, "fogParamsOptimized");
+ break;
+ case STATE_LIGHT_SPOT_DIR_NORMALIZED:
+ append(dst, "lightSpotDirNormalized");
+ break;
+ case STATE_LIGHT_POSITION:
+ append(dst, "lightPosition");
+ break;
+ case STATE_LIGHT_POSITION_NORMALIZED:
+ append(dst, "light.position.normalized");
+ break;
+ case STATE_LIGHT_HALF_VECTOR:
+ append(dst, "lightHalfVector");
break;
case STATE_PT_SCALE:
append(dst, "PTscale");
@@ -818,16 +840,16 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
char tmp[30];
append(str, "state.");
- append_token(str, (gl_state_index) state[0]);
+ append_token(str, state[0]);
switch (state[0]) {
case STATE_MATERIAL:
append_face(str, state[1]);
- append_token(str, (gl_state_index) state[2]);
+ append_token(str, state[2]);
break;
case STATE_LIGHT:
append_index(str, state[1]); /* light number [i]. */
- append_token(str, (gl_state_index) state[2]); /* coefficients */
+ append_token(str, state[2]); /* coefficients */
break;
case STATE_LIGHTMODEL_AMBIENT:
append(str, "lightmodel.ambient");
@@ -843,11 +865,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
case STATE_LIGHTPROD:
append_index(str, state[1]); /* light number [i]. */
append_face(str, state[2]);
- append_token(str, (gl_state_index) state[3]);
+ append_token(str, state[3]);
break;
case STATE_TEXGEN:
append_index(str, state[1]); /* tex unit [i] */
- append_token(str, (gl_state_index) state[2]); /* plane coef */
+ append_token(str, state[2]); /* plane coef */
break;
case STATE_TEXENV_COLOR:
append_index(str, state[1]); /* tex unit [i] */
@@ -869,11 +891,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
/* state[2] = first row to fetch */
/* state[3] = last row to fetch */
/* state[4] = transpose, inverse or invtrans */
- const gl_state_index mat = (gl_state_index) state[0];
+ const gl_state_index mat = state[0];
const GLuint index = (GLuint) state[1];
const GLuint firstRow = (GLuint) state[2];
const GLuint lastRow = (GLuint) state[3];
- const gl_state_index modifier = (gl_state_index) state[4];
+ const gl_state_index modifier = state[4];
if (index ||
mat == STATE_TEXTURE_MATRIX ||
mat == STATE_PROGRAM_MATRIX)
@@ -901,10 +923,11 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
case STATE_VERTEX_PROGRAM:
/* state[1] = {STATE_ENV, STATE_LOCAL} */
/* state[2] = parameter index */
- append_token(str, (gl_state_index) state[1]);
+ append_token(str, state[1]);
append_index(str, state[2]);
break;
case STATE_INTERNAL:
+ append_token(str, state[1]);
break;
default:
_mesa_problem(NULL, "Invalid state in _mesa_program_state_string");
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 8d2655ec51..8abb642a72 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2028,6 +2028,21 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
return NULL;
}
+ /* type checking to be sure function's return type matches 'dest' type */
+ if (dest) {
+ slang_typeinfo t0;
+
+ slang_typeinfo_construct(&t0);
+ _slang_typeof_operation(A, dest, &t0);
+
+ if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) {
+ slang_info_log_error(A->log,
+ "Incompatible type returned by call to '%s'",
+ name);
+ return NULL;
+ }
+ }
+
n = _slang_gen_function_call(A, fun, oper, dest);
if (n && !n->Store && !dest
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index efae4e98fb..457a6b92c1 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -1391,7 +1391,6 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
RETURN0;
break;
case OP_METHOD:
- printf("******* begin OP_METHOD\n");
op->type = SLANG_OPER_METHOD;
op->a_obj = parse_identifier(C);
if (op->a_obj == SLANG_ATOM_NULL)
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index f31e9b4e6c..e3cb252a3d 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -1324,7 +1324,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
_slang_is_temp(emitInfo->vt, n->Children[1]->Store) &&
(inst->DstReg.File == n->Children[1]->Store->File) &&
(inst->DstReg.Index == n->Children[1]->Store->Index) &&
- !n->Children[0]->Store->IsIndirect) {
+ !n->Children[0]->Store->IsIndirect &&
+ n->Children[0]->Store->Size <= 4) {
/* Peephole optimization:
* The Right-Hand-Side has its results in a temporary place.
* Modify the RHS (and the prev instruction) to store its results