Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
16e8625a
There was an error fetching the commit references. Please try again later.
Commit
16e8625a
authored
5 years ago
by
ReinUsesLisp
Browse files
Options
Downloads
Patches
Plain Diff
surface_base: Split BreakDown into layered and non-layered variants
parent
2b30000a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/video_core/texture_cache/surface_base.h
+48
-45
48 additions, 45 deletions
src/video_core/texture_cache/surface_base.h
with
48 additions
and
45 deletions
src/video_core/texture_cache/surface_base.h
+
48
−
45
View file @
16e8625a
...
@@ -106,32 +106,32 @@ public:
...
@@ -106,32 +106,32 @@ public:
}
}
bool
MatchesTopology
(
const
SurfaceParams
&
rhs
)
const
{
bool
MatchesTopology
(
const
SurfaceParams
&
rhs
)
const
{
const
u32
src_bpp
=
params
.
GetBytesPerPixel
();
const
u32
src_bpp
{
params
.
GetBytesPerPixel
()
}
;
const
u32
dst_bpp
=
rhs
.
GetBytesPerPixel
();
const
u32
dst_bpp
{
rhs
.
GetBytesPerPixel
()
}
;
return
std
::
tie
(
src_bpp
,
params
.
is_tiled
)
==
std
::
tie
(
dst_bpp
,
rhs
.
is_tiled
);
return
std
::
tie
(
src_bpp
,
params
.
is_tiled
)
==
std
::
tie
(
dst_bpp
,
rhs
.
is_tiled
);
}
}
MatchStructureResult
MatchesStructure
(
const
SurfaceParams
&
rhs
)
const
{
MatchStructureResult
MatchesStructure
(
const
SurfaceParams
&
rhs
)
const
{
if
(
params
.
is_tiled
)
{
if
(
!
params
.
is_tiled
)
{
if
(
std
::
tie
(
params
.
height
,
params
.
depth
,
params
.
block_width
,
params
.
block_height
,
params
.
block_depth
,
params
.
tile_width_spacing
)
==
std
::
tie
(
rhs
.
height
,
rhs
.
depth
,
rhs
.
block_width
,
rhs
.
block_height
,
rhs
.
block_depth
,
rhs
.
tile_width_spacing
))
{
if
(
params
.
width
==
rhs
.
width
)
{
return
MatchStructureResult
::
FullMatch
;
}
if
(
params
.
GetBlockAlignedWidth
()
==
rhs
.
GetBlockAlignedWidth
())
{
return
MatchStructureResult
::
SemiMatch
;
}
}
return
MatchStructureResult
::
None
;
}
else
{
if
(
std
::
tie
(
params
.
width
,
params
.
height
,
params
.
pitch
)
==
if
(
std
::
tie
(
params
.
width
,
params
.
height
,
params
.
pitch
)
==
std
::
tie
(
rhs
.
width
,
rhs
.
height
,
rhs
.
pitch
))
{
std
::
tie
(
rhs
.
width
,
rhs
.
height
,
rhs
.
pitch
))
{
return
MatchStructureResult
::
FullMatch
;
return
MatchStructureResult
::
FullMatch
;
}
}
return
MatchStructureResult
::
None
;
return
MatchStructureResult
::
None
;
}
}
// Tiled surface
if
(
std
::
tie
(
params
.
height
,
params
.
depth
,
params
.
block_width
,
params
.
block_height
,
params
.
block_depth
,
params
.
tile_width_spacing
)
==
std
::
tie
(
rhs
.
height
,
rhs
.
depth
,
rhs
.
block_width
,
rhs
.
block_height
,
rhs
.
block_depth
,
rhs
.
tile_width_spacing
))
{
if
(
params
.
width
==
rhs
.
width
)
{
return
MatchStructureResult
::
FullMatch
;
}
if
(
params
.
GetBlockAlignedWidth
()
==
rhs
.
GetBlockAlignedWidth
())
{
return
MatchStructureResult
::
SemiMatch
;
}
}
return
MatchStructureResult
::
None
;
}
}
std
::
optional
<
std
::
pair
<
u32
,
u32
>>
GetLayerMipmap
(
const
GPUVAddr
candidate_gpu_addr
)
const
{
std
::
optional
<
std
::
pair
<
u32
,
u32
>>
GetLayerMipmap
(
const
GPUVAddr
candidate_gpu_addr
)
const
{
...
@@ -151,35 +151,7 @@ public:
...
@@ -151,35 +151,7 @@ public:
}
}
std
::
vector
<
CopyParams
>
BreakDown
(
const
SurfaceParams
&
in_params
)
const
{
std
::
vector
<
CopyParams
>
BreakDown
(
const
SurfaceParams
&
in_params
)
const
{
std
::
vector
<
CopyParams
>
result
;
return
params
.
is_layered
?
BreakDownLayered
(
in_params
)
:
BreakDownNonLayered
(
in_params
);
const
u32
layers
{
params
.
depth
};
const
u32
mipmaps
{
params
.
num_levels
};
if
(
params
.
is_layered
)
{
result
.
reserve
(
static_cast
<
std
::
size_t
>
(
layers
)
*
static_cast
<
std
::
size_t
>
(
mipmaps
));
for
(
u32
layer
=
0
;
layer
<
layers
;
layer
++
)
{
const
u32
layer_offset
{
layer
*
mipmaps
};
for
(
u32
level
=
0
;
level
<
mipmaps
;
level
++
)
{
const
u32
width
{
std
::
min
(
params
.
GetMipWidth
(
level
),
in_params
.
GetMipWidth
(
level
))};
const
u32
height
{
std
::
min
(
params
.
GetMipHeight
(
level
),
in_params
.
GetMipHeight
(
level
))};
result
.
emplace_back
(
width
,
height
,
layer
,
level
);
}
}
return
result
;
}
else
{
result
.
reserve
(
mipmaps
);
for
(
u32
level
=
0
;
level
<
mipmaps
;
level
++
)
{
const
u32
width
{
std
::
min
(
params
.
GetMipWidth
(
level
),
in_params
.
GetMipWidth
(
level
))};
const
u32
height
{
std
::
min
(
params
.
GetMipHeight
(
level
),
in_params
.
GetMipHeight
(
level
))};
const
u32
depth
{
std
::
min
(
params
.
GetMipDepth
(
level
),
in_params
.
GetMipDepth
(
level
))};
result
.
emplace_back
(
width
,
height
,
depth
,
level
);
}
return
result
;
}
}
}
protected
:
protected
:
...
@@ -203,6 +175,37 @@ protected:
...
@@ -203,6 +175,37 @@ protected:
private
:
private
:
void
SwizzleFunc
(
MortonSwizzleMode
mode
,
u8
*
memory
,
const
SurfaceParams
&
params
,
u8
*
buffer
,
void
SwizzleFunc
(
MortonSwizzleMode
mode
,
u8
*
memory
,
const
SurfaceParams
&
params
,
u8
*
buffer
,
u32
level
);
u32
level
);
std
::
vector
<
CopyParams
>
BreakDownLayered
(
const
SurfaceParams
&
in_params
)
const
{
const
u32
layers
{
params
.
depth
};
const
u32
mipmaps
{
params
.
num_levels
};
std
::
vector
<
CopyParams
>
result
;
result
.
reserve
(
static_cast
<
std
::
size_t
>
(
layers
)
*
static_cast
<
std
::
size_t
>
(
mipmaps
));
for
(
u32
layer
=
0
;
layer
<
layers
;
layer
++
)
{
for
(
u32
level
=
0
;
level
<
mipmaps
;
level
++
)
{
const
u32
width
{
std
::
min
(
params
.
GetMipWidth
(
level
),
in_params
.
GetMipWidth
(
level
))};
const
u32
height
{
std
::
min
(
params
.
GetMipHeight
(
level
),
in_params
.
GetMipHeight
(
level
))};
result
.
emplace_back
(
width
,
height
,
layer
,
level
);
}
}
return
result
;
}
std
::
vector
<
CopyParams
>
BreakDownNonLayered
(
const
SurfaceParams
&
in_params
)
const
{
const
u32
mipmaps
{
params
.
num_levels
};
std
::
vector
<
CopyParams
>
result
;
result
.
reserve
(
mipmaps
);
for
(
u32
level
=
0
;
level
<
mipmaps
;
level
++
)
{
const
u32
width
{
std
::
min
(
params
.
GetMipWidth
(
level
),
in_params
.
GetMipWidth
(
level
))};
const
u32
height
{
std
::
min
(
params
.
GetMipHeight
(
level
),
in_params
.
GetMipHeight
(
level
))};
const
u32
depth
{
std
::
min
(
params
.
GetMipDepth
(
level
),
in_params
.
GetMipDepth
(
level
))};
result
.
emplace_back
(
width
,
height
,
depth
,
level
);
}
return
result
;
}
};
};
template
<
typename
TView
>
template
<
typename
TView
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment