Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7eefed14
Commit
7eefed14
authored
Oct 14, 2011
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: YUY2 and UYVY are block based.
parent
7fd75204
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
25 deletions
+35
-25
surface.c
dlls/d3d9/tests/surface.c
+2
-0
surface.c
dlls/wined3d/surface.c
+5
-5
utils.c
dlls/wined3d/utils.c
+27
-20
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/d3d9/tests/surface.c
View file @
7eefed14
...
...
@@ -663,6 +663,8 @@ static void test_surface_lockrect_blocks(IDirect3DDevice9 *device)
* which doesn't match the format spec. On newer Nvidia cards
* it has the correct 4x4 block size */
{
MAKEFOURCC
(
'A'
,
'T'
,
'I'
,
'2'
),
"ATI2N"
,
4
,
4
,
TRUE
},
{
D3DFMT_YUY2
,
"D3DFMT_YUY2"
,
2
,
1
,
FALSE
},
{
D3DFMT_UYVY
,
"D3DFMT_UYVY"
,
2
,
1
,
FALSE
},
};
static
const
struct
{
...
...
dlls/wined3d/surface.c
View file @
7eefed14
...
...
@@ -2476,7 +2476,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
}
/* NPOT block sizes would be silly. */
if
((
src_format
->
flags
&
WINED3DFMT_FLAG_
COMPRESSED
)
if
((
src_format
->
flags
&
WINED3DFMT_FLAG_
BLOCKS
)
&&
((
update_w
&
(
src_format
->
block_width
-
1
)
||
update_h
&
(
src_format
->
block_height
-
1
))
&&
(
src_w
!=
update_w
||
dst_w
!=
update_w
||
src_h
!=
update_h
||
dst_h
!=
update_h
)))
{
...
...
@@ -3096,7 +3096,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
TRACE
(
"surface %p.
\n
"
,
surface
);
if
((
format
->
flags
&
(
WINED3DFMT_FLAG_
COMPRESSED
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_COMPRESSED
)
if
((
format
->
flags
&
(
WINED3DFMT_FLAG_
BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
{
/* Since compressed formats are block based, pitch means the amount of
* bytes to the next row of block rather than the next row of pixels. */
...
...
@@ -3713,7 +3713,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
WARN
(
"Surface is already mapped.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
((
format
->
flags
&
WINED3DFMT_FLAG_
COMPRESSED
)
if
((
format
->
flags
&
WINED3DFMT_FLAG_
BLOCKS
)
&&
rect
&&
(
rect
->
left
||
rect
->
top
||
rect
->
right
!=
surface
->
resource
.
width
||
rect
->
bottom
!=
surface
->
resource
.
height
))
...
...
@@ -3755,7 +3755,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
}
else
{
if
((
format
->
flags
&
(
WINED3DFMT_FLAG_
COMPRESSED
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_COMPRESSED
)
if
((
format
->
flags
&
(
WINED3DFMT_FLAG_
BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
{
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
...
...
@@ -6666,7 +6666,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
dstwidth
=
xdst
.
right
-
xdst
.
left
;
width
=
(
xdst
.
right
-
xdst
.
left
)
*
bpp
;
if
(
src_format
->
flags
&
dst_format
->
flags
&
WINED3DFMT_FLAG_
COMPRESSED
)
if
(
src_format
->
flags
&
dst_format
->
flags
&
WINED3DFMT_FLAG_
BLOCKS
)
{
TRACE
(
"%s -> %s copy.
\n
"
,
debug_d3dformat
(
src_format
->
id
),
debug_d3dformat
(
dst_format
->
id
));
...
...
dlls/wined3d/utils.c
View file @
7eefed14
...
...
@@ -189,7 +189,7 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{
WINED3DFMT_S8_UINT_D24_FLOAT
,
WINED3DFMT_FLAG_FLOAT
},
};
struct
wined3d_format_
compression
_info
struct
wined3d_format_
block
_info
{
enum
wined3d_format_id
id
;
UINT
block_width
;
...
...
@@ -197,7 +197,7 @@ struct wined3d_format_compression_info
UINT
block_byte_count
;
};
static
const
struct
wined3d_format_
compression_info
format_compression
_info
[]
=
static
const
struct
wined3d_format_
block_info
format_block
_info
[]
=
{
{
WINED3DFMT_DXT1
,
4
,
4
,
8
},
{
WINED3DFMT_DXT2
,
4
,
4
,
16
},
...
...
@@ -205,6 +205,8 @@ static const struct wined3d_format_compression_info format_compression_info[] =
{
WINED3DFMT_DXT4
,
4
,
4
,
16
},
{
WINED3DFMT_DXT5
,
4
,
4
,
16
},
{
WINED3DFMT_ATI2N
,
4
,
4
,
16
},
{
WINED3DFMT_YUY2
,
2
,
1
,
4
},
{
WINED3DFMT_UYVY
,
2
,
1
,
4
},
};
struct
wined3d_format_vertex_info
...
...
@@ -594,23 +596,28 @@ static const struct wined3d_format_texture_info format_texture_info[] =
WINED3D_GL_EXT_NONE
,
NULL
},
{
WINED3DFMT_DXT1
,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
|
WINED3DFMT_FLAG_COMPRESSED
,
EXT_TEXTURE_COMPRESSION_S3TC
,
NULL
},
{
WINED3DFMT_DXT2
,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
|
WINED3DFMT_FLAG_COMPRESSED
,
EXT_TEXTURE_COMPRESSION_S3TC
,
NULL
},
{
WINED3DFMT_DXT3
,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
|
WINED3DFMT_FLAG_COMPRESSED
,
EXT_TEXTURE_COMPRESSION_S3TC
,
NULL
},
{
WINED3DFMT_DXT4
,
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
|
WINED3DFMT_FLAG_COMPRESSED
,
EXT_TEXTURE_COMPRESSION_S3TC
,
NULL
},
{
WINED3DFMT_DXT5
,
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_SRGB_READ
|
WINED3DFMT_FLAG_COMPRESSED
,
EXT_TEXTURE_COMPRESSION_S3TC
,
NULL
},
/* IEEE formats */
{
WINED3DFMT_R32_FLOAT
,
GL_RGB32F_ARB
,
GL_RGB32F_ARB
,
0
,
...
...
@@ -857,11 +864,11 @@ static const struct wined3d_format_texture_info format_texture_info[] =
/* Vendor-specific formats */
{
WINED3DFMT_ATI2N
,
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI
,
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI
,
0
,
GL_LUMINANCE_ALPHA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_COMPRESSED
,
ATI_TEXTURE_COMPRESSION_3DC
,
NULL
},
{
WINED3DFMT_ATI2N
,
GL_COMPRESSED_RED_GREEN_RGTC2
,
GL_COMPRESSED_RED_GREEN_RGTC2
,
0
,
GL_LUMINANCE_ALPHA
,
GL_UNSIGNED_BYTE
,
0
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
|
WINED3DFMT_FLAG_FILTERING
|
WINED3DFMT_FLAG_COMPRESSED
,
ARB_TEXTURE_COMPRESSION_RGTC
,
NULL
},
{
WINED3DFMT_INTZ
,
GL_DEPTH24_STENCIL8_EXT
,
GL_DEPTH24_STENCIL8_EXT
,
0
,
GL_DEPTH_STENCIL_EXT
,
GL_UNSIGNED_INT_24_8_EXT
,
0
,
...
...
@@ -946,27 +953,27 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info)
return
TRUE
;
}
static
BOOL
init_format_
compression
_info
(
struct
wined3d_gl_info
*
gl_info
)
static
BOOL
init_format_
block
_info
(
struct
wined3d_gl_info
*
gl_info
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
(
sizeof
(
format_
compression_info
)
/
sizeof
(
*
format_compression
_info
));
++
i
)
for
(
i
=
0
;
i
<
(
sizeof
(
format_
block_info
)
/
sizeof
(
*
format_block
_info
));
++
i
)
{
struct
wined3d_format
*
format
;
int
fmt_idx
=
getFmtIdx
(
format_
compression
_info
[
i
].
id
);
int
fmt_idx
=
getFmtIdx
(
format_
block
_info
[
i
].
id
);
if
(
fmt_idx
==
-
1
)
{
ERR
(
"Format %s (%#x) not found.
\n
"
,
debug_d3dformat
(
format_
compression_info
[
i
].
id
),
format_compression
_info
[
i
].
id
);
debug_d3dformat
(
format_
block_info
[
i
].
id
),
format_block
_info
[
i
].
id
);
return
FALSE
;
}
format
=
&
gl_info
->
formats
[
fmt_idx
];
format
->
block_width
=
format_
compression
_info
[
i
].
block_width
;
format
->
block_height
=
format_
compression
_info
[
i
].
block_height
;
format
->
block_byte_count
=
format_
compression
_info
[
i
].
block_byte_count
;
format
->
flags
|=
WINED3DFMT_FLAG_
COMPRESSED
;
format
->
block_width
=
format_
block
_info
[
i
].
block_width
;
format
->
block_height
=
format_
block
_info
[
i
].
block_height
;
format
->
block_byte_count
=
format_
block
_info
[
i
].
block_byte_count
;
format
->
flags
|=
WINED3DFMT_FLAG_
BLOCKS
;
}
return
TRUE
;
...
...
@@ -1623,7 +1630,7 @@ BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info)
{
if
(
!
init_format_base_info
(
gl_info
))
return
FALSE
;
if
(
!
init_format_
compression
_info
(
gl_info
))
if
(
!
init_format_
block
_info
(
gl_info
))
{
HeapFree
(
GetProcessHeap
(),
0
,
gl_info
->
formats
);
gl_info
->
formats
=
NULL
;
...
...
@@ -1638,7 +1645,7 @@ BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor v
{
if
(
!
init_format_base_info
(
gl_info
))
return
FALSE
;
if
(
!
init_format_
compression
_info
(
gl_info
))
goto
fail
;
if
(
!
init_format_
block
_info
(
gl_info
))
goto
fail
;
if
(
!
init_format_texture_info
(
gl_info
))
goto
fail
;
if
(
!
init_format_vertex_info
(
gl_info
))
goto
fail
;
...
...
@@ -1678,7 +1685,7 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
{
size
=
0
;
}
else
if
(
format
->
flags
&
WINED3DFMT_FLAG_
COMPRESSED
)
else
if
(
format
->
flags
&
WINED3DFMT_FLAG_
BLOCKS
)
{
UINT
row_block_count
=
(
width
+
format
->
block_width
-
1
)
/
format
->
block_width
;
UINT
row_count
=
(
height
+
format
->
block_height
-
1
)
/
format
->
block_height
;
...
...
dlls/wined3d/wined3d_private.h
View file @
7eefed14
...
...
@@ -2788,6 +2788,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_SHADOW 0x00004000
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
#define WINED3DFMT_FLAG_BLOCKS 0x00020000
struct
wined3d_format
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment