1bf215546Sopenharmony_ci#ifndef __NOUVEAU_GLDEFS_H__ 2bf215546Sopenharmony_ci#define __NOUVEAU_GLDEFS_H__ 3bf215546Sopenharmony_ci 4bf215546Sopenharmony_cistatic inline unsigned 5bf215546Sopenharmony_cinvgl_blend_func(unsigned factor) 6bf215546Sopenharmony_ci{ 7bf215546Sopenharmony_ci switch (factor) { 8bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_ZERO: 9bf215546Sopenharmony_ci return 0x0000; 10bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_ONE: 11bf215546Sopenharmony_ci return 0x0001; 12bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_SRC_COLOR: 13bf215546Sopenharmony_ci return 0x0300; 14bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_SRC_COLOR: 15bf215546Sopenharmony_ci return 0x0301; 16bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_SRC_ALPHA: 17bf215546Sopenharmony_ci return 0x0302; 18bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_SRC_ALPHA: 19bf215546Sopenharmony_ci return 0x0303; 20bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_DST_ALPHA: 21bf215546Sopenharmony_ci return 0x0304; 22bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_DST_ALPHA: 23bf215546Sopenharmony_ci return 0x0305; 24bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_DST_COLOR: 25bf215546Sopenharmony_ci return 0x0306; 26bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_DST_COLOR: 27bf215546Sopenharmony_ci return 0x0307; 28bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: 29bf215546Sopenharmony_ci return 0x0308; 30bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_CONST_COLOR: 31bf215546Sopenharmony_ci return 0x8001; 32bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_CONST_COLOR: 33bf215546Sopenharmony_ci return 0x8002; 34bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_CONST_ALPHA: 35bf215546Sopenharmony_ci return 0x8003; 36bf215546Sopenharmony_ci case PIPE_BLENDFACTOR_INV_CONST_ALPHA: 37bf215546Sopenharmony_ci return 0x8004; 38bf215546Sopenharmony_ci default: 39bf215546Sopenharmony_ci return 0x0000; 40bf215546Sopenharmony_ci } 41bf215546Sopenharmony_ci} 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_cistatic inline unsigned 44bf215546Sopenharmony_cinvgl_blend_eqn(unsigned func) 45bf215546Sopenharmony_ci{ 46bf215546Sopenharmony_ci switch (func) { 47bf215546Sopenharmony_ci case PIPE_BLEND_ADD: 48bf215546Sopenharmony_ci return 0x8006; 49bf215546Sopenharmony_ci case PIPE_BLEND_MIN: 50bf215546Sopenharmony_ci return 0x8007; 51bf215546Sopenharmony_ci case PIPE_BLEND_MAX: 52bf215546Sopenharmony_ci return 0x8008; 53bf215546Sopenharmony_ci case PIPE_BLEND_SUBTRACT: 54bf215546Sopenharmony_ci return 0x800a; 55bf215546Sopenharmony_ci case PIPE_BLEND_REVERSE_SUBTRACT: 56bf215546Sopenharmony_ci return 0x800b; 57bf215546Sopenharmony_ci default: 58bf215546Sopenharmony_ci return 0x8006; 59bf215546Sopenharmony_ci } 60bf215546Sopenharmony_ci} 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_cistatic inline unsigned 63bf215546Sopenharmony_cinvgl_logicop_func(unsigned func) 64bf215546Sopenharmony_ci{ 65bf215546Sopenharmony_ci switch (func) { 66bf215546Sopenharmony_ci case PIPE_LOGICOP_CLEAR: 67bf215546Sopenharmony_ci return 0x1500; 68bf215546Sopenharmony_ci case PIPE_LOGICOP_NOR: 69bf215546Sopenharmony_ci return 0x1508; 70bf215546Sopenharmony_ci case PIPE_LOGICOP_AND_INVERTED: 71bf215546Sopenharmony_ci return 0x1504; 72bf215546Sopenharmony_ci case PIPE_LOGICOP_COPY_INVERTED: 73bf215546Sopenharmony_ci return 0x150c; 74bf215546Sopenharmony_ci case PIPE_LOGICOP_AND_REVERSE: 75bf215546Sopenharmony_ci return 0x1502; 76bf215546Sopenharmony_ci case PIPE_LOGICOP_INVERT: 77bf215546Sopenharmony_ci return 0x150a; 78bf215546Sopenharmony_ci case PIPE_LOGICOP_XOR: 79bf215546Sopenharmony_ci return 0x1506; 80bf215546Sopenharmony_ci case PIPE_LOGICOP_NAND: 81bf215546Sopenharmony_ci return 0x150e; 82bf215546Sopenharmony_ci case PIPE_LOGICOP_AND: 83bf215546Sopenharmony_ci return 0x1501; 84bf215546Sopenharmony_ci case PIPE_LOGICOP_EQUIV: 85bf215546Sopenharmony_ci return 0x1509; 86bf215546Sopenharmony_ci case PIPE_LOGICOP_NOOP: 87bf215546Sopenharmony_ci return 0x1505; 88bf215546Sopenharmony_ci case PIPE_LOGICOP_OR_INVERTED: 89bf215546Sopenharmony_ci return 0x150d; 90bf215546Sopenharmony_ci case PIPE_LOGICOP_COPY: 91bf215546Sopenharmony_ci return 0x1503; 92bf215546Sopenharmony_ci case PIPE_LOGICOP_OR_REVERSE: 93bf215546Sopenharmony_ci return 0x150b; 94bf215546Sopenharmony_ci case PIPE_LOGICOP_OR: 95bf215546Sopenharmony_ci return 0x1507; 96bf215546Sopenharmony_ci case PIPE_LOGICOP_SET: 97bf215546Sopenharmony_ci return 0x150f; 98bf215546Sopenharmony_ci default: 99bf215546Sopenharmony_ci return 0x1505; 100bf215546Sopenharmony_ci } 101bf215546Sopenharmony_ci} 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_cistatic inline unsigned 104bf215546Sopenharmony_cinvgl_comparison_op(unsigned op) 105bf215546Sopenharmony_ci{ 106bf215546Sopenharmony_ci switch (op) { 107bf215546Sopenharmony_ci case PIPE_FUNC_NEVER: 108bf215546Sopenharmony_ci return 0x0200; 109bf215546Sopenharmony_ci case PIPE_FUNC_LESS: 110bf215546Sopenharmony_ci return 0x0201; 111bf215546Sopenharmony_ci case PIPE_FUNC_EQUAL: 112bf215546Sopenharmony_ci return 0x0202; 113bf215546Sopenharmony_ci case PIPE_FUNC_LEQUAL: 114bf215546Sopenharmony_ci return 0x0203; 115bf215546Sopenharmony_ci case PIPE_FUNC_GREATER: 116bf215546Sopenharmony_ci return 0x0204; 117bf215546Sopenharmony_ci case PIPE_FUNC_NOTEQUAL: 118bf215546Sopenharmony_ci return 0x0205; 119bf215546Sopenharmony_ci case PIPE_FUNC_GEQUAL: 120bf215546Sopenharmony_ci return 0x0206; 121bf215546Sopenharmony_ci case PIPE_FUNC_ALWAYS: 122bf215546Sopenharmony_ci return 0x0207; 123bf215546Sopenharmony_ci default: 124bf215546Sopenharmony_ci return 0x0207; 125bf215546Sopenharmony_ci } 126bf215546Sopenharmony_ci} 127bf215546Sopenharmony_ci 128bf215546Sopenharmony_cistatic inline unsigned 129bf215546Sopenharmony_cinvgl_polygon_mode(unsigned mode) 130bf215546Sopenharmony_ci{ 131bf215546Sopenharmony_ci switch (mode) { 132bf215546Sopenharmony_ci case PIPE_POLYGON_MODE_POINT: 133bf215546Sopenharmony_ci return 0x1b00; 134bf215546Sopenharmony_ci case PIPE_POLYGON_MODE_LINE: 135bf215546Sopenharmony_ci return 0x1b01; 136bf215546Sopenharmony_ci case PIPE_POLYGON_MODE_FILL: 137bf215546Sopenharmony_ci return 0x1b02; 138bf215546Sopenharmony_ci default: 139bf215546Sopenharmony_ci return 0x1b02; 140bf215546Sopenharmony_ci } 141bf215546Sopenharmony_ci} 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_cistatic inline unsigned 144bf215546Sopenharmony_cinvgl_stencil_op(unsigned op) 145bf215546Sopenharmony_ci{ 146bf215546Sopenharmony_ci switch (op) { 147bf215546Sopenharmony_ci case PIPE_STENCIL_OP_ZERO: 148bf215546Sopenharmony_ci return 0x0000; 149bf215546Sopenharmony_ci case PIPE_STENCIL_OP_INVERT: 150bf215546Sopenharmony_ci return 0x150a; 151bf215546Sopenharmony_ci case PIPE_STENCIL_OP_KEEP: 152bf215546Sopenharmony_ci return 0x1e00; 153bf215546Sopenharmony_ci case PIPE_STENCIL_OP_REPLACE: 154bf215546Sopenharmony_ci return 0x1e01; 155bf215546Sopenharmony_ci case PIPE_STENCIL_OP_INCR: 156bf215546Sopenharmony_ci return 0x1e02; 157bf215546Sopenharmony_ci case PIPE_STENCIL_OP_DECR: 158bf215546Sopenharmony_ci return 0x1e03; 159bf215546Sopenharmony_ci case PIPE_STENCIL_OP_INCR_WRAP: 160bf215546Sopenharmony_ci return 0x8507; 161bf215546Sopenharmony_ci case PIPE_STENCIL_OP_DECR_WRAP: 162bf215546Sopenharmony_ci return 0x8508; 163bf215546Sopenharmony_ci default: 164bf215546Sopenharmony_ci return 0x1e00; 165bf215546Sopenharmony_ci } 166bf215546Sopenharmony_ci} 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_cistatic inline unsigned 169bf215546Sopenharmony_cinvgl_primitive(unsigned prim) { 170bf215546Sopenharmony_ci switch (prim) { 171bf215546Sopenharmony_ci case PIPE_PRIM_POINTS: 172bf215546Sopenharmony_ci return 0x0001; 173bf215546Sopenharmony_ci case PIPE_PRIM_LINES: 174bf215546Sopenharmony_ci return 0x0002; 175bf215546Sopenharmony_ci case PIPE_PRIM_LINE_LOOP: 176bf215546Sopenharmony_ci return 0x0003; 177bf215546Sopenharmony_ci case PIPE_PRIM_LINE_STRIP: 178bf215546Sopenharmony_ci return 0x0004; 179bf215546Sopenharmony_ci case PIPE_PRIM_TRIANGLES: 180bf215546Sopenharmony_ci return 0x0005; 181bf215546Sopenharmony_ci case PIPE_PRIM_TRIANGLE_STRIP: 182bf215546Sopenharmony_ci return 0x0006; 183bf215546Sopenharmony_ci case PIPE_PRIM_TRIANGLE_FAN: 184bf215546Sopenharmony_ci return 0x0007; 185bf215546Sopenharmony_ci case PIPE_PRIM_QUADS: 186bf215546Sopenharmony_ci return 0x0008; 187bf215546Sopenharmony_ci case PIPE_PRIM_QUAD_STRIP: 188bf215546Sopenharmony_ci return 0x0009; 189bf215546Sopenharmony_ci case PIPE_PRIM_POLYGON: 190bf215546Sopenharmony_ci return 0x000a; 191bf215546Sopenharmony_ci default: 192bf215546Sopenharmony_ci return 0; 193bf215546Sopenharmony_ci } 194bf215546Sopenharmony_ci} 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci#endif 197