using of vao, warning: ARB_vertex_array_object is needed
Signed-off-by: Ryan Houdek <Sonicadvance1@gmail.com>
This commit is contained in:
parent
5c8800968a
commit
c207422987
|
@ -35,3 +35,4 @@ Source/Core/Common/Src/scmrev.h
|
|||
*.ipch
|
||||
.sconsign.dblite
|
||||
Externals/scons-local/*
|
||||
*~
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace OGL
|
|||
extern bool s_bHaveFramebufferBlit; // comes from Render.cpp. ugly.
|
||||
|
||||
static GLuint s_VBO = 0;
|
||||
static GLuint s_VAO = 0;
|
||||
static MathUtil::Rectangle<float> s_cached_sourcerc;
|
||||
static MathUtil::Rectangle<float> s_cached_drawrc;
|
||||
|
||||
|
@ -184,7 +185,22 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
|||
|
||||
glGenFramebuffersEXT(1, &m_xfbFramebuffer);
|
||||
|
||||
// Generate VBO & VAO - and initialize the VAO for "Draw"
|
||||
glGenBuffers(1, &s_VBO);
|
||||
glGenVertexArrays(1, &s_VAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||
glBindVertexArray(s_VAO);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 6*sizeof(GLfloat), NULL);
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+2);
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4);
|
||||
|
||||
// EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f
|
||||
glViewport(0, 0, m_targetWidth, m_targetHeight);
|
||||
|
@ -198,6 +214,7 @@ FramebufferManager::~FramebufferManager()
|
|||
{
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glDeleteBuffers(1, &s_VBO);
|
||||
glDeleteVertexArrays(1, &s_VAO);
|
||||
|
||||
GLuint glObj[3];
|
||||
|
||||
|
@ -343,39 +360,10 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
|||
s_cached_sourcerc = sourcerc;
|
||||
s_cached_drawrc = drawrc;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: remove on VAO
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||
}
|
||||
|
||||
// disable all pointer, TODO: use VAO
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
glDisableVertexAttribArray(SHADER_NORM2_ATTRIB);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
for(int i=2; i<8; i++) {
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glVertexPointer(2, GL_FLOAT, 6*sizeof(GLfloat), NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+2);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4);
|
||||
glBindVertexArray(s_VAO);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: this need to be removed in future
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,10 @@ void GLVertexFormat::SetupVertexPointers() {
|
|||
#ifdef USE_JIT
|
||||
((void (*)())(void*)m_compiledCode)();
|
||||
#else
|
||||
// TODO: use this :-)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, vtx_decl.stride, VertexManager::s_pBaseBufferPointer);
|
||||
if (vtx_decl.num_normals >= 1) {
|
||||
glNormalPointer(VarToGL(vtx_decl.normal_gl_type), vtx_decl.stride, (void *)(VertexManager::s_pBaseBufferPointer + vtx_decl.normal_offset[0]));
|
||||
|
|
|
@ -108,7 +108,9 @@ namespace OGL
|
|||
// ----------------------------
|
||||
static int s_fps = 0;
|
||||
static GLuint s_ShowEFBCopyRegions_VBO = 0;
|
||||
static GLuint s_ShowEFBCopyRegions_VAO = 0;
|
||||
static GLuint s_Swap_VBO = 0;
|
||||
static GLuint s_Swap_VAO[2];
|
||||
static TargetRectangle s_cached_targetRc;
|
||||
|
||||
static RasterFont* s_pfont = NULL;
|
||||
|
@ -322,6 +324,13 @@ Renderer::Renderer()
|
|||
bSuccess = false;
|
||||
}
|
||||
|
||||
if (!GLEW_ARB_vertex_array_object)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
|
||||
"GPU: Does your video card support OpenGL 3.0?");
|
||||
bSuccess = false;
|
||||
}
|
||||
|
||||
s_bHaveFramebufferBlit = strstr(ptoken, "GL_EXT_framebuffer_blit") != NULL;
|
||||
s_bHaveCoverageMSAA = strstr(ptoken, "GL_NV_framebuffer_multisample_coverage") != NULL;
|
||||
|
||||
|
@ -466,7 +475,33 @@ Renderer::Renderer()
|
|||
|
||||
// creating buffers
|
||||
glGenBuffers(1, &s_ShowEFBCopyRegions_VBO);
|
||||
glGenVertexArrays(1, &s_ShowEFBCopyRegions_VAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_ShowEFBCopyRegions_VBO);
|
||||
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glColorPointer (3, GL_FLOAT, sizeof(GLfloat)*5, (GLfloat*)NULL+2);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*5, NULL);
|
||||
|
||||
glGenBuffers(1, &s_Swap_VBO);
|
||||
glGenVertexArrays(2, s_Swap_VAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
|
||||
glBindVertexArray(s_Swap_VAO[0]);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, 7*sizeof(GLfloat), NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+3);
|
||||
|
||||
glBindVertexArray(s_Swap_VAO[1]);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, 7*sizeof(GLfloat), NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+3);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5);
|
||||
|
||||
glStencilFunc(GL_ALWAYS, 0, 0);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
@ -506,7 +541,9 @@ Renderer::~Renderer()
|
|||
UpdateActiveConfig();
|
||||
|
||||
glDeleteBuffers(1, &s_ShowEFBCopyRegions_VBO);
|
||||
glDeleteVertexArrays(1, &s_ShowEFBCopyRegions_VAO);
|
||||
glDeleteBuffers(1, &s_Swap_VBO);
|
||||
glDeleteVertexArrays(2, s_Swap_VAO);
|
||||
s_ShowEFBCopyRegions_VBO = 0;
|
||||
|
||||
delete s_pfont;
|
||||
|
@ -657,29 +694,12 @@ void Renderer::DrawDebugInfo()
|
|||
}
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
||||
// disable all pointer, TODO: use VAO
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
glDisableVertexAttribArray(SHADER_NORM2_ATTRIB);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
for(int i=0; i<8; i++) {
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glColorPointer (3, GL_FLOAT, sizeof(GLfloat)*5, (GLfloat*)NULL+2);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*5, NULL);
|
||||
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
|
||||
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
|
||||
|
||||
// Restore Line Size
|
||||
glLineWidth(lSize);
|
||||
|
||||
// disable buffer TODO: remove this, after everting is in vbo
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
// Clear stored regions
|
||||
stats.efb_regions.clear();
|
||||
}
|
||||
|
@ -1252,42 +1272,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||
glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
s_cached_targetRc = targetRc;
|
||||
} else {
|
||||
// TODO: remove this after switch to VAO
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
|
||||
}
|
||||
|
||||
// disable all pointer, TODO: use VAO
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
glDisableVertexAttribArray(SHADER_NORM2_ATTRIB);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
for(int i=1; i<8; i++) {
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
if (applyShader)
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 7*sizeof(GLfloat), NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+3);
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5);
|
||||
glBindVertexArray(s_Swap_VAO[applyShader]);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: also remove this
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
if(applyShader)
|
||||
PixelShaderCache::DisableShader();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace OGL
|
|||
|
||||
struct VBOCache {
|
||||
GLuint vbo;
|
||||
GLuint vao;
|
||||
TargetRectangle targetSource;
|
||||
};
|
||||
static std::map<u32,VBOCache> s_VBO;
|
||||
|
@ -323,6 +324,18 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||
item.targetSource.left = -1;
|
||||
item.targetSource.right = -1;
|
||||
glGenBuffers(1, &item.vbo);
|
||||
glGenVertexArrays(1, &item.vao);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, item.vbo);
|
||||
glBindVertexArray(item.vao);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*4, 0);
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL + 2);
|
||||
|
||||
vbo_it = s_VBO.insert(std::pair<u32,VBOCache>(targetSourceHash, item)).first;
|
||||
}
|
||||
if(!(vbo_it->second.targetSource == targetSource)) {
|
||||
|
@ -341,34 +354,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
|||
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
vbo_it->second.targetSource = targetSource;
|
||||
} else {
|
||||
// TODO: remove after switched to VAO
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo);
|
||||
}
|
||||
|
||||
// disable all pointer, TODO: use VAO
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
glDisableVertexAttribArray(SHADER_NORM2_ATTRIB);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
for(int i=1; i<8; i++) {
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL + 2);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*4, 0);
|
||||
glBindVertexArray(vbo_it->second.vao);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: this should be removed if we use vbo everywhere
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// Unbind texture from temporary framebuffer
|
||||
|
@ -453,7 +443,8 @@ TextureCache::TextureCache()
|
|||
TextureCache::~TextureCache()
|
||||
{
|
||||
for(std::map<u32, VBOCache>::iterator it = s_VBO.begin(); it != s_VBO.end(); it++) {
|
||||
glGenBuffers(1, &it->second.vbo);
|
||||
glDeleteBuffers(1, &it->second.vbo);
|
||||
glDeleteVertexArrays(1, &it->second.vao);
|
||||
}
|
||||
s_VBO.clear();
|
||||
|
||||
|
|
|
@ -57,8 +57,13 @@ static FRAGMENTSHADER s_yuyvToRgbProgram;
|
|||
const u32 NUM_ENCODING_PROGRAMS = 64;
|
||||
static FRAGMENTSHADER s_encodingPrograms[NUM_ENCODING_PROGRAMS];
|
||||
|
||||
static GLuint s_VBO = 0;
|
||||
static GLuint s_encode_VBO = 0;
|
||||
static GLuint s_encode_VAO = 0;
|
||||
static GLuint s_decode_VBO = 0;
|
||||
static GLuint s_decode_VAO = 0;
|
||||
static TargetRectangle s_cached_sourceRc;
|
||||
static int s_cached_srcWidth = 0;
|
||||
static int s_cached_srcHeight = 0;
|
||||
|
||||
void CreateRgbToYuyvProgram()
|
||||
{
|
||||
|
@ -144,14 +149,37 @@ void Init()
|
|||
{
|
||||
glGenFramebuffersEXT(1, &s_texConvFrameBuffer);
|
||||
|
||||
glGenBuffers(1, &s_VBO);
|
||||
glGenBuffers(1, &s_encode_VBO );
|
||||
glGenVertexArrays(1, &s_encode_VAO );
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
|
||||
glBindVertexArray( s_encode_VAO );
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 4*sizeof(GLfloat), NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 4*sizeof(GLfloat), (GLfloat*)NULL + 2);
|
||||
s_cached_sourceRc.top = -1;
|
||||
s_cached_sourceRc.bottom = -1;
|
||||
s_cached_sourceRc.left = -1;
|
||||
s_cached_sourceRc.right = -1;
|
||||
|
||||
glGenBuffers(1, &s_decode_VBO );
|
||||
glGenVertexArrays(1, &s_decode_VAO );
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
|
||||
glBindVertexArray( s_decode_VAO );
|
||||
s_cached_srcWidth = -1;
|
||||
s_cached_srcHeight = -1;
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*4, NULL);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL+2);
|
||||
|
||||
|
||||
|
||||
glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
|
||||
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, renderBufferWidth, renderBufferHeight);
|
||||
|
||||
s_srcTextureWidth = 0;
|
||||
|
@ -171,7 +199,10 @@ void Shutdown()
|
|||
glDeleteTextures(1, &s_srcTexture);
|
||||
glDeleteRenderbuffersEXT(1, &s_dstRenderBuffer);
|
||||
glDeleteFramebuffersEXT(1, &s_texConvFrameBuffer);
|
||||
glDeleteBuffers(1, &s_VBO);
|
||||
glDeleteBuffers(1, &s_encode_VBO );
|
||||
glDeleteVertexArrays(1, &s_encode_VAO );
|
||||
glDeleteBuffers(1, &s_decode_VBO );
|
||||
glDeleteVertexArrays(1, &s_decode_VAO );
|
||||
|
||||
s_rgbToYuyvProgram.Destroy();
|
||||
s_yuyvToRgbProgram.Destroy();
|
||||
|
@ -235,38 +266,15 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
|
|||
1.f, -1.f,
|
||||
(float)sourceRc.right, (float)sourceRc.top
|
||||
};
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
|
||||
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
|
||||
s_cached_sourceRc = sourceRc;
|
||||
} else {
|
||||
// TODO: remove
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
|
||||
}
|
||||
|
||||
// disable all pointer, TODO: use VAO
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableVertexAttribArray(SHADER_NORM1_ATTRIB);
|
||||
glDisableVertexAttribArray(SHADER_NORM2_ATTRIB);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
for(int i=1; i<8; i++) {
|
||||
glClientActiveTexture(GL_TEXTURE0 + i);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, 4*sizeof(GLfloat), (GLfloat*)NULL + 2);
|
||||
glVertexPointer(2, GL_FLOAT, 4*sizeof(GLfloat), NULL);
|
||||
glBindVertexArray( s_encode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// TODO: remove this
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// .. and then read back the results.
|
||||
|
@ -423,31 +431,34 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
|||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
GLfloat tex1[] = {
|
||||
(float)srcFmtWidth, (float)srcHeight,
|
||||
(float)srcFmtWidth, 0.f,
|
||||
0.f, 0.f,
|
||||
0.f, (float)srcHeight
|
||||
};
|
||||
GLfloat vtx1[] = {
|
||||
1.f, -1.f,
|
||||
1.f, 1.f,
|
||||
-1.f, 1.f,
|
||||
-1.f, -1.f
|
||||
};
|
||||
if(s_cached_srcHeight != srcHeight || s_cached_srcWidth != srcWidth) {
|
||||
GLfloat vertices[] = {
|
||||
1.f, -1.f,
|
||||
(float)srcFmtWidth, (float)srcHeight,
|
||||
1.f, 1.f,
|
||||
(float)srcFmtWidth, 0.f,
|
||||
-1.f, 1.f,
|
||||
0.f, 0.f,
|
||||
-1.f, -1.f,
|
||||
0.f, (float)srcHeight
|
||||
};
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, tex1);
|
||||
glVertexPointer(2, GL_FLOAT, 0, vtx1);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*4*4, vertices, GL_STREAM_DRAW);
|
||||
|
||||
s_cached_srcHeight = srcHeight;
|
||||
s_cached_srcWidth = srcWidth;
|
||||
}
|
||||
|
||||
glBindVertexArray( s_decode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// reset state
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0);
|
||||
TextureCache::DisableStage(0);
|
||||
TextureCache::DisableStage(0);
|
||||
|
||||
VertexShaderManager::SetViewportChanged();
|
||||
|
||||
|
|
Loading…
Reference in New Issue