aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
committermarha <marha@users.sourceforge.net>2015-03-05 22:17:40 +0100
commit8574eba804031f6b19713f0b02952280730bf62e (patch)
tree9afa4d6fe299d43ab7e580dc08a5547120274561 /mesalib/src/mesa/program
parenteef70231353a6103f47fcae88a6e89e765e5cd47 (diff)
downloadvcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.gz
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.tar.bz2
vcxsrv-8574eba804031f6b19713f0b02952280730bf62e.zip
fontconfig mesa git update 5 Mar 2015
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/arbprogparse.c4
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp2
-rw-r--r--mesalib/src/mesa/program/prog_execute.c85
-rw-r--r--mesalib/src/mesa/program/prog_instruction.c12
-rw-r--r--mesalib/src/mesa/program/prog_optimize.c34
-rw-r--r--mesalib/src/mesa/program/prog_parameter.c6
-rw-r--r--mesalib/src/mesa/program/prog_parameter_layout.c2
-rw-r--r--mesalib/src/mesa/program/prog_print.c16
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c18
-rw-r--r--mesalib/src/mesa/program/program.c40
-rw-r--r--mesalib/src/mesa/program/program.h2
-rw-r--r--mesalib/src/mesa/program/program_parse.y14
-rw-r--r--mesalib/src/mesa/program/programopt.c2
-rw-r--r--mesalib/src/mesa/program/sampler.cpp1
14 files changed, 122 insertions, 116 deletions
diff --git a/mesalib/src/mesa/program/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c
index 53a6f37cb..3ddaeca8a 100644
--- a/mesalib/src/mesa/program/arbprogparse.c
+++ b/mesalib/src/mesa/program/arbprogparse.c
@@ -73,7 +73,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
struct asm_parser_state state;
GLuint i;
- ASSERT(target == GL_FRAGMENT_PROGRAM_ARB);
+ assert(target == GL_FRAGMENT_PROGRAM_ARB);
memset(&prog, 0, sizeof(prog));
memset(&state, 0, sizeof(state));
@@ -166,7 +166,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
struct gl_program prog;
struct asm_parser_state state;
- ASSERT(target == GL_VERTEX_PROGRAM_ARB);
+ assert(target == GL_VERTEX_PROGRAM_ARB);
memset(&prog, 0, sizeof(prog));
memset(&state, 0, sizeof(state));
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index b2776da45..39790ec8e 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -1018,7 +1018,7 @@ void
ir_to_mesa_visitor::visit(ir_expression *ir)
{
unsigned int operand;
- src_reg op[Elements(ir->operands)];
+ src_reg op[ARRAY_SIZE(ir->operands)];
src_reg result_src;
dst_reg result_dst;
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index b2fbc808a..dc4919ae8 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/src/mesa/program/prog_execute.c
@@ -35,6 +35,7 @@
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/macros.h"
@@ -123,7 +124,7 @@ get_src_register_pointer(const struct prog_src_register *source,
return (GLfloat *) prog->Parameters->ParameterValues[reg];
case PROGRAM_SYSTEM_VALUE:
- assert(reg < (GLint) Elements(machine->SystemValues));
+ assert(reg < (GLint) ARRAY_SIZE(machine->SystemValues));
return machine->SystemValues[reg];
default:
@@ -190,10 +191,10 @@ fetch_vector4(const struct prog_src_register *source,
COPY_4V(result, src);
}
else {
- ASSERT(GET_SWZ(source->Swizzle, 0) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 1) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 2) <= 3);
- ASSERT(GET_SWZ(source->Swizzle, 3) <= 3);
+ assert(GET_SWZ(source->Swizzle, 0) <= 3);
+ assert(GET_SWZ(source->Swizzle, 1) <= 3);
+ assert(GET_SWZ(source->Swizzle, 2) <= 3);
+ assert(GET_SWZ(source->Swizzle, 3) <= 3);
result[0] = src[GET_SWZ(source->Swizzle, 0)];
result[1] = src[GET_SWZ(source->Swizzle, 1)];
result[2] = src[GET_SWZ(source->Swizzle, 2)];
@@ -201,13 +202,13 @@ fetch_vector4(const struct prog_src_register *source,
}
if (source->Abs) {
- result[0] = FABSF(result[0]);
- result[1] = FABSF(result[1]);
- result[2] = FABSF(result[2]);
- result[3] = FABSF(result[3]);
+ result[0] = fabsf(result[0]);
+ result[1] = fabsf(result[1]);
+ result[2] = fabsf(result[2]);
+ result[3] = fabsf(result[3]);
}
if (source->Negate) {
- ASSERT(source->Negate == NEGATE_XYZW);
+ assert(source->Negate == NEGATE_XYZW);
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
@@ -259,13 +260,13 @@ fetch_vector4_deriv(struct gl_context * ctx,
result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
if (source->Abs) {
- result[0] = FABSF(result[0]);
- result[1] = FABSF(result[1]);
- result[2] = FABSF(result[2]);
- result[3] = FABSF(result[3]);
+ result[0] = fabsf(result[0]);
+ result[1] = fabsf(result[1]);
+ result[2] = fabsf(result[2]);
+ result[3] = fabsf(result[3]);
}
if (source->Negate) {
- ASSERT(source->Negate == NEGATE_XYZW);
+ assert(source->Negate == NEGATE_XYZW);
result[0] = -result[0];
result[1] = -result[1];
result[2] = -result[2];
@@ -290,7 +291,7 @@ fetch_vector1(const struct prog_src_register *source,
result[0] = src[GET_SWZ(source->Swizzle, 0)];
if (source->Abs) {
- result[0] = FABSF(result[0]);
+ result[0] = fabsf(result[0]);
}
if (source->Negate) {
result[0] = -result[0];
@@ -520,10 +521,10 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat a[4], result[4];
fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = FABSF(a[0]);
- result[1] = FABSF(a[1]);
- result[2] = FABSF(a[2]);
- result[3] = FABSF(a[3]);
+ result[0] = fabsf(a[0]);
+ result[1] = fabsf(a[1]);
+ result[2] = fabsf(a[2]);
+ result[3] = fabsf(a[3]);
store_vector4(inst, machine, result);
}
break;
@@ -556,12 +557,12 @@ _mesa_execute_program(struct gl_context * ctx,
break;
case OPCODE_BGNLOOP:
/* no-op */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
break;
case OPCODE_ENDLOOP:
/* subtract 1 here since pc is incremented by for(pc) loop */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_BGNLOOP);
pc = inst->BranchTarget - 1; /* go to matching BNGLOOP */
break;
@@ -570,7 +571,7 @@ _mesa_execute_program(struct gl_context * ctx,
case OPCODE_ENDSUB: /* end subroutine */
break;
case OPCODE_BRK: /* break out of loop (conditional) */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
if (eval_condition(machine, inst)) {
/* break out of loop */
@@ -579,7 +580,7 @@ _mesa_execute_program(struct gl_context * ctx,
}
break;
case OPCODE_CONT: /* continue loop (conditional) */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
if (eval_condition(machine, inst)) {
/* continue at ENDLOOP */
@@ -708,7 +709,7 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat t[4], q[4], floor_t0;
fetch_vector1(&inst->SrcReg[0], machine, t);
- floor_t0 = FLOORF(t[0]);
+ floor_t0 = floorf(t[0]);
if (floor_t0 > FLT_MAX_EXP) {
SET_POS_INFINITY(q[0]);
SET_POS_INFINITY(q[2]);
@@ -718,7 +719,7 @@ _mesa_execute_program(struct gl_context * ctx,
q[2] = 0.0F;
}
else {
- q[0] = LDEXPF(1.0, (int) floor_t0);
+ q[0] = ldexpf(1.0, (int) floor_t0);
/* Note: GL_NV_vertex_program expects
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
@@ -747,10 +748,10 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat a[4], result[4];
fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = FLOORF(a[0]);
- result[1] = FLOORF(a[1]);
- result[2] = FLOORF(a[2]);
- result[3] = FLOORF(a[3]);
+ result[0] = floorf(a[0]);
+ result[1] = floorf(a[1]);
+ result[2] = floorf(a[2]);
+ result[3] = floorf(a[3]);
store_vector4(inst, machine, result);
}
break;
@@ -758,17 +759,17 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat a[4], result[4];
fetch_vector4(&inst->SrcReg[0], machine, a);
- result[0] = a[0] - FLOORF(a[0]);
- result[1] = a[1] - FLOORF(a[1]);
- result[2] = a[2] - FLOORF(a[2]);
- result[3] = a[3] - FLOORF(a[3]);
+ result[0] = a[0] - floorf(a[0]);
+ result[1] = a[1] - floorf(a[1]);
+ result[2] = a[2] - floorf(a[2]);
+ result[3] = a[3] - floorf(a[3]);
store_vector4(inst, machine, result);
}
break;
case OPCODE_IF:
{
GLboolean cond;
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ELSE ||
program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDIF);
@@ -797,7 +798,7 @@ _mesa_execute_program(struct gl_context * ctx,
break;
case OPCODE_ELSE:
/* goto ENDIF */
- ASSERT(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDIF);
assert(inst->BranchTarget >= 0);
pc = inst->BranchTarget;
@@ -874,7 +875,7 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat t[4], q[4], abs_t0;
fetch_vector1(&inst->SrcReg[0], machine, t);
- abs_t0 = FABSF(t[0]);
+ abs_t0 = fabsf(t[0]);
if (abs_t0 != 0.0F) {
if (IS_INF_OR_NAN(abs_t0))
{
@@ -884,7 +885,7 @@ _mesa_execute_program(struct gl_context * ctx,
}
else {
int exponent;
- GLfloat mantissa = FREXPF(t[0], &exponent);
+ GLfloat mantissa = frexpf(t[0], &exponent);
q[0] = (GLfloat) (exponent - 1);
q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */
@@ -1083,8 +1084,8 @@ _mesa_execute_program(struct gl_context * ctx,
{
GLfloat a[4], result[4];
fetch_vector1(&inst->SrcReg[0], machine, a);
- a[0] = FABSF(a[0]);
- result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
+ a[0] = fabsf(a[0]);
+ result[0] = result[1] = result[2] = result[3] = 1.0f / sqrtf(a[0]);
store_vector4(inst, machine, result);
if (DEBUG_PROG) {
printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]);
@@ -1260,7 +1261,7 @@ _mesa_execute_program(struct gl_context * ctx,
else if (swz == SWIZZLE_ONE)
result[i] = 1.0;
else {
- ASSERT(swz <= 3);
+ assert(swz <= 3);
result[i] = src[swz];
}
if (source->Negate & (1 << i))
@@ -1357,7 +1358,7 @@ _mesa_execute_program(struct gl_context * ctx,
fetch_vector4(&inst->SrcReg[0], machine, texcoord);
/* Not so sure about this test - if texcoord[3] is
- * zero, we'd probably be fine except for an ASSERT in
+ * zero, we'd probably be fine except for an assert in
* IROUND_POS() which gets triggered by the inf values created.
*/
if (texcoord[3] != 0.0) {
diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c
index 254c0128f..6a9bcb7b5 100644
--- a/mesalib/src/mesa/program/prog_instruction.c
+++ b/mesalib/src/mesa/program/prog_instruction.c
@@ -200,9 +200,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
GLuint
_mesa_num_inst_src_regs(gl_inst_opcode opcode)
{
- ASSERT(opcode < MAX_OPCODE);
- ASSERT(opcode == InstInfo[opcode].Opcode);
- ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
+ assert(opcode < MAX_OPCODE);
+ assert(opcode == InstInfo[opcode].Opcode);
+ assert(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
return InstInfo[opcode].NumSrcRegs;
}
@@ -213,9 +213,9 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode)
GLuint
_mesa_num_inst_dst_regs(gl_inst_opcode opcode)
{
- ASSERT(opcode < MAX_OPCODE);
- ASSERT(opcode == InstInfo[opcode].Opcode);
- ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
+ assert(opcode < MAX_OPCODE);
+ assert(opcode == InstInfo[opcode].Opcode);
+ assert(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
return InstInfo[opcode].NumDstRegs;
}
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c
index 65d427cb4..6d4485acb 100644
--- a/mesalib/src/mesa/program/prog_optimize.c
+++ b/mesalib/src/mesa/program/prog_optimize.c
@@ -57,7 +57,7 @@ get_src_arg_mask(const struct prog_instruction *inst,
GLuint read_mask, channel_mask;
GLuint comp;
- ASSERT(arg < _mesa_num_inst_src_regs(inst->Opcode));
+ assert(arg < _mesa_num_inst_src_regs(inst->Opcode));
/* Form the dst register, find the written channels */
if (inst->CondUpdate) {
@@ -133,7 +133,7 @@ get_dst_mask_for_mov(const struct prog_instruction *mov, GLuint src_mask)
GLuint comp;
GLuint updated_mask = 0x0;
- ASSERT(mov->Opcode == OPCODE_MOV);
+ assert(mov->Opcode == OPCODE_MOV);
for (comp = 0; comp < 4; ++comp) {
GLuint src_comp;
@@ -225,13 +225,13 @@ replace_regs(struct gl_program *prog, gl_register_file file, const GLint map[])
for (j = 0; j < numSrc; j++) {
if (inst->SrcReg[j].File == file) {
GLuint index = inst->SrcReg[j].Index;
- ASSERT(map[index] >= 0);
+ assert(map[index] >= 0);
inst->SrcReg[j].Index = map[index];
}
}
if (inst->DstReg.File == file) {
const GLuint index = inst->DstReg.Index;
- ASSERT(map[index] >= 0);
+ assert(map[index] >= 0);
inst->DstReg.Index = map[index];
}
}
@@ -272,7 +272,7 @@ _mesa_remove_dead_code_global(struct gl_program *prog)
if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) {
const GLuint index = inst->SrcReg[j].Index;
GLuint read_mask;
- ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
+ assert(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
read_mask = get_src_arg_mask(inst, j, NO_MASK);
if (inst->SrcReg[j].RelAddr) {
@@ -295,7 +295,7 @@ _mesa_remove_dead_code_global(struct gl_program *prog)
/* check dst reg */
if (inst->DstReg.File == PROGRAM_TEMPORARY) {
const GLuint index = inst->DstReg.Index;
- ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
+ assert(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
if (inst->DstReg.RelAddr) {
if (dbg)
@@ -676,7 +676,7 @@ _mesa_merge_mov_into_inst(struct prog_instruction *inst,
for (dst_comp = 0; dst_comp < 4; ++dst_comp) {
if (mov->DstReg.WriteMask & (1 << dst_comp)) {
const GLuint src_comp = GET_SWZ(mov->SrcReg[0].Swizzle, dst_comp);
- ASSERT(src_comp < 4);
+ assert(src_comp < 4);
dst_to_src_comp[dst_comp] = src_comp;
}
}
@@ -692,9 +692,9 @@ _mesa_merge_mov_into_inst(struct prog_instruction *inst,
if ((mov->DstReg.WriteMask & (1 << dst_comp)) == 0)
continue;
src_comp = dst_to_src_comp[dst_comp];
- ASSERT(src_comp < 4);
+ assert(src_comp < 4);
arg_comp = GET_SWZ(arg_swz, src_comp);
- ASSERT(arg_comp < 4);
+ assert(arg_comp < 4);
inst->SrcReg[arg].Swizzle |= arg_comp << (3*dst_comp);
}
}
@@ -871,7 +871,7 @@ insert_interval_by_end(struct interval_list *list, const struct interval *inv)
{
GLuint i;
for (i = 0; i + 1 < list->Num; i++) {
- ASSERT(list->Intervals[i].End <= list->Intervals[i + 1].End);
+ assert(list->Intervals[i].End <= list->Intervals[i + 1].End);
}
}
#endif
@@ -887,8 +887,8 @@ remove_interval(struct interval_list *list, const struct interval *inv)
for (k = 0; k < list->Num; k++) {
if (list->Intervals[k].Reg == inv->Reg) {
/* found, remove it */
- ASSERT(list->Intervals[k].Start == inv->Start);
- ASSERT(list->Intervals[k].End == inv->End);
+ assert(list->Intervals[k].Start == inv->Start);
+ assert(list->Intervals[k].End == inv->End);
while (k < list->Num - 1) {
list->Intervals[k] = list->Intervals[k + 1];
k++;
@@ -924,7 +924,7 @@ sort_interval_list_by_start(struct interval_list *list)
{
GLuint i;
for (i = 0; i + 1 < list->Num; i++) {
- ASSERT(list->Intervals[i].Start <= list->Intervals[i + 1].Start);
+ assert(list->Intervals[i].Start <= list->Intervals[i + 1].Start);
}
}
#endif
@@ -966,9 +966,9 @@ update_interval(GLint intBegin[], GLint intEnd[],
begin = loopStack[0].Start;
}
- ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
+ assert(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
if (intBegin[index] == -1) {
- ASSERT(intEnd[index] == -1);
+ assert(intEnd[index] == -1);
intBegin[index] = begin;
intEnd[index] = end;
}
@@ -1176,7 +1176,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
else {
/* Interval 'inv' has expired */
const GLint regNew = registerMap[inv->Reg];
- ASSERT(regNew >= 0);
+ assert(regNew >= 0);
if (dbg)
printf(" expire interval for reg %u\n", inv->Reg);
@@ -1188,7 +1188,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
/* return register regNew to the free pool */
if (dbg)
printf(" free reg %d\n", regNew);
- ASSERT(usedRegs[regNew] == GL_TRUE);
+ assert(usedRegs[regNew] == GL_TRUE);
usedRegs[regNew] = GL_FALSE;
}
}
diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c
index 0ef46415d..5939f6f72 100644
--- a/mesalib/src/mesa/program/prog_parameter.c
+++ b/mesalib/src/mesa/program/prog_parameter.c
@@ -241,8 +241,8 @@ _mesa_add_typed_unnamed_constant(struct gl_program_parameter_list *paramList,
GLenum datatype, GLuint *swizzleOut)
{
GLint pos;
- ASSERT(size >= 1);
- ASSERT(size <= 4);
+ assert(size >= 1);
+ assert(size <= 4);
if (swizzleOut &&
_mesa_lookup_parameter_constant(paramList, values,
@@ -528,7 +528,7 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list)
GLuint size = MIN2(p->Size, 4);
GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType,
list->ParameterValues[i], NULL);
- ASSERT(j >= 0);
+ assert(j >= 0);
pCopy = clone->Parameters + j;
/* copy state indexes */
if (p->Type == PROGRAM_STATE_VAR) {
diff --git a/mesalib/src/mesa/program/prog_parameter_layout.c b/mesalib/src/mesa/program/prog_parameter_layout.c
index e83469059..282a367ad 100644
--- a/mesalib/src/mesa/program/prog_parameter_layout.c
+++ b/mesalib/src/mesa/program/prog_parameter_layout.c
@@ -28,7 +28,7 @@
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
-#include "main/compiler.h"
+#include "main/imports.h"
#include "main/mtypes.h"
#include "prog_parameter.h"
#include "prog_parameter_layout.h"
diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c
index 3f499749a..d588d07ff 100644
--- a/mesalib/src/mesa/program/prog_print.c
+++ b/mesalib/src/mesa/program/prog_print.c
@@ -182,20 +182,20 @@ arb_input_attrib_string(GLuint index, GLenum progType)
};
/* sanity checks */
- STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX);
- STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(vertAttribs) == VERT_ATTRIB_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(fragAttribs) == VARYING_SLOT_MAX);
assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0);
assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0);
assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0);
assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < Elements(vertAttribs));
+ assert(index < ARRAY_SIZE(vertAttribs));
return vertAttribs[index];
}
else {
assert(progType == GL_FRAGMENT_PROGRAM_ARB);
- assert(index < Elements(fragAttribs));
+ assert(index < ARRAY_SIZE(fragAttribs));
return fragAttribs[index];
}
}
@@ -321,19 +321,19 @@ arb_output_attrib_string(GLuint index, GLenum progType)
};
/* sanity checks */
- STATIC_ASSERT(Elements(vertResults) == VARYING_SLOT_MAX);
- STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(vertResults) == VARYING_SLOT_MAX);
+ STATIC_ASSERT(ARRAY_SIZE(fragResults) == FRAG_RESULT_MAX);
assert(strcmp(vertResults[VARYING_SLOT_POS], "result.position") == 0);
assert(strcmp(vertResults[VARYING_SLOT_VAR0], "result.varying[0]") == 0);
assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0);
if (progType == GL_VERTEX_PROGRAM_ARB) {
- assert(index < Elements(vertResults));
+ assert(index < ARRAY_SIZE(vertResults));
return vertResults[index];
}
else {
assert(progType == GL_FRAGMENT_PROGRAM_ARB);
- assert(index < Elements(fragResults));
+ assert(index < ARRAY_SIZE(fragResults));
return fragResults[index];
}
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 7f5daf8c6..57b25a7e3 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -29,6 +29,7 @@
*/
+#include <stdio.h>
#include "main/glheader.h"
#include "main/context.h"
#include "main/blend.h"
@@ -41,6 +42,9 @@
#include "main/samplerobj.h"
+#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
+
+
/**
* Use the list of tokens in the state[] array to find global GL state
* and return it in <value>. Usually, four values are returned in <value>
@@ -58,9 +62,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
/* state[1] is either 0=front or 1=back side */
const GLuint face = (GLuint) state[1];
const struct gl_material *mat = &ctx->Light.Material;
- ASSERT(face == 0 || face == 1);
+ assert(face == 0 || face == 1);
/* we rely on tokens numbered so that _BACK_ == _FRONT_+ 1 */
- ASSERT(MAT_ATTRIB_FRONT_AMBIENT + 1 == MAT_ATTRIB_BACK_AMBIENT);
+ assert(MAT_ATTRIB_FRONT_AMBIENT + 1 == MAT_ATTRIB_BACK_AMBIENT);
/* XXX we could get rid of this switch entirely with a little
* work in arbprogparse.c's parse_state_single_item().
*/
@@ -170,7 +174,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
const GLuint ln = (GLuint) state[1];
const GLuint face = (GLuint) state[2];
GLint i;
- ASSERT(face == 0 || face == 1);
+ assert(face == 0 || face == 1);
switch (state[3]) {
case STATE_AMBIENT:
for (i = 0; i < 3; i++) {
@@ -295,8 +299,8 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
const gl_state_index modifier = state[4];
const GLfloat *m;
GLuint row, i;
- ASSERT(firstRow < 4);
- ASSERT(lastRow < 4);
+ assert(firstRow < 4);
+ assert(lastRow < 4);
if (mat == STATE_MODELVIEW_MATRIX) {
matrix = ctx->ModelviewMatrixStack.Top;
}
@@ -307,11 +311,11 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
matrix = &ctx->_ModelProjectMatrix;
}
else if (mat == STATE_TEXTURE_MATRIX) {
- ASSERT(index < Elements(ctx->TextureMatrixStack));
+ assert(index < ARRAY_SIZE(ctx->TextureMatrixStack));
matrix = ctx->TextureMatrixStack[index].Top;
}
else if (mat == STATE_PROGRAM_MATRIX) {
- ASSERT(index < Elements(ctx->ProgramMatrixStack));
+ assert(index < ARRAY_SIZE(ctx->ProgramMatrixStack));
matrix = ctx->ProgramMatrixStack[index].Top;
}
else {
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 6e17fe65f..61a9e97c9 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -56,21 +56,21 @@ _mesa_init_program(struct gl_context *ctx)
* If this assertion fails, we need to increase the field
* size for register indexes (see INST_INDEX_BITS).
*/
- ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4
<= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4
<= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTemps <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTemps <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents <= 4 * MAX_UNIFORMS);
- ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents <= 4 * MAX_UNIFORMS);
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents <= 4 * MAX_UNIFORMS);
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents <= 4 * MAX_UNIFORMS);
- ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxAddressOffset <= (1 << INST_INDEX_BITS));
- ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAddressOffset <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_VERTEX].MaxAddressOffset <= (1 << INST_INDEX_BITS));
+ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAddressOffset <= (1 << INST_INDEX_BITS));
/* If this fails, increase prog_instruction::TexSrcUnit size */
STATIC_ASSERT(MAX_TEXTURE_UNITS <= (1 << 5));
@@ -364,8 +364,8 @@ void
_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
{
(void) ctx;
- ASSERT(prog);
- ASSERT(prog->RefCount==0);
+ assert(prog);
+ assert(prog->RefCount==0);
if (prog == &_mesa_DummyProgram)
return;
@@ -414,12 +414,12 @@ _mesa_reference_program_(struct gl_context *ctx,
if (*ptr && prog) {
/* sanity check */
if ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB)
- ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB);
+ assert(prog->Target == GL_VERTEX_PROGRAM_ARB);
else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB)
- ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
+ assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB ||
prog->Target == GL_FRAGMENT_PROGRAM_NV);
else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
- ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
+ assert(prog->Target == MESA_GEOMETRY_PROGRAM);
}
#endif
@@ -434,14 +434,14 @@ _mesa_reference_program_(struct gl_context *ctx,
((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
(*ptr)->RefCount - 1);
#endif
- ASSERT((*ptr)->RefCount > 0);
+ assert((*ptr)->RefCount > 0);
(*ptr)->RefCount--;
deleteFlag = ((*ptr)->RefCount == 0);
/*mtx_lock(&(*ptr)->Mutex);*/
if (deleteFlag) {
- ASSERT(ctx);
+ assert(ctx);
ctx->Driver.DeleteProgram(ctx, *ptr);
}
@@ -733,7 +733,7 @@ _mesa_combine_programs(struct gl_context *ctx,
GLbitfield64 inputsB;
GLuint i;
- ASSERT(progA->Target == progB->Target);
+ assert(progA->Target == progB->Target);
newInst = _mesa_alloc_instructions(newLength);
if (!newInst)
@@ -867,14 +867,14 @@ _mesa_find_used_registers(const struct gl_program *prog,
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
if (inst->DstReg.File == file) {
- ASSERT(inst->DstReg.Index < usedSize);
+ assert(inst->DstReg.Index < usedSize);
if(inst->DstReg.Index < usedSize)
used[inst->DstReg.Index] = GL_TRUE;
}
for (j = 0; j < n; j++) {
if (inst->SrcReg[j].File == file) {
- ASSERT(inst->SrcReg[j].Index < (GLint) usedSize);
+ assert(inst->SrcReg[j].Index < (GLint) usedSize);
if (inst->SrcReg[j].Index < (GLint) usedSize)
used[inst->SrcReg[j].Index] = GL_TRUE;
}
diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h
index ef698242f..0b0d1ac6f 100644
--- a/mesalib/src/mesa/program/program.h
+++ b/mesalib/src/mesa/program/program.h
@@ -210,7 +210,7 @@ _mesa_program_enum_to_shader_stage(GLenum v)
case GL_COMPUTE_PROGRAM_NV:
return MESA_SHADER_COMPUTE;
default:
- ASSERT(0);
+ assert(0);
return ~0;
}
}
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 1664740b4..716b83d2d 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -21,6 +21,8 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -2333,11 +2335,11 @@ set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
{
const GLint maxIndex = 1 << INST_INDEX_BITS;
const GLint minIndex = 0;
- ASSERT(index >= minIndex);
+ assert(index >= minIndex);
(void) minIndex;
- ASSERT(index <= maxIndex);
+ assert(index <= maxIndex);
(void) maxIndex;
- ASSERT(file == PROGRAM_TEMPORARY ||
+ assert(file == PROGRAM_TEMPORARY ||
file == PROGRAM_ADDRESS ||
file == PROGRAM_OUTPUT);
memset(r, 0, sizeof(*r));
@@ -2375,10 +2377,10 @@ set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
{
const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
const GLint minIndex = -(1 << INST_INDEX_BITS);
- ASSERT(file < PROGRAM_FILE_MAX);
- ASSERT(index >= minIndex);
+ assert(file < PROGRAM_FILE_MAX);
+ assert(index >= minIndex);
(void) minIndex;
- ASSERT(index <= maxIndex);
+ assert(index <= maxIndex);
(void) maxIndex;
memset(r, 0, sizeof(*r));
r->Base.File = file;
diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c
index fdaa4a465..e82c68a53 100644
--- a/mesalib/src/mesa/program/programopt.c
+++ b/mesalib/src/mesa/program/programopt.c
@@ -335,7 +335,7 @@ _mesa_append_fog_code(struct gl_context *ctx,
inst++;
}
else {
- ASSERT(fog_mode == GL_EXP || fog_mode == GL_EXP2);
+ assert(fog_mode == GL_EXP || fog_mode == GL_EXP2);
/* fogPRefOpt.z = d/ln(2), fogPRefOpt.w = d/sqrt(ln(2) */
/* EXP: MUL fogFactorTemp.x, fogPRefOpt.z, fragment.fogcoord.x; */
/* EXP2: MUL fogFactorTemp.x, fogPRefOpt.w, fragment.fogcoord.x; */
diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp
index f8584c968..ea3024d51 100644
--- a/mesalib/src/mesa/program/sampler.cpp
+++ b/mesalib/src/mesa/program/sampler.cpp
@@ -29,7 +29,6 @@
#include "../glsl/program.h"
#include "ir_uniform.h"
-#include "main/compiler.h"
#include "main/mtypes.h"
#include "program/hash_table.h"
#include "program/prog_parameter.h"