. Updates to get X86, MXX and 3DNow assembler code working with Watcom
[mesa.git] / src / mesa / x86 / mmx.h
1
2 /*
3 * Mesa 3-D graphics library
4 * Version: 3.1
5 *
6 * Copyright (C) 1999 Brian Paul All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27
28
29
30 #ifndef ASM_MMX_H
31 #define ASM_MMX_H
32
33
34 extern void _ASMAPI
35 gl_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
36 GLubyte rgba[][4], const GLubyte dest[][4] );
37
38
39 void gl_mmx_set_blend_function( GLcontext *ctx )
40 {
41 const GLenum eq = ctx->Color.BlendEquation;
42 const GLenum srcRGB = ctx->Color.BlendSrcRGB;
43 const GLenum dstRGB = ctx->Color.BlendDstRGB;
44 const GLenum srcA = ctx->Color.BlendSrcA;
45 const GLenum dstA = ctx->Color.BlendDstA;
46
47
48 if (srcRGB != srcA || dstRGB != dstA) {
49 ctx->Color.BlendFunc = blend_general;
50 }
51 else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_SRC_ALPHA
52 && dstRGB==GL_ONE_MINUS_SRC_ALPHA) {
53 ctx->Color.BlendFunc = gl_mmx_blend_transparency;
54 }
55 else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_ONE && dstRGB==GL_ONE) {
56 ctx->Color.BlendFunc = blend_add;
57 }
58 else if (((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_REVERSE_SUBTRACT_EXT)
59 && (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR))
60 ||
61 ((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_SUBTRACT_EXT)
62 && (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) {
63 ctx->Color.BlendFunc = blend_modulate;
64 }
65 else if (eq==GL_MIN_EXT) {
66 ctx->Color.BlendFunc = blend_min;
67 }
68 else if (eq==GL_MAX_EXT) {
69 ctx->Color.BlendFunc = blend_max;
70 }
71 else {
72 ctx->Color.BlendFunc = blend_general;
73 }
74 }
75
76
77 #endif