ReactOS 0.4.17-dev-966-gf06eace
surface.c File Reference
#include "wined3d_private.h"
#include "wined3d_gl.h"
Include dependency graph for surface.c:

Go to the source code of this file.

Classes

struct  d3dfmt_converter_desc
 

Macros

#define STRETCH_ROW(type)
 
#define COPY_COLORKEY_FX(type)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d)
 
 WINE_DECLARE_DEBUG_CHANNEL (d3d_perf)
 
static void get_color_masks (const struct wined3d_format *format, uint32_t *masks)
 
static void convert_r32_float_r16_float (const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
 
static void convert_r5g6b5_x8r8g8b8 (const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
 
static void convert_a8r8g8b8_x8r8g8b8 (const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
 
static BYTE cliptobyte (int x)
 
static void convert_yuy2_x8r8g8b8 (const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
 
static void convert_yuy2_r5g6b5 (const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
 
static const struct d3dfmt_converter_desc * find_converter (enum wined3d_format_id from, enum wined3d_format_id to)
 
static struct wined3d_texture * surface_convert_format (struct wined3d_texture *src_texture, unsigned int sub_resource_idx, const struct wined3d_format *dst_format)
 
void texture2d_read_from_framebuffer (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD src_location, DWORD dst_location)
 
static void cpu_blitter_destroy (struct wined3d_blitter *blitter, struct wined3d_context *context)
 
static HRESULT surface_cpu_blt_compressed (const BYTE *src_data, BYTE *dst_data, UINT src_pitch, UINT dst_pitch, UINT update_w, UINT update_h, const struct wined3d_format *format, uint32_t flags, const struct wined3d_blt_fx *fx)
 
static HRESULT surface_cpu_blt (struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, uint32_t flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 
void cpu_blitter_clear_texture (struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_box *box, const struct wined3d_color *colour)
 
static void cpu_blitter_clear_rtv (struct wined3d_rendertarget_view *view, const struct wined3d_box *box, const struct wined3d_color *colour)
 
static bool wined3d_box_intersect (struct wined3d_box *ret, const struct wined3d_box *b1, const struct wined3d_box *b2)
 
static void cpu_blitter_clear (struct wined3d_blitter *blitter, struct wined3d_device *device, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects, const RECT *draw_rect, uint32_t flags, const struct wined3d_color *colour, float depth, unsigned int stencil)
 
static DWORD cpu_blitter_blit (struct wined3d_blitter *blitter, enum wined3d_blit_op op, struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect, const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter, const struct wined3d_format *resolve_format)
 
struct wined3d_blitter * wined3d_cpu_blitter_create (void)
 
static bool wined3d_is_colour_blit (enum wined3d_blit_op blit_op)
 
static bool sub_resource_is_on_cpu (const struct wined3d_texture *texture, unsigned int sub_resource_idx)
 
HRESULT texture2d_blt (struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, uint32_t flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 

Variables

static const struct d3dfmt_converter_desc converters []
 
static const struct wined3d_blitter_ops cpu_blitter_ops
 

Macro Definition Documentation

◆ COPY_COLORKEY_FX

#define COPY_COLORKEY_FX (   type)
Value:
do { \
const type *s; \
type *d = (type *)dbuf, *dx, tmp; \
for (y = sy = 0; y < dst_height; ++y, sy += yinc) \
{ \
s = (const type *)(sbase + (sy >> 16) * src_map.row_pitch); \
dx = d; \
for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
{ \
tmp = s[sx >> 16]; \
if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) \
&& ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) \
{ \
dx[0] = tmp; \
} \
dx = (type *)(((BYTE *)dx) + dstxinc); \
} \
d = (type *)(((BYTE *)d) + dstyinc); \
} \
} while(0)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define d
Definition: ke_i.h:81
GLint dx
Definition: linetemp.h:97
unsigned char BYTE
Definition: xxhash.c:193

◆ STRETCH_ROW

#define STRETCH_ROW (   type)
Value:
do { \
const type *s = (const type *)sbuf; \
type *d = (type *)dbuf; \
for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
d[x] = s[sx >> 16]; \
} while(0)

Function Documentation

◆ cliptobyte()

static BYTE cliptobyte ( int  x)
inlinestatic

Definition at line 124 of file surface.c.

125{
126 return (BYTE)((x < 0) ? 0 : ((x > 255) ? 255 : x));
127}

Referenced by convert_yuy2_r5g6b5(), and convert_yuy2_x8r8g8b8().

◆ convert_a8r8g8b8_x8r8g8b8()

static void convert_a8r8g8b8_x8r8g8b8 ( const BYTE *  src,
BYTE *  dst,
unsigned int  pitch_in,
unsigned int  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 105 of file surface.c.

107{
108 unsigned int x, y;
109
110 TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
111
112 for (y = 0; y < h; ++y)
113 {
114 const DWORD *src_line = (const DWORD *)(src + y * pitch_in);
115 DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
116
117 for (x = 0; x < w; ++x)
118 {
119 dst_line[x] = 0xff000000 | (src_line[x] & 0xffffff);
120 }
121 }
122}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4

◆ convert_r32_float_r16_float()

static void convert_r32_float_r16_float ( const BYTE *  src,
BYTE *  dst,
unsigned int  pitch_in,
unsigned int  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 43 of file surface.c.

45{
46 unsigned short *dst_s;
47 const float *src_f;
48 unsigned int x, y;
49
50 TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
51
52 for (y = 0; y < h; ++y)
53 {
54 src_f = (const float *)(src + y * pitch_in);
55 dst_s = (unsigned short *) (dst + y * pitch_out);
56 for (x = 0; x < w; ++x)
57 {
58 dst_s[x] = float_32_to_16(src_f + x);
59 }
60 }
61}
unsigned short float_32_to_16(const float in)
Definition: math.c:2102

◆ convert_r5g6b5_x8r8g8b8()

static void convert_r5g6b5_x8r8g8b8 ( const BYTE *  src,
BYTE *  dst,
unsigned int  pitch_in,
unsigned int  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 63 of file surface.c.

65{
66 static const unsigned char convert_5to8[] =
67 {
68 0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a,
69 0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b,
70 0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd,
71 0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff,
72 };
73 static const unsigned char convert_6to8[] =
74 {
75 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c,
76 0x20, 0x24, 0x28, 0x2d, 0x31, 0x35, 0x39, 0x3d,
77 0x41, 0x45, 0x49, 0x4d, 0x51, 0x55, 0x59, 0x5d,
78 0x61, 0x65, 0x69, 0x6d, 0x71, 0x75, 0x79, 0x7d,
79 0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e,
80 0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe,
81 0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd7, 0xdb, 0xdf,
82 0xe3, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff,
83 };
84 unsigned int x, y;
85
86 TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
87
88 for (y = 0; y < h; ++y)
89 {
90 const WORD *src_line = (const WORD *)(src + y * pitch_in);
91 DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
92 for (x = 0; x < w; ++x)
93 {
94 WORD pixel = src_line[x];
95 dst_line[x] = 0xff000000u
96 | convert_5to8[(pixel & 0xf800u) >> 11] << 16
97 | convert_6to8[(pixel & 0x07e0u) >> 5] << 8
98 | convert_5to8[(pixel & 0x001fu)];
99 }
100 }
101}
unsigned short WORD
Definition: ntddk_ex.h:93

◆ convert_yuy2_r5g6b5()

static void convert_yuy2_r5g6b5 ( const BYTE *  src,
BYTE *  dst,
unsigned int  pitch_in,
unsigned int  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 171 of file surface.c.

173{
174 unsigned int x, y;
175 int c2, d, e, r2 = 0, g2 = 0, b2 = 0;
176
177 TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out);
178
179 for (y = 0; y < h; ++y)
180 {
181 const BYTE *src_line = src + y * pitch_in;
182 WORD *dst_line = (WORD *)(dst + y * pitch_out);
183 for (x = 0; x < w; ++x)
184 {
185 /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV:
186 * C = Y - 16; D = U - 128; E = V - 128;
187 * R = cliptobyte((298 * C + 409 * E + 128) >> 8);
188 * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8);
189 * B = cliptobyte((298 * C + 516 * D + 128) >> 8);
190 * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V .
191 * U and V are shared between the pixels. */
192 if (!(x & 1)) /* For every even pixel, read new U and V. */
193 {
194 d = (int) src_line[1] - 128;
195 e = (int) src_line[3] - 128;
196 r2 = 409 * e + 128;
197 g2 = - 100 * d - 208 * e + 128;
198 b2 = 516 * d + 128;
199 }
200 c2 = 298 * ((int) src_line[0] - 16);
201 dst_line[x] = (cliptobyte((c2 + r2) >> 8) >> 3) << 11 /* red */
202 | (cliptobyte((c2 + g2) >> 8) >> 2) << 5 /* green */
203 | (cliptobyte((c2 + b2) >> 8) >> 3); /* blue */
204 /* Scale RGB values to 0..255 range,
205 * then clip them if still not in range (may be negative),
206 * then shift them within DWORD if necessary. */
207 src_line += 2;
208 }
209 }
210}
static BYTE cliptobyte(int x)
Definition: surface.c:124
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define e
Definition: ke_i.h:82
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:538
static DNS_RECORDW r2
Definition: record.c:38

◆ convert_yuy2_x8r8g8b8()

static void convert_yuy2_x8r8g8b8 ( const BYTE *  src,
BYTE *  dst,
unsigned int  pitch_in,
unsigned int  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 129 of file surface.c.

131{
132 int c2, d, e, r2 = 0, g2 = 0, b2 = 0;
133 unsigned int x, y;
134
135 TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
136
137 for (y = 0; y < h; ++y)
138 {
139 const BYTE *src_line = src + y * pitch_in;
140 DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
141 for (x = 0; x < w; ++x)
142 {
143 /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV:
144 * C = Y - 16; D = U - 128; E = V - 128;
145 * R = cliptobyte((298 * C + 409 * E + 128) >> 8);
146 * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8);
147 * B = cliptobyte((298 * C + 516 * D + 128) >> 8);
148 * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V .
149 * U and V are shared between the pixels. */
150 if (!(x & 1)) /* For every even pixel, read new U and V. */
151 {
152 d = (int) src_line[1] - 128;
153 e = (int) src_line[3] - 128;
154 r2 = 409 * e + 128;
155 g2 = - 100 * d - 208 * e + 128;
156 b2 = 516 * d + 128;
157 }
158 c2 = 298 * ((int) src_line[0] - 16);
159 dst_line[x] = 0xff000000
160 | cliptobyte((c2 + r2) >> 8) << 16 /* red */
161 | cliptobyte((c2 + g2) >> 8) << 8 /* green */
162 | cliptobyte((c2 + b2) >> 8); /* blue */
163 /* Scale RGB values to 0..255 range,
164 * then clip them if still not in range (may be negative),
165 * then shift them within DWORD if necessary. */
166 src_line += 2;
167 }
168 }
169}

◆ cpu_blitter_blit()

static DWORD cpu_blitter_blit ( struct wined3d_blitter *  blitter,
enum wined3d_blit_op  op,
struct wined3d_context *  context,
struct wined3d_texture *  src_texture,
unsigned int  src_sub_resource_idx,
DWORD  src_location,
const RECT *  src_rect,
struct wined3d_texture *  dst_texture,
unsigned int  dst_sub_resource_idx,
DWORD  dst_location,
const RECT *  dst_rect,
const struct wined3d_color_key *  color_key,
enum wined3d_texture_filter_type  filter,
const struct wined3d_format *  resolve_format 
)
static

Definition at line 1251 of file surface.c.

1257{
1258 struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
1259 struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
1260 struct wined3d_blt_fx fx;
1261 DWORD flags = 0;
1262
1263 memset(&fx, 0, sizeof(fx));
1264 switch (op)
1265 {
1268 break;
1271 break;
1274 break;
1277 fx.src_color_key = *color_key;
1278 break;
1279 default:
1280 FIXME("Unhandled op %#x.\n", op);
1281 break;
1282 }
1283
1284 if (FAILED(surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
1285 src_texture, src_sub_resource_idx, &src_box, flags, &fx, filter)))
1286 ERR("Failed to blit.\n");
1287 wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
1288
1289 return dst_location | (dst_texture->sub_resources[dst_sub_resource_idx].locations
1290 & dst_texture->resource.map_binding);
1291}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
UINT op
Definition: effect.c:235
static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, uint32_t flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: surface.c:596
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, uint32_t location)
Definition: texture.c:770
GLbitfield flags
Definition: glext.h:7161
#define FAILED(hr)
Definition: intsafe.h:51
#define memset(x, y, z)
Definition: compat.h:39
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
Definition: http.c:7252
Definition: filter.c:165
struct wined3d_texture::wined3d_texture_sub_resource * sub_resources
struct wined3d_resource resource
GLfixed fx
Definition: tritemp.h:484
#define WINED3D_BLT_ALPHA_TEST
Definition: wined3d.h:1373
#define WINED3D_BLT_SRC_CKEY_OVERRIDE
Definition: wined3d.h:1368
#define WINED3D_BLT_FX
Definition: wined3d.h:1364
#define WINED3D_BLT_RAW
Definition: wined3d.h:1371
@ WINED3D_BLIT_OP_COLOR_BLIT_CKEY
@ WINED3D_BLIT_OP_RAW_BLIT
@ WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST
@ WINED3D_BLIT_OP_DEPTH_BLIT
@ WINED3D_BLIT_OP_COLOR_BLIT

◆ cpu_blitter_clear()

static void cpu_blitter_clear ( struct wined3d_blitter *  blitter,
struct wined3d_device *  device,
unsigned int  rt_count,
const struct wined3d_fb_state *  fb,
unsigned int  rect_count,
const RECT *  clear_rects,
const RECT *  draw_rect,
uint32_t  flags,
const struct wined3d_color *  colour,
float  depth,
unsigned int  stencil 
)
static

Definition at line 1198 of file surface.c.

1201{
1202 struct wined3d_color c = {depth, 0.0f, 0.0f, 0.0f};
1203 struct wined3d_box box, box_clip, box_view;
1205 unsigned int i, j;
1206
1207 if (!rect_count)
1208 {
1209 rect_count = 1;
1210 clear_rects = draw_rect;
1211 }
1212
1213 for (i = 0; i < rect_count; ++i)
1214 {
1215 box.left = max(clear_rects[i].left, draw_rect->left);
1216 box.top = max(clear_rects[i].top, draw_rect->top);
1217 box.right = min(clear_rects[i].right, draw_rect->right);
1218 box.bottom = min(clear_rects[i].bottom, draw_rect->bottom);
1219 box.front = 0;
1220 box.back = ~0u;
1221
1222 if (box.left >= box.right || box.top >= box.bottom)
1223 continue;
1224
1226 {
1227 for (j = 0; j < rt_count; ++j)
1228 {
1229 if ((view = fb->render_targets[j]))
1230 {
1232 if (wined3d_box_intersect(&box_clip, &box_view, &box))
1233 cpu_blitter_clear_rtv(view, &box_clip, colour);
1234 }
1235 }
1236 }
1237
1239 {
1240 if ((view->format->depth_size && !(flags & WINED3DCLEAR_ZBUFFER))
1241 || (view->format->stencil_size && !(flags & WINED3DCLEAR_STENCIL)))
1242 FIXME("Clearing %#x on %s.\n", flags, debug_d3dformat(view->format->id));
1243
1245 if (wined3d_box_intersect(&box_clip, &box_view, &box))
1246 cpu_blitter_clear_rtv(view, &box_clip, &c);
1247 }
1248 }
1249}
static bool wined3d_box_intersect(struct wined3d_box *ret, const struct wined3d_box *b1, const struct wined3d_box *b2)
Definition: surface.c:1189
static void cpu_blitter_clear_rtv(struct wined3d_rendertarget_view *view, const struct wined3d_box *box, const struct wined3d_color *colour)
Definition: surface.c:1173
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:4605
void wined3d_rendertarget_view_get_box(struct wined3d_rendertarget_view *view, struct wined3d_box *box)
Definition: view.c:542
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define min(a, b)
Definition: monoChain.cc:55
Definition: palette.c:466
struct wined3d_rendertarget_view * depth_stencil
struct wined3d_rendertarget_view * render_targets[WINED3D_MAX_RENDER_TARGETS]
#define max(a, b)
Definition: svc.c:63
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:1008
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1010
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1009

◆ cpu_blitter_clear_rtv()

static void cpu_blitter_clear_rtv ( struct wined3d_rendertarget_view *  view,
const struct wined3d_box *  box,
const struct wined3d_color *  colour 
)
static

Definition at line 1173 of file surface.c.

1175{
1176 if (view->format->id != view->resource->format->id)
1177 FIXME("View format %s doesn't match resource format %s.\n",
1178 debug_d3dformat(view->format->id), debug_d3dformat(view->resource->format->id));
1179
1180 if (view->resource->type == WINED3D_RTYPE_BUFFER)
1181 {
1182 FIXME("Not implemented for buffers.\n");
1183 return;
1184 }
1185
1186 cpu_blitter_clear_texture(texture_from_resource(view->resource), view->sub_resource_idx, box, colour);
1187}
void cpu_blitter_clear_texture(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_box *box, const struct wined3d_color *colour)
Definition: surface.c:1128
enum view_type type
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:718
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)

Referenced by cpu_blitter_clear().

◆ cpu_blitter_clear_texture()

void cpu_blitter_clear_texture ( struct wined3d_texture *  texture,
unsigned int  sub_resource_idx,
const struct wined3d_box *  box,
const struct wined3d_color *  colour 
)

Definition at line 1128 of file surface.c.

1130{
1131 struct wined3d_device *device = texture->resource.device;
1132 struct wined3d_context *context;
1133 struct wined3d_bo_address data;
1134 struct wined3d_box level_box;
1135 struct wined3d_map_desc map;
1136 struct wined3d_range range;
1137 bool full_subresource;
1138 unsigned int level;
1139 DWORD map_binding;
1140
1141 TRACE("texture %p, sub_resource_idx %u, box %s, colour %s.\n",
1142 texture, sub_resource_idx, debug_box(box), debug_color(colour));
1143
1144 if (texture->resource.format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
1145 {
1146 FIXME("Not implemented for format %s.\n", debug_d3dformat(texture->resource.format->id));
1147 return;
1148 }
1149
1151
1152 level = sub_resource_idx % texture->level_count;
1154 full_subresource = !memcmp(box, &level_box, sizeof(*box));
1155
1156 map_binding = texture->resource.map_binding;
1157 if (!wined3d_texture_load_location(texture, sub_resource_idx, context, map_binding))
1158 ERR("Failed to load the sub-resource into %s.\n", wined3d_debug_location(map_binding));
1159 wined3d_texture_invalidate_location(texture, sub_resource_idx, ~map_binding);
1160 wined3d_texture_get_pitch(texture, level, &map.row_pitch, &map.slice_pitch);
1161 wined3d_texture_get_bo_address(texture, sub_resource_idx, &data, map_binding);
1163 texture->sub_resources[sub_resource_idx].size, WINED3D_MAP_WRITE);
1164 range.offset = 0;
1165 range.size = texture->sub_resources[sub_resource_idx].size;
1166
1167 wined3d_resource_memory_colour_fill(&texture->resource, &map, colour, box, full_subresource);
1168
1171}
Definition: _map.h:48
range
Definition: d3dx9_private.h:58
#define NULL
Definition: types.h:112
void wined3d_resource_memory_colour_fill(struct wined3d_resource *resource, const struct wined3d_map_desc *map, const struct wined3d_color *colour, const struct wined3d_box *box, bool full_subresource)
Definition: resource.c:601
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location)
Definition: texture.c:702
void wined3d_texture_get_bo_address(const struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, uint32_t location)
Definition: texture.c:727
void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: texture.c:1697
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:4552
const char * wined3d_debug_location(uint32_t location)
Definition: utils.c:6588
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:4561
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
GLint level
Definition: gl.h:1546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint texture
Definition: glext.h:6295
Definition: devices.h:37
#define WINED3D_MAP_WRITE
Definition: wined3d.h:956
static void context_release(struct wined3d_context *context)
static void wined3d_context_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, unsigned int range_count, const struct wined3d_range *ranges)
static void wined3d_texture_get_level_box(const struct wined3d_texture *texture, unsigned int level, struct wined3d_box *box)
static void * wined3d_context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, size_t size, uint32_t map_flags)
#define WINED3D_FORMAT_ATTR_BLOCKS
static struct wined3d_context * context_acquire(struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)

Referenced by cpu_blitter_clear_rtv(), and wined3d_cs_exec_clear_sysmem_texture().

◆ cpu_blitter_destroy()

static void cpu_blitter_destroy ( struct wined3d_blitter *  blitter,
struct wined3d_context *  context 
)
static

Definition at line 483 of file surface.c.

484{
485 struct wined3d_blitter *next;
486
487 if ((next = blitter->next))
488 next->ops->blitter_destroy(next, context);
489
490 free(blitter);
491}
#define free
Definition: debug_ros.c:5
static unsigned __int64 next
Definition: rand_nt.c:6
struct wined3d_blitter * next

◆ find_converter()

static const struct d3dfmt_converter_desc * find_converter ( enum wined3d_format_id  from,
enum wined3d_format_id  to 
)
inlinestatic

Definition at line 230 of file surface.c.

232{
233 unsigned int i;
234
235 for (i = 0; i < ARRAY_SIZE(converters); ++i)
236 {
237 if (converters[i].from == from && converters[i].to == to)
238 return &converters[i];
239 }
240
241 return NULL;
242}
#define ARRAY_SIZE(A)
Definition: main.h:20
static const struct d3dfmt_converter_desc converters[]
Definition: surface.c:220
CardRegion * from
Definition: spigame.cpp:19

Referenced by surface_convert_format().

◆ get_color_masks()

static void get_color_masks ( const struct wined3d_format *  format,
uint32_t *  masks 
)
static

Definition at line 36 of file surface.c.

37{
38 masks[0] = wined3d_mask_from_size(format->red_size) << format->red_offset;
39 masks[1] = wined3d_mask_from_size(format->green_size) << format->green_offset;
40 masks[2] = wined3d_mask_from_size(format->blue_size) << format->blue_offset;
41}
static const BYTE masks[8]
Definition: dib.c:3008
static uint32_t wined3d_mask_from_size(unsigned int size)

Referenced by surface_cpu_blt().

◆ sub_resource_is_on_cpu()

static bool sub_resource_is_on_cpu ( const struct wined3d_texture *  texture,
unsigned int  sub_resource_idx 
)
static

Definition at line 1329 of file surface.c.

1330{
1331 DWORD locations = texture->sub_resources[sub_resource_idx].locations;
1332
1334 return true;
1335
1337 return true;
1338
1339 return false;
1340}
GLsizei const GLint * locations
Definition: glext.h:10542
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
#define WINED3D_LOCATION_SYSMEM
#define WINED3D_LOCATION_BUFFER
#define WINED3D_LOCATION_CLEARED

Referenced by texture2d_blt().

◆ surface_convert_format()

static struct wined3d_texture * surface_convert_format ( struct wined3d_texture *  src_texture,
unsigned int  sub_resource_idx,
const struct wined3d_format *  dst_format 
)
static

Definition at line 244 of file surface.c.

246{
247 unsigned int texture_level = sub_resource_idx % src_texture->level_count;
248 const struct wined3d_format *src_format = src_texture->resource.format;
249 struct wined3d_device *device = src_texture->resource.device;
250 const struct d3dfmt_converter_desc *conv = NULL;
251 unsigned int src_row_pitch, src_slice_pitch;
252 struct wined3d_texture *dst_texture;
253 struct wined3d_bo_address src_data;
255 struct wined3d_context *context;
256 DWORD map_binding;
257
258 if (!(conv = find_converter(src_format->id, dst_format->id)) && ((device->wined3d->flags & WINED3D_NO3D)
259 || !is_identity_fixup(src_format->color_fixup) || src_format->conv_byte_count
260 || !is_identity_fixup(dst_format->color_fixup) || dst_format->conv_byte_count
261 || ((src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
262 && !src_format->decompress)))
263 {
264 FIXME("Cannot find a conversion function from format %s to %s.\n",
265 debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
266 return NULL;
267 }
268
269 /* FIXME: Multisampled conversion? */
270 desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
271 desc.format = dst_format->id;
272 desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
273 desc.multisample_quality = 0;
275 desc.bind_flags = 0;
277 desc.width = wined3d_texture_get_level_width(src_texture, texture_level);
278 desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
279 desc.depth = 1;
280 desc.size = 0;
282 NULL, NULL, &wined3d_null_parent_ops, &dst_texture)))
283 {
284 ERR("Failed to create a destination texture for conversion.\n");
285 return NULL;
286 }
287
289
290 map_binding = src_texture->resource.map_binding;
291 if (!wined3d_texture_load_location(src_texture, sub_resource_idx, context, map_binding))
292 ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
293 wined3d_texture_get_pitch(src_texture, texture_level, &src_row_pitch, &src_slice_pitch);
294 wined3d_texture_get_bo_address(src_texture, sub_resource_idx, &src_data, map_binding);
295
296 if (conv)
297 {
298 unsigned int dst_row_pitch, dst_slice_pitch;
299 struct wined3d_bo_address dst_data;
300 struct wined3d_range range;
301 const BYTE *src;
302 BYTE *dst;
303
304 map_binding = dst_texture->resource.map_binding;
305 if (!wined3d_texture_load_location(dst_texture, 0, context, map_binding))
306 ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
307 wined3d_texture_get_pitch(dst_texture, 0, &dst_row_pitch, &dst_slice_pitch);
308 wined3d_texture_get_bo_address(dst_texture, 0, &dst_data, map_binding);
309
311 src_texture->sub_resources[sub_resource_idx].size, WINED3D_MAP_READ);
313 dst_texture->sub_resources[0].size, WINED3D_MAP_WRITE);
314
315 conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
316
317 range.offset = 0;
318 range.size = dst_texture->sub_resources[0].size;
319 wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
322 }
323 else
324 {
325 struct wined3d_box src_box = {0, 0, desc.width, desc.height, 0, 1};
326
327 TRACE("Using upload conversion.\n");
328
330 dst_texture->texture_ops->texture_upload_data(context, wined3d_const_bo_address(&src_data),
331 src_format, &src_box, src_row_pitch, src_slice_pitch,
332 dst_texture, 0, WINED3D_LOCATION_TEXTURE_RGB, 0, 0, 0);
333
336 }
337
339
340 return dst_texture;
341}
static const struct d3dfmt_converter_desc * find_converter(enum wined3d_format_id from, enum wined3d_format_id to)
Definition: surface.c:230
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, uint32_t flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:4158
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, uint32_t location)
Definition: texture.c:678
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, unsigned int location)
Definition: texture.c:2116
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static const char * dst_format
Definition: dib.c:1339
void(* convert)(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:215
unsigned int sub_resource_idx
unsigned int attrs
enum wined3d_format_id id
void(* decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
struct color_fixup_desc color_fixup
const struct wined3d_texture_ops * texture_ops
unsigned int level_count
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:3472
#define WINED3D_NO3D
Definition: wined3d.h:1323
#define WINED3D_TEXTURE_CREATE_DISCARD
Definition: wined3d.h:1563
@ WINED3D_MULTISAMPLE_NONE
Definition: wined3d.h:573
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720
#define WINED3D_MAP_READ
Definition: wined3d.h:957
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:932
#define WINED3DUSAGE_CS
Definition: wined3d.h:933
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define WINED3D_FORMAT_ATTR_COMPRESSED
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
#define WINED3D_LOCATION_TEXTURE_RGB

Referenced by surface_cpu_blt().

◆ surface_cpu_blt()

static HRESULT surface_cpu_blt ( struct wined3d_texture *  dst_texture,
unsigned int  dst_sub_resource_idx,
const struct wined3d_box *  dst_box,
struct wined3d_texture *  src_texture,
unsigned int  src_sub_resource_idx,
const struct wined3d_box *  src_box,
uint32_t  flags,
const struct wined3d_blt_fx *  fx,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 596 of file surface.c.

600{
601 unsigned int bpp, src_height, src_width, dst_height, dst_width, row_byte_count;
602 struct wined3d_device *device = dst_texture->resource.device;
603 const struct wined3d_format *src_format, *dst_format;
604 struct wined3d_texture *converted_texture = NULL;
605 struct wined3d_bo_address src_data, dst_data;
606 unsigned int src_fmt_attrs, dst_fmt_attrs;
607 struct wined3d_map_desc dst_map, src_map;
608 unsigned int x, sx, xinc, y, sy, yinc;
609 struct wined3d_context *context;
610 struct wined3d_range dst_range;
611 unsigned int texture_level;
613 BOOL same_sub_resource;
614 BOOL upload = FALSE;
615 DWORD map_binding;
616 const BYTE *sbase;
617 const BYTE *sbuf;
618 BYTE *dbuf;
619
620 TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_box %s, src_texture %p, "
621 "src_sub_resource_idx %u, src_box %s, flags %#x, fx %p, filter %s.\n",
622 dst_texture, dst_sub_resource_idx, debug_box(dst_box), src_texture,
623 src_sub_resource_idx, debug_box(src_box), flags, fx, debug_d3dtexturefiltertype(filter));
624
626
627 src_format = src_texture->resource.format;
628 dst_format = dst_texture->resource.format;
629
630 if (wined3d_format_is_typeless(src_format) && src_format->id == dst_format->typeless_id)
631 src_format = dst_format;
633 dst_format = src_format;
634
635 src_height = src_box->bottom - src_box->top;
636 src_width = src_box->right - src_box->left;
637 dst_height = dst_box->bottom - dst_box->top;
638 dst_width = dst_box->right - dst_box->left;
639
640 dst_range.offset = 0;
641 dst_range.size = dst_texture->sub_resources[dst_sub_resource_idx].size;
642 if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
643 {
644 same_sub_resource = TRUE;
645
646 map_binding = dst_texture->resource.map_binding;
647 texture_level = dst_sub_resource_idx % dst_texture->level_count;
648 if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, map_binding))
649 ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
650 wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
651 wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
652 wined3d_texture_get_bo_address(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
653 dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
654 dst_texture->sub_resources[dst_sub_resource_idx].size, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
655
656 src_map = dst_map;
657 }
658 else
659 {
660 same_sub_resource = FALSE;
661 upload = dst_format->attrs & WINED3D_FORMAT_ATTR_BLOCKS
662 && (dst_width != src_width || dst_height != src_height);
663
664 if (upload)
665 {
667 ? wined3d_get_format(device->adapter, WINED3DFMT_B8G8R8A8_UNORM, 0) : src_format;
668 }
669
670 if (!(flags & WINED3D_BLT_RAW) && dst_format->id != src_format->id)
671 {
672 if (!(converted_texture = surface_convert_format(src_texture, src_sub_resource_idx, dst_format)))
673 {
674 FIXME("Cannot convert %s to %s.\n", debug_d3dformat(src_format->id),
678 }
679 src_texture = converted_texture;
680 src_sub_resource_idx = 0;
681 src_format = src_texture->resource.format;
682 }
683
684 map_binding = src_texture->resource.map_binding;
685 texture_level = src_sub_resource_idx % src_texture->level_count;
686 if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, map_binding))
687 ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
688 wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
689 wined3d_texture_get_bo_address(src_texture, src_sub_resource_idx, &src_data, map_binding);
690 src_map.data = wined3d_context_map_bo_address(context, &src_data,
691 src_texture->sub_resources[src_sub_resource_idx].size, WINED3D_MAP_READ);
692
693 if (upload)
694 {
696 &dst_map.row_pitch, &dst_map.slice_pitch);
697 dst_map.data = malloc(dst_map.slice_pitch);
698 }
699 else
700 {
701 map_binding = dst_texture->resource.map_binding;
702 texture_level = dst_sub_resource_idx % dst_texture->level_count;
703 if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, map_binding))
704 ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
705
706 wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
707 wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
708 wined3d_texture_get_bo_address(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
709 dst_map.data = wined3d_context_map_bo_address(context, &dst_data,
710 dst_texture->sub_resources[dst_sub_resource_idx].size, WINED3D_MAP_WRITE);
711 }
712 }
713 src_fmt_attrs = src_format->attrs;
714 dst_fmt_attrs = dst_format->attrs;
715 flags &= ~WINED3D_BLT_RAW;
716
717 bpp = dst_format->byte_count;
718 row_byte_count = dst_width * bpp;
719
720 sbase = (BYTE *)src_map.data
721 + ((src_box->top / src_format->block_height) * src_map.row_pitch)
722 + ((src_box->left / src_format->block_width) * src_format->block_byte_count);
723 dbuf = (BYTE *)dst_map.data
724 + ((dst_box->top / dst_format->block_height) * dst_map.row_pitch)
725 + ((dst_box->left / dst_format->block_width) * dst_format->block_byte_count);
726
727 if (src_fmt_attrs & dst_fmt_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
728 {
729 TRACE("%s -> %s copy.\n", debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
730
731 if (same_sub_resource)
732 {
733 FIXME("Only plain blits supported on compressed surfaces.\n");
734 hr = E_NOTIMPL;
735 goto release;
736 }
737
738 hr = surface_cpu_blt_compressed(sbase, dbuf,
739 src_map.row_pitch, dst_map.row_pitch, dst_width, dst_height,
740 src_format, flags, fx);
741 goto release;
742 }
743
744 if ((src_fmt_attrs | dst_fmt_attrs) & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
745 {
746 FIXME("Unsupported blit between height-scaled formats (src %s, dst %s).\n",
747 debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
748 hr = E_NOTIMPL;
749 goto release;
750 }
751
753 && (src_width != dst_width || src_height != dst_height))
754 {
755 /* Can happen when d3d9 apps do a StretchRect() call which isn't handled in GL. */
756 FIXME("Filter %s not supported in software blit.\n", debug_d3dtexturefiltertype(filter));
757 }
758
759 xinc = (src_width << 16) / dst_width;
760 yinc = (src_height << 16) / dst_height;
761
762 if (!flags)
763 {
764 /* No effects, we can cheat here. */
765 if (dst_width == src_width)
766 {
767 if (dst_height == src_height)
768 {
769 /* No stretching in either direction. This needs to be as fast
770 * as possible. */
771 sbuf = sbase;
772
773 /* Check for overlapping surfaces. */
774 if (!same_sub_resource || dst_box->top < src_box->top
775 || dst_box->right <= src_box->left || src_box->right <= dst_box->left)
776 {
777 /* No overlap, or dst above src, so copy from top downwards. */
778 for (y = 0; y < dst_height; ++y)
779 {
780 memcpy(dbuf, sbuf, row_byte_count);
781 sbuf += src_map.row_pitch;
782 dbuf += dst_map.row_pitch;
783 }
784 }
785 else if (dst_box->top > src_box->top)
786 {
787 /* Copy from bottom upwards. */
788 sbuf += src_map.row_pitch * dst_height;
789 dbuf += dst_map.row_pitch * dst_height;
790 for (y = 0; y < dst_height; ++y)
791 {
792 sbuf -= src_map.row_pitch;
793 dbuf -= dst_map.row_pitch;
794 memcpy(dbuf, sbuf, row_byte_count);
795 }
796 }
797 else
798 {
799 /* Src and dst overlapping on the same line, use memmove. */
800 for (y = 0; y < dst_height; ++y)
801 {
802 memmove(dbuf, sbuf, row_byte_count);
803 sbuf += src_map.row_pitch;
804 dbuf += dst_map.row_pitch;
805 }
806 }
807 }
808 else
809 {
810 /* Stretching in y direction only. */
811 for (y = sy = 0; y < dst_height; ++y, sy += yinc)
812 {
813 sbuf = sbase + (sy >> 16) * src_map.row_pitch;
814 memcpy(dbuf, sbuf, row_byte_count);
815 dbuf += dst_map.row_pitch;
816 }
817 }
818 }
819 else
820 {
821 /* Stretching in X direction. */
822 unsigned int last_sy = ~0u;
823 for (y = sy = 0; y < dst_height; ++y, sy += yinc)
824 {
825 sbuf = sbase + (sy >> 16) * src_map.row_pitch;
826
827 if ((sy >> 16) == (last_sy >> 16))
828 {
829 /* This source row is the same as last source row -
830 * Copy the already stretched row. */
831 memcpy(dbuf, dbuf - dst_map.row_pitch, row_byte_count);
832 }
833 else
834 {
835#define STRETCH_ROW(type) \
836do { \
837 const type *s = (const type *)sbuf; \
838 type *d = (type *)dbuf; \
839 for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
840 d[x] = s[sx >> 16]; \
841} while(0)
842
843 switch(bpp)
844 {
845 case 1:
847 break;
848 case 2:
850 break;
851 case 4:
853 break;
854 case 3:
855 {
856 const BYTE *s;
857 BYTE *d = dbuf;
858 for (x = sx = 0; x < dst_width; x++, sx+= xinc)
859 {
860 DWORD pixel;
861
862 s = sbuf + 3 * (sx >> 16);
863 pixel = s[0] | (s[1] << 8) | (s[2] << 16);
864 d[0] = (pixel ) & 0xff;
865 d[1] = (pixel >> 8) & 0xff;
866 d[2] = (pixel >> 16) & 0xff;
867 d += 3;
868 }
869 break;
870 }
871 default:
872 FIXME("Stretched blit not implemented for bpp %u.\n", bpp * 8);
874 goto error;
875 }
876#undef STRETCH_ROW
877 }
878 dbuf += dst_map.row_pitch;
879 last_sy = sy;
880 }
881 }
882 }
883 else
884 {
885 LONG dstyinc = dst_map.row_pitch, dstxinc = bpp;
886 DWORD keylow = 0xffffffff, keyhigh = 0, keymask = 0xffffffff;
887 DWORD destkeylow = 0x0, destkeyhigh = 0xffffffff, destkeymask = 0xffffffff;
890 {
891 /* The color keying flags are checked for correctness in ddraw. */
893 {
894 keylow = src_texture->async.src_blt_color_key.color_space_low_value;
895 keyhigh = src_texture->async.src_blt_color_key.color_space_high_value;
896 }
898 {
899 keylow = fx->src_color_key.color_space_low_value;
900 keyhigh = fx->src_color_key.color_space_high_value;
901 }
902
904 {
905 /* Destination color keys are taken from the source surface! */
906 destkeylow = src_texture->async.dst_blt_color_key.color_space_low_value;
907 destkeyhigh = src_texture->async.dst_blt_color_key.color_space_high_value;
908 }
910 {
911 destkeylow = fx->dst_color_key.color_space_low_value;
912 destkeyhigh = fx->dst_color_key.color_space_high_value;
913 }
914
915 if (bpp == 1)
916 {
917 keymask = 0xff;
918 }
919 else
920 {
921 uint32_t masks[3];
922 get_color_masks(src_format, masks);
923 keymask = masks[0] | masks[1] | masks[2];
924 }
927 }
928
929 if (flags & WINED3D_BLT_FX)
930 {
931 BYTE *dTopLeft, *dTopRight, *dBottomLeft, *dBottomRight, *tmp;
932 LONG tmpxy;
933 dTopLeft = dbuf;
934 dTopRight = dbuf + ((dst_width - 1) * bpp);
935 dBottomLeft = dTopLeft + ((dst_height - 1) * dst_map.row_pitch);
936 dBottomRight = dBottomLeft + ((dst_width - 1) * bpp);
937
939 {
940 /* I don't think we need to do anything about this flag. */
941 WARN("Nothing done for WINEDDBLTFX_ARITHSTRETCHY.\n");
942 }
944 {
945 tmp = dTopRight;
946 dTopRight = dTopLeft;
947 dTopLeft = tmp;
948 tmp = dBottomRight;
949 dBottomRight = dBottomLeft;
950 dBottomLeft = tmp;
951 dstxinc = dstxinc * -1;
952 }
954 {
955 tmp = dTopLeft;
956 dTopLeft = dBottomLeft;
957 dBottomLeft = tmp;
958 tmp = dTopRight;
959 dTopRight = dBottomRight;
960 dBottomRight = tmp;
961 dstyinc = dstyinc * -1;
962 }
963 if (fx->fx & WINEDDBLTFX_NOTEARING)
964 {
965 /* I don't think we need to do anything about this flag. */
966 WARN("Nothing done for WINEDDBLTFX_NOTEARING.\n");
967 }
968 if (fx->fx & WINEDDBLTFX_ROTATE180)
969 {
970 tmp = dBottomRight;
971 dBottomRight = dTopLeft;
972 dTopLeft = tmp;
973 tmp = dBottomLeft;
974 dBottomLeft = dTopRight;
975 dTopRight = tmp;
976 dstxinc = dstxinc * -1;
977 dstyinc = dstyinc * -1;
978 }
979 if (fx->fx & WINEDDBLTFX_ROTATE270)
980 {
981 tmp = dTopLeft;
982 dTopLeft = dBottomLeft;
983 dBottomLeft = dBottomRight;
984 dBottomRight = dTopRight;
985 dTopRight = tmp;
986 tmpxy = dstxinc;
987 dstxinc = dstyinc;
988 dstyinc = tmpxy;
989 dstxinc = dstxinc * -1;
990 }
991 if (fx->fx & WINEDDBLTFX_ROTATE90)
992 {
993 tmp = dTopLeft;
994 dTopLeft = dTopRight;
995 dTopRight = dBottomRight;
996 dBottomRight = dBottomLeft;
997 dBottomLeft = tmp;
998 tmpxy = dstxinc;
999 dstxinc = dstyinc;
1000 dstyinc = tmpxy;
1001 dstyinc = dstyinc * -1;
1002 }
1004 {
1005 /* I don't think we need to do anything about this flag. */
1006 WARN("Nothing done for WINEDDBLTFX_ZBUFFERBASEDEST.\n");
1007 }
1008 dbuf = dTopLeft;
1009 flags &= ~(WINED3D_BLT_FX);
1010 }
1011
1012#define COPY_COLORKEY_FX(type) \
1013do { \
1014 const type *s; \
1015 type *d = (type *)dbuf, *dx, tmp; \
1016 for (y = sy = 0; y < dst_height; ++y, sy += yinc) \
1017 { \
1018 s = (const type *)(sbase + (sy >> 16) * src_map.row_pitch); \
1019 dx = d; \
1020 for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
1021 { \
1022 tmp = s[sx >> 16]; \
1023 if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) \
1024 && ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) \
1025 { \
1026 dx[0] = tmp; \
1027 } \
1028 dx = (type *)(((BYTE *)dx) + dstxinc); \
1029 } \
1030 d = (type *)(((BYTE *)d) + dstyinc); \
1031 } \
1032} while(0)
1033
1034 switch (bpp)
1035 {
1036 case 1:
1038 break;
1039 case 2:
1041 break;
1042 case 4:
1044 break;
1045 case 3:
1046 {
1047 const BYTE *s;
1048 BYTE *d = dbuf, *dx;
1049 for (y = sy = 0; y < dst_height; ++y, sy += yinc)
1050 {
1051 sbuf = sbase + (sy >> 16) * src_map.row_pitch;
1052 dx = d;
1053 for (x = sx = 0; x < dst_width; ++x, sx+= xinc)
1054 {
1055 DWORD pixel, dpixel = 0;
1056 s = sbuf + 3 * (sx>>16);
1057 pixel = s[0] | (s[1] << 8) | (s[2] << 16);
1058 dpixel = dx[0] | (dx[1] << 8 ) | (dx[2] << 16);
1059 if (((pixel & keymask) < keylow || (pixel & keymask) > keyhigh)
1060 && ((dpixel & keymask) >= destkeylow || (dpixel & keymask) <= keyhigh))
1061 {
1062 dx[0] = (pixel ) & 0xff;
1063 dx[1] = (pixel >> 8) & 0xff;
1064 dx[2] = (pixel >> 16) & 0xff;
1065 }
1066 dx += dstxinc;
1067 }
1068 d += dstyinc;
1069 }
1070 break;
1071 }
1072 default:
1073 FIXME("%s color-keyed blit not implemented for bpp %u.\n",
1074 (flags & WINED3D_BLT_SRC_CKEY) ? "Source" : "Destination", bpp * 8);
1076 goto error;
1077#undef COPY_COLORKEY_FX
1078 }
1079 }
1080
1081error:
1082 if (flags)
1083 FIXME(" Unsupported flags %#x.\n", flags);
1084
1085release:
1086 if (upload && hr == WINED3D_OK)
1087 {
1088 struct wined3d_bo_address data;
1089
1090 data.buffer_object = 0;
1091 data.addr = dst_map.data;
1092
1093 texture_level = dst_sub_resource_idx % dst_texture->level_count;
1094
1096 dst_texture->texture_ops->texture_upload_data(context, wined3d_const_bo_address(&data), dst_format,
1097 dst_box, dst_map.row_pitch, dst_map.slice_pitch, dst_texture, texture_level,
1098 WINED3D_LOCATION_TEXTURE_RGB, dst_box->left, dst_box->top, 0);
1099
1102 }
1103
1104 if (upload)
1105 {
1106 free(dst_map.data);
1107 }
1108 else
1109 {
1110 wined3d_context_unmap_bo_address(context, &dst_data, 1, &dst_range);
1111 }
1112
1113 if (!same_sub_resource)
1115 if (SUCCEEDED(hr) && dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
1116 {
1117 SetRect(&dst_texture->swapchain->front_buffer_update,
1118 dst_box->left, dst_box->top, dst_box->right, dst_box->bottom);
1119 dst_texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(dst_texture->swapchain);
1120 }
1121 if (converted_texture)
1122 wined3d_texture_decref(converted_texture);
1124
1125 return hr;
1126}
#define WARN(fmt,...)
Definition: precomp.h:61
#define E_NOTIMPL
Definition: ddrawi.h:99
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
#define STRETCH_ROW(type)
static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data, UINT src_pitch, UINT dst_pitch, UINT update_w, UINT update_h, const struct wined3d_format *format, uint32_t flags, const struct wined3d_blt_fx *fx)
Definition: surface.c:493
static struct wined3d_texture * surface_convert_format(struct wined3d_texture *src_texture, unsigned int sub_resource_idx, const struct wined3d_format *dst_format)
Definition: surface.c:244
#define COPY_COLORKEY_FX(type)
static void get_color_masks(const struct wined3d_format *format, uint32_t *masks)
Definition: surface.c:36
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1606
const struct wined3d_format * wined3d_get_format(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id, unsigned int bind_flags)
Definition: utils.c:4428
const char * debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type)
Definition: utils.c:5194
void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: utils.c:4489
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SUCCEEDED(hr)
Definition: intsafe.h:50
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
long LONG
Definition: pedump.c:60
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
struct wined3d_bo * buffer_object
UINT left
Definition: wined3d.h:1873
UINT right
Definition: wined3d.h:1875
UINT bottom
Definition: wined3d.h:1876
UINT top
Definition: wined3d.h:1874
enum wined3d_format_id typeless_id
struct wined3d_swapchain * swapchain
struct wined3d_texture::wined3d_texture_async async
#define WINEDDBLTFX_ROTATE270
Definition: wined3d.h:1356
#define WINED3D_BLT_DST_CKEY
Definition: wined3d.h:1365
#define WINED3D_OK
Definition: wined3d.h:33
#define WINED3D_BLT_SRC_CKEY
Definition: wined3d.h:1367
#define WINEDDBLTFX_NOTEARING
Definition: wined3d.h:1352
#define WINEDDBLTFX_MIRRORUPDOWN
Definition: wined3d.h:1350
#define WINEDDBLTFX_ROTATE90
Definition: wined3d.h:1358
#define WINED3DERR_NOTAVAILABLE
Definition: wined3d.h:42
@ WINED3D_TEXF_NONE
Definition: wined3d.h:705
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
#define WINED3D_BLT_DST_CKEY_OVERRIDE
Definition: wined3d.h:1366
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:244
#define WINEDDBLTFX_ZBUFFERBASEDEST
Definition: wined3d.h:1362
#define WINEDDBLTFX_ARITHSTRETCHY
Definition: wined3d.h:1346
#define WINEDDBLTFX_ROTATE180
Definition: wined3d.h:1354
#define WINEDDBLTFX_MIRRORLEFTRIGHT
Definition: wined3d.h:1348
static BOOL wined3d_format_is_typeless(const struct wined3d_format *format)
#define WINED3D_FORMAT_ATTR_HEIGHT_SCALE
ULONG bpp[]
Definition: xlate.c:19

