mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-05 09:39:58 +00:00
glsl shaders for showEfbCopyRegions
This commit is contained in:
parent
bff02b3b73
commit
092a99cbd2
@ -106,6 +106,8 @@ namespace OGL
|
|||||||
static int s_fps = 0;
|
static int s_fps = 0;
|
||||||
static GLuint s_ShowEFBCopyRegions_VBO = 0;
|
static GLuint s_ShowEFBCopyRegions_VBO = 0;
|
||||||
static GLuint s_ShowEFBCopyRegions_VAO = 0;
|
static GLuint s_ShowEFBCopyRegions_VAO = 0;
|
||||||
|
static FRAGMENTSHADER s_ShowEFBCopyRegions_PS;
|
||||||
|
static VERTEXSHADER s_ShowEFBCopyRegions_VS;
|
||||||
|
|
||||||
static RasterFont* s_pfont = NULL;
|
static RasterFont* s_pfont = NULL;
|
||||||
|
|
||||||
@ -384,16 +386,37 @@ Renderer::Renderer()
|
|||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
|
|
||||||
s_pfont = new RasterFont();
|
s_pfont = new RasterFont();
|
||||||
|
|
||||||
|
PixelShaderCache::CompilePixelShader(s_ShowEFBCopyRegions_PS,
|
||||||
|
"#version 130\n"
|
||||||
|
"in vec4 c;\n"
|
||||||
|
"out vec4 ocol0;\n"
|
||||||
|
"void main(void) {\n"
|
||||||
|
" ocol0 = c;\n"
|
||||||
|
"}\n"
|
||||||
|
);
|
||||||
|
VertexShaderCache::CompileVertexShader(s_ShowEFBCopyRegions_VS,
|
||||||
|
"#version 130\n"
|
||||||
|
"in vec2 vertexPosition;\n"
|
||||||
|
"in vec3 color;\n"
|
||||||
|
"out vec4 c;\n"
|
||||||
|
"void main(void) {\n"
|
||||||
|
" gl_Position = vec4(vertexPosition,0,1);\n"
|
||||||
|
" c = vec4(color, 1.0);\n"
|
||||||
|
"}\n"
|
||||||
|
);
|
||||||
|
ProgramShaderCache::SetBothShaders(s_ShowEFBCopyRegions_PS.glprogid, s_ShowEFBCopyRegions_VS.glprogid);
|
||||||
|
GLuint shader_program = ProgramShaderCache::GetCurrentProgram();
|
||||||
|
|
||||||
// creating buffers
|
// creating buffers
|
||||||
glGenBuffers(1, &s_ShowEFBCopyRegions_VBO);
|
glGenBuffers(1, &s_ShowEFBCopyRegions_VBO);
|
||||||
glGenVertexArrays(1, &s_ShowEFBCopyRegions_VAO);
|
glGenVertexArrays(1, &s_ShowEFBCopyRegions_VAO);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO);
|
glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO);
|
||||||
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableVertexAttribArray(glGetAttribLocation(shader_program, "vertexPosition"));
|
||||||
glColorPointer (3, GL_FLOAT, sizeof(GLfloat)*5, (GLfloat*)NULL+2);
|
glVertexAttribPointer(glGetAttribLocation(shader_program, "vertexPosition"), 2, GL_FLOAT, 0, sizeof(GLfloat)*5, NULL);
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableVertexAttribArray(glGetAttribLocation(shader_program, "color"));
|
||||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*5, NULL);
|
glVertexAttribPointer(glGetAttribLocation(shader_program, "color"), 3, GL_FLOAT, 0, sizeof(GLfloat)*5, (GLfloat*)NULL+2);
|
||||||
|
|
||||||
// TODO: this after merging with graphic_update
|
// TODO: this after merging with graphic_update
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
@ -442,6 +465,8 @@ Renderer::~Renderer()
|
|||||||
|
|
||||||
delete s_pfont;
|
delete s_pfont;
|
||||||
s_pfont = 0;
|
s_pfont = 0;
|
||||||
|
s_ShowEFBCopyRegions_PS.Destroy();
|
||||||
|
s_ShowEFBCopyRegions_VS.Destroy();
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
if (scrshotThread.joinable())
|
if (scrshotThread.joinable())
|
||||||
@ -583,6 +608,7 @@ void Renderer::DrawDebugInfo()
|
|||||||
}
|
}
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
|
|
||||||
|
ProgramShaderCache::SetBothShaders(s_ShowEFBCopyRegions_PS.glprogid, s_ShowEFBCopyRegions_VS.glprogid);
|
||||||
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
||||||
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
|
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user