1 /**************************************************************************
3 * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
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 TUNGSTEN GRAPHICS 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 **************************************************************************/
30 #include "swrast/swrast.h"
32 #include "intel_context.h"
33 #include "intel_pixel.h"
34 #include "intel_regions.h"
38 * Check if any fragment operations are in effect which might effect
42 intel_check_blit_fragment_ops(GLcontext
* ctx
)
45 _mesa_update_state(ctx
);
47 /* XXX Note: Scissor could be done with the blitter:
49 return !(ctx
->_ImageTransferState
||
50 ctx
->Color
.AlphaEnabled
||
53 ctx
->Scissor
.Enabled
||
54 ctx
->Stencil
.Enabled
||
55 !ctx
->Color
.ColorMask
[0] ||
56 !ctx
->Color
.ColorMask
[1] ||
57 !ctx
->Color
.ColorMask
[2] ||
58 !ctx
->Color
.ColorMask
[3] ||
59 ctx
->Texture
._EnabledUnits
||
60 ctx
->FragmentProgram
._Enabled
||
61 ctx
->Color
.BlendEnabled
);
66 intel_check_meta_tex_fragment_ops(GLcontext
* ctx
)
69 _mesa_update_state(ctx
);
71 /* Some of _ImageTransferState (scale, bias) could be done with
72 * fragment programs on i915.
74 return !(ctx
->_ImageTransferState
|| ctx
->Fog
.Enabled
|| /* not done yet */
75 ctx
->Texture
._EnabledUnits
|| ctx
->FragmentProgram
._Enabled
);
78 /* The intel_region struct doesn't really do enough to capture the
79 * format of the pixels in the region. For now this code assumes that
80 * the region is a display surface and hence is either ARGB8888 or
82 * XXX FBO: If we'd pass in the intel_renderbuffer instead of region, we'd
83 * know the buffer's pixel format.
85 * \param format as given to glDraw/ReadPixels
86 * \param type as given to glDraw/ReadPixels
89 intel_check_blit_format(struct intel_region
* region
,
90 GLenum format
, GLenum type
)
92 if (region
->cpp
== 4 &&
93 (type
== GL_UNSIGNED_INT_8_8_8_8_REV
||
94 type
== GL_UNSIGNED_BYTE
) && format
== GL_BGRA
) {
98 if (region
->cpp
== 2 &&
99 type
== GL_UNSIGNED_SHORT_5_6_5_REV
&& format
== GL_BGR
) {
103 if (INTEL_DEBUG
& DEBUG_PIXEL
)
104 fprintf(stderr
, "%s: bad format for blit (cpp %d, type %s format %s)\n",
105 __FUNCTION__
, region
->cpp
,
106 _mesa_lookup_enum_by_nr(type
), _mesa_lookup_enum_by_nr(format
));
113 intelInitPixelFuncs(struct dd_function_table
*functions
)
115 functions
->Accum
= _swrast_Accum
;
116 functions
->Bitmap
= _swrast_Bitmap
;
117 functions
->CopyPixels
= intelCopyPixels
;
118 functions
->ReadPixels
= intelReadPixels
;
119 functions
->DrawPixels
= intelDrawPixels
;