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
a3703f57
There was an error fetching the commit references. Please try again later.
Commit
a3703f57
authored
6 years ago
by
ReinUsesLisp
Browse files
Options
Downloads
Patches
Plain Diff
gl_shader_cache: Refactor to support disk shader cache
parent
40390862
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/video_core/renderer_opengl/gl_shader_cache.cpp
+345
-105
345 additions, 105 deletions
src/video_core/renderer_opengl/gl_shader_cache.cpp
src/video_core/renderer_opengl/gl_shader_cache.h
+43
-16
43 additions, 16 deletions
src/video_core/renderer_opengl/gl_shader_cache.h
with
388 additions
and
121 deletions
src/video_core/renderer_opengl/gl_shader_cache.cpp
+
345
−
105
View file @
a3703f57
This diff is collapsed.
Click to expand it.
src/video_core/renderer_opengl/gl_shader_cache.h
+
43
−
16
View file @
a3703f57
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include
<array>
#include
<array>
#include
<map>
#include
<map>
#include
<memory>
#include
<memory>
#include
<set>
#include
<tuple>
#include
<tuple>
#include
<glad/glad.h>
#include
<glad/glad.h>
...
@@ -23,13 +24,25 @@ namespace OpenGL {
...
@@ -23,13 +24,25 @@ namespace OpenGL {
class
CachedShader
;
class
CachedShader
;
class
RasterizerOpenGL
;
class
RasterizerOpenGL
;
struct
UnspecializedShader
;
using
Shader
=
std
::
shared_ptr
<
CachedShader
>
;
using
Shader
=
std
::
shared_ptr
<
CachedShader
>
;
using
CachedProgram
=
std
::
shared_ptr
<
OGLProgram
>
;
using
Maxwell
=
Tegra
::
Engines
::
Maxwell3D
::
Regs
;
using
Maxwell
=
Tegra
::
Engines
::
Maxwell3D
::
Regs
;
using
PrecompiledPrograms
=
std
::
map
<
ShaderDiskCacheUsage
,
CachedProgram
>
;
using
PrecompiledShaders
=
std
::
map
<
u64
,
GLShader
::
ProgramResult
>
;
class
CachedShader
final
:
public
RasterizerCacheObject
{
class
CachedShader
final
:
public
RasterizerCacheObject
{
public:
public:
CachedShader
(
VAddr
addr
,
Maxwell
::
ShaderProgram
program_type
);
explicit
CachedShader
(
VAddr
addr
,
u64
unique_identifier
,
Maxwell
::
ShaderProgram
program_type
,
ShaderDiskCacheOpenGL
&
disk_cache
,
const
PrecompiledPrograms
&
precompiled_programs
,
ProgramCode
&&
program_code
,
ProgramCode
&&
program_code_b
);
explicit
CachedShader
(
VAddr
addr
,
u64
unique_identifier
,
Maxwell
::
ShaderProgram
program_type
,
ShaderDiskCacheOpenGL
&
disk_cache
,
const
PrecompiledPrograms
&
precompiled_programs
,
GLShader
::
ProgramResult
result
);
VAddr
GetAddr
()
const
override
{
VAddr
GetAddr
()
const
override
{
return
addr
;
return
addr
;
...
@@ -56,33 +69,35 @@ private:
...
@@ -56,33 +69,35 @@ private:
// declared by the hardware. Workaround this issue by generating a different shader per input
// declared by the hardware. Workaround this issue by generating a different shader per input
// topology class.
// topology class.
struct
GeometryPrograms
{
struct
GeometryPrograms
{
OGL
Program
points
;
Cached
Program
points
;
OGL
Program
lines
;
Cached
Program
lines
;
OGL
Program
lines_adjacency
;
Cached
Program
lines_adjacency
;
OGL
Program
triangles
;
Cached
Program
triangles
;
OGL
Program
triangles_adjacency
;
Cached
Program
triangles_adjacency
;
};
};
std
::
string
AllocateBindings
(
BaseBindings
base_bindings
);
GLuint
GetGeometryShader
(
GLenum
primitive_mode
,
BaseBindings
base_bindings
);
GLuint
GetGeometryShader
(
GLenum
primitive_mode
,
BaseBindings
base_bindings
);
/// Generates a geometry shader or returns one that already exists.
/// Generates a geometry shader or returns one that already exists.
GLuint
LazyGeometryProgram
(
OGLProgram
&
target_program
,
BaseBindings
base_bindings
,
GLuint
LazyGeometryProgram
(
CachedProgram
&
target_program
,
BaseBindings
base_bindings
,
const
std
::
string
&
glsl_topology
,
u32
max_vertices
,
GLenum
primitive_mode
);
const
std
::
string
&
debug_name
);
CachedProgram
TryLoadProgram
(
GLenum
primitive_mode
,
BaseBindings
base_bindings
)
const
;
ShaderDiskCacheUsage
GetUsage
(
GLenum
primitive_mode
,
BaseBindings
base_bindings
)
const
;
void
CalculateProperties
();
const
VAddr
addr
;
const
u64
unique_identifier
;
const
Maxwell
::
ShaderProgram
program_type
;
ShaderDiskCacheOpenGL
&
disk_cache
;
const
PrecompiledPrograms
&
precompiled_programs
;
VAddr
addr
{};
std
::
size_t
shader_length
{};
std
::
size_t
shader_length
{};
Maxwell
::
ShaderProgram
program_type
{};
GLShader
::
ShaderSetup
setup
;
GLShader
::
ShaderEntries
entries
;
GLShader
::
ShaderEntries
entries
;
std
::
string
code
;
std
::
string
code
;
std
::
map
<
BaseBindings
,
OGL
Program
>
programs
;
std
::
map
<
BaseBindings
,
Cached
Program
>
programs
;
std
::
map
<
BaseBindings
,
GeometryPrograms
>
geometry_programs
;
std
::
map
<
BaseBindings
,
GeometryPrograms
>
geometry_programs
;
std
::
map
<
u32
,
GLuint
>
cbuf_resource_cache
;
std
::
map
<
u32
,
GLuint
>
cbuf_resource_cache
;
...
@@ -101,7 +116,19 @@ public:
...
@@ -101,7 +116,19 @@ public:
Shader
GetStageProgram
(
Maxwell
::
ShaderProgram
program
);
Shader
GetStageProgram
(
Maxwell
::
ShaderProgram
program
);
private:
private:
std
::
map
<
u64
,
UnspecializedShader
>
GenerateUnspecializedShaders
(
const
std
::
vector
<
ShaderDiskCacheRaw
>&
raws
);
CachedProgram
GeneratePrecompiledProgram
(
std
::
vector
<
ShaderDiskCachePrecompiledEntry
>&
precompiled
,
const
ShaderDiskCachePrecompiledEntry
&
precompiled_entry
,
const
std
::
set
<
GLenum
>&
supported_formats
);
std
::
array
<
Shader
,
Maxwell
::
MaxShaderProgram
>
last_shaders
;
std
::
array
<
Shader
,
Maxwell
::
MaxShaderProgram
>
last_shaders
;
ShaderDiskCacheOpenGL
disk_cache
;
PrecompiledShaders
precompiled_shaders
;
PrecompiledPrograms
precompiled_programs
;
};
};
}
// namespace OpenGL
}
// namespace OpenGL
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