ReactOS  0.4.13-dev-241-g63286c6
surface.c File Reference
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.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, DWORD *masks)
 
static BOOL texture2d_is_full_rect (const struct wined3d_texture *texture, unsigned int level, const RECT *r)
 
static void texture2d_depth_blt_fbo (const struct wined3d_device *device, 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)
 
static BOOL is_multisample_location (const struct wined3d_texture *texture, DWORD location)
 
static void texture2d_blt_fbo (const struct wined3d_device *device, struct wined3d_context *context, enum wined3d_texture_filter_type filter, 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)
 
static BOOL fbo_blitter_supported (enum wined3d_blit_op blit_op, const struct wined3d_gl_info *gl_info, const struct wined3d_resource *src_resource, DWORD src_location, const struct wined3d_resource *dst_resource, DWORD dst_location)
 
static void texture2d_download_data (struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, DWORD dst_location)
 
static unsigned short float_32_to_16 (const float *in)
 
static void convert_r32_float_r16_float (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_r5g6b5_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_a8r8g8b8_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static BYTE cliptobyte (int x)
 
static void convert_yuy2_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_yuy2_r5g6b5 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_a8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_a4r4g4b4 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_x4r4g4b4 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_a1r5g5b5 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt1_x1r5g5b5 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt3_a8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt3_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt3_a4r4g4b4 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt3_x4r4g4b4 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt5_a8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_dxt5_x8r8g8b8 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_a8r8g8b8_dxt1 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_x8r8g8b8_dxt1 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_a1r5g5b5_dxt1 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_x1r5g5b5_dxt1 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_a8r8g8b8_dxt3 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_x8r8g8b8_dxt3 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_a8r8g8b8_dxt5 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static void convert_x8r8g8b8_dxt5 (const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
 
static const struct d3dfmt_converter_descfind_converter (enum wined3d_format_id from, enum wined3d_format_id to)
 
static struct wined3d_texturesurface_convert_format (struct wined3d_texture *src_texture, unsigned int sub_resource_idx, const struct wined3d_format *dst_format)
 
static void texture2d_read_from_framebuffer (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD src_location, DWORD dst_location)
 
void texture2d_load_fb_texture (struct wined3d_texture *texture, unsigned int sub_resource_idx, BOOL srgb, struct wined3d_context *context)
 
static void fb_copy_to_texture_direct (struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect_in, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, enum wined3d_texture_filter_type filter)
 
static void fb_copy_to_texture_hwstretch (struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect_in, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, enum wined3d_texture_filter_type filter)
 
static HRESULT wined3d_texture_blt_special (struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 
BOOL texture2d_load_sysmem (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD dst_location)
 
BOOL texture2d_load_drawable (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context)
 
BOOL texture2d_load_texture (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, BOOL srgb)
 
BOOL texture2d_load_renderbuffer (struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD dst_location)
 
static void fbo_blitter_destroy (struct wined3d_blitter *blitter, struct wined3d_context *context)
 
static void fbo_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, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
 
static DWORD fbo_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 *colour_key, enum wined3d_texture_filter_type filter)
 
void wined3d_fbo_blitter_create (struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
 
static void raw_blitter_destroy (struct wined3d_blitter *blitter, struct wined3d_context *context)
 
static void raw_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, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
 
static DWORD raw_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 *colour_key, enum wined3d_texture_filter_type filter)
 
void wined3d_raw_blitter_create (struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
 
static void ffp_blitter_destroy (struct wined3d_blitter *blitter, struct wined3d_context *context)
 
static BOOL ffp_blit_supported (enum wined3d_blit_op blit_op, const struct wined3d_context *context, const struct wined3d_resource *src_resource, DWORD src_location, const struct wined3d_resource *dst_resource, DWORD dst_location)
 
static BOOL ffp_blitter_use_cpu_clear (struct wined3d_rendertarget_view *view)
 
static void ffp_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, DWORD flags, const struct wined3d_color *colour, float depth, DWORD stencil)
 
static DWORD ffp_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)
 
void wined3d_ffp_blitter_create (struct wined3d_blitter **next, const struct wined3d_gl_info *gl_info)
 
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, DWORD 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, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 
static void surface_cpu_blt_colour_fill (struct wined3d_rendertarget_view *view, const struct wined3d_box *box, const struct wined3d_color *colour)
 
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, DWORD flags, const struct wined3d_color *colour, float depth, DWORD 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)
 
struct wined3d_blitterwined3d_cpu_blitter_create (void)
 
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, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
 

Variables

static const DWORD surface_simple_locations
 
static const struct d3dfmt_converter_desc converters []
 
static const struct d3dfmt_converter_desc dxtn_converters []
 
static const struct wined3d_blitter_ops fbo_blitter_ops
 
static const struct wined3d_blitter_ops raw_blitter_ops
 
static const struct wined3d_blitter_ops ffp_blitter_ops
 
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)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define d
Definition: ke_i.h:81
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97

◆ 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)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define d
Definition: ke_i.h:81
GLdouble s
Definition: gl.h:2039

Function Documentation

◆ cliptobyte()

static BYTE cliptobyte ( int  x)
inlinestatic

Definition at line 715 of file surface.c.

