mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 20:37:33 +01:00
gl_shader_util: Add parameter to handle retrievable programs
This commit is contained in:
parent
0ed5d728ca
commit
8b11368671
@ -71,7 +71,8 @@ void OGLShader::Release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OGLProgram::CreateFromSource(const char* vert_shader, const char* geo_shader,
|
void OGLProgram::CreateFromSource(const char* vert_shader, const char* geo_shader,
|
||||||
const char* frag_shader, bool separable_program) {
|
const char* frag_shader, bool separable_program,
|
||||||
|
bool hint_retrievable) {
|
||||||
OGLShader vert, geo, frag;
|
OGLShader vert, geo, frag;
|
||||||
if (vert_shader)
|
if (vert_shader)
|
||||||
vert.Create(vert_shader, GL_VERTEX_SHADER);
|
vert.Create(vert_shader, GL_VERTEX_SHADER);
|
||||||
@ -81,7 +82,7 @@ void OGLProgram::CreateFromSource(const char* vert_shader, const char* geo_shade
|
|||||||
frag.Create(frag_shader, GL_FRAGMENT_SHADER);
|
frag.Create(frag_shader, GL_FRAGMENT_SHADER);
|
||||||
|
|
||||||
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
|
||||||
Create(separable_program, vert.handle, geo.handle, frag.handle);
|
Create(separable_program, hint_retrievable, vert.handle, geo.handle, frag.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLProgram::Release() {
|
void OGLProgram::Release() {
|
||||||
|
@ -101,15 +101,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
void Create(bool separable_program, T... shaders) {
|
void Create(bool separable_program, bool hint_retrievable, T... shaders) {
|
||||||
if (handle != 0)
|
if (handle != 0)
|
||||||
return;
|
return;
|
||||||
handle = GLShader::LoadProgram(separable_program, shaders...);
|
handle = GLShader::LoadProgram(separable_program, hint_retrievable, shaders...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new internal OpenGL resource and stores the handle
|
/// Creates a new internal OpenGL resource and stores the handle
|
||||||
void CreateFromSource(const char* vert_shader, const char* geo_shader, const char* frag_shader,
|
void CreateFromSource(const char* vert_shader, const char* geo_shader, const char* frag_shader,
|
||||||
bool separable_program = false);
|
bool separable_program = false, bool hint_retrievable = false);
|
||||||
|
|
||||||
/// Deletes the internal OpenGL resource
|
/// Deletes the internal OpenGL resource
|
||||||
void Release();
|
void Release();
|
||||||
|
@ -47,7 +47,7 @@ GLuint LoadShader(const char* source, GLenum type);
|
|||||||
* @returns Handle of the newly created OpenGL program object
|
* @returns Handle of the newly created OpenGL program object
|
||||||
*/
|
*/
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
GLuint LoadProgram(bool separable_program, T... shaders) {
|
GLuint LoadProgram(bool separable_program, bool hint_retrievable, T... shaders) {
|
||||||
// Link the program
|
// Link the program
|
||||||
LOG_DEBUG(Render_OpenGL, "Linking program...");
|
LOG_DEBUG(Render_OpenGL, "Linking program...");
|
||||||
|
|
||||||
@ -58,6 +58,9 @@ GLuint LoadProgram(bool separable_program, T... shaders) {
|
|||||||
if (separable_program) {
|
if (separable_program) {
|
||||||
glProgramParameteri(program_id, GL_PROGRAM_SEPARABLE, GL_TRUE);
|
glProgramParameteri(program_id, GL_PROGRAM_SEPARABLE, GL_TRUE);
|
||||||
}
|
}
|
||||||
|
if (hint_retrievable) {
|
||||||
|
glProgramParameteri(program_id, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
glLinkProgram(program_id);
|
glLinkProgram(program_id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user