Referenced by cpu_blitter_blit(), and texture2d_blt().

◆ surface_cpu_blt_compressed()

static HRESULT surface_cpu_blt_compressed ( const BYTE *  src_data,
BYTE *  dst_data,
UINT  src_pitch,
UINT  dst_pitch,
UINT  update_w,
UINT  update_h,
const struct wined3d_format *  format,
uint32_t  flags,
const struct wined3d_blt_fx *  fx 
)
static

Definition at line 493 of file surface.c.

496{
497 UINT row_block_count;
498 const BYTE *src_row;
499 BYTE *dst_row;
500 UINT x, y;
501
502 src_row = src_data;
503 dst_row = dst_data;
504
505 row_block_count = (update_w + format->block_width - 1) / format->block_width;
506
507 if (!flags)
508 {
509 for (y = 0; y < update_h; y += format->block_height)
510 {
511 memcpy(dst_row, src_row, row_block_count * format->block_byte_count);
512 src_row += src_pitch;
513 dst_row += dst_pitch;
514 }
515
516 return WINED3D_OK;
517 }
518
520 {
521 src_row += (((update_h / format->block_height) - 1) * src_pitch);
522
523 switch (format->id)
524 {
525 case WINED3DFMT_DXT1:
526 for (y = 0; y < update_h; y += format->block_height)
527 {
528 struct block
529 {
530 WORD color[2];
531 BYTE control_row[4];
532 };
533
534 const struct block *s = (const struct block *)src_row;
535 struct block *d = (struct block *)dst_row;
536
537 for (x = 0; x < row_block_count; ++x)
538 {
539 d[x].color[0] = s[x].color[0];
540 d[x].color[1] = s[x].color[1];
541 d[x].control_row[0] = s[x].control_row[3];
542 d[x].control_row[1] = s[x].control_row[2];
543 d[x].control_row[2] = s[x].control_row[1];
544 d[x].control_row[3] = s[x].control_row[0];
545 }
546 src_row -= src_pitch;
547 dst_row += dst_pitch;
548 }
549 return WINED3D_OK;
550
551 case WINED3DFMT_DXT2:
552 case WINED3DFMT_DXT3:
553 for (y = 0; y < update_h; y += format->block_height)
554 {
555 struct block
556 {
557 WORD alpha_row[4];
558 WORD color[2];
559 BYTE control_row[4];
560 };
561
562 const struct block *s = (const struct block *)src_row;
563 struct block *d = (struct block *)dst_row;
564
565 for (x = 0; x < row_block_count; ++x)
566 {
567 d[x].alpha_row[0] = s[x].alpha_row[3];
568 d[x].alpha_row[1] = s[x].alpha_row[2];
569 d[x].alpha_row[2] = s[x].alpha_row[1];
570 d[x].alpha_row[3] = s[x].alpha_row[0];
571 d[x].color[0] = s[x].color[0];
572 d[x].color[1] = s[x].color[1];
573 d[x].control_row[0] = s[x].control_row[3];
574 d[x].control_row[1] = s[x].control_row[2];
575 d[x].control_row[2] = s[x].control_row[1];
576 d[x].control_row[3] = s[x].control_row[0];
577 }
578 src_row -= src_pitch;
579 dst_row += dst_pitch;
580 }
581 return WINED3D_OK;
582
583 default:
584 FIXME("Compressed flip not implemented for format %s.\n",
586 return E_NOTIMPL;
587 }
588 }
589
590 FIXME("Unsupported blit on compressed surface (format %s, flags %#x, DDFX %#x).\n",
592
593 return E_NOTIMPL;
594}
GLuint color
Definition: glext.h:6243
unsigned int UINT
Definition: sysinfo.c:13
@ WINED3DFMT_DXT2
Definition: wined3d.h:261
@ WINED3DFMT_DXT1
Definition: wined3d.h:260
@ WINED3DFMT_DXT3
Definition: wined3d.h:262
static unsigned int block
Definition: xmlmemory.c:101

Referenced by surface_cpu_blt().

◆ texture2d_blt()

HRESULT texture2d_blt ( struct wined3d_texture *  dst_texture,
unsigned int  dst_sub_resource_idx,
const struct wined3d_box *  dst_box,
struct wined3d_texture *  src_texture,
unsigned int  src_sub_resource_idx,
const struct wined3d_box *  src_box,
uint32_t  flags,
const struct wined3d_blt_fx *  fx,
enum wined3d_texture_filter_type  filter 
)

Definition at line 1342 of file surface.c.

1346{
1347 struct wined3d_texture_sub_resource *src_sub_resource, *dst_sub_resource;
1348 struct wined3d_device *device = dst_texture->resource.device;
1349 struct wined3d_swapchain *src_swapchain, *dst_swapchain;
1350 BOOL scale, convert, resolve, resolve_typeless = FALSE;
1351 const struct wined3d_format *resolve_format = NULL;
1352 const struct wined3d_color_key *colour_key = NULL;
1353 DWORD src_location, dst_location, valid_locations;
1354 struct wined3d_context *context;
1355 enum wined3d_blit_op blit_op;
1356 RECT src_rect, dst_rect;
1357 bool src_ds, dst_ds;
1358
1359 static const DWORD simple_blit = WINED3D_BLT_SRC_CKEY
1363
1364 TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_box %s, src_texture %p, "
1365 "src_sub_resource_idx %u, src_box %s, flags %#x, fx %p, filter %s.\n",
1366 dst_texture, dst_sub_resource_idx, debug_box(dst_box), src_texture, src_sub_resource_idx,
1368 TRACE("Usage is %s.\n", debug_d3dusage(dst_texture->resource.usage));
1369
1370 if (fx)
1371 {
1372 TRACE("fx %#x.\n", fx->fx);
1373 TRACE("dst_color_key {0x%08x, 0x%08x}.\n",
1374 fx->dst_color_key.color_space_low_value,
1375 fx->dst_color_key.color_space_high_value);
1376 TRACE("src_color_key {0x%08x, 0x%08x}.\n",
1377 fx->src_color_key.color_space_low_value,
1378 fx->src_color_key.color_space_high_value);
1379 TRACE("resolve_format_id %s.\n", debug_d3dformat(fx->resolve_format_id));
1380
1381 if (fx->resolve_format_id != WINED3DFMT_UNKNOWN)
1382 resolve_format = wined3d_get_format(device->adapter, fx->resolve_format_id, 0);
1383 }
1384
1385 dst_sub_resource = &dst_texture->sub_resources[dst_sub_resource_idx];
1386 src_sub_resource = &src_texture->sub_resources[src_sub_resource_idx];
1387
1388 if (src_sub_resource->locations & WINED3D_LOCATION_DISCARDED)
1389 {
1390 WARN("Source sub-resource is discarded, nothing to do.\n");
1391 return WINED3D_OK;
1392 }
1393
1394 SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
1395 SetRect(&dst_rect, dst_box->left, dst_box->top, dst_box->right, dst_box->bottom);
1396
1397 if (!fx || !(fx->fx))
1398 flags &= ~WINED3D_BLT_FX;
1399
1400 /* WINED3D_BLT_DO_NOT_WAIT appeared in DX7. */
1402 {
1403 static unsigned int once;
1404
1405 if (!once++)
1406 FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n");
1407 }
1408
1410
1411 if (flags & ~simple_blit)
1412 {
1413 WARN_(d3d_perf)("Using CPU fallback for complex blit (%#x).\n", flags);
1414 goto cpu;
1415 }
1416
1417 src_swapchain = src_texture->swapchain;
1418 dst_swapchain = dst_texture->swapchain;
1419
1420 if (src_swapchain && dst_swapchain && src_swapchain != dst_swapchain
1421 && src_texture == src_swapchain->front_buffer)
1422 {
1423 /* TODO: We could support cross-swapchain blits by first downloading
1424 * the source to a texture. */
1425 FIXME("Cross-swapchain blit not supported.\n");
1427 }
1428
1429 scale = src_box->right - src_box->left != dst_box->right - dst_box->left
1430 || src_box->bottom - src_box->top != dst_box->bottom - dst_box->top;
1431 convert = src_texture->resource.format->id != dst_texture->resource.format->id;
1432 resolve = src_texture->resource.multisample_type != dst_texture->resource.multisample_type;
1433 if (resolve)
1434 {
1435 resolve_typeless = (wined3d_format_is_typeless(src_texture->resource.format)
1436 || wined3d_format_is_typeless(dst_texture->resource.format))
1437 && (src_texture->resource.format->typeless_id == dst_texture->resource.format->typeless_id);
1438 if (resolve_typeless && !resolve_format)
1439 WARN("Resolve format for typeless resolve not specified.\n");
1440 }
1441
1442 dst_ds = dst_texture->resource.format->depth_size || dst_texture->resource.format->stencil_size;
1443 src_ds = src_texture->resource.format->depth_size || src_texture->resource.format->stencil_size;
1444
1445 if (src_ds || dst_ds)
1446 {
1447 TRACE("Depth/stencil blit.\n");
1448
1449 if (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)
1450 dst_location = dst_texture->resource.draw_binding;
1451 else
1452 dst_location = dst_texture->resource.map_binding;
1453
1454 if ((flags & WINED3D_BLT_RAW) || (!scale && !convert && !resolve))
1455 blit_op = WINED3D_BLIT_OP_RAW_BLIT;
1456 else
1458
1459 context = context_acquire(device, dst_texture, dst_sub_resource_idx);
1460 valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
1461 src_texture, src_sub_resource_idx, src_texture->resource.draw_binding, &src_rect,
1462 dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, NULL, filter, resolve_format);
1464
1465 wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations);
1466 wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~valid_locations);
1467
1468 return WINED3D_OK;
1469 }
1470
1471 TRACE("Colour blit.\n");
1472
1473 /* In principle this would apply to depth blits as well, but we don't
1474 * implement those in the CPU blitter at the moment. */
1475 if ((dst_sub_resource->locations & dst_texture->resource.map_binding)
1476 && (src_sub_resource->locations & src_texture->resource.map_binding))
1477 {
1478 if (scale)
1479 TRACE("Not doing sysmem blit because of scaling.\n");
1480 else if (convert)
1481 TRACE("Not doing sysmem blit because of format conversion.\n");
1482 else
1483 goto cpu;
1484 }
1485
1488 {
1489 colour_key = &fx->src_color_key;
1491 }
1492 else if (flags & WINED3D_BLT_SRC_CKEY)
1493 {
1494 colour_key = &src_texture->async.src_blt_color_key;
1496 }
1497 else if (flags & WINED3D_BLT_ALPHA_TEST)
1498 {
1500 }
1501 else if (sub_resource_is_on_cpu(src_texture, src_sub_resource_idx)
1502 && !sub_resource_is_on_cpu(dst_texture, dst_sub_resource_idx)
1503 && (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
1504 {
1505 /* Upload */
1506 if (scale)
1507 TRACE("Not doing upload because of scaling.\n");
1508 else if (convert)
1509 TRACE("Not doing upload because of format conversion.\n");
1510 else if (dst_texture->resource.format->conv_byte_count)
1511 TRACE("Not doing upload because the destination format needs conversion.\n");
1512 else
1513 {
1514 wined3d_texture_upload_from_texture(dst_texture, dst_sub_resource_idx, dst_box->left,
1515 dst_box->top, dst_box->front, src_texture, src_sub_resource_idx, src_box);
1516 if (!wined3d_resource_is_offscreen(&dst_texture->resource))
1517 {
1518 context = context_acquire(device, dst_texture, dst_sub_resource_idx);
1519 wined3d_texture_load_location(dst_texture, dst_sub_resource_idx,
1520 context, dst_texture->resource.draw_binding);
1522 }
1523 return WINED3D_OK;
1524 }
1525 }
1526 else if (!sub_resource_is_on_cpu(src_texture, src_sub_resource_idx)
1527 && !(dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
1528 {
1529 /* Download */
1530 if (scale)
1531 TRACE("Not doing download because of scaling.\n");
1532 else if (convert)
1533 TRACE("Not doing download because of format conversion.\n");
1534 else if (src_texture->resource.format->conv_byte_count)
1535 TRACE("Not doing download because the source format needs conversion.\n");
1536 else if (!(src_texture->flags & WINED3D_TEXTURE_DOWNLOADABLE))
1537 TRACE("Not doing download because texture is not downloadable.\n");
1538 else if (!wined3d_texture_is_full_rect(src_texture, src_sub_resource_idx % src_texture->level_count, &src_rect))
1539 TRACE("Not doing download because of partial download (src).\n");
1540 else if (!wined3d_texture_is_full_rect(dst_texture, dst_sub_resource_idx % dst_texture->level_count, &dst_rect))
1541 TRACE("Not doing download because of partial download (dst).\n");
1542 else
1543 {
1544 wined3d_texture_download_from_texture(dst_texture, dst_sub_resource_idx, src_texture,
1545 src_sub_resource_idx);
1546 return WINED3D_OK;
1547 }
1548 }
1549 else if (dst_swapchain && dst_swapchain->back_buffers
1550 && dst_texture == dst_swapchain->front_buffer
1551 && src_texture == dst_swapchain->back_buffers[0])
1552 {
1553 /* Use present for back -> front blits. The idea behind this is that
1554 * present is potentially faster than a blit, in particular when FBO
1555 * blits aren't available. Some ddraw applications like Half-Life and
1556 * Prince of Persia 3D use Blt() from the backbuffer to the
1557 * frontbuffer instead of doing a Flip(). D3d8 and d3d9 applications
1558 * can't blit directly to the frontbuffer. */
1559 enum wined3d_swap_effect swap_effect = dst_swapchain->state.desc.swap_effect;
1560
1561 TRACE("Using present for backbuffer -> frontbuffer blit.\n");
1562
1563 /* Set the swap effect to COPY, we don't want the backbuffer to become
1564 * undefined. */
1565 dst_swapchain->state.desc.swap_effect = WINED3D_SWAP_EFFECT_COPY;
1566 wined3d_swapchain_present(dst_swapchain, NULL, NULL,
1567 dst_swapchain->win_handle, dst_swapchain->swap_interval, 0);
1568 dst_swapchain->state.desc.swap_effect = swap_effect;
1569
1570 return WINED3D_OK;
1571 }
1572
1573 if ((flags & WINED3D_BLT_RAW) || (blit_op == WINED3D_BLIT_OP_COLOR_BLIT && !scale && !convert && !resolve))
1574 blit_op = WINED3D_BLIT_OP_RAW_BLIT;
1575
1576 context = context_acquire(device, dst_texture, dst_sub_resource_idx);
1577
1578 if (src_texture->resource.multisample_type != WINED3D_MULTISAMPLE_NONE && !resolve_typeless
1579 && ((scale && !context->d3d_info->scaled_resolve)
1580 || convert || !wined3d_is_colour_blit(blit_op)))
1581 src_location = WINED3D_LOCATION_RB_RESOLVED;
1582 else
1583 src_location = src_texture->resource.draw_binding;
1584
1585 if (!(dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
1586 dst_location = dst_texture->resource.map_binding;
1587 else if (dst_texture->resource.multisample_type != WINED3D_MULTISAMPLE_NONE
1588 && (scale || convert || !wined3d_is_colour_blit(blit_op)))
1589 dst_location = WINED3D_LOCATION_RB_RESOLVED;
1590 else
1591 dst_location = dst_texture->resource.draw_binding;
1592
1593 valid_locations = device->blitter->ops->blitter_blit(device->blitter, blit_op, context,
1594 src_texture, src_sub_resource_idx, src_location, &src_rect,
1595 dst_texture, dst_sub_resource_idx, dst_location, &dst_rect, colour_key, filter, resolve_format);
1596
1598
1599 wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, valid_locations);
1600 wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~valid_locations);
1601
1602 return WINED3D_OK;
1603
1604cpu:
1605 return surface_cpu_blt(dst_texture, dst_sub_resource_idx, dst_box,
1606 src_texture, src_sub_resource_idx, src_box, flags, fx, filter);
1607}
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
Definition: resource.c:406
static bool sub_resource_is_on_cpu(const struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: surface.c:1329
static bool wined3d_is_colour_blit(enum wined3d_blit_op blit_op)
Definition: surface.c:1315
void wined3d_texture_upload_from_texture(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box)
Definition: texture.c:4335
void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx)
Definition: texture.c:4381
const char * debug_d3dusage(uint32_t usage)
Definition: utils.c:4895
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
int convert
Definition: msacm.c:1374
#define WARN_(ch,...)
Definition: debug.h:157
Definition: dcommon.idl:28
UINT front
Definition: wined3d.h:1877
struct wined3d_texture ** back_buffers
unsigned int swap_interval
struct wined3d_texture * front_buffer
struct wined3d_swapchain_state state
HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, uint32_t flags)
Definition: swapchain.c:192
wined3d_swap_effect
Definition: wined3d.h:533
@ WINED3D_SWAP_EFFECT_COPY
Definition: wined3d.h:538
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127
#define WINED3D_BLT_SYNCHRONOUS
Definition: wined3d.h:1372
#define WINED3D_BLT_DO_NOT_WAIT
Definition: wined3d.h:1370
#define WINED3D_BLT_WAIT
Definition: wined3d.h:1369
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:44
#define WINED3D_TEXTURE_DOWNLOADABLE
static bool wined3d_texture_is_full_rect(const struct wined3d_texture *texture, unsigned int level, const RECT *r)
#define WINED3D_LOCATION_RB_RESOLVED
#define WINED3D_LOCATION_DISCARDED
wined3d_blit_op

Referenced by wined3d_cs_exec_blt_sub_resource().

◆ texture2d_read_from_framebuffer()

void texture2d_read_from_framebuffer ( struct wined3d_texture *  texture,
unsigned int  sub_resource_idx,
struct wined3d_context *  context,
DWORD  src_location,
DWORD  dst_location 
)

Definition at line 343 of file surface.c.

345{
346 struct wined3d_resource *resource = &texture->resource;
347 struct wined3d_device *device = resource->device;
348 const struct wined3d_format_gl *format_gl;
349 struct wined3d_texture *restore_texture;
350 const struct wined3d_gl_info *gl_info;
351 struct wined3d_context_gl *context_gl;
352 unsigned int row_pitch, slice_pitch;
353 unsigned int width, height, level;
355 bool restore_context = false;
356 unsigned int restore_idx;
357 BYTE *row, *top, *bottom;
358 BOOL src_is_upside_down;
359 BYTE *mem = NULL;
361 unsigned int i;
362
363 TRACE("texture %p, sub_resource_idx %u, context %p, src_location %s, dst_location %s.\n",
364 texture, sub_resource_idx, context, wined3d_debug_location(src_location), wined3d_debug_location(dst_location));
365
366 /* dst_location was already prepared by the caller. */
367 wined3d_texture_get_bo_address(texture, sub_resource_idx, &data, dst_location);
368 offset = data.addr;
369
370 restore_texture = context->current_rt.texture;
371 restore_idx = context->current_rt.sub_resource_idx;
372 if (!wined3d_resource_is_offscreen(resource) && (restore_texture != texture || restore_idx != sub_resource_idx))
373 {
374 context = context_acquire(device, texture, sub_resource_idx);
375 restore_context = true;
376 }
377 context_gl = wined3d_context_gl(context);
378 gl_info = context_gl->gl_info;
379
380 if (resource->format->depth_size || resource->format->stencil_size)
382 NULL, 0, resource, sub_resource_idx, src_location);
383 else
385 resource, sub_resource_idx, NULL, 0, src_location);
386
387 /* Select the correct read buffer, and give some debug output. There is no
388 * need to keep track of the current read buffer or reset it, every part
389 * of the code that reads pixels sets the read buffer as desired. */
391 {
392 /* Mapping the primary render target which is not on a swapchain.
393 * Read from the back buffer. */
394 TRACE("Mapping offscreen render target.\n");
395 gl_info->gl_ops.gl.p_glReadBuffer(wined3d_context_gl_get_offscreen_gl_buffer(context_gl));
396 src_is_upside_down = TRUE;
397 }
398 else
399 {
400 /* Onscreen surfaces are always part of a swapchain */
402 TRACE("Mapping %#x buffer.\n", buffer);
403 gl_info->gl_ops.gl.p_glReadBuffer(buffer);
404 src_is_upside_down = FALSE;
405 }
406 checkGLcall("glReadBuffer");
408
409 if (data.buffer_object)
410 {
411 GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, wined3d_bo_gl(data.buffer_object)->id));
412 checkGLcall("glBindBuffer");
413 offset += data.buffer_object->buffer_offset;
414 }
415 else
416 {
417 GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
418 checkGLcall("glBindBuffer");
419 }
420
421 level = sub_resource_idx % texture->level_count;
422 wined3d_texture_get_pitch(texture, level, &row_pitch, &slice_pitch);
423 format_gl = wined3d_format_gl(resource->format);
424
425 /* Setup pixel store pack state -- to glReadPixels into the correct place */
426 gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, row_pitch / format_gl->f.byte_count);
427 checkGLcall("glPixelStorei");
428
431 gl_info->gl_ops.gl.p_glReadPixels(0, 0, width, height,
432 format_gl->format, format_gl->type, offset);
433 checkGLcall("glReadPixels");
434
435 /* Reset previous pixel store pack state */
436 gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ROW_LENGTH, 0);
437 checkGLcall("glPixelStorei");
438
439 if (!src_is_upside_down)
440 {
441 /* glReadPixels returns the image upside down, and there is no way to
442 * prevent this. Flip the lines in software. */
443
444 if (!(row = malloc(row_pitch)))
445 goto error;
446
447 if (data.buffer_object)
448 {
450 checkGLcall("glMapBuffer");
451 }
452 mem += (uintptr_t)offset;
453
454 top = mem;
455 bottom = mem + row_pitch * (height - 1);
456 for (i = 0; i < height / 2; i++)
457 {
458 memcpy(row, top, row_pitch);
459 memcpy(top, bottom, row_pitch);
460 memcpy(bottom, row, row_pitch);
461 top += row_pitch;
462 bottom -= row_pitch;
463 }
464 free(row);
465
466 if (data.buffer_object)
467 GL_EXTCALL(glUnmapBuffer(GL_PIXEL_PACK_BUFFER));
468 }
469
470error:
471 if (data.buffer_object)
472 {
473 GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
474 wined3d_context_gl_reference_bo(context_gl, wined3d_bo_gl(data.buffer_object));
475 checkGLcall("glBindBuffer");
476 }
477
478 if (restore_context)
479 context_restore(context, restore_texture, restore_idx);
480}
void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl *context_gl, GLenum target)
Definition: context_gl.c:419
void wined3d_context_gl_apply_fbo_state_explicit(struct wined3d_context_gl *context_gl, GLenum target, struct wined3d_resource *rt, unsigned int rt_sub_resource_idx, struct wined3d_resource *ds, unsigned int ds_sub_resource_idx, uint32_t location)
Definition: context_gl.c:852
GLenum wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_gl *context_gl)
Definition: context_gl.c:3139
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:55
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
Definition: texture.c:113
unsigned int uintptr_t
Definition: corecrt.h:185
unsigned char uint8_t
Definition: stdint.h:33
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
#define GL_PACK_ROW_LENGTH
Definition: gl.h:628
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
unsigned int GLenum
Definition: gl.h:150
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint buffer
Definition: glext.h:5915
GLintptr offset
Definition: glext.h:5920
#define GL_PIXEL_PACK_BUFFER
Definition: glext.h:476
#define GL_READ_WRITE
Definition: glext.h:343
#define GL_READ_FRAMEBUFFER
Definition: glext.h:1698
Definition: mem.c:349
const struct wined3d_gl_info * gl_info
Definition: wined3d_gl.h:603
struct wined3d_format f
Definition: wined3d_gl.h:1142
struct opengl_funcs gl_ops
Definition: wined3d_gl.h:353
static void wined3d_context_gl_reference_bo(struct wined3d_context_gl *context_gl, struct wined3d_bo_gl *bo_gl)
Definition: wined3d_gl.h:912
#define GL_EXTCALL(f)
Definition: wined3d_gl.h:360
#define checkGLcall(A)
Definition: wined3d_gl.h:402
#define WINED3D_LOCATION_DRAWABLE

