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
97b6405a
There was an error fetching the commit references. Please try again later.
Commit
97b6405a
authored
6 years ago
by
FernandoS27
Browse files
Options
Downloads
Patches
Plain Diff
Implemented helper function to correctly calculate a texture's size
parent
2946d4bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/video_core/textures/decoders.cpp
+16
-0
16 additions, 0 deletions
src/video_core/textures/decoders.cpp
src/video_core/textures/decoders.h
+6
-0
6 additions, 0 deletions
src/video_core/textures/decoders.h
with
22 additions
and
0 deletions
src/video_core/textures/decoders.cpp
+
16
−
0
View file @
97b6405a
...
...
@@ -4,6 +4,7 @@
#include
<cmath>
#include
<cstring>
#include
"common/alignment.h"
#include
"common/assert.h"
#include
"core/memory.h"
#include
"video_core/gpu.h"
...
...
@@ -199,4 +200,19 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
return
rgba_data
;
}
std
::
size_t
CalculateSize
(
bool
tiled
,
u32
bytes_per_pixel
,
u32
width
,
u32
height
,
u32
depth
,
u32
block_height
,
u32
block_depth
)
{
if
(
tiled
)
{
const
u32
gobs_in_x
=
64
/
bytes_per_pixel
;
const
u32
gobs_in_y
=
8
;
const
u32
gobs_in_z
=
1
;
const
u32
aligned_width
=
Common
::
AlignUp
(
width
,
gobs_in_x
);
const
u32
aligned_height
=
Common
::
AlignUp
(
height
,
gobs_in_y
*
block_height
);
const
u32
aligned_depth
=
Common
::
AlignUp
(
depth
,
gobs_in_z
*
block_depth
);
return
aligned_width
*
aligned_height
*
aligned_depth
*
bytes_per_pixel
;
}
else
{
return
width
*
height
*
depth
*
bytes_per_pixel
;
}
}
}
// namespace Tegra::Texture
This diff is collapsed.
Click to expand it.
src/video_core/textures/decoders.h
+
6
−
0
View file @
97b6405a
...
...
@@ -32,4 +32,10 @@ void CopySwizzledData(u32 width, u32 height, u32 bytes_per_pixel, u32 out_bytes_
std
::
vector
<
u8
>
DecodeTexture
(
const
std
::
vector
<
u8
>&
texture_data
,
TextureFormat
format
,
u32
width
,
u32
height
);
/**
* This function calculates the correct size of a texture depending if it's tiled or not.
*/
std
::
size_t
CalculateSize
(
bool
tiled
,
u32
bytes_per_pixel
,
u32
width
,
u32
height
,
u32
depth
,
u32
block_height
,
u32
block_depth
);
}
// namespace Tegra::Texture
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