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
9076612e
Commit
9076612e
authored
Apr 22, 2015
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Shadow format flags in the resource.
parent
b6717dc2
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
50 deletions
+69
-50
context.c
dlls/wined3d/context.c
+4
-3
cs.c
dlls/wined3d/cs.c
+3
-1
device.c
dlls/wined3d/device.c
+2
-2
resource.c
dlls/wined3d/resource.c
+21
-18
shader.c
dlls/wined3d/shader.c
+1
-1
state.c
dlls/wined3d/state.c
+2
-2
surface.c
dlls/wined3d/surface.c
+27
-16
texture.c
dlls/wined3d/texture.c
+2
-2
volume.c
dlls/wined3d/volume.c
+6
-5
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/context.c
View file @
9076612e
...
@@ -128,7 +128,7 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
...
@@ -128,7 +128,7 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context,
if
(
depth_stencil
)
if
(
depth_stencil
)
{
{
DWORD
format_flags
=
depth_stencil
->
resource
.
format
->
flags
;
DWORD
format_flags
=
depth_stencil
->
resource
.
format
_
flags
;
if
(
depth_stencil
->
current_renderbuffer
)
if
(
depth_stencil
->
current_renderbuffer
)
{
{
...
@@ -3168,11 +3168,12 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d
...
@@ -3168,11 +3168,12 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d
{
{
/* Disable blending when the alpha mask has changed and when a format doesn't support blending. */
/* Disable blending when the alpha mask has changed and when a format doesn't support blending. */
if
((
old
->
alpha_size
&&
!
new
->
alpha_size
)
||
(
!
old
->
alpha_size
&&
new
->
alpha_size
)
if
((
old
->
alpha_size
&&
!
new
->
alpha_size
)
||
(
!
old
->
alpha_size
&&
new
->
alpha_size
)
||
!
(
new
->
flags
&
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
))
||
!
(
target
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
))
context_invalidate_state
(
context
,
STATE_RENDER
(
WINED3D_RS_ALPHABLENDENABLE
));
context_invalidate_state
(
context
,
STATE_RENDER
(
WINED3D_RS_ALPHABLENDENABLE
));
/* Update sRGB writing when switching between formats that do/do not support sRGB writing */
/* Update sRGB writing when switching between formats that do/do not support sRGB writing */
if
((
old
->
flags
&
WINED3DFMT_FLAG_SRGB_WRITE
)
!=
(
new
->
flags
&
WINED3DFMT_FLAG_SRGB_WRITE
))
if
((
context
->
current_rt
->
resource
.
format_flags
&
WINED3DFMT_FLAG_SRGB_WRITE
)
!=
(
target
->
resource
.
format_flags
&
WINED3DFMT_FLAG_SRGB_WRITE
))
context_invalidate_state
(
context
,
STATE_RENDER
(
WINED3D_RS_SRGBWRITEENABLE
));
context_invalidate_state
(
context
,
STATE_RENDER
(
WINED3D_RS_SRGBWRITEENABLE
));
}
}
...
...
dlls/wined3d/cs.c
View file @
9076612e
...
@@ -649,13 +649,15 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
...
@@ -649,13 +649,15 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
{
{
const
struct
wined3d_format
*
new_format
=
op
->
texture
->
resource
.
format
;
const
struct
wined3d_format
*
new_format
=
op
->
texture
->
resource
.
format
;
const
struct
wined3d_format
*
old_format
=
prev
?
prev
->
resource
.
format
:
NULL
;
const
struct
wined3d_format
*
old_format
=
prev
?
prev
->
resource
.
format
:
NULL
;
unsigned
int
old_fmt_flags
=
prev
?
prev
->
resource
.
format_flags
:
0
;
unsigned
int
new_fmt_flags
=
op
->
texture
->
resource
.
format_flags
;
if
(
InterlockedIncrement
(
&
op
->
texture
->
resource
.
bind_count
)
==
1
)
if
(
InterlockedIncrement
(
&
op
->
texture
->
resource
.
bind_count
)
==
1
)
op
->
texture
->
sampler
=
op
->
stage
;
op
->
texture
->
sampler
=
op
->
stage
;
if
(
!
prev
||
op
->
texture
->
target
!=
prev
->
target
if
(
!
prev
||
op
->
texture
->
target
!=
prev
->
target
||
!
is_same_fixup
(
new_format
->
color_fixup
,
old_format
->
color_fixup
)
||
!
is_same_fixup
(
new_format
->
color_fixup
,
old_format
->
color_fixup
)
||
(
new_f
ormat
->
flags
&
WINED3DFMT_FLAG_SHADOW
)
!=
(
old_format
->
flags
&
WINED3DFMT_FLAG_SHADOW
))
||
(
new_f
mt_flags
&
WINED3DFMT_FLAG_SHADOW
)
!=
(
old_fmt_
flags
&
WINED3DFMT_FLAG_SHADOW
))
device_invalidate_state
(
cs
->
device
,
STATE_SHADER
(
WINED3D_SHADER_TYPE_PIXEL
));
device_invalidate_state
(
cs
->
device
,
STATE_SHADER
(
WINED3D_SHADER_TYPE_PIXEL
));
if
(
!
prev
&&
op
->
stage
<
d3d_info
->
limits
.
ffp_blend_stages
)
if
(
!
prev
&&
op
->
stage
<
d3d_info
->
limits
.
ffp_blend_stages
)
...
...
dlls/wined3d/device.c
View file @
9076612e
...
@@ -1925,7 +1925,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
...
@@ -1925,7 +1925,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
struct
wined3d_surface
*
depth_stencil
,
*
surface
;
struct
wined3d_surface
*
depth_stencil
,
*
surface
;
if
(
!
texture
||
texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE
if
(
!
texture
||
texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE
||
!
(
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_DEPTH
))
||
!
(
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_DEPTH
))
return
;
return
;
surface
=
surface_from_resource
(
texture
->
sub_resources
[
0
]);
surface
=
surface_from_resource
(
texture
->
sub_resources
[
0
]);
if
(
!
(
depth_stencil
=
wined3d_rendertarget_view_get_surface
(
state
->
fb
->
depth_stencil
)))
if
(
!
(
depth_stencil
=
wined3d_rendertarget_view_get_surface
(
state
->
fb
->
depth_stencil
)))
...
@@ -3674,7 +3674,7 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
...
@@ -3674,7 +3674,7 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
}
}
texture
=
state
->
textures
[
i
];
texture
=
state
->
textures
[
i
];
if
(
!
texture
||
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_FILTERING
)
continue
;
if
(
!
texture
||
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_FILTERING
)
continue
;
if
(
state
->
sampler_states
[
i
][
WINED3D_SAMP_MAG_FILTER
]
!=
WINED3D_TEXF_POINT
)
if
(
state
->
sampler_states
[
i
][
WINED3D_SAMP_MAG_FILTER
]
!=
WINED3D_TEXF_POINT
)
{
{
...
...
dlls/wined3d/resource.c
View file @
9076612e
...
@@ -81,29 +81,12 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
...
@@ -81,29 +81,12 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
const
struct
wined3d
*
d3d
=
device
->
wined3d
;
const
struct
wined3d
*
d3d
=
device
->
wined3d
;
resource_check_usage
(
usage
);
resource_check_usage
(
usage
);
if
(
pool
!=
WINED3D_POOL_SCRATCH
&&
type
!=
WINED3D_RTYPE_BUFFER
)
{
if
((
usage
&
WINED3DUSAGE_RENDERTARGET
)
&&
!
(
format
->
flags
&
WINED3DFMT_FLAG_RENDERTARGET
))
{
WARN
(
"Format %s cannot be used for render targets.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
if
((
usage
&
WINED3DUSAGE_DEPTHSTENCIL
)
&&
!
(
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
)))
{
WARN
(
"Format %s cannot be used for depth/stencil buffers.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
if
((
usage
&
WINED3DUSAGE_TEXTURE
)
&&
!
(
format
->
flags
&
WINED3DFMT_FLAG_TEXTURE
))
{
WARN
(
"Format %s cannot be used for texturing.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
}
resource
->
ref
=
1
;
resource
->
ref
=
1
;
resource
->
device
=
device
;
resource
->
device
=
device
;
resource
->
type
=
type
;
resource
->
type
=
type
;
resource
->
format
=
format
;
resource
->
format
=
format
;
resource
->
format_flags
=
format
->
flags
;
resource
->
multisample_type
=
multisample_type
;
resource
->
multisample_type
=
multisample_type
;
resource
->
multisample_quality
=
multisample_quality
;
resource
->
multisample_quality
=
multisample_quality
;
resource
->
usage
=
usage
;
resource
->
usage
=
usage
;
...
@@ -121,6 +104,26 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
...
@@ -121,6 +104,26 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource
->
resource_ops
=
resource_ops
;
resource
->
resource_ops
=
resource_ops
;
resource
->
map_binding
=
WINED3D_LOCATION_SYSMEM
;
resource
->
map_binding
=
WINED3D_LOCATION_SYSMEM
;
if
(
pool
!=
WINED3D_POOL_SCRATCH
&&
type
!=
WINED3D_RTYPE_BUFFER
)
{
if
((
usage
&
WINED3DUSAGE_RENDERTARGET
)
&&
!
(
resource
->
format_flags
&
WINED3DFMT_FLAG_RENDERTARGET
))
{
WARN
(
"Format %s cannot be used for render targets.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
if
((
usage
&
WINED3DUSAGE_DEPTHSTENCIL
)
&&
!
(
resource
->
format_flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
)))
{
WARN
(
"Format %s cannot be used for depth/stencil buffers.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
if
((
usage
&
WINED3DUSAGE_TEXTURE
)
&&
!
(
resource
->
format_flags
&
WINED3DFMT_FLAG_TEXTURE
))
{
WARN
(
"Format %s cannot be used for texturing.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
}
}
if
(
size
)
if
(
size
)
{
{
if
(
!
wined3d_resource_allocate_sysmem
(
resource
))
if
(
!
wined3d_resource_allocate_sysmem
(
resource
))
...
...
dlls/wined3d/shader.c
View file @
9076612e
...
@@ -2459,7 +2459,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
...
@@ -2459,7 +2459,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
}
}
args
->
color_fixup
[
i
]
=
texture
->
resource
.
format
->
color_fixup
;
args
->
color_fixup
[
i
]
=
texture
->
resource
.
format
->
color_fixup
;
if
(
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_SHADOW
)
if
(
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_SHADOW
)
args
->
shadow
|=
1
<<
i
;
args
->
shadow
|=
1
<<
i
;
/* Flag samplers that need NP2 texcoord fixup. */
/* Flag samplers that need NP2 texcoord fixup. */
...
...
dlls/wined3d/state.c
View file @
9076612e
...
@@ -3632,11 +3632,11 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
...
@@ -3632,11 +3632,11 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
&&
sampler_states
[
WINED3D_SAMP_MIP_FILTER
]
!=
WINED3D_TEXF_ANISOTROPIC
)
&&
sampler_states
[
WINED3D_SAMP_MIP_FILTER
]
!=
WINED3D_TEXF_ANISOTROPIC
)
||
(
texture
->
flags
&
WINED3D_TEXTURE_COND_NP2
))
||
(
texture
->
flags
&
WINED3D_TEXTURE_COND_NP2
))
desc
->
max_anisotropy
=
1
;
desc
->
max_anisotropy
=
1
;
desc
->
compare
=
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_SHADOW
;
desc
->
compare
=
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_SHADOW
;
desc
->
comparison_func
=
WINED3D_CMP_LESSEQUAL
;
desc
->
comparison_func
=
WINED3D_CMP_LESSEQUAL
;
desc
->
srgb_decode
=
sampler_states
[
WINED3D_SAMP_SRGB_TEXTURE
];
desc
->
srgb_decode
=
sampler_states
[
WINED3D_SAMP_SRGB_TEXTURE
];
if
(
!
(
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_FILTERING
))
if
(
!
(
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_FILTERING
))
{
{
desc
->
mag_filter
=
WINED3D_TEXF_POINT
;
desc
->
mag_filter
=
WINED3D_TEXF_POINT
;
desc
->
min_filter
=
WINED3D_TEXF_POINT
;
desc
->
min_filter
=
WINED3D_TEXF_POINT
;
...
...
dlls/wined3d/surface.c
View file @
9076612e
...
@@ -359,6 +359,7 @@ static void get_color_masks(const struct wined3d_format *format, DWORD *masks)
...
@@ -359,6 +359,7 @@ static void get_color_masks(const struct wined3d_format *format, DWORD *masks)
static
HRESULT
surface_create_dib_section
(
struct
wined3d_surface
*
surface
)
static
HRESULT
surface_create_dib_section
(
struct
wined3d_surface
*
surface
)
{
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
unsigned
int
format_flags
=
surface
->
resource
.
format_flags
;
SYSTEM_INFO
sysInfo
;
SYSTEM_INFO
sysInfo
;
BITMAPINFO
*
b_info
;
BITMAPINFO
*
b_info
;
int
extraline
=
0
;
int
extraline
=
0
;
...
@@ -366,7 +367,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
...
@@ -366,7 +367,7 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
TRACE
(
"surface %p.
\n
"
,
surface
);
TRACE
(
"surface %p.
\n
"
,
surface
);
if
(
!
(
format
->
flags
&
WINED3DFMT_FLAG_GETDC
))
if
(
!
(
format
_
flags
&
WINED3DFMT_FLAG_GETDC
))
{
{
WARN
(
"Cannot use GetDC on a %s surface.
\n
"
,
debug_d3dformat
(
format
->
id
));
WARN
(
"Cannot use GetDC on a %s surface.
\n
"
,
debug_d3dformat
(
format
->
id
));
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
...
@@ -664,7 +665,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
...
@@ -664,7 +665,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
if
(
pow2Width
>
surface
->
resource
.
width
||
pow2Height
>
surface
->
resource
.
height
)
if
(
pow2Width
>
surface
->
resource
.
width
||
pow2Height
>
surface
->
resource
.
height
)
{
{
/* TODO: Add support for non power two compressed textures. */
/* TODO: Add support for non power two compressed textures. */
if
(
surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_HEIGHT_SCALE
))
if
(
surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_COMPRESSED
|
WINED3DFMT_FLAG_HEIGHT_SCALE
))
{
{
FIXME
(
"(%p) Compressed or height scaled non-power-two textures are not supported w(%d) h(%d)
\n
"
,
FIXME
(
"(%p) Compressed or height scaled non-power-two textures are not supported w(%d) h(%d)
\n
"
,
surface
,
surface
->
resource
.
width
,
surface
->
resource
.
height
);
surface
,
surface
->
resource
.
width
,
surface
->
resource
.
height
);
...
@@ -751,7 +752,7 @@ static void surface_unmap(struct wined3d_surface *surface)
...
@@ -751,7 +752,7 @@ static void surface_unmap(struct wined3d_surface *surface)
if
(
surface
->
container
->
swapchain
&&
surface
->
container
->
swapchain
->
front_buffer
==
surface
->
container
)
if
(
surface
->
container
->
swapchain
&&
surface
->
container
->
swapchain
->
front_buffer
==
surface
->
container
)
surface_load_location
(
surface
,
surface
->
container
->
resource
.
draw_binding
);
surface_load_location
(
surface
,
surface
->
container
->
resource
.
draw_binding
);
else
if
(
surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
))
else
if
(
surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
))
FIXME
(
"Depth / stencil buffer locking is not implemented.
\n
"
);
FIXME
(
"Depth / stencil buffer locking is not implemented.
\n
"
);
}
}
...
@@ -779,8 +780,8 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
...
@@ -779,8 +780,8 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device,
TRACE
(
"dst_surface %p, dst_location %s, dst_rect %s.
\n
"
,
TRACE
(
"dst_surface %p, dst_location %s, dst_rect %s.
\n
"
,
dst_surface
,
wined3d_debug_location
(
dst_location
),
wine_dbgstr_rect
(
dst_rect
));
dst_surface
,
wined3d_debug_location
(
dst_location
),
wine_dbgstr_rect
(
dst_rect
));
src_mask
=
src_surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
src_mask
=
src_surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
dst_mask
=
dst_surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
dst_mask
=
dst_surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
if
(
src_mask
!=
dst_mask
)
if
(
src_mask
!=
dst_mask
)
{
{
...
@@ -1276,7 +1277,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
...
@@ -1276,7 +1277,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
surface_get_memory
(
surface
,
&
data
,
dst_location
);
surface_get_memory
(
surface
,
&
data
,
dst_location
);
if
(
format
->
flags
&
WINED3DFMT_FLAG_COMPRESSED
)
if
(
surface
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_COMPRESSED
)
{
{
TRACE
(
"(%p) : Calling glGetCompressedTexImage level %d, format %#x, type %#x, data %p.
\n
"
,
TRACE
(
"(%p) : Calling glGetCompressedTexImage level %d, format %#x, type %#x, data %p.
\n
"
,
surface
,
surface
->
texture_level
,
format
->
glFormat
,
format
->
glType
,
data
.
addr
);
surface
,
surface
->
texture_level
,
format
->
glFormat
,
format
->
glType
,
data
.
addr
);
...
@@ -1549,6 +1550,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
...
@@ -1549,6 +1550,7 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
{
{
const
struct
wined3d_format
*
src_format
;
const
struct
wined3d_format
*
src_format
;
const
struct
wined3d_format
*
dst_format
;
const
struct
wined3d_format
*
dst_format
;
unsigned
int
src_fmt_flags
,
dst_fmt_flags
;
const
struct
wined3d_gl_info
*
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
;
struct
wined3d_context
*
context
;
struct
wined3d_context
*
context
;
struct
wined3d_bo_address
data
;
struct
wined3d_bo_address
data
;
...
@@ -1564,6 +1566,8 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
...
@@ -1564,6 +1566,8 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
src_format
=
src_surface
->
resource
.
format
;
src_format
=
src_surface
->
resource
.
format
;
dst_format
=
dst_surface
->
resource
.
format
;
dst_format
=
dst_surface
->
resource
.
format
;
src_fmt_flags
=
src_surface
->
resource
.
format_flags
;
dst_fmt_flags
=
dst_surface
->
resource
.
format_flags
;
if
(
src_format
->
id
!=
dst_format
->
id
)
if
(
src_format
->
id
!=
dst_format
->
id
)
{
{
...
@@ -1611,14 +1615,14 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
...
@@ -1611,14 +1615,14 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
if
((
src_f
ormat
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
surface_check_block_align
(
src_surface
,
src_rect
))
if
((
src_f
mt_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
surface_check_block_align
(
src_surface
,
src_rect
))
{
{
WARN
(
"Source rectangle not block-aligned.
\n
"
);
WARN
(
"Source rectangle not block-aligned.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
SetRect
(
&
dst_rect
,
dst_point
->
x
,
dst_point
->
y
,
dst_point
->
x
+
update_w
,
dst_point
->
y
+
update_h
);
SetRect
(
&
dst_rect
,
dst_point
->
x
,
dst_point
->
y
,
dst_point
->
x
+
update_w
,
dst_point
->
y
+
update_h
);
if
((
dst_f
ormat
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
surface_check_block_align
(
dst_surface
,
&
dst_rect
))
if
((
dst_f
mt_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
surface_check_block_align
(
dst_surface
,
&
dst_rect
))
{
{
WARN
(
"Destination rectangle not block-aligned.
\n
"
);
WARN
(
"Destination rectangle not block-aligned.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
...
@@ -2507,6 +2511,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
...
@@ -2507,6 +2511,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
struct
wined3d_map_desc
*
map_desc
,
const
RECT
*
rect
,
DWORD
flags
)
struct
wined3d_map_desc
*
map_desc
,
const
RECT
*
rect
,
DWORD
flags
)
{
{
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
const
struct
wined3d_format
*
format
=
surface
->
resource
.
format
;
unsigned
int
fmt_flags
=
surface
->
resource
.
format_flags
;
struct
wined3d_device
*
device
=
surface
->
resource
.
device
;
struct
wined3d_device
*
device
=
surface
->
resource
.
device
;
struct
wined3d_context
*
context
;
struct
wined3d_context
*
context
;
const
struct
wined3d_gl_info
*
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
;
...
@@ -2521,7 +2526,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
...
@@ -2521,7 +2526,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
if
((
f
ormat
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
rect
if
((
f
mt_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
rect
&&
!
surface_check_block_align
(
surface
,
rect
))
&&
!
surface_check_block_align
(
surface
,
rect
))
{
{
WARN
(
"Map rect %s is misaligned for %ux%u blocks.
\n
"
,
WARN
(
"Map rect %s is misaligned for %ux%u blocks.
\n
"
,
...
@@ -2600,7 +2605,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
...
@@ -2600,7 +2605,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
base_memory
=
NULL
;
base_memory
=
NULL
;
}
}
if
(
f
ormat
->
flags
&
WINED3DFMT_FLAG_BROKEN_PITCH
)
if
(
f
mt_
flags
&
WINED3DFMT_FLAG_BROKEN_PITCH
)
map_desc
->
row_pitch
=
surface
->
resource
.
width
*
format
->
byte_count
;
map_desc
->
row_pitch
=
surface
->
resource
.
width
*
format
->
byte_count
;
else
else
map_desc
->
row_pitch
=
wined3d_surface_get_pitch
(
surface
);
map_desc
->
row_pitch
=
wined3d_surface_get_pitch
(
surface
);
...
@@ -2616,7 +2621,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
...
@@ -2616,7 +2621,7 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
}
}
else
else
{
{
if
((
f
ormat
->
flags
&
(
WINED3DFMT_FLAG_BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
if
((
f
mt_
flags
&
(
WINED3DFMT_FLAG_BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
{
{
/* Compressed textures are block based, so calculate the offset of
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
* the block that contains the top-left pixel of the locked rectangle. */
...
@@ -3981,7 +3986,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
...
@@ -3981,7 +3986,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
}
if
(
surface
->
locations
&
(
WINED3D_LOCATION_TEXTURE_SRGB
|
WINED3D_LOCATION_TEXTURE_RGB
)
if
(
surface
->
locations
&
(
WINED3D_LOCATION_TEXTURE_SRGB
|
WINED3D_LOCATION_TEXTURE_RGB
)
&&
(
surface
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB
)
&&
(
surface
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB
)
&&
fbo_blit_supported
(
gl_info
,
WINED3D_BLIT_OP_COLOR_BLIT
,
&&
fbo_blit_supported
(
gl_info
,
WINED3D_BLIT_OP_COLOR_BLIT
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
))
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
))
...
@@ -3997,7 +4002,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
...
@@ -3997,7 +4002,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
}
}
if
(
surface
->
locations
&
(
WINED3D_LOCATION_RB_MULTISAMPLE
|
WINED3D_LOCATION_RB_RESOLVED
)
if
(
surface
->
locations
&
(
WINED3D_LOCATION_RB_MULTISAMPLE
|
WINED3D_LOCATION_RB_RESOLVED
)
&&
(
!
srgb
||
(
surface
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB
))
&&
(
!
srgb
||
(
surface
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB
))
&&
fbo_blit_supported
(
gl_info
,
WINED3D_BLIT_OP_COLOR_BLIT
,
&&
fbo_blit_supported
(
gl_info
,
WINED3D_BLIT_OP_COLOR_BLIT
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
,
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
))
NULL
,
surface
->
resource
.
usage
,
surface
->
resource
.
pool
,
surface
->
resource
.
format
))
...
@@ -4554,6 +4559,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
...
@@ -4554,6 +4559,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
{
{
int
bpp
,
srcheight
,
srcwidth
,
dstheight
,
dstwidth
,
width
;
int
bpp
,
srcheight
,
srcwidth
,
dstheight
,
dstwidth
,
width
;
const
struct
wined3d_format
*
src_format
,
*
dst_format
;
const
struct
wined3d_format
*
src_format
,
*
dst_format
;
unsigned
int
src_fmt_flags
,
dst_fmt_flags
;
struct
wined3d_texture
*
src_texture
=
NULL
;
struct
wined3d_texture
*
src_texture
=
NULL
;
struct
wined3d_map_desc
dst_map
,
src_map
;
struct
wined3d_map_desc
dst_map
,
src_map
;
const
BYTE
*
sbase
=
NULL
;
const
BYTE
*
sbase
=
NULL
;
...
@@ -4572,10 +4578,13 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
...
@@ -4572,10 +4578,13 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
src_map
=
dst_map
;
src_map
=
dst_map
;
src_format
=
dst_surface
->
resource
.
format
;
src_format
=
dst_surface
->
resource
.
format
;
dst_format
=
src_format
;
dst_format
=
src_format
;
dst_fmt_flags
=
dst_surface
->
resource
.
format_flags
;
src_fmt_flags
=
dst_fmt_flags
;
}
}
else
else
{
{
dst_format
=
dst_surface
->
resource
.
format
;
dst_format
=
dst_surface
->
resource
.
format
;
dst_fmt_flags
=
dst_surface
->
resource
.
format_flags
;
if
(
src_surface
)
if
(
src_surface
)
{
{
if
(
dst_surface
->
resource
.
format
->
id
!=
src_surface
->
resource
.
format
->
id
)
if
(
dst_surface
->
resource
.
format
->
id
!=
src_surface
->
resource
.
format
->
id
)
...
@@ -4590,10 +4599,12 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
...
@@ -4590,10 +4599,12 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
}
}
wined3d_surface_map
(
src_surface
,
&
src_map
,
NULL
,
WINED3D_MAP_READONLY
);
wined3d_surface_map
(
src_surface
,
&
src_map
,
NULL
,
WINED3D_MAP_READONLY
);
src_format
=
src_surface
->
resource
.
format
;
src_format
=
src_surface
->
resource
.
format
;
src_fmt_flags
=
src_surface
->
resource
.
format_flags
;
}
}
else
else
{
{
src_format
=
dst_format
;
src_format
=
dst_format
;
src_fmt_flags
=
dst_fmt_flags
;
}
}
wined3d_surface_map
(
dst_surface
,
&
dst_map
,
dst_rect
,
0
);
wined3d_surface_map
(
dst_surface
,
&
dst_map
,
dst_rect
,
0
);
...
@@ -4617,7 +4628,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
...
@@ -4617,7 +4628,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
+
((
dst_rect
->
top
/
dst_format
->
block_height
)
*
dst_map
.
row_pitch
)
+
((
dst_rect
->
top
/
dst_format
->
block_height
)
*
dst_map
.
row_pitch
)
+
((
dst_rect
->
left
/
dst_format
->
block_width
)
*
dst_format
->
block_byte_count
);
+
((
dst_rect
->
left
/
dst_format
->
block_width
)
*
dst_format
->
block_byte_count
);
if
(
src_f
ormat
->
flags
&
dst_format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
if
(
src_f
mt_flags
&
dst_fmt_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
{
{
TRACE
(
"%s -> %s copy.
\n
"
,
debug_d3dformat
(
src_format
->
id
),
debug_d3dformat
(
dst_format
->
id
));
TRACE
(
"%s -> %s copy.
\n
"
,
debug_d3dformat
(
src_format
->
id
),
debug_d3dformat
(
dst_format
->
id
));
...
@@ -5227,9 +5238,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
...
@@ -5227,9 +5238,9 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
||
src_rect
.
bottom
-
src_rect
.
top
!=
dst_rect
.
bottom
-
dst_rect
.
top
);
||
src_rect
.
bottom
-
src_rect
.
top
!=
dst_rect
.
bottom
-
dst_rect
.
top
);
convert
=
src_surface
&&
src_surface
->
resource
.
format
->
id
!=
dst_surface
->
resource
.
format
->
id
;
convert
=
src_surface
&&
src_surface
->
resource
.
format
->
id
!=
dst_surface
->
resource
.
format
->
id
;
dst_ds_flags
=
dst_surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
dst_ds_flags
=
dst_surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
if
(
src_surface
)
if
(
src_surface
)
src_ds_flags
=
src_surface
->
resource
.
format
->
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
src_ds_flags
=
src_surface
->
resource
.
format
_
flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
);
else
else
src_ds_flags
=
0
;
src_ds_flags
=
0
;
...
...
dlls/wined3d/texture.c
View file @
9076612e
...
@@ -865,7 +865,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
...
@@ -865,7 +865,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
GLsizei
width
=
surface
->
pow2Width
;
GLsizei
width
=
surface
->
pow2Width
;
const
BYTE
*
mem
=
NULL
;
const
BYTE
*
mem
=
NULL
;
if
(
format
->
flags
&
WINED3DFMT_FLAG_HEIGHT_SCALE
)
if
(
texture
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_HEIGHT_SCALE
)
{
{
height
*=
format
->
height_scale
.
numerator
;
height
*=
format
->
height_scale
.
numerator
;
height
/=
format
->
height_scale
.
denominator
;
height
/=
format
->
height_scale
.
denominator
;
...
@@ -898,7 +898,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
...
@@ -898,7 +898,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
}
}
}
}
if
(
format
->
flags
&
WINED3DFMT_FLAG_COMPRESSED
&&
mem
)
if
(
texture
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_COMPRESSED
&&
mem
)
{
{
GL_EXTCALL
(
glCompressedTexImage2D
(
surface
->
texture_target
,
surface
->
texture_level
,
GL_EXTCALL
(
glCompressedTexImage2D
(
surface
->
texture_target
,
surface
->
texture_level
,
internal
,
width
,
height
,
0
,
surface
->
resource
.
size
,
mem
));
internal
,
width
,
height
,
0
,
surface
->
resource
.
size
,
mem
));
...
...
dlls/wined3d/volume.c
View file @
9076612e
...
@@ -44,7 +44,7 @@ void wined3d_volume_get_pitch(const struct wined3d_volume *volume, UINT *row_pit
...
@@ -44,7 +44,7 @@ void wined3d_volume_get_pitch(const struct wined3d_volume *volume, UINT *row_pit
{
{
const
struct
wined3d_format
*
format
=
volume
->
resource
.
format
;
const
struct
wined3d_format
*
format
=
volume
->
resource
.
format
;
if
(
format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
if
(
volume
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
{
{
/* Since compressed formats are block based, pitch means the amount of
/* 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. */
* bytes to the next row of block rather than the next row of pixels. */
...
@@ -89,7 +89,7 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
...
@@ -89,7 +89,7 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
if
(
data
->
buffer_object
)
if
(
data
->
buffer_object
)
ERR
(
"Loading a converted volume from a PBO.
\n
"
);
ERR
(
"Loading a converted volume from a PBO.
\n
"
);
if
(
format
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
if
(
volume
->
resource
.
format_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
ERR
(
"Converting a block-based format.
\n
"
);
ERR
(
"Converting a block-based format.
\n
"
);
dst_row_pitch
=
width
*
format
->
conv_byte_count
;
dst_row_pitch
=
width
*
format
->
conv_byte_count
;
...
@@ -551,6 +551,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
...
@@ -551,6 +551,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
const
struct
wined3d_gl_info
*
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
;
BYTE
*
base_memory
;
BYTE
*
base_memory
;
const
struct
wined3d_format
*
format
=
volume
->
resource
.
format
;
const
struct
wined3d_format
*
format
=
volume
->
resource
.
format
;
const
unsigned
int
fmt_flags
=
volume
->
resource
.
format_flags
;
TRACE
(
"volume %p, map_desc %p, box %p, flags %#x.
\n
"
,
TRACE
(
"volume %p, map_desc %p, box %p, flags %#x.
\n
"
,
volume
,
map_desc
,
box
,
flags
);
volume
,
map_desc
,
box
,
flags
);
...
@@ -571,7 +572,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
...
@@ -571,7 +572,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
WARN
(
"Map box is invalid.
\n
"
);
WARN
(
"Map box is invalid.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
if
((
f
ormat
->
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
volume_check_block_align
(
volume
,
box
))
if
((
f
mt_
flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
volume_check_block_align
(
volume
,
box
))
{
{
WARN
(
"Map box is misaligned for %ux%u blocks.
\n
"
,
WARN
(
"Map box is misaligned for %ux%u blocks.
\n
"
,
format
->
block_width
,
format
->
block_height
);
format
->
block_width
,
format
->
block_height
);
...
@@ -635,7 +636,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
...
@@ -635,7 +636,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
TRACE
(
"Base memory pointer %p.
\n
"
,
base_memory
);
TRACE
(
"Base memory pointer %p.
\n
"
,
base_memory
);
if
(
f
ormat
->
flags
&
WINED3DFMT_FLAG_BROKEN_PITCH
)
if
(
f
mt_
flags
&
WINED3DFMT_FLAG_BROKEN_PITCH
)
{
{
map_desc
->
row_pitch
=
volume
->
resource
.
width
*
format
->
byte_count
;
map_desc
->
row_pitch
=
volume
->
resource
.
width
*
format
->
byte_count
;
map_desc
->
slice_pitch
=
map_desc
->
row_pitch
*
volume
->
resource
.
height
;
map_desc
->
slice_pitch
=
map_desc
->
row_pitch
*
volume
->
resource
.
height
;
...
@@ -655,7 +656,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
...
@@ -655,7 +656,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
TRACE
(
"Lock Box (%p) = l %u, t %u, r %u, b %u, fr %u, ba %u
\n
"
,
TRACE
(
"Lock Box (%p) = l %u, t %u, r %u, b %u, fr %u, ba %u
\n
"
,
box
,
box
->
left
,
box
->
top
,
box
->
right
,
box
->
bottom
,
box
->
front
,
box
->
back
);
box
,
box
->
left
,
box
->
top
,
box
->
right
,
box
->
bottom
,
box
->
front
,
box
->
back
);
if
((
f
ormat
->
flags
&
(
WINED3DFMT_FLAG_BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
if
((
f
mt_
flags
&
(
WINED3DFMT_FLAG_BLOCKS
|
WINED3DFMT_FLAG_BROKEN_PITCH
))
==
WINED3DFMT_FLAG_BLOCKS
)
{
{
/* Compressed textures are block based, so calculate the offset of
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
* the block that contains the top-left pixel of the locked rectangle. */
...
...
dlls/wined3d/wined3d_private.h
View file @
9076612e
...
@@ -2108,6 +2108,7 @@ struct wined3d_resource
...
@@ -2108,6 +2108,7 @@ struct wined3d_resource
struct
wined3d_device
*
device
;
struct
wined3d_device
*
device
;
enum
wined3d_resource_type
type
;
enum
wined3d_resource_type
type
;
const
struct
wined3d_format
*
format
;
const
struct
wined3d_format
*
format
;
unsigned
int
format_flags
;
enum
wined3d_multisample_type
multisample_type
;
enum
wined3d_multisample_type
multisample_type
;
UINT
multisample_quality
;
UINT
multisample_quality
;
DWORD
usage
;
DWORD
usage
;
...
...
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