716 {
717  return (BYTE)((x < 0) ? 0 : ((x > 255) ? 255 : x));
718 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned char BYTE
Definition: mem.h:68

Referenced by convert_yuy2_r5g6b5(), and convert_yuy2_x8r8g8b8().

◆ convert_a1r5g5b5_dxt1()

static void convert_a1r5g5b5_dxt1 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 887 of file surface.c.

889 {
890  wined3d_dxt1_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5A1_UNORM, w, h);
891 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:389
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_a8r8g8b8_dxt1()

static void convert_a8r8g8b8_dxt1 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 875 of file surface.c.

877 {
878  wined3d_dxt1_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
879 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:389
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_a8r8g8b8_dxt3()

static void convert_a8r8g8b8_dxt3 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 899 of file surface.c.

901 {
902  wined3d_dxt3_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
903 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:417
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_a8r8g8b8_dxt5()

static void convert_a8r8g8b8_dxt5 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 911 of file surface.c.

913 {
914  wined3d_dxt5_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
915 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:439
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_a8r8g8b8_x8r8g8b8()

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

Definition at line 696 of file surface.c.

698 {
699  unsigned int x, y;
700 
701  TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
702 
703  for (y = 0; y < h; ++y)
704  {
705  const DWORD *src_line = (const DWORD *)(src + y * pitch_in);
706  DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
707 
708  for (x = 0; x < w; ++x)
709  {
710  dst_line[x] = 0xff000000 | (src_line[x] & 0xffffff);
711  }
712  }
713 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ convert_dxt1_a1r5g5b5()

static void convert_dxt1_a1r5g5b5 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 827 of file surface.c.

829 {
830  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5A1_UNORM, w, h);
831 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt1_a4r4g4b4()

static void convert_dxt1_a4r4g4b4 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 815 of file surface.c.

817 {
818  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4A4_UNORM, w, h);
819 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt1_a8r8g8b8()

static void convert_dxt1_a8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 803 of file surface.c.

805 {
806  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
807 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt1_x1r5g5b5()

static void convert_dxt1_x1r5g5b5 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 833 of file surface.c.

835 {
836  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5X1_UNORM, w, h);
837 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt1_x4r4g4b4()

static void convert_dxt1_x4r4g4b4 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 821 of file surface.c.

823 {
824  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4X4_UNORM, w, h);
825 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt1_x8r8g8b8()

static void convert_dxt1_x8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 809 of file surface.c.

811 {
812  wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
813 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:317
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt3_a4r4g4b4()

static void convert_dxt3_a4r4g4b4 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 851 of file surface.c.

853 {
854  wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4A4_UNORM, w, h);
855 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:345
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt3_a8r8g8b8()

static void convert_dxt3_a8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 839 of file surface.c.

841 {
842  wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
843 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:345
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt3_x4r4g4b4()

static void convert_dxt3_x4r4g4b4 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 857 of file surface.c.

859 {
860  wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B4G4R4X4_UNORM, w, h);
861 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:345
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt3_x8r8g8b8()

static void convert_dxt3_x8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 845 of file surface.c.

847 {
848  wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
849 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:345
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_dxt5_a8r8g8b8()

static void convert_dxt5_a8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 863 of file surface.c.

865 {
866  wined3d_dxt5_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8A8_UNORM, w, h);
867 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:369

◆ convert_dxt5_x8r8g8b8()

static void convert_dxt5_x8r8g8b8 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 869 of file surface.c.

871 {
872  wined3d_dxt5_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
873 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:369

◆ convert_r32_float_r16_float()

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

Definition at line 634 of file surface.c.

636 {
637  unsigned short *dst_s;
638  const float *src_f;
639  unsigned int x, y;
640 
641  TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
642 
643  for (y = 0; y < h; ++y)
644  {
645  src_f = (const float *)(src + y * pitch_in);
646  dst_s = (unsigned short *) (dst + y * pitch_out);
647  for (x = 0; x < w; ++x)
648  {
649  dst_s[x] = float_32_to_16(src_f + x);
650  }
651  }
652 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static unsigned short float_32_to_16(const float *in)
Definition: surface.c:572

◆ convert_r5g6b5_x8r8g8b8()

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

Definition at line 654 of file surface.c.

656 {
657  static const unsigned char convert_5to8[] =
658  {
659  0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a,
660  0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b,
661  0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd,
662  0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff,
663  };
664  static const unsigned char convert_6to8[] =
665  {
666  0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c,
667  0x20, 0x24, 0x28, 0x2d, 0x31, 0x35, 0x39, 0x3d,
668  0x41, 0x45, 0x49, 0x4d, 0x51, 0x55, 0x59, 0x5d,
669  0x61, 0x65, 0x69, 0x6d, 0x71, 0x75, 0x79, 0x7d,
670  0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e,
671  0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe,
672  0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd7, 0xdb, 0xdf,
673  0xe3, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff,
674  };
675  unsigned int x, y;
676 
677  TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
678 
679  for (y = 0; y < h; ++y)
680  {
681  const WORD *src_line = (const WORD *)(src + y * pitch_in);
682  DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
683  for (x = 0; x < w; ++x)
684  {
685  WORD pixel = src_line[x];
686  dst_line[x] = 0xff000000u
687  | convert_5to8[(pixel & 0xf800u) >> 11] << 16
688  | convert_6to8[(pixel & 0x07e0u) >> 5] << 8
689  | convert_5to8[(pixel & 0x001fu)];
690  }
691  }
692 }
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
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define TRACE(s)
Definition: solgame.cpp:4
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ convert_x1r5g5b5_dxt1()

static void convert_x1r5g5b5_dxt1 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 893 of file surface.c.

895 {
896  wined3d_dxt1_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B5G5R5X1_UNORM, w, h);
897 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:389
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_x8r8g8b8_dxt1()

static void convert_x8r8g8b8_dxt1 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 881 of file surface.c.

883 {
884  wined3d_dxt1_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
885 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:389
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_x8r8g8b8_dxt3()

static void convert_x8r8g8b8_dxt3 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 905 of file surface.c.

907 {
908  wined3d_dxt3_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
909 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:417
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_x8r8g8b8_dxt5()

static void convert_x8r8g8b8_dxt5 ( const BYTE src,
BYTE dst,
DWORD  pitch_in,
DWORD  pitch_out,
unsigned int  w,
unsigned int  h 
)
static

Definition at line 917 of file surface.c.

919 {
920  wined3d_dxt5_encode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
921 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h)
Definition: dxtn.c:439
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ convert_yuy2_r5g6b5()

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

Definition at line 762 of file surface.c.

764 {
765  unsigned int x, y;
766  int c2, d, e, r2 = 0, g2 = 0, b2 = 0;
767 
768  TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out);
769 
770  for (y = 0; y < h; ++y)
771  {
772  const BYTE *src_line = src + y * pitch_in;
773  WORD *dst_line = (WORD *)(dst + y * pitch_out);
774  for (x = 0; x < w; ++x)
775  {
776  /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV:
777  * C = Y - 16; D = U - 128; E = V - 128;
778  * R = cliptobyte((298 * C + 409 * E + 128) >> 8);
779  * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8);
780  * B = cliptobyte((298 * C + 516 * D + 128) >> 8);
781  * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V .
782  * U and V are shared between the pixels. */
783  if (!(x & 1)) /* For every even pixel, read new U and V. */
784  {
785  d = (int) src_line[1] - 128;
786  e = (int) src_line[3] - 128;
787  r2 = 409 * e + 128;
788  g2 = - 100 * d - 208 * e + 128;
789  b2 = 516 * d + 128;
790  }
791  c2 = 298 * ((int) src_line[0] - 16);
792  dst_line[x] = (cliptobyte((c2 + r2) >> 8) >> 3) << 11 /* red */
793  | (cliptobyte((c2 + g2) >> 8) >> 2) << 5 /* green */
794  | (cliptobyte((c2 + b2) >> 8) >> 3); /* blue */
795  /* Scale RGB values to 0..255 range,
796  * then clip them if still not in range (may be negative),
797  * then shift them within DWORD if necessary. */
798  src_line += 2;
799  }
800  }
801 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define e
Definition: ke_i.h:82
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
static DNS_RECORDW r2
Definition: record.c:38
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static BYTE cliptobyte(int x)
Definition: surface.c:715
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ convert_yuy2_x8r8g8b8()

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

Definition at line 720 of file surface.c.

722 {
723  int c2, d, e, r2 = 0, g2 = 0, b2 = 0;
724  unsigned int x, y;
725 
726  TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
727 
728  for (y = 0; y < h; ++y)
729  {
730  const BYTE *src_line = src + y * pitch_in;
731  DWORD *dst_line = (DWORD *)(dst + y * pitch_out);
732  for (x = 0; x < w; ++x)
733  {
734  /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV:
735  * C = Y - 16; D = U - 128; E = V - 128;
736  * R = cliptobyte((298 * C + 409 * E + 128) >> 8);
737  * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8);
738  * B = cliptobyte((298 * C + 516 * D + 128) >> 8);
739  * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V .
740  * U and V are shared between the pixels. */
741  if (!(x & 1)) /* For every even pixel, read new U and V. */
742  {
743  d = (int) src_line[1] - 128;
744  e = (int) src_line[3] - 128;
745  r2 = 409 * e + 128;
746  g2 = - 100 * d - 208 * e + 128;
747  b2 = 516 * d + 128;
748  }
749  c2 = 298 * ((int) src_line[0] - 16);
750  dst_line[x] = 0xff000000
751  | cliptobyte((c2 + r2) >> 8) << 16 /* red */
752  | cliptobyte((c2 + g2) >> 8) << 8 /* green */
753  | cliptobyte((c2 + b2) >> 8); /* blue */
754  /* Scale RGB values to 0..255 range,
755  * then clip them if still not in range (may be negative),
756  * then shift them within DWORD if necessary. */
757  src_line += 2;
758  }
759  }
760 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define e
Definition: ke_i.h:82
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
static DNS_RECORDW r2
Definition: record.c:38
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static BYTE cliptobyte(int x)
Definition: surface.c:715
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ 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 
)
static

Definition at line 3404 of file surface.c.

3409 {
3410  struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, 0, 1};
3411  struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
3412  struct wined3d_blt_fx fx;
3413  DWORD flags = 0;
3414 
3415  memset(&fx, 0, sizeof(fx));
3416  switch (op)
3417  {
3421  break;
3424  break;
3427  fx.src_color_key = *color_key;
3428  break;
3429  default:
3430  FIXME("Unhandled op %#x.\n", op);
3431  break;
3432  }
3433 
3434  if (FAILED(surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
3435  src_texture, src_sub_resource_idx, &src_box, flags, &fx, filter)))
3436  ERR("Failed to blit.\n");
3437  wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location);
3438 
3439  return dst_location | (dst_texture->sub_resources[dst_sub_resource_idx].locations
3440  & dst_texture->resource.map_binding);
3441 }
#define WINED3D_BLT_SRC_CKEY_OVERRIDE
Definition: wined3d.h:1363
Definition: http.c:6587
LONG top
Definition: windef.h:292
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, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
Definition: surface.c:2768
struct wined3d_resource resource
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define FIXME(fmt,...)
Definition: debug.h:110
#define WINED3D_BLT_FX
Definition: wined3d.h:1359
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define WINED3D_BLT_ALPHA_TEST
Definition: wined3d.h:1368
GLfixed fx
Definition: tritemp.h:482
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define ERR(fmt,...)
Definition: debug.h:109
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:380
LONG bottom
Definition: windef.h:294
UINT op
Definition: effect.c:223
#define memset(x, y, z)
Definition: compat.h:39
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ 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,
DWORD  flags,
const struct wined3d_color colour,
float  depth,
DWORD  stencil 
)
static

Definition at line 3357 of file surface.c.

3360 {
3361  struct wined3d_color c = {depth, 0.0f, 0.0f, 0.0f};
3363  struct wined3d_box box;
3364  unsigned int i, j;
3365 
3366  if (!rect_count)
3367  {
3368  rect_count = 1;
3369  clear_rects = draw_rect;
3370  }
3371 
3372  for (i = 0; i < rect_count; ++i)
3373  {
3374  box.left = max(clear_rects[i].left, draw_rect->left);
3375  box.top = max(clear_rects[i].top, draw_rect->top);
3376  box.right = min(clear_rects[i].right, draw_rect->right);
3377  box.bottom = min(clear_rects[i].bottom, draw_rect->bottom);
3378  box.front = 0;
3379  box.back = 1;
3380 
3381  if (box.left >= box.right || box.top >= box.bottom)
3382  continue;
3383 
3384  if (flags & WINED3DCLEAR_TARGET)
3385  {
3386  for (j = 0; j < rt_count; ++j)
3387  {
3388  if ((view = fb->render_targets[j]))
3390  }
3391  }
3392 
3394  {
3395  if ((view->format->depth_size && !(flags & WINED3DCLEAR_ZBUFFER))
3396  || (view->format->stencil_size && !(flags & WINED3DCLEAR_STENCIL)))
3397  FIXME("Clearing %#x on %s.\n", flags, debug_d3dformat(view->format->id));
3398 
3400  }
3401  }
3402 }
#define max(a, b)
Definition: svc.c:63
struct wined3d_rendertarget_view * render_targets[MAX_RENDER_TARGET_VIEWS]
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1001
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1000
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
static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view, const struct wined3d_box *box, const struct wined3d_color *colour)
Definition: surface.c:3251
#define FIXME(fmt,...)
Definition: debug.h:110
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 GLint GLint j
Definition: glfuncs.h:250
const GLubyte * c
Definition: glext.h:8905
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:999
struct wined3d_rendertarget_view * depth_stencil
#define min(a, b)
Definition: monoChain.cc:55
static IOleDocumentView * view
Definition: activex.c:1749
LONG bottom
Definition: windef.h:294
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3922
Definition: palette.c:467

◆ cpu_blitter_destroy()

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

Definition at line 2655 of file surface.c.

2656 {
2657  struct wined3d_blitter *next;
2658 
2659  if ((next = blitter->next))
2660  next->ops->blitter_destroy(next, context);
2661 
2662  heap_free(blitter);
2663 }
Definition: http.c:6587
struct wined3d_blitter * next
static unsigned __int64 next
Definition: rand_nt.c:6
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ fb_copy_to_texture_direct()

static void fb_copy_to_texture_direct ( struct wined3d_texture dst_texture,
unsigned int  dst_sub_resource_idx,
const RECT dst_rect_in,
struct wined3d_texture src_texture,
unsigned int  src_sub_resource_idx,
const RECT src_rect,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 1258 of file surface.c.

1261 {
1262  struct wined3d_device *device = dst_texture->resource.device;
1263  unsigned int src_height, src_level, dst_level;
1264  const struct wined3d_gl_info *gl_info;
1265  float xrel, yrel;
1266  struct wined3d_context *context;
1267  BOOL upsidedown = FALSE;
1268  RECT dst_rect = *dst_rect_in;
1269  GLenum dst_target;
1270 
1271  /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
1272  * glCopyTexSubImage is a bit picky about the parameters we pass to it
1273  */
1274  if(dst_rect.top > dst_rect.bottom) {
1275  UINT tmp = dst_rect.bottom;
1276  dst_rect.bottom = dst_rect.top;
1277  dst_rect.top = tmp;
1278  upsidedown = TRUE;
1279  }
1280 
1281  context = context_acquire(device, src_texture, src_sub_resource_idx);
1282  gl_info = context->gl_info;
1284  wined3d_texture_load(dst_texture, context, FALSE);
1285 
1286  /* Bind the target texture */
1287  context_bind_texture(context, dst_texture->target, dst_texture->texture_rgb.name);
1288  if (wined3d_resource_is_offscreen(&src_texture->resource))
1289  {
1290  TRACE("Reading from an offscreen target\n");
1291  upsidedown = !upsidedown;
1292  gl_info->gl_ops.gl.p_glReadBuffer(context_get_offscreen_gl_buffer(context));
1293  }
1294  else
1295  {
1296  gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(src_texture));
1297  }
1298  checkGLcall("glReadBuffer");
1299 
1300  xrel = (float) (src_rect->right - src_rect->left) / (float) (dst_rect.right - dst_rect.left);
1301  yrel = (float) (src_rect->bottom - src_rect->top) / (float) (dst_rect.bottom - dst_rect.top);
1302 
1303  if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
1304  {
1305  FIXME_(d3d_perf)("Doing a pixel by pixel copy from the framebuffer to a texture.\n");
1306 
1308  ERR("Texture filtering not supported in direct blit.\n");
1309  }
1311  && ((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)))
1312  {
1313  ERR("Texture filtering not supported in direct blit\n");
1314  }
1315 
1316  src_level = src_sub_resource_idx % src_texture->level_count;
1317  dst_level = dst_sub_resource_idx % dst_texture->level_count;
1318 
1319  src_height = wined3d_texture_get_level_height(src_texture, src_level);
1320  dst_target = wined3d_texture_get_sub_resource_target(dst_texture, dst_sub_resource_idx);
1321  if (upsidedown
1322  && !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
1323  && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)))
1324  {
1325  /* Upside down copy without stretching is nice, one glCopyTexSubImage call will do. */
1326  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level,
1327  dst_rect.left /*xoffset */, dst_rect.top /* y offset */,
1328  src_rect->left, src_height - src_rect->bottom,
1329  dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top);
1330  }
1331  else
1332  {
1333  LONG row;
1334  UINT yoffset = src_height - src_rect->top + dst_rect.top - 1;
1335  /* I have to process this row by row to swap the image,
1336  * otherwise it would be upside down, so stretching in y direction
1337  * doesn't cost extra time
1338  *
1339  * However, stretching in x direction can be avoided if not necessary
1340  */
1341  for(row = dst_rect.top; row < dst_rect.bottom; row++) {
1342  if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
1343  {
1344  /* Well, that stuff works, but it's very slow.
1345  * find a better way instead
1346  */
1347  LONG col;
1348 
1349  for (col = dst_rect.left; col < dst_rect.right; ++col)
1350  {
1351  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level,
1352  dst_rect.left + col /* x offset */, row /* y offset */,
1353  src_rect->left + col * xrel, yoffset - (int) (row * yrel), 1, 1);
1354  }
1355  }
1356  else
1357  {
1358  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level,
1359  dst_rect.left /* x offset */, row /* y offset */,
1360  src_rect->left, yoffset - (int) (row * yrel), dst_rect.right - dst_rect.left, 1);
1361  }
1362  }
1363  }
1364  checkGLcall("glCopyTexSubImage2D");
1365 
1367 
1368  /* The texture is now most up to date - If the surface is a render target
1369  * and has a drawable, this path is never entered. */
1370  wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
1371  wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
1372 }
static GLenum wined3d_texture_get_sub_resource_target(const struct wined3d_texture *texture, unsigned int sub_resource_idx)
void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device)
Definition: context.c:2748
#define TRUE
Definition: types.h:120
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
Definition: http.c:6587
GLenum context_get_offscreen_gl_buffer(const struct wined3d_context *context)
Definition: context.c:2721
LONG top
Definition: windef.h:292
struct wined3d_resource resource
LONG left
Definition: windef.h:291
void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name)
Definition: context.c:2503
LONG right
Definition: windef.h:293
GLint GLint GLint yoffset
Definition: gl.h:1547
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
#define FIXME_(x)
Definition: compat.h:67
#define eps
void context_release(struct wined3d_context *context)
Definition: context.c:1559
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:286
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
Definition: resource.c:540
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
Definition: texture.c:91
unsigned int GLenum
Definition: gl.h:150
#define ERR(fmt,...)
Definition: debug.h:109
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4218
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
#define WINED3D_LOCATION_TEXTURE_RGB
#define checkGLcall(A)
unsigned int UINT
Definition: ndis.h:50
void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1262
LONG bottom
Definition: windef.h:294
const struct wined3d_gl_info * gl_info
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
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

Referenced by wined3d_texture_blt_special().

◆ fb_copy_to_texture_hwstretch()

static void fb_copy_to_texture_hwstretch ( struct wined3d_texture dst_texture,
unsigned int  dst_sub_resource_idx,
const RECT dst_rect_in,
struct wined3d_texture src_texture,
unsigned int  src_sub_resource_idx,
const RECT src_rect,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 1375 of file surface.c.

1378 {
1379  unsigned int src_width, src_height, src_pow2_width, src_pow2_height, src_level;
1380  struct wined3d_device *device = dst_texture->resource.device;
1381  GLenum src_target, dst_target, texture_target;
1382  GLuint src, backup = 0;
1383  float left, right, top, bottom; /* Texture coordinates */
1384  const struct wined3d_gl_info *gl_info;
1385  struct wined3d_context *context;
1386  GLenum drawBuffer = GL_BACK;
1387  GLenum offscreen_buffer;
1388  BOOL noBackBufferBackup;
1389  BOOL src_offscreen;
1390  BOOL upsidedown = FALSE;
1391  RECT dst_rect = *dst_rect_in;
1392 
1393  TRACE("Using hwstretch blit\n");
1394 
1395  src_target = wined3d_texture_get_sub_resource_target(src_texture, src_sub_resource_idx);
1396  dst_target = wined3d_texture_get_sub_resource_target(dst_texture, dst_sub_resource_idx);
1397 
1398  /* Activate the Proper context for reading from the source surface, set it up for blitting */
1399  context = context_acquire(device, src_texture, src_sub_resource_idx);
1400  gl_info = context->gl_info;
1402  wined3d_texture_load(dst_texture, context, FALSE);
1403 
1404  offscreen_buffer = context_get_offscreen_gl_buffer(context);
1405  src_level = src_sub_resource_idx % src_texture->level_count;
1406  src_width = wined3d_texture_get_level_width(src_texture, src_level);
1407  src_height = wined3d_texture_get_level_height(src_texture, src_level);
1408  src_pow2_width = wined3d_texture_get_level_pow2_width(src_texture, src_level);
1409  src_pow2_height = wined3d_texture_get_level_pow2_height(src_texture, src_level);
1410 
1411  src_offscreen = wined3d_resource_is_offscreen(&src_texture->resource);
1412  noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO;
1413  if (!noBackBufferBackup && !src_texture->texture_rgb.name)
1414  {
1415  /* Get it a description */
1416  wined3d_texture_load(src_texture, context, FALSE);
1417  }
1418 
1419  /* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
1420  * This way we don't have to wait for the 2nd readback to finish to leave this function.
1421  */
1422  if (context->aux_buffers >= 2)
1423  {
1424  /* Got more than one aux buffer? Use the 2nd aux buffer */
1425  drawBuffer = GL_AUX1;
1426  }
1427  else if ((!src_offscreen || offscreen_buffer == GL_BACK) && context->aux_buffers >= 1)
1428  {
1429  /* Only one aux buffer, but it isn't used (Onscreen rendering, or non-aux orm)? Use it! */
1430  drawBuffer = GL_AUX0;
1431  }
1432 
1433  if (noBackBufferBackup)
1434  {
1435  gl_info->gl_ops.gl.p_glGenTextures(1, &backup);
1436  checkGLcall("glGenTextures");
1438  texture_target = GL_TEXTURE_2D;
1439  }
1440  else
1441  {
1442  /* Backup the back buffer and copy the source buffer into a texture to draw an upside down stretched quad. If
1443  * we are reading from the back buffer, the backup can be used as source texture
1444  */
1445  texture_target = src_target;
1446  context_bind_texture(context, texture_target, src_texture->texture_rgb.name);
1447  gl_info->gl_ops.gl.p_glEnable(texture_target);
1448  checkGLcall("glEnable(texture_target)");
1449 
1450  /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */
1451  src_texture->sub_resources[src_sub_resource_idx].locations &= ~WINED3D_LOCATION_TEXTURE_RGB;
1452  }
1453 
1454  /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
1455  * glCopyTexSubImage is a bit picky about the parameters we pass to it
1456  */
1457  if(dst_rect.top > dst_rect.bottom) {
1458  UINT tmp = dst_rect.bottom;
1459  dst_rect.bottom = dst_rect.top;
1460  dst_rect.top = tmp;
1461  upsidedown = TRUE;
1462  }
1463 
1464  if (src_offscreen)
1465  {
1466  TRACE("Reading from an offscreen target\n");
1467  upsidedown = !upsidedown;
1468  gl_info->gl_ops.gl.p_glReadBuffer(offscreen_buffer);
1469  }
1470  else
1471  {
1472  gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(src_texture));
1473  }
1474 
1475  /* TODO: Only back up the part that will be overwritten */
1476  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(texture_target, 0, 0, 0, 0, 0, src_width, src_height);
1477 
1478  checkGLcall("glCopyTexSubImage2D");
1479 
1480  /* No issue with overriding these - the sampler is dirty due to blit usage */
1481  gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, wined3d_gl_mag_filter(filter));
1482  checkGLcall("glTexParameteri");
1483  gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER,
1485  checkGLcall("glTexParameteri");
1486 
1487  if (!src_texture->swapchain || src_texture == src_texture->swapchain->back_buffers[0])
1488  {
1489  src = backup ? backup : src_texture->texture_rgb.name;
1490  }
1491  else
1492  {
1493  gl_info->gl_ops.gl.p_glReadBuffer(GL_FRONT);
1494  checkGLcall("glReadBuffer(GL_FRONT)");
1495 
1496  gl_info->gl_ops.gl.p_glGenTextures(1, &src);
1497  checkGLcall("glGenTextures(1, &src)");
1499 
1500  /* TODO: Only copy the part that will be read. Use src_rect->left,
1501  * src_rect->bottom as origin, but with the width watch out for power
1502  * of 2 sizes. */
1503  gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, src_pow2_width,
1504  src_pow2_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1505  checkGLcall("glTexImage2D");
1506  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, src_width, src_height);
1507 
1508  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1509  checkGLcall("glTexParameteri");
1510  gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1511  checkGLcall("glTexParameteri");
1512 
1513  gl_info->gl_ops.gl.p_glReadBuffer(GL_BACK);
1514  checkGLcall("glReadBuffer(GL_BACK)");
1515 
1516  if (texture_target != GL_TEXTURE_2D)
1517  {
1518  gl_info->gl_ops.gl.p_glDisable(texture_target);
1519  gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
1520  texture_target = GL_TEXTURE_2D;
1521  }
1522  }
1523  checkGLcall("glEnd and previous");
1524 
1525  left = src_rect->left;
1526  right = src_rect->right;
1527 
1528  if (!upsidedown)
1529  {
1530  top = src_height - src_rect->top;
1531  bottom = src_height - src_rect->bottom;
1532  }
1533  else
1534  {
1535  top = src_height - src_rect->bottom;
1536  bottom = src_height - src_rect->top;
1537  }
1538 
1539  if (src_texture->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
1540  {
1541  left /= src_pow2_width;
1542  right /= src_pow2_width;
1543  top /= src_pow2_height;
1544  bottom /= src_pow2_height;
1545  }
1546 
1547  /* draw the source texture stretched and upside down. The correct surface is bound already */
1548  gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1549  gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1550 
1551  context_set_draw_buffer(context, drawBuffer);
1552  gl_info->gl_ops.gl.p_glReadBuffer(drawBuffer);
1553 
1554  gl_info->gl_ops.gl.p_glBegin(GL_QUADS);
1555  /* bottom left */
1556  gl_info->gl_ops.gl.p_glTexCoord2f(left, bottom);
1557  gl_info->gl_ops.gl.p_glVertex2i(0, 0);
1558 
1559  /* top left */
1560  gl_info->gl_ops.gl.p_glTexCoord2f(left, top);
1561  gl_info->gl_ops.gl.p_glVertex2i(0, dst_rect.bottom - dst_rect.top);
1562 
1563  /* top right */
1564  gl_info->gl_ops.gl.p_glTexCoord2f(right, top);
1565  gl_info->gl_ops.gl.p_glVertex2i(dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top);
1566 
1567  /* bottom right */
1568  gl_info->gl_ops.gl.p_glTexCoord2f(right, bottom);
1569  gl_info->gl_ops.gl.p_glVertex2i(dst_rect.right - dst_rect.left, 0);
1570  gl_info->gl_ops.gl.p_glEnd();
1571  checkGLcall("glEnd and previous");
1572 
1573  if (texture_target != dst_target)
1574  {
1575  gl_info->gl_ops.gl.p_glDisable(texture_target);
1576  gl_info->gl_ops.gl.p_glEnable(dst_target);
1577  texture_target = dst_target;
1578  }
1579 
1580  /* Now read the stretched and upside down image into the destination texture */
1581  context_bind_texture(context, texture_target, dst_texture->texture_rgb.name);
1582  gl_info->gl_ops.gl.p_glCopyTexSubImage2D(texture_target,
1583  0,
1584  dst_rect.left, dst_rect.top, /* xoffset, yoffset */
1585  0, 0, /* We blitted the image to the origin */
1586  dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top);
1587  checkGLcall("glCopyTexSubImage2D");
1588 
1589  if (drawBuffer == GL_BACK)
1590  {
1591  /* Write the back buffer backup back. */
1592  if (backup)
1593  {
1594  if (texture_target != GL_TEXTURE_2D)
1595  {
1596  gl_info->gl_ops.gl.p_glDisable(texture_target);
1597  gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
1598  texture_target = GL_TEXTURE_2D;
1599  }
1601  }
1602  else
1603  {
1604  if (texture_target != src_target)
1605  {
1606  gl_info->gl_ops.gl.p_glDisable(texture_target);
1607  gl_info->gl_ops.gl.p_glEnable(src_target);
1608  texture_target = src_target;
1609  }
1610  context_bind_texture(context, src_target, src_texture->texture_rgb.name);
1611  }
1612 
1613  gl_info->gl_ops.gl.p_glBegin(GL_QUADS);
1614  /* top left */
1615  gl_info->gl_ops.gl.p_glTexCoord2f(0.0f, 0.0f);
1616  gl_info->gl_ops.gl.p_glVertex2i(0, src_height);
1617 
1618  /* bottom left */
1619  gl_info->gl_ops.gl.p_glTexCoord2f(0.0f, (float)src_height / (float)src_pow2_height);
1620  gl_info->gl_ops.gl.p_glVertex2i(0, 0);
1621 
1622  /* bottom right */
1623  gl_info->gl_ops.gl.p_glTexCoord2f((float)src_width / (float)src_pow2_width,
1624  (float)src_height / (float)src_pow2_height);
1625  gl_info->gl_ops.gl.p_glVertex2i(src_width, 0);
1626 
1627  /* top right */
1628  gl_info->gl_ops.gl.p_glTexCoord2f((float)src_width / (float)src_pow2_width, 0.0f);
1629  gl_info->gl_ops.gl.p_glVertex2i(src_width, src_height);
1630  gl_info->gl_ops.gl.p_glEnd();
1631  }
1632  gl_info->gl_ops.gl.p_glDisable(texture_target);
1633  checkGLcall("glDisable(texture_target)");
1634 
1635  /* Cleanup */
1636  if (src != src_texture->texture_rgb.name && src != backup)
1637  {
1638  gl_info->gl_ops.gl.p_glDeleteTextures(1, &src);
1639  checkGLcall("glDeleteTextures(1, &src)");
1640  }
1641  if (backup)
1642  {
1643  gl_info->gl_ops.gl.p_glDeleteTextures(1, &backup);
1644  checkGLcall("glDeleteTextures(1, &backup)");
1645  }
1646 
1648 
1649  /* The texture is now most up to date - If the surface is a render target
1650  * and has a drawable, this path is never entered. */
1651  wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
1652  wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
1653 }
#define ORM_FBO
static GLenum wined3d_texture_get_sub_resource_target(const struct wined3d_texture *texture, unsigned int sub_resource_idx)
#define GL_BACK
Definition: gl.h:271
static long backup()
Definition: maze.c:403
#define TRUE
Definition: types.h:120
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
#define GL_QUADS
Definition: gl.h:197
#define GL_CLAMP_TO_EDGE
Definition: gl.h:1481
Definition: http.c:6587
struct wined3d_swapchain * swapchain
GLenum context_get_offscreen_gl_buffer(const struct wined3d_context *context)
Definition: context.c:2721
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
#define GL_NEAREST
Definition: gl.h:678
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
LONG top
Definition: windef.h:292
struct wined3d_resource resource
LONG left
Definition: windef.h:291
void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name)
Definition: context.c:2503
LONG right
Definition: windef.h:293
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define GL_FRONT
Definition: gl.h:270
#define GL_AUX1
Definition: gl.h:476
static GLenum wined3d_gl_min_mip_filter(enum wined3d_texture_filter_type min_filter, enum wined3d_texture_filter_type mip_filter)
smooth NULL
Definition: ftsmooth.c:416
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
GLint GLint bottom
Definition: glext.h:7726
void context_release(struct wined3d_context *context)
Definition: context.c:1559
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:286
void context_apply_ffp_blit_state(struct wined3d_context *context, const struct wined3d_device *device)
Definition: context.c:2899
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
Definition: resource.c:540
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
Definition: texture.c:91
#define WINED3D_TEXTURE_NORMALIZED_COORDS
static unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture *texture, unsigned int level)
GLenum src
Definition: glext.h:6340
unsigned int GLenum
Definition: gl.h:150
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4218
unsigned int GLuint
Definition: gl.h:159
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
#define GL_AUX0
Definition: gl.h:475
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
#define WINED3D_LOCATION_TEXTURE_RGB
#define checkGLcall(A)
unsigned int UINT
Definition: ndis.h:50
void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1262
#define GL_TEXTURE_2D
Definition: gl.h:645
static GLenum wined3d_gl_mag_filter(enum wined3d_texture_filter_type mag_filter)
LONG bottom
Definition: windef.h:294
#define GL_RGBA
Definition: gl.h:503
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
const struct wined3d_gl_info * gl_info
void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
Definition: context.c:2470
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
static unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture *texture, unsigned int level)

Referenced by wined3d_texture_blt_special().

◆ fbo_blitter_blit()

static DWORD fbo_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 colour_key,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 2097 of file surface.c.

2102 {
2103  struct wined3d_resource *src_resource, *dst_resource;
2104  enum wined3d_blit_op blit_op = op;
2105  struct wined3d_device *device;
2106  struct wined3d_blitter *next;
2107 
2108  TRACE("blitter %p, op %#x, context %p, src_texture %p, src_sub_resource_idx %u, src_location %s, src_rect %s, "
2109  "dst_texture %p, dst_sub_resource_idx %u, dst_location %s, dst_rect %s, colour_key %p, filter %s.\n",
2110  blitter, op, context, src_texture, src_sub_resource_idx, wined3d_debug_location(src_location),
2111  wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
2112  wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
2113 
2114  src_resource = &src_texture->resource;
2115  dst_resource = &dst_texture->resource;
2116 
2117  device = dst_resource->device;
2118 
2119  if (blit_op == WINED3D_BLIT_OP_RAW_BLIT && dst_resource->format->id == src_resource->format->id)
2120  {
2122  blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
2123  else
2124  blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
2125  }
2126 
2127  if (!fbo_blitter_supported(blit_op, context->gl_info,
2128  src_resource, src_location, dst_resource, dst_location))
2129  {
2130  if (!(next = blitter->next))
2131  {
2132  ERR("No blitter to handle blit op %#x.\n", op);
2133  return dst_location;
2134  }
2135 
2136  TRACE("Forwarding to blitter %p.\n", next);
2137  return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
2138  src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
2139  }
2140 
2141  if (blit_op == WINED3D_BLIT_OP_COLOR_BLIT)
2142  {
2143  TRACE("Colour blit.\n");
2144  texture2d_blt_fbo(device, context, filter, src_texture, src_sub_resource_idx, src_location,
2145  src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
2146  return dst_location;
2147  }
2148 
2149  if (blit_op == WINED3D_BLIT_OP_DEPTH_BLIT)
2150  {
2151  TRACE("Depth/stencil blit.\n");
2152  texture2d_depth_blt_fbo(device, context, src_texture, src_sub_resource_idx, src_location,
2153  src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect);
2154  return dst_location;
2155  }
2156 
2157  ERR("This blitter does not implement blit op %#x.\n", blit_op);
2158  return dst_location;
2159 }
#define WINED3DFMT_FLAG_STENCIL
Definition: http.c:6587
struct wined3d_blitter * next
struct wined3d_resource resource
unsigned int format_flags
const struct wined3d_format * format
wined3d_blit_op
const char * wined3d_debug_location(DWORD location)
Definition: utils.c:6306
Definition: devices.h:37
static BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_gl_info *gl_info, const struct wined3d_resource *src_resource, DWORD src_location, const struct wined3d_resource *dst_resource, DWORD dst_location)
Definition: surface.c:293
struct wined3d_device * device
#define TRACE(s)
Definition: solgame.cpp:4
const char * debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type)
Definition: utils.c:4480
const char * wine_dbgstr_rect(const RECT *rect)
#define ERR(fmt,...)
Definition: debug.h:109
static unsigned __int64 next
Definition: rand_nt.c:6
static void texture2d_blt_fbo(const struct wined3d_device *device, struct wined3d_context *context, enum wined3d_texture_filter_type filter, 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)
Definition: surface.c:151
#define WINED3DFMT_FLAG_DEPTH
UINT op
Definition: effect.c:223
static void texture2d_depth_blt_fbo(const struct wined3d_device *device, 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)
Definition: surface.c:60
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ fbo_blitter_clear()

static void fbo_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,
DWORD  flags,
const struct wined3d_color colour,
float  depth,
DWORD  stencil 
)
static

Definition at line 2086 of file surface.c.

2089 {
2090  struct wined3d_blitter *next;
2091 
2092  if ((next = blitter->next))
2093  next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
2094  clear_rects, draw_rect, flags, colour, depth, stencil);
2095 }
struct wined3d_blitter * next
GLint GLfloat GLint stencil
Definition: glext.h:6260
Definition: devices.h:37
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static unsigned __int64 next
Definition: rand_nt.c:6

◆ fbo_blitter_destroy()

static void fbo_blitter_destroy ( struct wined3d_blitter blitter,
struct wined3d_context context 
)
static

Definition at line 2076 of file surface.c.

2077 {
2078  struct wined3d_blitter *next;
2079 
2080  if ((next = blitter->next))
2081  next->ops->blitter_destroy(next, context);
2082 
2083  heap_free(blitter);
2084 }
Definition: http.c:6587
struct wined3d_blitter * next
static unsigned __int64 next
Definition: rand_nt.c:6
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ fbo_blitter_supported()

static BOOL fbo_blitter_supported ( enum wined3d_blit_op  blit_op,
const struct wined3d_gl_info gl_info,
const struct wined3d_resource src_resource,
DWORD  src_location,
const struct wined3d_resource dst_resource,
DWORD  dst_location 
)
static

Definition at line 293 of file surface.c.

296 {
297  const struct wined3d_format *src_format = src_resource->format;
298  const struct wined3d_format *dst_format = dst_resource->format;
299 
300  if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
301  return FALSE;
302 
303  /* Source and/or destination need to be on the GL side */
304  if (!(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
305  return FALSE;
306 
307  if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
308  return FALSE;
309 
310  switch (blit_op)
311  {
314  || (src_resource->usage & WINED3DUSAGE_RENDERTARGET)))
315  return FALSE;
317  || (dst_resource->usage & WINED3DUSAGE_RENDERTARGET)))
318  return FALSE;
319  if ((src_format->id != dst_format->id || dst_location == WINED3D_LOCATION_DRAWABLE)
320  && (!is_identity_fixup(src_format->color_fixup) || !is_identity_fixup(dst_format->color_fixup)))
321  return FALSE;
322  break;
323 
326  return FALSE;
328  return FALSE;
329  /* Accept pure swizzle fixups for depth formats. In general we
330  * ignore the stencil component (if present) at the moment and the
331  * swizzle is not relevant with just the depth component. */
332  if (is_complex_fixup(src_format->color_fixup) || is_complex_fixup(dst_format->color_fixup)
333  || is_scaling_fixup(src_format->color_fixup) || is_scaling_fixup(dst_format->color_fixup))
334  return FALSE;
335  break;
336 
337  default:
338  return FALSE;
339  }
340 
341  return TRUE;
342 }
#define ORM_FBO
#define WINED3DFMT_FLAG_STENCIL
enum wined3d_resource_type type
#define TRUE
Definition: types.h:120
static const char * dst_format
Definition: dib.c:1133
unsigned int access
static BOOL is_complex_fixup(struct color_fixup_desc fixup)
const struct wined3d_format * format
struct color_fixup_desc color_fixup
#define WINED3D_LOCATION_DRAWABLE
static BOOL is_scaling_fixup(struct color_fixup_desc fixup)
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:908
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
#define WINED3DFMT_FLAG_FBO_ATTACHABLE
enum wined3d_format_id id
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT]
struct wined3d_fbo_ops fbo_ops
#define WINED3DFMT_FLAG_DEPTH

Referenced by fbo_blitter_blit(), and texture2d_load_texture().

◆ ffp_blit_supported()

static BOOL ffp_blit_supported ( enum wined3d_blit_op  blit_op,
const struct wined3d_context context,
const struct wined3d_resource src_resource,
DWORD  src_location,
const struct wined3d_resource dst_resource,
DWORD  dst_location 
)
static

Definition at line 2327 of file surface.c.

