1 /**************************************************************************
3 * Copyright 2006 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portionsalloc
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include "main/accum.h"
29 #include "main/enums.h"
30 #include "main/state.h"
31 #include "main/bufferobj.h"
32 #include "main/context.h"
33 #include "swrast/swrast.h"
35 #include "brw_context.h"
36 #include "intel_pixel.h"
38 #define FILE_DEBUG_FLAG DEBUG_PIXEL
41 effective_func(GLenum func
, bool src_alpha_is_one
)
43 if (src_alpha_is_one
) {
44 if (func
== GL_SRC_ALPHA
)
46 if (func
== GL_ONE_MINUS_SRC_ALPHA
)
54 * Check if any fragment operations are in effect which might effect
58 intel_check_blit_fragment_ops(struct gl_context
* ctx
, bool src_alpha_is_one
)
61 _mesa_update_state(ctx
);
63 if (ctx
->FragmentProgram
._Enabled
) {
64 DBG("fallback due to fragment program\n");
68 if (ctx
->Color
.BlendEnabled
&&
69 (effective_func(ctx
->Color
.Blend
[0].SrcRGB
, src_alpha_is_one
) != GL_ONE
||
70 effective_func(ctx
->Color
.Blend
[0].DstRGB
, src_alpha_is_one
) != GL_ZERO
||
71 ctx
->Color
.Blend
[0].EquationRGB
!= GL_FUNC_ADD
||
72 effective_func(ctx
->Color
.Blend
[0].SrcA
, src_alpha_is_one
) != GL_ONE
||
73 effective_func(ctx
->Color
.Blend
[0].DstA
, src_alpha_is_one
) != GL_ZERO
||
74 ctx
->Color
.Blend
[0].EquationA
!= GL_FUNC_ADD
)) {
75 DBG("fallback due to blend\n");
79 if (ctx
->Texture
._MaxEnabledTexImageUnit
!= -1) {
80 DBG("fallback due to texturing\n");
84 if (!(ctx
->Color
.ColorMask
[0][0] &&
85 ctx
->Color
.ColorMask
[0][1] &&
86 ctx
->Color
.ColorMask
[0][2] &&
87 ctx
->Color
.ColorMask
[0][3])) {
88 DBG("fallback due to color masking\n");
92 if (ctx
->Color
.AlphaEnabled
) {
93 DBG("fallback due to alpha\n");
97 if (ctx
->Depth
.Test
) {
98 DBG("fallback due to depth test\n");
102 if (ctx
->Fog
.Enabled
) {
103 DBG("fallback due to fog\n");
107 if (ctx
->_ImageTransferState
) {
108 DBG("fallback due to image transfer\n");
112 if (ctx
->Stencil
._Enabled
) {
113 DBG("fallback due to image stencil\n");
117 if (ctx
->Pixel
.ZoomX
!= 1.0F
|| ctx
->Pixel
.ZoomY
!= 1.0F
) {
118 DBG("fallback due to pixel zoom\n");
122 if (ctx
->RenderMode
!= GL_RENDER
) {
123 DBG("fallback due to render mode\n");
131 intelInitPixelFuncs(struct dd_function_table
*functions
)
133 functions
->Accum
= _mesa_accum
;
134 functions
->Bitmap
= intelBitmap
;
135 functions
->CopyPixels
= intelCopyPixels
;
136 functions
->DrawPixels
= intelDrawPixels
;
137 functions
->ReadPixels
= intelReadPixels
;