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
301e2b5b
There was an error fetching the commit references. Please try again later.
Commit
301e2b5b
authored
4 years ago
by
ReinUsesLisp
Browse files
Options
Downloads
Patches
Plain Diff
vulkan_memory_allocator: Remove unnecesary 'device' memory from commits
parent
432f045d
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/vulkan_common/vulkan_memory_allocator.cpp
+10
-10
10 additions, 10 deletions
src/video_core/vulkan_common/vulkan_memory_allocator.cpp
src/video_core/vulkan_common/vulkan_memory_allocator.h
+5
-5
5 additions, 5 deletions
src/video_core/vulkan_common/vulkan_memory_allocator.h
with
15 additions
and
15 deletions
src/video_core/vulkan_common/vulkan_memory_allocator.cpp
+
10
−
10
View file @
301e2b5b
...
...
@@ -71,7 +71,7 @@ public:
.
end
=
*
alloc
+
size
,
};
commits
.
insert
(
std
::
ranges
::
upper_bound
(
commits
,
*
alloc
,
{},
&
Range
::
begin
),
range
);
return
std
::
make_optional
<
MemoryCommit
>
(
device
,
this
,
*
memory
,
*
alloc
,
*
alloc
+
size
);
return
std
::
make_optional
<
MemoryCommit
>
(
this
,
*
memory
,
*
alloc
,
*
alloc
+
size
);
}
void
Free
(
u64
begin
)
{
...
...
@@ -127,9 +127,9 @@ private:
std
::
span
<
u8
>
memory_mapped_span
;
///< Memory mapped span. Empty if not queried before.
};
MemoryCommit
::
MemoryCommit
(
const
Device
&
device_
,
MemoryAllocation
*
allocation_
,
VkDeviceMemory
memory_
,
u64
begin
,
u64
end
)
noexcept
:
device
{
&
device_
},
allocation
{
allocation_
},
memory
{
memory_
},
interval
{
begin
,
end
}
{}
MemoryCommit
::
MemoryCommit
(
MemoryAllocation
*
allocation_
,
VkDeviceMemory
memory_
,
u64
begin_
,
u64
end
_
)
noexcept
:
allocation
{
allocation_
},
memory
{
memory_
},
begin
{
begin
_
}
,
end
{
end_
}
{}
MemoryCommit
::~
MemoryCommit
()
{
Release
();
...
...
@@ -137,28 +137,28 @@ MemoryCommit::~MemoryCommit() {
MemoryCommit
&
MemoryCommit
::
operator
=
(
MemoryCommit
&&
rhs
)
noexcept
{
Release
();
device
=
rhs
.
device
;
allocation
=
std
::
exchange
(
rhs
.
allocation
,
nullptr
);
memory
=
rhs
.
memory
;
interval
=
rhs
.
interval
;
begin
=
rhs
.
begin
;
end
=
rhs
.
end
;
span
=
std
::
exchange
(
rhs
.
span
,
std
::
span
<
u8
>
{});
return
*
this
;
}
MemoryCommit
::
MemoryCommit
(
MemoryCommit
&&
rhs
)
noexcept
:
device
{
rhs
.
device
},
allocation
{
std
::
exchange
(
rhs
.
allocation
,
nullptr
)},
memory
{
rhs
.
memory
},
interval
{
rhs
.
interval
},
span
{
std
::
exchange
(
rhs
.
span
,
std
::
span
<
u8
>
{})}
{}
:
allocation
{
std
::
exchange
(
rhs
.
allocation
,
nullptr
)},
memory
{
rhs
.
memory
},
begin
{
rhs
.
begin
},
end
{
rhs
.
end
},
span
{
std
::
exchange
(
rhs
.
span
,
std
::
span
<
u8
>
{})}
{}
std
::
span
<
u8
>
MemoryCommit
::
Map
()
{
if
(
span
.
empty
())
{
span
=
allocation
->
Map
().
subspan
(
interval
.
first
,
interval
.
second
-
interval
.
first
);
span
=
allocation
->
Map
().
subspan
(
begin
,
end
-
begin
);
}
return
span
;
}
void
MemoryCommit
::
Release
()
{
if
(
allocation
)
{
allocation
->
Free
(
interval
.
first
);
allocation
->
Free
(
begin
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/video_core/vulkan_common/vulkan_memory_allocator.h
+
5
−
5
View file @
301e2b5b
...
...
@@ -29,8 +29,8 @@ enum class MemoryUsage {
class
MemoryCommit
{
public:
explicit
MemoryCommit
()
noexcept
=
default
;
explicit
MemoryCommit
(
const
Device
&
device_
,
MemoryAllocation
*
allocation_
,
VkDeviceMemory
memory_
,
u64
begin
,
u64
end
)
noexcept
;
explicit
MemoryCommit
(
MemoryAllocation
*
allocation_
,
VkDeviceMemory
memory_
,
u64
begin_
,
u64
end
_
)
noexcept
;
~
MemoryCommit
();
MemoryCommit
&
operator
=
(
MemoryCommit
&&
)
noexcept
;
...
...
@@ -50,16 +50,16 @@ public:
/// Returns the start position of the commit relative to the allocation.
VkDeviceSize
Offset
()
const
{
return
static_cast
<
VkDeviceSize
>
(
interval
.
first
);
return
static_cast
<
VkDeviceSize
>
(
begin
);
}
private
:
void
Release
();
const
Device
*
device
{};
///< Vulkan device.
MemoryAllocation
*
allocation
{};
///< Pointer to the large memory allocation.
VkDeviceMemory
memory
{};
///< Vulkan device memory handler.
std
::
pair
<
u64
,
u64
>
interval
{};
///< Interval where the commit exists.
u64
begin
{};
///< Beginning offset in bytes to where the commit exists.
u64
end
{};
///< Offset in bytes where the commit ends.
std
::
span
<
u8
>
span
;
///< Host visible memory span. Empty if not queried before.
};
...
...
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