Referenced by wined3d_texture_gl_load_sysmem().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( d3d_perf  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d  )

◆ wined3d_box_intersect()

static bool wined3d_box_intersect ( struct wined3d_box *  ret,
const struct wined3d_box *  b1,
const struct wined3d_box *  b2 
)
static

Definition at line 1189 of file surface.c.

1191{
1192 wined3d_box_set(ret, max(b1->left, b2->left), max(b1->top, b2->top),
1193 min(b1->right, b2->right), min(b1->bottom, b2->bottom),
1194 max(b1->front, b2->front), min(b1->back, b2->back));
1195 return ret->right > ret->left && ret->bottom > ret->top && ret->back > ret->front;
1196}
return ret
Definition: mutex.c:147
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:529
static void wined3d_box_set(struct wined3d_box *box, unsigned int left, unsigned int top, unsigned int right, unsigned int bottom, unsigned int front, unsigned int back)
Definition: wined3d.h:3006

Referenced by cpu_blitter_clear().

◆ wined3d_cpu_blitter_create()

struct wined3d_blitter * wined3d_cpu_blitter_create ( void  )

Definition at line 1300 of file surface.c.

1301{
1302 struct wined3d_blitter *blitter;
1303
1304 if (!(blitter = malloc(sizeof(*blitter))))
1305 return NULL;
1306
1307 TRACE("Created blitter %p.\n", blitter);
1308
1309 blitter->ops = &cpu_blitter_ops;
1310 blitter->next = NULL;
1311
1312 return blitter;
1313}
static const struct wined3d_blitter_ops cpu_blitter_ops
Definition: surface.c:1293
const struct wined3d_blitter_ops * ops