2330 {
2331  const struct wined3d_format *src_format = src_resource->format;
2332  const struct wined3d_format *dst_format = dst_resource->format;
2333  BOOL decompress;
2334 
2335  if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
2336  return FALSE;
2337 
2338  decompress = src_format && (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
2340  if (!decompress && !(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
2341  {
2342  TRACE("Source or destination resource is not GPU accessible.\n");
2343  return FALSE;
2344  }
2345 
2346  if (blit_op == WINED3D_BLIT_OP_RAW_BLIT && dst_format->id == src_format->id)
2347  {
2349  blit_op = WINED3D_BLIT_OP_DEPTH_BLIT;
2350  else
2351  blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
2352  }
2353 
2354  switch (blit_op)
2355  {
2357  if (context->d3d_info->shader_color_key)
2358  {
2359  TRACE("Color keying requires converted textures.\n");
2360  return FALSE;
2361  }
2364  if (!context->gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
2365  return FALSE;
2366 
2367  if (TRACE_ON(d3d))
2368  {
2369  TRACE("Checking support for fixup:\n");
2370  dump_color_fixup_desc(src_format->color_fixup);
2371  }
2372 
2373  /* We only support identity conversions. */
2374  if (!is_identity_fixup(src_format->color_fixup)
2375  || !is_identity_fixup(dst_format->color_fixup))
2376  {
2378  && dst_format->id == src_format->id && dst_location == WINED3D_LOCATION_DRAWABLE)
2379  {
2380  WARN("Claiming fixup support because of ORM_BACKBUFFER.\n");
2381  }
2382  else
2383  {
2384  TRACE("Fixups are not supported.\n");
2385  return FALSE;
2386  }
2387  }
2388 
2389  if (!(dst_resource->usage & WINED3DUSAGE_RENDERTARGET))
2390  {
2391  TRACE("Can only blit to render targets.\n");
2392  return FALSE;
2393  }
2394  return TRUE;
2395 
2396  default:
2397  TRACE("Unsupported blit operation %#x.\n", blit_op);
2398  return FALSE;
2399  }
2400 }
#define WINED3DFMT_FLAG_STENCIL
enum wined3d_resource_type type
#define TRUE
Definition: types.h:120
static const char * dst_format
Definition: dib.c:1133
Definition: http.c:6587
unsigned int access
#define WARN(fmt,...)
Definition: debug.h:111
const struct wined3d_format * format
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ORM_BACKBUFFER
struct color_fixup_desc color_fixup
#define WINED3D_LOCATION_DRAWABLE
#define TRACE(s)
Definition: solgame.cpp:4
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:908
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
enum wined3d_format_id id
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3DFMT_FLAG_COMPRESSED
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT]
#define WINED3DFMT_FLAG_DEPTH
void dump_color_fixup_desc(struct color_fixup_desc fixup)
Definition: utils.c:4792
#define TRACE_ON(x)
Definition: compat.h:65

Referenced by ffp_blitter_blit().

◆ ffp_blitter_blit()

static DWORD ffp_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 
)
static

Definition at line 2471 of file surface.c.

2476 {
2477  const struct wined3d_gl_info *gl_info = context->gl_info;
2478  struct wined3d_resource *src_resource, *dst_resource;
2479  struct wined3d_texture *staging_texture = NULL;
2480  struct wined3d_color_key old_blt_key;
2481  struct wined3d_device *device;
2482  struct wined3d_blitter *next;
2483  DWORD old_color_key_flags;
2484  RECT r;
2485 
2486  src_resource = &src_texture->resource;
2487  dst_resource = &dst_texture->resource;
2488  device = dst_resource->device;
2489 
2490  if (!ffp_blit_supported(op, context, src_resource, src_location, dst_resource, dst_location))
2491  {
2492  if ((next = blitter->next))
2493  return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
2494  src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, color_key, filter);
2495  }
2496 
2497  TRACE("Blt from texture %p, %u to rendertarget %p, %u.\n",
2498  src_texture, src_sub_resource_idx, dst_texture, dst_sub_resource_idx);
2499 
2500  old_blt_key = src_texture->async.src_blt_color_key;
2501  old_color_key_flags = src_texture->async.color_key_flags;
2503 
2504  if (!(src_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU))
2505  {
2506  struct wined3d_resource_desc desc;
2507  struct wined3d_box upload_box;
2508  unsigned int src_level;
2509  HRESULT hr;
2510 
2511  TRACE("Source texture is not GPU accessible, creating a staging texture.\n");
2512 
2513  src_level = src_sub_resource_idx % src_texture->level_count;
2514  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
2515  desc.format = src_texture->resource.format->id;
2516  desc.multisample_type = src_texture->resource.multisample_type;
2517  desc.multisample_quality = src_texture->resource.multisample_quality;
2518  desc.usage = WINED3DUSAGE_PRIVATE;
2520  desc.width = wined3d_texture_get_level_width(src_texture, src_level);
2521  desc.height = wined3d_texture_get_level_height(src_texture, src_level);
2522  desc.depth = 1;
2523  desc.size = 0;
2524 
2525  if (FAILED(hr = wined3d_texture_create(device, &desc, 1, 1, 0,
2526  NULL, NULL, &wined3d_null_parent_ops, &staging_texture)))
2527  {
2528  ERR("Failed to create staging texture, hr %#x.\n", hr);
2529  return dst_location;
2530  }
2531 
2532  wined3d_box_set(&upload_box, 0, 0, desc.width, desc.height, 0, desc.depth);
2533  wined3d_texture_upload_from_texture(staging_texture, 0, 0, 0, 0,
2534  src_texture, src_sub_resource_idx, &upload_box);
2535 
2536  src_texture = staging_texture;
2537  src_sub_resource_idx = 0;
2538  }
2539  else
2540  {
2541  /* Make sure the surface is up-to-date. This should probably use
2542  * surface_load_location() and worry about the destination surface
2543  * too, unless we're overwriting it completely. */
2544  wined3d_texture_load(src_texture, context, FALSE);
2545  }
2546 
2548 
2549  if (dst_location == WINED3D_LOCATION_DRAWABLE)
2550  {
2551  r = *dst_rect;
2552  wined3d_texture_translate_drawable_coords(dst_texture, context->win_handle, &r);
2553  dst_rect = &r;
2554  }
2555 
2557  {
2558  GLenum buffer;
2559 
2560  if (dst_location == WINED3D_LOCATION_DRAWABLE)
2561  {
2562  TRACE("Destination texture %p is onscreen.\n", dst_texture);
2563  buffer = wined3d_texture_get_gl_buffer(dst_texture);
2564  }
2565  else
2566  {
2567  TRACE("Destination texture %p is offscreen.\n", dst_texture);
2569  }
2571  dst_resource, dst_sub_resource_idx, NULL, 0, dst_location);
2575  }
2576 
2577  gl_info->gl_ops.gl.p_glEnable(src_texture->target);
2578  checkGLcall("glEnable(target)");
2579 
2581  {
2582  gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
2583  checkGLcall("glEnable(GL_ALPHA_TEST)");
2584  }
2585 
2586  if (color_key)
2587  {
2588  /* For P8 surfaces, the alpha component contains the palette index.
2589  * Which means that the colorkey is one of the palette entries. In
2590  * other cases pixels that should be masked away have alpha set to 0. */
2591  if (src_texture->resource.format->id == WINED3DFMT_P8_UINT)
2592  gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL,
2593  (float)src_texture->async.src_blt_color_key.color_space_low_value / 255.0f);
2594  else
2595  gl_info->gl_ops.gl.p_glAlphaFunc(GL_NOTEQUAL, 0.0f);
2596  checkGLcall("glAlphaFunc");
2597  }
2598 
2599  context_draw_textured_quad(context, src_texture, src_sub_resource_idx, src_rect, dst_rect, filter);
2600 
2602  {
2603  gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
2604  checkGLcall("glDisable(GL_ALPHA_TEST)");
2605  }
2606 
2607  gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
2608  checkGLcall("glDisable(GL_TEXTURE_2D)");
2609  if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
2610  {
2611  gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
2612  checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
2613  }
2614  if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
2615  {
2616  gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
2617  checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
2618  }
2619 
2620  if (dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
2621  gl_info->gl_ops.gl.p_glFlush();
2622 
2623  /* Restore the color key parameters */
2625  (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
2626 
2627  if (staging_texture)
2628  wined3d_texture_decref(staging_texture);
2629 
2630  return dst_location;
2631 }
#define ORM_FBO
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
struct opengl_funcs gl_ops
HRESULT hr
Definition: shlfolder.c:183
Definition: http.c:6587
struct wined3d_swapchain * swapchain
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1336
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, struct wined3d_resource *rt, unsigned int rt_sub_resource_idx, struct wined3d_resource *ds, unsigned int ds_sub_resource_idx, DWORD location)
Definition: context.c:788
struct wined3d_blitter * next
struct wined3d_resource resource
GLuint buffer
Definition: glext.h:5915
void context_invalidate_state(struct wined3d_context *context, DWORD state)
Definition: context.c:1638
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:2793
#define GL_TEXTURE_CUBE_MAP_ARB
Definition: glext.h:1230
#define GL_TEXTURE_RECTANGLE_ARB
Definition: glext.h:1614
void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_texture *texture, unsigned int sub_resource_idx, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter)
Definition: context.c:5741
#define GL_COLOR_ATTACHMENT0
Definition: glext.h:1714
struct wined3d_texture::wined3d_texture_async async
Definition: devices.h:37
BOOL supported[WINED3D_GL_EXT_COUNT]
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
struct wined3d_device * device
#define WINED3D_LOCATION_DRAWABLE
void context_check_fbo_status(const struct wined3d_context *context, GLenum target)
Definition: context.c:382
#define GL_DRAW_FRAMEBUFFER
Definition: glext.h:1699
#define GL_NOTEQUAL
Definition: gl.h:298
GLfloat f
Definition: glext.h:7540
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD flags, const struct wined3d_color_key *color_key)
Definition: texture.c:1431
void context_apply_ffp_blit_state(struct wined3d_context *context, const struct wined3d_device *device)
Definition: context.c:2899
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
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:3528
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture)
Definition: texture.c:91
void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *texture, HWND window, RECT *rect)
Definition: texture.c:69
unsigned int GLenum
Definition: gl.h:150
#define WINED3DUSAGE_PRIVATE
Definition: wined3d.h:925
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define ERR(fmt,...)
Definition: debug.h:109
static unsigned __int64 next
Definition: rand_nt.c:6
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6781
#define checkGLcall(A)
void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1262
#define GL_ALPHA_TEST
Definition: gl.h:366
#define GL_TEXTURE_2D
Definition: gl.h:645
#define STATE_FRAMEBUFFER
ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture)
Definition: texture.c:1219
UINT op
Definition: effect.c:223
static BOOL ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context, const struct wined3d_resource *src_resource, DWORD src_location, const struct wined3d_resource *dst_resource, DWORD dst_location)
Definition: surface.c:2327
void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
Definition: context.c:2470
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3326

◆ ffp_blitter_clear()

static void ffp_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,
DWORD  flags,
const struct wined3d_color colour,
float  depth,
DWORD  stencil 
)
static

Definition at line 2422 of file surface.c.

2425 {
2427  struct wined3d_blitter *next;
2428  DWORD next_flags = 0;
2429  unsigned int i;
2430 
2431  if (flags & WINED3DCLEAR_TARGET)
2432  {
2433  for (i = 0; i < rt_count; ++i)
2434  {
2435  if (!(view = fb->render_targets[i]))
2436  continue;
2437 
2439  || (!(view->resource->usage & WINED3DUSAGE_RENDERTARGET)
2441  || !(view->format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE))))
2442  {
2443  next_flags |= WINED3DCLEAR_TARGET;
2445  break;
2446  }
2447 
2448  /* FIXME: We should reject colour fills on formats with fixups,
2449  * but this would break P8 colour fills for example. */
2450  }
2451  }
2452 
2454  && (!view->format->depth_size || (flags & WINED3DCLEAR_ZBUFFER))
2455  && (!view->format->stencil_size || (flags & WINED3DCLEAR_STENCIL))
2457  {
2458  next_flags |= flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL);
2460  }
2461 
2462  if (flags)
2463  device_clear_render_targets(device, rt_count, fb, rect_count,
2464  clear_rects, draw_rect, flags, colour, depth, stencil);
2465 
2466  if (next_flags && (next = blitter->next))
2467  next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
2468  clear_rects, draw_rect, next_flags, colour, depth, stencil);
2469 }
#define ORM_FBO
static BOOL ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view)
Definition: surface.c:2402
struct wined3d_rendertarget_view * render_targets[MAX_RENDER_TARGET_VIEWS]
struct wined3d_blitter * next
#define WINED3DCLEAR_STENCIL
Definition: wined3d.h:1001
GLint GLfloat GLint stencil
Definition: glext.h:6260
#define WINED3DCLEAR_ZBUFFER
Definition: wined3d.h:1000
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
Definition: devices.h:37
#define WINED3DUSAGE_RENDERTARGET
Definition: wined3d.h:908
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define WINED3DFMT_FLAG_FBO_ATTACHABLE
void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb, UINT rect_count, const RECT *clear_rect, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
Definition: device.c:224
#define WINED3DCLEAR_TARGET
Definition: wined3d.h:999
struct wined3d_rendertarget_view * depth_stencil
static unsigned __int64 next
Definition: rand_nt.c:6
static IOleDocumentView * view
Definition: activex.c:1749

◆ ffp_blitter_destroy()

static void ffp_blitter_destroy ( struct wined3d_blitter blitter,
struct wined3d_context context 
)
static

Definition at line 2317 of file surface.c.

2318 {
2319  struct wined3d_blitter *next;
2320 
2321  if ((next = blitter->next))
2322  next->ops->blitter_destroy(next, context);
2323 
2324  heap_free(blitter);
2325 }
Definition: http.c:6587
struct wined3d_blitter * next
static unsigned __int64 next
Definition: rand_nt.c:6
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ ffp_blitter_use_cpu_clear()

static BOOL ffp_blitter_use_cpu_clear ( struct wined3d_rendertarget_view view)
static

Definition at line 2402 of file surface.c.

2403 {
2404  struct wined3d_resource *resource;
2405  struct wined3d_texture *texture;
2406  DWORD locations;
2407 
2408  resource = view->resource;
2409  if (resource->type == WINED3D_RTYPE_BUFFER)
2410  return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU);
2411 
2413  locations = texture->sub_resources[view->sub_resource_idx].locations;
2414  if (locations & (resource->map_binding | WINED3D_LOCATION_DISCARDED))
2415  return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
2416  || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
2417 
2418  return !(resource->access & WINED3D_RESOURCE_ACCESS_GPU)
2419  && !(texture->flags & WINED3D_TEXTURE_CONVERTED);
2420 }
int resource
Definition: rdpsnd_sgi.c:44
GLenum GLuint texture
Definition: glext.h:6295
unsigned long DWORD
Definition: ntddk_ex.h:95
static struct wined3d_texture * texture_from_resource(struct wined3d_resource *resource)
GLsizei const GLint * locations
Definition: glext.h:10542
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:55
#define WINED3D_TEXTURE_CONVERTED
#define WINED3D_TEXTURE_PIN_SYSMEM
#define WINED3D_LOCATION_DISCARDED

Referenced by ffp_blitter_clear().

◆ find_converter()

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

Definition at line 966 of file surface.c.

968 {
969  unsigned int i;
970 
971  for (i = 0; i < ARRAY_SIZE(converters); ++i)
972  {
973  if (converters[i].from == from && converters[i].to == to)
974  return &converters[i];
975  }
976 
977  for (i = 0; i < (sizeof(dxtn_converters) / sizeof(*dxtn_converters)); ++i)
978  {
979  if (dxtn_converters[i].from == from && dxtn_converters[i].to == to)
981  }
982 
983  return NULL;
984 }
BOOL wined3d_dxtn_supported(void)
Definition: dxtn.c:510
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
static const struct d3dfmt_converter_desc converters[]
Definition: surface.c:929
smooth NULL
Definition: ftsmooth.c:416
static const struct d3dfmt_converter_desc dxtn_converters[]
Definition: surface.c:939
#define ARRAY_SIZE(a)
Definition: main.h:24
CardRegion * from
Definition: spigame.cpp:19

Referenced by surface_convert_format().

◆ float_32_to_16()

static unsigned short float_32_to_16 ( const float *  in)
inlinestatic

Definition at line 572 of file surface.c.

573 {
574  int exp = 0;
575  float tmp = fabsf(*in);
576  unsigned int mantissa;
577  unsigned short ret;
578 
579  /* Deal with special numbers */
580  if (*in == 0.0f)
581  return 0x0000;
582  if (isnan(*in))
583  return 0x7c01;
584  if (isinf(*in))
585  return (*in < 0.0f ? 0xfc00 : 0x7c00);
586 
587  if (tmp < (float)(1u << 10))
588  {
589  do
590  {
591  tmp = tmp * 2.0f;
592  exp--;
593  } while (tmp < (float)(1u << 10));
594  }
595  else if (tmp >= (float)(1u << 11))
596  {
597  do
598  {
599  tmp /= 2.0f;
600  exp++;
601  } while (tmp >= (float)(1u << 11));
602  }
603 
604  mantissa = (unsigned int)tmp;
605  if (tmp - mantissa >= 0.5f)
606  ++mantissa; /* Round to nearest, away from zero. */
607 
608  exp += 10; /* Normalize the mantissa. */
609  exp += 15; /* Exponent is encoded with excess 15. */
610 
611  if (exp > 30) /* too big */
612  {
613  ret = 0x7c00; /* INF */
614  }
615  else if (exp <= 0)
616  {
617  /* exp == 0: Non-normalized mantissa. Returns 0x0000 (=0.0) for too small numbers. */
618  while (exp <= 0)
619  {
620  mantissa = mantissa >> 1;
621  ++exp;
622  }
623  ret = mantissa & 0x3ff;
624  }
625  else
626  {
627  ret = (exp << 10) | (mantissa & 0x3ff);
628  }
629 
630  ret |= ((*in < 0.0f ? 1 : 0) << 15); /* Add the sign */
631  return ret;
632 }
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
GLfloat f
Definition: glext.h:7540
int isinf(double x)
int ret
int isnan(double x)
GLuint in
Definition: glext.h:9616
DWORD exp
Definition: msg.c:15681
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:164
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by convert_r32_float_r16_float(), and format_from_vec4().

◆ get_color_masks()

static void get_color_masks ( const struct wined3d_format format,
DWORD masks 
)
static

Definition at line 40 of file surface.c.

41 {
42  masks[0] = ((1u << format->red_size) - 1) << format->red_offset;
43  masks[1] = ((1u << format->green_size) - 1) << format->green_offset;
44  masks[2] = ((1u << format->blue_size) - 1) << format->blue_offset;
45 }
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
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static const BYTE masks[8]
Definition: dib.c:2760

Referenced by surface_cpu_blt().

◆ is_multisample_location()

static BOOL is_multisample_location ( const struct wined3d_texture texture,
DWORD  location 
)
static

Definition at line 140 of file surface.c.

141 {
143  return TRUE;
145  return FALSE;
147 }
#define TRUE
Definition: types.h:120
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: glext.h:1939
#define WINED3D_LOCATION_RB_MULTISAMPLE
GLenum GLuint texture
Definition: glext.h:6295
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY
Definition: glext.h:1941
#define WINED3D_LOCATION_TEXTURE_RGB
#define WINED3D_LOCATION_TEXTURE_SRGB

Referenced by texture2d_blt_fbo(), and texture2d_load_sysmem().

◆ raw_blitter_blit()

static DWORD raw_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 colour_key,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 2215 of file surface.c.

2220 {
2221  const struct wined3d_gl_info *gl_info = context->gl_info;
2222  unsigned int src_level, src_layer, dst_level, dst_layer;
2223  struct wined3d_blitter *next;
2224  GLuint src_name, dst_name;
2225  DWORD location;
2226 
2227  /* If we would need to copy from a renderbuffer or drawable, we'd probably
2228  * be better of using the FBO blitter directly, since we'd need to use it
2229  * to copy the resource contents to the texture anyway. */
2231  || (src_texture->resource.format->id == dst_texture->resource.format->id
2234  {
2235  if (!(next = blitter->next))
2236  {
2237  ERR("No blitter to handle blit op %#x.\n", op);
2238  return dst_location;
2239  }
2240 
2241  TRACE("Forwarding to blitter %p.\n", next);
2242  return next->ops->blitter_blit(next, op, context, src_texture, src_sub_resource_idx, src_location,
2243  src_rect, dst_texture, dst_sub_resource_idx, dst_location, dst_rect, colour_key, filter);
2244  }
2245 
2246  TRACE("Blit using ARB_copy_image.\n");
2247 
2248  src_level = src_sub_resource_idx % src_texture->level_count;
2249  src_layer = src_sub_resource_idx / src_texture->level_count;
2250 
2251  dst_level = dst_sub_resource_idx % dst_texture->level_count;
2252  dst_layer = dst_sub_resource_idx / dst_texture->level_count;
2253 
2255  if (!location)
2256  location = src_texture->flags & WINED3D_TEXTURE_IS_SRGB
2258  if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, location))
2259  ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(location));
2261 
2263  if (!location)
2264  location = dst_texture->flags & WINED3D_TEXTURE_IS_SRGB
2266  if (texture2d_is_full_rect(dst_texture, dst_level, dst_rect))
2267  {
2268  if (!wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, location))
2269  ERR("Failed to prepare the destination sub-resource into %s.\n", wined3d_debug_location(location));
2270  }
2271  else
2272  {
2273  if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, location))
2274  ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(location));
2275  }
2277 
2278  GL_EXTCALL(glCopyImageSubData(src_name, src_texture->target, src_level,
2279  src_rect->left, src_rect->top, src_layer, dst_name, dst_texture->target, dst_level,
2280  dst_rect->left, dst_rect->top, dst_layer, src_rect->right - src_rect->left,
2281  src_rect->bottom - src_rect->top, 1));
2282  checkGLcall("copy image data");
2283 
2284  wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, location);
2285  wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~location);
2286  if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, dst_location))
2287  ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(dst_location));
2288 
2289  return dst_location | location;
2290 }
Definition: http.c:6587
static GLuint wined3d_texture_get_texture_name(const struct wined3d_texture *texture, const struct wined3d_context *context, BOOL srgb)
struct wined3d_blitter * next
LONG top
Definition: windef.h:292
struct wined3d_resource resource
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define WINED3D_TEXTURE_IS_SRGB
const char * wined3d_debug_location(DWORD location)
Definition: utils.c:6306
#define GL_EXTCALL(f)
BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:1800
#define TRACE(s)
Definition: solgame.cpp:4
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:286
unsigned long DWORD
Definition: ntddk_ex.h:95
#define location(file, line)
Definition: kmtest.h:18
#define ERR(fmt,...)
Definition: debug.h:109
static BOOL texture2d_is_full_rect(const struct wined3d_texture *texture, unsigned int level, const RECT *r)
Definition: surface.c:47
static unsigned __int64 next
Definition: rand_nt.c:6
unsigned int GLuint
Definition: gl.h:159
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
#define WINED3D_LOCATION_TEXTURE_RGB
#define checkGLcall(A)
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:380
LONG bottom
Definition: windef.h:294
UINT op
Definition: effect.c:223
#define WINED3D_LOCATION_TEXTURE_SRGB
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ raw_blitter_clear()

static void raw_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,
DWORD  flags,
const struct wined3d_color colour,
float  depth,
DWORD  stencil 
)
static

Definition at line 2197 of file surface.c.

2200 {
2201  struct wined3d_blitter *next;
2202 
2203  if (!(next = blitter->next))
2204  {
2205  ERR("No blitter to handle clear.\n");
2206  return;
2207  }
2208 
2209  TRACE("Forwarding to blitter %p.\n", next);
2210  next->ops->blitter_clear(next, device, rt_count, fb, rect_count,
2211  clear_rects, draw_rect, flags, colour, depth, stencil);
2212 }
struct wined3d_blitter * next
GLint GLfloat GLint stencil
Definition: glext.h:6260
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define ERR(fmt,...)
Definition: debug.h:109
static unsigned __int64 next
Definition: rand_nt.c:6

◆ raw_blitter_destroy()

static void raw_blitter_destroy ( struct wined3d_blitter blitter,
struct wined3d_context context 
)
static

Definition at line 2186 of file surface.c.

2187 {
2188  struct wined3d_blitter *next;
2189 
2190  if ((next = blitter->next))
2191  next->ops->blitter_destroy(next, context);
2192 
2193  heap_free(blitter);
2194 }
Definition: http.c:6587
struct wined3d_blitter * next
static unsigned __int64 next
Definition: rand_nt.c:6
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 986 of file surface.c.

