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
98be5a49
There was an error fetching the commit references. Please try again later.
Commit
98be5a49
authored
6 years ago
by
ReinUsesLisp
Browse files
Options
Downloads
Patches
Plain Diff
gl_shader_disk_cache: Add ShaderDiskCacheOpenGL class and helpers
parent
145c3ac8
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/renderer_opengl/gl_shader_disk_cache.cpp
+52
-0
52 additions, 0 deletions
src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
src/video_core/renderer_opengl/gl_shader_disk_cache.h
+24
-0
24 additions, 0 deletions
src/video_core/renderer_opengl/gl_shader_disk_cache.h
with
76 additions
and
0 deletions
src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
+
52
−
0
View file @
98be5a49
...
...
@@ -4,6 +4,18 @@
#pragma once
#include
<fmt/format.h>
#include
"common/assert.h"
#include
"common/common_paths.h"
#include
"common/common_types.h"
#include
"common/file_util.h"
#include
"common/logging/log.h"
#include
"core/core.h"
#include
"core/hle/kernel/process.h"
#include
"video_core/renderer_opengl/gl_shader_cache.h"
#include
"video_core/renderer_opengl/gl_shader_disk_cache.h"
namespace
OpenGL
{
...
...
@@ -11,4 +23,44 @@ namespace OpenGL {
// Making sure sizes doesn't change by accident
static_assert
(
sizeof
(
BaseBindings
)
==
12
);
namespace
{
std
::
string
GetTitleID
()
{
return
fmt
::
format
(
"{:016X}"
,
Core
::
CurrentProcess
()
->
GetTitleID
());
}
}
// namespace
bool
ShaderDiskCacheOpenGL
::
EnsureDirectories
()
const
{
const
auto
CreateDir
=
[](
const
std
::
string
&
dir
)
{
if
(
!
FileUtil
::
CreateDir
(
dir
))
{
LOG_ERROR
(
Render_OpenGL
,
"Failed to create directory={}"
,
dir
);
return
false
;
}
return
true
;
};
return
CreateDir
(
FileUtil
::
GetUserPath
(
FileUtil
::
UserPath
::
ShaderDir
))
&&
CreateDir
(
GetBaseDir
())
&&
CreateDir
(
GetTransferableDir
())
&&
CreateDir
(
GetPrecompiledDir
());
}
std
::
string
ShaderDiskCacheOpenGL
::
GetTransferablePath
()
const
{
return
FileUtil
::
SanitizePath
(
GetTransferableDir
()
+
DIR_SEP_CHR
+
GetTitleID
()
+
".bin"
);
}
std
::
string
ShaderDiskCacheOpenGL
::
GetPrecompiledPath
()
const
{
return
FileUtil
::
SanitizePath
(
GetPrecompiledDir
()
+
DIR_SEP_CHR
+
GetTitleID
()
+
".bin"
);
}
std
::
string
ShaderDiskCacheOpenGL
::
GetTransferableDir
()
const
{
return
GetBaseDir
()
+
DIR_SEP
"transferable"
;
}
std
::
string
ShaderDiskCacheOpenGL
::
GetPrecompiledDir
()
const
{
return
GetBaseDir
()
+
DIR_SEP
"precompiled"
;
}
std
::
string
ShaderDiskCacheOpenGL
::
GetBaseDir
()
const
{
return
FileUtil
::
GetUserPath
(
FileUtil
::
UserPath
::
ShaderDir
)
+
DIR_SEP
"opengl"
;
}
}
// namespace OpenGL
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/video_core/renderer_opengl/gl_shader_disk_cache.h
+
24
−
0
View file @
98be5a49
...
...
@@ -4,9 +4,11 @@
#pragma once
#include
<string>
#include
<tuple>
#include
"common/common_types.h"
#include
"common/file_util.h"
#include
"video_core/engines/maxwell_3d.h"
namespace
OpenGL
{
...
...
@@ -38,4 +40,26 @@ public:
}
};
class
ShaderDiskCacheOpenGL
{
public:
private:
/// Create shader disk cache directories. Returns true on success.
bool
EnsureDirectories
()
const
;
/// Gets current game's transferable file path
std
::
string
GetTransferablePath
()
const
;
/// Gets current game's precompiled file path
std
::
string
GetPrecompiledPath
()
const
;
/// Get user's transferable directory path
std
::
string
GetTransferableDir
()
const
;
/// Get user's precompiled directory path
std
::
string
GetPrecompiledDir
()
const
;
/// Get user's shader directory path
std
::
string
GetBaseDir
()
const
;
};
}
// namespace OpenGL
\ No newline at end of file
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