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