-#ifndef __NVGL_PIPE_H__
-#define __NVGL_PIPE_H__
-
-#include <GL/gl.h>
+#ifndef __NOUVEAU_GLDEFS_H__
+#define __NOUVEAU_GLDEFS_H__
static INLINE unsigned
nvgl_blend_func(unsigned factor)
{
switch (factor) {
+ case PIPE_BLENDFACTOR_ZERO:
+ return 0x0000;
case PIPE_BLENDFACTOR_ONE:
- return GL_ONE;
+ return 0x0001;
case PIPE_BLENDFACTOR_SRC_COLOR:
- return GL_SRC_COLOR;
+ return 0x0300;
+ case PIPE_BLENDFACTOR_INV_SRC_COLOR:
+ return 0x0301;
case PIPE_BLENDFACTOR_SRC_ALPHA:
- return GL_SRC_ALPHA;
+ return 0x0302;
+ case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
+ return 0x0303;
case PIPE_BLENDFACTOR_DST_ALPHA:
- return GL_DST_ALPHA;
+ return 0x0304;
+ case PIPE_BLENDFACTOR_INV_DST_ALPHA:
+ return 0x0305;
case PIPE_BLENDFACTOR_DST_COLOR:
- return GL_DST_COLOR;
+ return 0x0306;
+ case PIPE_BLENDFACTOR_INV_DST_COLOR:
+ return 0x0307;
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
- return GL_SRC_ALPHA_SATURATE;
+ return 0x0308;
case PIPE_BLENDFACTOR_CONST_COLOR:
- return GL_CONSTANT_COLOR;
- case PIPE_BLENDFACTOR_CONST_ALPHA:
- return GL_CONSTANT_ALPHA;
- case PIPE_BLENDFACTOR_ZERO:
- return GL_ZERO;
- case PIPE_BLENDFACTOR_INV_SRC_COLOR:
- return GL_ONE_MINUS_SRC_COLOR;
- case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
- return GL_ONE_MINUS_SRC_ALPHA;
- case PIPE_BLENDFACTOR_INV_DST_ALPHA:
- return GL_ONE_MINUS_DST_ALPHA;
- case PIPE_BLENDFACTOR_INV_DST_COLOR:
- return GL_ONE_MINUS_DST_COLOR;
+ return 0x8001;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
- return GL_ONE_MINUS_CONSTANT_COLOR;
+ return 0x8002;
+ case PIPE_BLENDFACTOR_CONST_ALPHA:
+ return 0x8003;
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
- return GL_ONE_MINUS_CONSTANT_ALPHA;
+ return 0x8004;
default:
- return GL_ONE;
+ assert(0);
}
}
{
switch (func) {
case PIPE_BLEND_ADD:
- return GL_FUNC_ADD;
- case PIPE_BLEND_SUBTRACT:
- return GL_FUNC_SUBTRACT;
- case PIPE_BLEND_REVERSE_SUBTRACT:
- return GL_FUNC_REVERSE_SUBTRACT;
+ return 0x8006;
case PIPE_BLEND_MIN:
- return GL_MIN;
+ return 0x8007;
case PIPE_BLEND_MAX:
- return GL_MAX;
+ return 0x8008;
+ case PIPE_BLEND_SUBTRACT:
+ return 0x800a;
+ case PIPE_BLEND_REVERSE_SUBTRACT:
+ return 0x800b;
default:
- return GL_FUNC_ADD;
+ assert(0);
}
}
{
switch (func) {
case PIPE_LOGICOP_CLEAR:
- return GL_CLEAR;
+ return 0x1500;
case PIPE_LOGICOP_NOR:
- return GL_NOR;
+ return 0x1508;
case PIPE_LOGICOP_AND_INVERTED:
- return GL_AND_INVERTED;
+ return 0x1504;
case PIPE_LOGICOP_COPY_INVERTED:
- return GL_COPY_INVERTED;
+ return 0x150c;
case PIPE_LOGICOP_AND_REVERSE:
- return GL_AND_REVERSE;
+ return 0x1502;
case PIPE_LOGICOP_INVERT:
- return GL_INVERT;
+ return 0x150a;
case PIPE_LOGICOP_XOR:
- return GL_XOR;
+ return 0x1506;
case PIPE_LOGICOP_NAND:
- return GL_NAND;
+ return 0x150e;
case PIPE_LOGICOP_AND:
- return GL_AND;
+ return 0x1501;
case PIPE_LOGICOP_EQUIV:
- return GL_EQUIV;
+ return 0x1509;
case PIPE_LOGICOP_NOOP:
- return GL_NOOP;
+ return 0x1505;
case PIPE_LOGICOP_OR_INVERTED:
- return GL_OR_INVERTED;
+ return 0x150d;
case PIPE_LOGICOP_COPY:
- return GL_COPY;
+ return 0x1503;
case PIPE_LOGICOP_OR_REVERSE:
- return GL_OR_REVERSE;
+ return 0x150b;
case PIPE_LOGICOP_OR:
- return GL_OR;
+ return 0x1507;
case PIPE_LOGICOP_SET:
- return GL_SET;
+ return 0x150f;
default:
- return GL_CLEAR;
+ assert(0);
}
}
{
switch (op) {
case PIPE_FUNC_NEVER:
- return GL_NEVER;
+ return 0x0200;
case PIPE_FUNC_LESS:
- return GL_LESS;
+ return 0x0201;
case PIPE_FUNC_EQUAL:
- return GL_EQUAL;
+ return 0x0202;
case PIPE_FUNC_LEQUAL:
- return GL_LEQUAL;
+ return 0x0203;
case PIPE_FUNC_GREATER:
- return GL_GREATER;
+ return 0x0204;
case PIPE_FUNC_NOTEQUAL:
- return GL_NOTEQUAL;
+ return 0x0205;
case PIPE_FUNC_GEQUAL:
- return GL_GEQUAL;
+ return 0x0206;
case PIPE_FUNC_ALWAYS:
- return GL_ALWAYS;
+ return 0x0207;
default:
- return GL_NEVER;
+ assert(0);
}
}
nvgl_polygon_mode(unsigned mode)
{
switch (mode) {
- case PIPE_POLYGON_MODE_FILL:
- return GL_FILL;
- case PIPE_POLYGON_MODE_LINE:
- return GL_LINE;
case PIPE_POLYGON_MODE_POINT:
- return GL_POINT;
+ return 0x1b00;
+ case PIPE_POLYGON_MODE_LINE:
+ return 0x1b01;
+ case PIPE_POLYGON_MODE_FILL:
+ return 0x1b02;
default:
- return GL_FILL;
+ assert(0);
}
}
nvgl_stencil_op(unsigned op)
{
switch (op) {
- case PIPE_STENCIL_OP_KEEP:
- return GL_KEEP;
case PIPE_STENCIL_OP_ZERO:
- return GL_ZERO;
+ return 0x0000;
+ case PIPE_STENCIL_OP_INVERT:
+ return 0x150a;
+ case PIPE_STENCIL_OP_KEEP:
+ return 0x1e00;
case PIPE_STENCIL_OP_REPLACE:
- return GL_REPLACE;
+ return 0x1e01;
case PIPE_STENCIL_OP_INCR:
- return GL_INCR;
+ return 0x1e02;
case PIPE_STENCIL_OP_DECR:
- return GL_DECR;
+ return 0x1e03;
case PIPE_STENCIL_OP_INCR_WRAP:
- return GL_INCR_WRAP;
+ return 0x8507;
case PIPE_STENCIL_OP_DECR_WRAP:
- return GL_DECR_WRAP;
- case PIPE_STENCIL_OP_INVERT:
- return GL_INVERT;
+ return 0x8508;
default:
- return GL_KEEP;
+ assert(0);
}
}
nvgl_primitive(unsigned prim) {
switch (prim) {
case PIPE_PRIM_POINTS:
- return GL_POINTS + 1;
+ return 0x0001;
case PIPE_PRIM_LINES:
- return GL_LINES + 1;
+ return 0x0002;
case PIPE_PRIM_LINE_LOOP:
- return GL_LINE_LOOP + 1;
+ return 0x0003;
case PIPE_PRIM_LINE_STRIP:
- return GL_LINE_STRIP + 1;
+ return 0x0004;
case PIPE_PRIM_TRIANGLES:
- return GL_TRIANGLES + 1;
+ return 0x0005;
case PIPE_PRIM_TRIANGLE_STRIP:
- return GL_TRIANGLE_STRIP + 1;
+ return 0x0006;
case PIPE_PRIM_TRIANGLE_FAN:
- return GL_TRIANGLE_FAN + 1;
+ return 0x0007;
case PIPE_PRIM_QUADS:
- return GL_QUADS + 1;
+ return 0x0008;
case PIPE_PRIM_QUAD_STRIP:
- return GL_QUAD_STRIP + 1;
+ return 0x0009;
case PIPE_PRIM_POLYGON:
- return GL_POLYGON + 1;
+ return 0x000a;
default:
- return GL_POINTS + 1;
+ assert(0);
}
}