Referenced by adapter_no3d_init_3d(), adapter_vk_init_3d(), and wined3d_device_gl_create_primary_opengl_context_cs().

◆ wined3d_is_colour_blit()

static bool wined3d_is_colour_blit ( enum wined3d_blit_op  blit_op)
static

Definition at line 1315 of file surface.c.

1316{
1317 switch (blit_op)
1318 {
1322 return true;
1323
1324 default:
1325 return false;
1326 }
1327}

Referenced by texture2d_blt().

Variable Documentation

◆ converters

const struct d3dfmt_converter_desc converters[]
static
Initial value:
=
{
}
static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:171
static void convert_r5g6b5_x8r8g8b8(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:63
static void convert_yuy2_x8r8g8b8(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:129
static void convert_a8r8g8b8_x8r8g8b8(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:105
static void convert_r32_float_r16_float(const BYTE *src, BYTE *dst, unsigned int pitch_in, unsigned int pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:43
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:245
@ WINED3DFMT_R16_FLOAT
Definition: wined3d.h:211
@ WINED3DFMT_R32_FLOAT
Definition: wined3d.h:198
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:242
@ WINED3DFMT_YUY2
Definition: wined3d.h:258

Definition at line 220 of file surface.c.

Referenced by find_converter().

◆ cpu_blitter_ops

const struct wined3d_blitter_ops cpu_blitter_ops
static
Initial value:
=
{
}
static DWORD cpu_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_op op, struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, DWORD src_location, const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect, const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter, const struct wined3d_format *resolve_format)
Definition: surface.c:1251
static void cpu_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device, unsigned int rt_count, const struct wined3d_fb_state *fb, unsigned int rect_count, const RECT *clear_rects, const RECT *draw_rect, uint32_t flags, const struct wined3d_color *colour, float depth, unsigned int stencil)
Definition: surface.c:1198
static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
Definition: surface.c:483

Definition at line 1293 of file surface.c.

Referenced by wined3d_cpu_blitter_create().