diff options
| author | Tilka <tilkax@gmail.com> | 2019-02-26 04:21:05 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-26 04:21:05 +0000 |
| commit | 6ce7f44b8a0bb3b95d3f12ebffbef7a71a443fdd (patch) | |
| tree | 98380ce3a3284c52597a6fba86589c847219ecd5 /Source/Core/VideoBackends/OGL/ProgramShaderCache.h | |
| parent | 19673ce79af814ca3b77d7f8ea60458e564bfa51 (diff) | |
| parent | f039149198657c1891e1c6462ed30c31ed4b8486 (diff) | |
Merge pull request #7753 from stenzek/videocommon-all-the-things
Move a significant amount of video backend logic to VideoCommon
Diffstat (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.h')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/ProgramShaderCache.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h index b94e733167..7fc267dc5d 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h @@ -44,9 +44,9 @@ struct SHADER struct PipelineProgramKey { - const OGLShader* vertex_shader; - const OGLShader* geometry_shader; - const OGLShader* pixel_shader; + u64 vertex_shader_id; + u64 geometry_shader_id; + u64 pixel_shader_id; bool operator==(const PipelineProgramKey& rhs) const; bool operator!=(const PipelineProgramKey& rhs) const; @@ -82,7 +82,6 @@ public: const std::string& gcode); static StreamBuffer* GetUniformBuffer(); static u32 GetUniformBufferAlignment(); - static void InvalidateConstants(); static void UploadConstants(); static void UploadConstants(const void* data, u32 data_size); @@ -90,6 +89,14 @@ public: static void Shutdown(); static void CreateHeader(); + // This counter increments with each shader object allocated, in order to give it a unique ID. + // Since the shaders can be destroyed after a pipeline is created, we can't use the shader pointer + // as a key for GL programs. For the same reason, we can't use the GL objects either. This ID is + // guaranteed to be unique for the emulation session, even if the memory allocator or GL driver + // re-uses pointers, therefore we won't have any collisions where the shaders attached to a + // pipeline do not match the pipeline configuration. + static u64 GenerateShaderID(); + static const PipelineProgram* GetPipelineProgram(const GLVertexFormat* vertex_format, const OGLShader* vertex_shader, const OGLShader* geometry_shader, |
