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
Expand all
Hide 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,
if
(
depth_stencil
)
{
DWORD
format_flags
=
depth_stencil
->
resource
.
format
->
flags
;
DWORD
format_flags
=
depth_stencil
->
resource
.
format
_
flags
;
if
(
depth_stencil
->
current_renderbuffer
)
{
...
...
@@ -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. */
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
));
/* 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
));
}
...
...
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)
{
const
struct
wined3d_format
*
new_format
=
op
->
texture
->
resource
.
format
;
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
)
op
->
texture
->
sampler
=
op
->
stage
;
if
(
!
prev
||
op
->
texture
->
target
!=
prev
->
target
||
!
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
));
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)
struct
wined3d_surface
*
depth_stencil
,
*
surface
;
if
(
!
texture
||
texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE
||
!
(
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_DEPTH
))
||
!
(
texture
->
resource
.
format
_
flags
&
WINED3DFMT_FLAG_DEPTH
))
return
;
surface
=
surface_from_resource
(
texture
->
sub_resources
[
0
]);
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
}
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
)
{
...
...
dlls/wined3d/resource.c
View file @
9076612e
...
...
@@ -81,29 +81,12 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
const
struct
wined3d
*
d3d
=
device
->
wined3d
;
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
->
device
=
device
;
resource
->
type
=
type
;
resource
->
format
=
format
;
resource
->
format_flags
=
format
->
flags
;
resource
->
multisample_type
=
multisample_type
;
resource
->
multisample_quality
=
multisample_quality
;
resource
->
usage
=
usage
;
...
...
@@ -121,6 +104,26 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource
->
resource_ops
=
resource_ops
;
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
(
!
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
}
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
;
/* 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
&&
sampler_states
[
WINED3D_SAMP_MIP_FILTER
]
!=
WINED3D_TEXF_ANISOTROPIC
)
||
(
texture
->
flags
&
WINED3D_TEXTURE_COND_NP2
))
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
->
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
->
min_filter
=
WINED3D_TEXF_POINT
;
...
...
dlls/wined3d/surface.c
View file @
9076612e
This diff is collapsed.
Click to expand it.
dlls/wined3d/texture.c
View file @
9076612e
...
...
@@ -865,7 +865,7 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
GLsizei
width
=
surface
->
pow2Width
;
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
.
denominator
;
...
...
@@ -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
,
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
{
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
* 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
if
(
data
->
buffer_object
)
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
"
);
dst_row_pitch
=
width
*
format
->
conv_byte_count
;
...
...
@@ -551,6 +551,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
const
struct
wined3d_gl_info
*
gl_info
;
BYTE
*
base_memory
;
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
"
,
volume
,
map_desc
,
box
,
flags
);
...
...
@@ -571,7 +572,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
WARN
(
"Map box is invalid.
\n
"
);
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
"
,
format
->
block_width
,
format
->
block_height
);
...
...
@@ -635,7 +636,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
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
->
slice_pitch
=
map_desc
->
row_pitch
*
volume
->
resource
.
height
;
...
...
@@ -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
"
,
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
* 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
struct
wined3d_device
*
device
;
enum
wined3d_resource_type
type
;
const
struct
wined3d_format
*
format
;
unsigned
int
format_flags
;
enum
wined3d_multisample_type
multisample_type
;
UINT
multisample_quality
;
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