988 {
989  unsigned int texture_level = sub_resource_idx % src_texture->level_count;
990  const struct wined3d_format *src_format = src_texture->resource.format;
991  struct wined3d_device *device = src_texture->resource.device;
992  const struct d3dfmt_converter_desc *conv = NULL;
993  unsigned int src_row_pitch, src_slice_pitch;
994  struct wined3d_context *context = NULL;
995  struct wined3d_texture *dst_texture;
996  struct wined3d_bo_address src_data;
998  DWORD map_binding;
999 
1000  if (!(conv = find_converter(src_format->id, dst_format->id)) && (!device->d3d_initialized
1001  || !is_identity_fixup(src_format->color_fixup) || src_format->conv_byte_count
1002  || !is_identity_fixup(dst_format->color_fixup) || dst_format->conv_byte_count
1004  {
1005  FIXME("Cannot find a conversion function from format %s to %s.\n",
1006  debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
1007  return NULL;
1008  }
1009 
1010  /* FIXME: Multisampled conversion? */
1011  desc.resource_type = WINED3D_RTYPE_TEXTURE_2D;
1012  desc.format = dst_format->id;
1013  desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
1014  desc.multisample_quality = 0;
1017  desc.width = wined3d_texture_get_level_width(src_texture, texture_level);
1018  desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
1019  desc.depth = 1;
1020  desc.size = 0;
1023  NULL, NULL, &wined3d_null_parent_ops, &dst_texture)))
1024  {
1025  ERR("Failed to create a destination texture for conversion.\n");
1026  return NULL;
1027  }
1028 
1029  if (device->d3d_initialized)
1031 
1032  map_binding = src_texture->resource.map_binding;
1033  if (!wined3d_texture_load_location(src_texture, sub_resource_idx, context, map_binding))
1034  ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
1035  wined3d_texture_get_pitch(src_texture, texture_level, &src_row_pitch, &src_slice_pitch);
1036  wined3d_texture_get_memory(src_texture, sub_resource_idx, &src_data, map_binding);
1037 
1038  if (conv)
1039  {
1040  unsigned int dst_row_pitch, dst_slice_pitch;
1041  struct wined3d_bo_address dst_data;
1042  const BYTE *src;
1043  BYTE *dst;
1044 
1045  map_binding = dst_texture->resource.map_binding;
1046  if (!wined3d_texture_load_location(dst_texture, 0, context, map_binding))
1047  ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
1048  wined3d_texture_get_pitch(dst_texture, 0, &dst_row_pitch, &dst_slice_pitch);
1049  wined3d_texture_get_memory(dst_texture, 0, &dst_data, map_binding);
1050 
1051  src = context_map_bo_address(context, &src_data,
1052  src_texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
1054  &dst_data, dst_texture->sub_resources[0].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
1055 
1056  conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
1057 
1058  wined3d_texture_invalidate_location(dst_texture, 0, ~map_binding);
1061  }
1062  else
1063  {
1064  struct wined3d_box src_box = {0, 0, desc.width, desc.height, 0, 1};
1065 
1066  TRACE("Using upload conversion.\n");
1067 
1070  wined3d_texture_upload_data(dst_texture, 0, context, src_format, &src_box,
1071  wined3d_const_bo_address(&src_data), src_row_pitch, src_slice_pitch, 0, 0, 0, FALSE);
1072 
1075  }
1076 
1077  if (context)
1079 
1080  return dst_texture;
1081 }
static unsigned int wined3d_texture_get_level_height(const struct wined3d_texture *texture, unsigned int level)
void context_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, GLenum binding)
Definition: context.c:2598
static const char * dst_format
Definition: dib.c:1133
Definition: http.c:6587
static unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture, unsigned int level)
void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1706
struct wined3d_resource resource
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:58
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:56
#define WINED3D_TEXTURE_CREATE_DISCARD
Definition: wined3d.h:1559
const char * wined3d_debug_location(DWORD location)
Definition: utils.c:6306
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
struct color_fixup_desc color_fixup
#define GL_PIXEL_UNPACK_BUFFER
Definition: glext.h:477
smooth NULL
Definition: ftsmooth.c:416
void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, const struct wined3d_format *format, const struct wined3d_box *src_box, const struct wined3d_const_bo_address *data, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, BOOL srgb)
Definition: texture.c:1887
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations)
Definition: texture.c:436
void context_release(struct wined3d_context *context)
Definition: context.c:1559
#define TRACE(s)
Definition: solgame.cpp:4
void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:286
#define WINED3D_MAP_READ
Definition: wined3d.h:948
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:57
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINED3D_MAP_WRITE
Definition: wined3d.h:947
void(* convert)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
Definition: surface.c:926
enum wined3d_format_id id
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
#define WINED3DUSAGE_PRIVATE
Definition: wined3d.h:925
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define ERR(fmt,...)
Definition: debug.h:109
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4218
#define WINED3D_TEXTURE_CREATE_MAPPABLE
Definition: wined3d.h:1558
const struct wined3d_parent_ops wined3d_null_parent_ops
Definition: directx.c:6781
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
GLenum GLenum dst
Definition: glext.h:6340
#define WINED3D_LOCATION_TEXTURE_RGB
static struct wined3d_const_bo_address * wined3d_const_bo_address(struct wined3d_bo_address *data)
void * context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
Definition: context.c:2569
#define WINED3DUSAGE_SCRATCH
Definition: wined3d.h:924
BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location)
Definition: texture.c:380
#define WINED3DFMT_FLAG_COMPRESSED
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT]
static const struct d3dfmt_converter_desc * find_converter(enum wined3d_format_id from, enum wined3d_format_id to)
Definition: surface.c:966
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
Definition: texture.c:1064
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:3922
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:1364
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
Definition: texture.c:3326

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,
DWORD  flags,
const struct wined3d_blt_fx fx,
enum wined3d_texture_filter_type  filter 
)
static

Definition at line 2768 of file surface.c.

2772 {
2773  unsigned int bpp, src_height, src_width, dst_height, dst_width, row_byte_count;
2774  struct wined3d_device *device = dst_texture->resource.device;
2775  const struct wined3d_format *src_format, *dst_format;
2776  struct wined3d_texture *converted_texture = NULL;
2777  struct wined3d_bo_address src_data, dst_data;
2778  unsigned int src_fmt_flags, dst_fmt_flags;
2779  struct wined3d_map_desc dst_map, src_map;
2780  struct wined3d_context *context = NULL;
2781  unsigned int x, sx, xinc, y, sy, yinc;
2782  unsigned int texture_level;
2783  HRESULT hr = WINED3D_OK;
2784  BOOL same_sub_resource;
2785  DWORD map_binding;
2786  const BYTE *sbase;
2787  const BYTE *sbuf;
2788  BYTE *dbuf;
2789 
2790  TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_box %s, src_texture %p, "
2791  "src_sub_resource_idx %u, src_box %s, flags %#x, fx %p, filter %s.\n",
2792  dst_texture, dst_sub_resource_idx, debug_box(dst_box), src_texture,
2793  src_sub_resource_idx, debug_box(src_box), flags, fx, debug_d3dtexturefiltertype(filter));
2794 
2795  if (device->d3d_initialized)
2797 
2798  if (src_texture == dst_texture && src_sub_resource_idx == dst_sub_resource_idx)
2799  {
2800  same_sub_resource = TRUE;
2801 
2802  map_binding = dst_texture->resource.map_binding;
2803  texture_level = dst_sub_resource_idx % dst_texture->level_count;
2804  if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, map_binding))
2805  ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
2806  wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
2807  wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
2808  wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
2809  dst_map.data = context_map_bo_address(context, &dst_data,
2810  dst_texture->sub_resources[dst_sub_resource_idx].size,
2812 
2813  src_map = dst_map;
2814  src_format = dst_texture->resource.format;
2815  dst_format = src_format;
2816  dst_fmt_flags = dst_texture->resource.format_flags;
2817  src_fmt_flags = dst_fmt_flags;
2818  }
2819  else
2820  {
2821  same_sub_resource = FALSE;
2822  dst_format = dst_texture->resource.format;
2823  dst_fmt_flags = dst_texture->resource.format_flags;
2824  if (!(flags & WINED3D_BLT_RAW) && dst_texture->resource.format->id != src_texture->resource.format->id)
2825  {
2826  if (!(converted_texture = surface_convert_format(src_texture, src_sub_resource_idx, dst_format)))
2827  {
2828  FIXME("Cannot convert %s to %s.\n", debug_d3dformat(src_texture->resource.format->id),
2829  debug_d3dformat(dst_texture->resource.format->id));
2830  if (context)
2832  return WINED3DERR_NOTAVAILABLE;
2833  }
2834  src_texture = converted_texture;
2835  src_sub_resource_idx = 0;
2836  }
2837  src_format = src_texture->resource.format;
2838  src_fmt_flags = src_texture->resource.format_flags;
2839 
2840  map_binding = src_texture->resource.map_binding;
2841  texture_level = src_sub_resource_idx % src_texture->level_count;
2842  if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, map_binding))
2843  ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(map_binding));
2844  wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
2845  wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_data, map_binding);
2846  src_map.data = context_map_bo_address(context, &src_data,
2847  src_texture->sub_resources[src_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
2848 
2849  map_binding = dst_texture->resource.map_binding;
2850  texture_level = dst_sub_resource_idx % dst_texture->level_count;
2851  if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, map_binding))
2852  ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(map_binding));
2853  wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~map_binding);
2854  wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
2855  wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
2856  dst_map.data = context_map_bo_address(context, &dst_data,
2857  dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
2858  }
2859  flags &= ~WINED3D_BLT_RAW;
2860 
2861  bpp = dst_format->byte_count;
2862  src_height = src_box->bottom - src_box->top;
2863  src_width = src_box->right - src_box->left;
2864  dst_height = dst_box->bottom - dst_box->top;
2865  dst_width = dst_box->right - dst_box->left;
2866  row_byte_count = dst_width * bpp;
2867 
2868  sbase = (BYTE *)src_map.data
2869  + ((src_box->top / src_format->block_height) * src_map.row_pitch)
2870  + ((src_box->left / src_format->block_width) * src_format->block_byte_count);
2871  dbuf = (BYTE *)dst_map.data
2872  + ((dst_box->top / dst_format->block_height) * dst_map.row_pitch)
2873  + ((dst_box->left / dst_format->block_width) * dst_format->block_byte_count);
2874 
2875  if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS)
2876  {
2877  TRACE("%s -> %s copy.\n", debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
2878 
2879  if (same_sub_resource)
2880  {
2881  FIXME("Only plain blits supported on compressed surfaces.\n");
2882  hr = E_NOTIMPL;
2883  goto release;
2884  }
2885 
2886  if (src_height != dst_height || src_width != dst_width)
2887  {
2888  WARN("Stretching not supported on compressed surfaces.\n");
2890  goto release;
2891  }
2892 
2893  hr = surface_cpu_blt_compressed(sbase, dbuf,
2894  src_map.row_pitch, dst_map.row_pitch, dst_width, dst_height,
2895  src_format, flags, fx);
2896  goto release;
2897  }
2898 
2900  && (src_width != dst_width || src_height != dst_height))
2901  {
2902  /* Can happen when d3d9 apps do a StretchRect() call which isn't handled in GL. */
2903  static int once;
2904  if (!once++) FIXME("Filter %s not supported in software blit.\n", debug_d3dtexturefiltertype(filter));
2905  }
2906 
2907  xinc = (src_width << 16) / dst_width;
2908  yinc = (src_height << 16) / dst_height;
2909 
2910  if (!flags)
2911  {
2912  /* No effects, we can cheat here. */
2913  if (dst_width == src_width)
2914  {
2915  if (dst_height == src_height)
2916  {
2917  /* No stretching in either direction. This needs to be as fast
2918  * as possible. */
2919  sbuf = sbase;
2920 
2921  /* Check for overlapping surfaces. */
2922  if (!same_sub_resource || dst_box->top < src_box->top
2923  || dst_box->right <= src_box->left || src_box->right <= dst_box->left)
2924  {
2925  /* No overlap, or dst above src, so copy from top downwards. */
2926  for (y = 0; y < dst_height; ++y)
2927  {
2928  memcpy(dbuf, sbuf, row_byte_count);
2929  sbuf += src_map.row_pitch;
2930  dbuf += dst_map.row_pitch;
2931  }
2932  }
2933  else if (dst_box->top > src_box->top)
2934  {
2935  /* Copy from bottom upwards. */
2936  sbuf += src_map.row_pitch * dst_height;
2937  dbuf += dst_map.row_pitch * dst_height;
2938  for (y = 0; y < dst_height; ++y)
2939  {
2940  sbuf -= src_map.row_pitch;
2941  dbuf -= dst_map.row_pitch;
2942  memcpy(dbuf, sbuf, row_byte_count);
2943  }
2944  }
2945  else
2946  {
2947  /* Src and dst overlapping on the same line, use memmove. */
2948  for (y = 0; y < dst_height; ++y)
2949  {
2950  memmove(dbuf, sbuf, row_byte_count);
2951  sbuf += src_map.row_pitch;
2952  dbuf += dst_map.row_pitch;
2953  }
2954  }
2955  }
2956  else
2957  {
2958  /* Stretching in y direction only. */
2959  for (y = sy = 0; y < dst_height; ++y, sy += yinc)
2960  {
2961  sbuf = sbase + (sy >> 16) * src_map.row_pitch;
2962  memcpy(dbuf, sbuf, row_byte_count);
2963  dbuf += dst_map.row_pitch;
2964  }
2965  }
2966  }
2967  else
2968  {
2969  /* Stretching in X direction. */
2970  unsigned int last_sy = ~0u;
2971  for (y = sy = 0; y < dst_height; ++y, sy += yinc)
2972  {
2973  sbuf = sbase + (sy >> 16) * src_map.row_pitch;
2974 
2975  if ((sy >> 16) == (last_sy >> 16))
2976  {
2977  /* This source row is the same as last source row -
2978  * Copy the already stretched row. */
2979  memcpy(dbuf, dbuf - dst_map.row_pitch, row_byte_count);
2980  }
2981  else
2982  {
2983 #define STRETCH_ROW(type) \
2984 do { \
2985  const type *s = (const type *)sbuf; \
2986  type *d = (type *)dbuf; \
2987  for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
2988  d[x] = s[sx >> 16]; \
2989 } while(0)
2990 
2991  switch(bpp)
2992  {
2993  case 1:
2994  STRETCH_ROW(BYTE);
2995  break;
2996  case 2:
2997  STRETCH_ROW(WORD);
2998  break;
2999  case 4:
3000  STRETCH_ROW(DWORD);
3001  break;
3002  case 3:
3003  {
3004  const BYTE *s;
3005  BYTE *d = dbuf;
3006  for (x = sx = 0; x < dst_width; x++, sx+= xinc)
3007  {
3008  DWORD pixel;
3009 
3010  s = sbuf + 3 * (sx >> 16);
3011  pixel = s[0] | (s[1] << 8) | (s[2] << 16);
3012  d[0] = (pixel ) & 0xff;
3013  d[1] = (pixel >> 8) & 0xff;
3014  d[2] = (pixel >> 16) & 0xff;
3015  d += 3;
3016  }
3017  break;
3018  }
3019  default:
3020  FIXME("Stretched blit not implemented for bpp %u.\n", bpp * 8);
3022  goto error;
3023  }
3024 #undef STRETCH_ROW
3025  }
3026  dbuf += dst_map.row_pitch;
3027  last_sy = sy;
3028  }
3029  }
3030  }
3031  else
3032  {
3033  LONG dstyinc = dst_map.row_pitch, dstxinc = bpp;
3034  DWORD keylow = 0xffffffff, keyhigh = 0, keymask = 0xffffffff;
3035  DWORD destkeylow = 0x0, destkeyhigh = 0xffffffff, destkeymask = 0xffffffff;
3038  {
3039  /* The color keying flags are checked for correctness in ddraw. */
3041  {
3042  keylow = src_texture->async.src_blt_color_key.color_space_low_value;
3043  keyhigh = src_texture->async.src_blt_color_key.color_space_high_value;
3044  }
3046  {
3047  keylow = fx->src_color_key.color_space_low_value;
3048  keyhigh = fx->src_color_key.color_space_high_value;
3049  }
3050 
3052  {
3053  /* Destination color keys are taken from the source surface! */
3054  destkeylow = src_texture->async.dst_blt_color_key.color_space_low_value;
3055  destkeyhigh = src_texture->async.dst_blt_color_key.color_space_high_value;
3056  }
3058  {
3059  destkeylow = fx->dst_color_key.color_space_low_value;
3060  destkeyhigh = fx->dst_color_key.color_space_high_value;
3061  }
3062 
3063  if (bpp == 1)
3064  {
3065  keymask = 0xff;
3066  }
3067  else
3068  {
3069  DWORD masks[3];
3070  get_color_masks(src_format, masks);
3071  keymask = masks[0] | masks[1] | masks[2];
3072  }
3075  }
3076 
3077  if (flags & WINED3D_BLT_FX)
3078  {
3079  BYTE *dTopLeft, *dTopRight, *dBottomLeft, *dBottomRight, *tmp;
3080  LONG tmpxy;
3081  dTopLeft = dbuf;
3082  dTopRight = dbuf + ((dst_width - 1) * bpp);
3083  dBottomLeft = dTopLeft + ((dst_height - 1) * dst_map.row_pitch);
3084  dBottomRight = dBottomLeft + ((dst_width - 1) * bpp);
3085 
3086  if (fx->fx & WINEDDBLTFX_ARITHSTRETCHY)
3087  {
3088  /* I don't think we need to do anything about this flag. */
3089  WARN("Nothing done for WINEDDBLTFX_ARITHSTRETCHY.\n");
3090  }
3091  if (fx->fx & WINEDDBLTFX_MIRRORLEFTRIGHT)
3092  {
3093  tmp = dTopRight;
3094  dTopRight = dTopLeft;
3095  dTopLeft = tmp;
3096  tmp = dBottomRight;
3097  dBottomRight = dBottomLeft;
3098  dBottomLeft = tmp;
3099  dstxinc = dstxinc * -1;
3100  }
3101  if (fx->fx & WINEDDBLTFX_MIRRORUPDOWN)
3102  {
3103  tmp = dTopLeft;
3104  dTopLeft = dBottomLeft;
3105  dBottomLeft = tmp;
3106  tmp = dTopRight;
3107  dTopRight = dBottomRight;
3108  dBottomRight = tmp;
3109  dstyinc = dstyinc * -1;
3110  }
3111  if (fx->fx & WINEDDBLTFX_NOTEARING)
3112  {
3113  /* I don't think we need to do anything about this flag. */
3114  WARN("Nothing done for WINEDDBLTFX_NOTEARING.\n");
3115  }
3116  if (fx->fx & WINEDDBLTFX_ROTATE180)
3117  {
3118  tmp = dBottomRight;
3119  dBottomRight = dTopLeft;
3120  dTopLeft = tmp;
3121  tmp = dBottomLeft;
3122  dBottomLeft = dTopRight;
3123  dTopRight = tmp;
3124  dstxinc = dstxinc * -1;
3125  dstyinc = dstyinc * -1;
3126  }
3127  if (fx->fx & WINEDDBLTFX_ROTATE270)
3128  {
3129  tmp = dTopLeft;
3130  dTopLeft = dBottomLeft;
3131  dBottomLeft = dBottomRight;
3132  dBottomRight = dTopRight;
3133  dTopRight = tmp;
3134  tmpxy = dstxinc;
3135  dstxinc = dstyinc;
3136  dstyinc = tmpxy;
3137  dstxinc = dstxinc * -1;
3138  }
3139  if (fx->fx & WINEDDBLTFX_ROTATE90)
3140  {
3141  tmp = dTopLeft;
3142  dTopLeft = dTopRight;
3143  dTopRight = dBottomRight;
3144  dBottomRight = dBottomLeft;
3145  dBottomLeft = tmp;
3146  tmpxy = dstxinc;
3147  dstxinc = dstyinc;
3148  dstyinc = tmpxy;
3149  dstyinc = dstyinc * -1;
3150  }
3151  if (fx->fx & WINEDDBLTFX_ZBUFFERBASEDEST)
3152  {
3153  /* I don't think we need to do anything about this flag. */
3154  WARN("Nothing done for WINEDDBLTFX_ZBUFFERBASEDEST.\n");
3155  }
3156  dbuf = dTopLeft;
3157  flags &= ~(WINED3D_BLT_FX);
3158  }
3159 
3160 #define COPY_COLORKEY_FX(type) \
3161 do { \
3162  const type *s; \
3163  type *d = (type *)dbuf, *dx, tmp; \
3164  for (y = sy = 0; y < dst_height; ++y, sy += yinc) \
3165  { \
3166  s = (const type *)(sbase + (sy >> 16) * src_map.row_pitch); \
3167  dx = d; \
3168  for (x = sx = 0; x < dst_width; ++x, sx += xinc) \
3169  { \
3170  tmp = s[sx >> 16]; \
3171  if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) \
3172  && ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) \
3173  { \
3174  dx[0] = tmp; \
3175  } \
3176  dx = (type *)(((BYTE *)dx) + dstxinc); \
3177  } \
3178  d = (type *)(((BYTE *)d) + dstyinc); \
3179  } \
3180 } while(0)
3181 
3182  switch (bpp)
3183  {
3184  case 1:
3186  break;
3187  case 2:
3189  break;
3190  case 4:
3192  break;
3193  case 3:
3194  {
3195  const BYTE *s;
3196  BYTE *d = dbuf, *dx;
3197  for (y = sy = 0; y < dst_height; ++y, sy += yinc)
3198  {
3199  sbuf = sbase + (sy >> 16) * src_map.row_pitch;
3200  dx = d;
3201  for (x = sx = 0; x < dst_width; ++x, sx+= xinc)
3202  {
3203  DWORD pixel, dpixel = 0;
3204  s = sbuf + 3 * (sx>>16);
3205  pixel = s[0] | (s[1] << 8) | (s[2] << 16);
3206  dpixel = dx[0] | (dx[1] << 8 ) | (dx[2] << 16);
3207  if (((pixel & keymask) < keylow || (pixel & keymask) > keyhigh)
3208  && ((dpixel & keymask) >= destkeylow || (dpixel & keymask) <= keyhigh))
3209  {
3210  dx[0] = (pixel ) & 0xff;
3211  dx[1] = (pixel >> 8) & 0xff;
3212  dx[2] = (pixel >> 16) & 0xff;
3213  }
3214  dx += dstxinc;
3215  }
3216  d += dstyinc;
3217  }
3218  break;
3219  }
3220  default:
3221  FIXME("%s color-keyed blit not implemented for bpp %u.\n",
3222  (flags & WINED3D_BLT_SRC_CKEY) ? "Source" : "Destination", bpp * 8);
3224  goto error;
3225 #undef COPY_COLORKEY_FX
3226  }
3227  }
3228 
3229 error:
3230  if (flags)
3231  FIXME(" Unsupported flags %#x.\n", flags);
3232 
3233 release:
3235  if (!same_sub_resource)
3237  if (SUCCEEDED(hr) && dst_texture->swapchain && dst_texture->swapchain->front_buffer == dst_texture)
3238  {
3239  SetRect(&dst_texture->swapchain->front_buffer_update,
3240  dst_box->left, dst_box->top, dst_box->right, dst_box->bottom);
3241  dst_texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(dst_texture->swapchain);
3242  }
3243  if (converted_texture)
3244  wined3d_texture_decref(converted_texture);
3245  if (context)
3247 
3248  return hr;
3249 }
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
#define WINED3D_BLT_SRC_CKEY
Definition: wined3d.h:1362
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
#define WINEDDBLTFX_ROTATE270
Definition: wined3d.h:1351
UINT left
Definition: wined3d.h:1840
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
void context_unmap_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data, GLenum binding)
Definition: context.c:2598
static const char * dst_format
Definition: dib.c:1133
#define WINED3D_BLT_SRC_CKEY_OVERRIDE
Definition: wined3d.h:1363
Definition: http.c:6587
struct wined3d_swapchain * swapchain
#define WINEDDBLTFX_ZBUFFERBASEDEST
Definition: wined3d.h:1357
#define WARN(fmt,...)
Definition: debug.h:111
#define WINED3DFMT_FLAG_BLOCKS
#define COPY_COLORKEY_FX(type)
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:3881
struct wined3d_resource resource
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WINEDDBLTFX_NOTEARING
Definition: wined3d.h:1347
UINT top
Definition: wined3d.h:1841
#define STRETCH_ROW(type)
#define WINEDDBLTFX_ROTATE90
Definition: wined3d.h:1353
#define WINED3D_BLT_DST_CKEY_OVERRIDE
Definition: wined3d.h:1361
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, DWORD flags, const struct wined3d_blt_fx *fx)
Definition: surface.c:2665
#define WINED3D_BLT_RAW
Definition: wined3d.h:1366
#define WINEDDBLTFX_MIRRORUPDOWN
Definition: wined3d.h:1345
struct wined3d_texture::wined3d_texture_async async
const char * wined3d_debug_location(DWORD location)
Definition: utils.c:6306
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
#define WINEDDBLTFX_ARITHSTRETCHY
Definition: wined3d.h:1341
#define GL_PIXEL_UNPACK_BUFFER
Definition: glext.h:477
smooth NULL
Definition: ftsmooth.c:416
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations)
Definition: texture.c:436
void context_release(struct wined3d_context *context)
Definition: context.c:1559
UINT right
Definition: wined3d.h:1842
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
#define WINED3D_BLT_FX
Definition: wined3d.h:1359
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define WINED3D_MAP_READ
Definition: wined3d.h:948
LONG HRESULT
Definition: typedefs.h:77
const char * debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type)
Definition: utils.c:4480
#define WINED3D_OK
Definition: wined3d.h:37
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT bottom
Definition: wined3d.h:1843
GLbitfield flags
Definition: glext.h:7161
#define WINED3D_MAP_WRITE
Definition: wined3d.h:947
enum wined3d_format_id id
#define WINEDDBLTFX_MIRRORLEFTRIGHT
Definition: wined3d.h:1343
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GLfixed fx
Definition: tritemp.h:482
GLdouble s
Definition: gl.h:2039
struct wined3d_texture::wined3d_texture_sub_resource sub_resources[1]
#define ERR(fmt,...)
Definition: debug.h:109
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4218
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
void wined3d_texture_invalidate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location)
Definition: texture.c:310
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WINED3DERR_NOTAVAILABLE
Definition: wined3d.h:46
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:986
GLint GLint GLint GLint GLint GLint y
Definition: