Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix ass subs for GLES #2273

Merged
merged 1 commit into from

6 participants

@FernetMenta
Collaborator

see title

@popcornmix
Collaborator

Confirmed working on Pi. CPU usage massively lower when playing files with ASS/SSA subs.
Good job!

@popcornmix
Collaborator

@theuni
Yes it was broken. On Pi it was taking over a second (with m_count=828) to render ASS subs...

@theuni
Owner

@popcornmix not sure I'd call that broken (I was speaking in terms of whether it should be backported to Frodo or not), but since you could certainly argue that it was so inefficient that it didn't work before on some platforms but it works now, I'd have no problem with that.

@FernetMenta +1.

@davilla
Collaborator

@Memphiz can you check iOS ?

@FernetMenta
Collaborator

@theuni

Also, though it wasn't there before, we should probably add a quick sanity check to be sure that m_count > 0, since everything else hinges on it.

like this?

  if (m_texture == 0 || m_count == 0)
    return;
@theuni
Owner

should be fine, yea. I really doubt it's necessary, as it looks like quads must've been set to something to get that far. but it doesn't hurt.

@davilla
Collaborator

+1, works fine under pivos amlogic arm SoCs which use mali.

@Memphiz
Owner

will test on ios in a min.

@Memphiz
Owner

works fine on ios.

@FernetMenta FernetMenta merged commit 9599872 into from
@FernetMenta FernetMenta deleted the branch
@riso

wow thank you. been waiting for this for a long time. great job.

@damianb damianb referenced this pull request in archlinuxarm/PKGBUILDs
Closed

aur/xbmc-rbp-git (arm6) needs update #408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 21, 2013
  1. @FernetMenta

    fix ass subs for GLES

    FernetMenta authored
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 11 deletions.
  1. +22 −11 xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
View
33 xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
@@ -374,7 +374,7 @@ COverlayGlyphGL::~COverlayGlyphGL()
void COverlayGlyphGL::Render(SRenderState& state)
{
- if (m_texture == 0)
+ if ((m_texture == 0) || (m_count == 0))
return;
glEnable(GL_TEXTURE_2D);
@@ -433,21 +433,32 @@ void COverlayGlyphGL::Render(SRenderState& state)
GLint colLoc = g_Windowing.GUIShaderGetCol();
GLint tex0Loc = g_Windowing.GUIShaderGetCoord0();
- glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, x));
- glVertexAttribPointer(colLoc, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, r));
- glVertexAttribPointer(tex0Loc, 2, GL_FLOAT, GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, u));
+ // stack object until VBOs will be used
+ std::vector<VERTEX> vecVertices( 6 * m_count);
+ VERTEX *vertices = &vecVertices[0];
+
+ for (int i=0; i<m_count*4; i+=4)
+ {
+ *vertices++ = m_vertex[i];
+ *vertices++ = m_vertex[i+1];
+ *vertices++ = m_vertex[i+2];
+
+ *vertices++ = m_vertex[i+1];
+ *vertices++ = m_vertex[i+3];
+ *vertices++ = m_vertex[i+2];
+ }
+
+ vertices = &vecVertices[0];
+
+ glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, x));
+ glVertexAttribPointer(colLoc, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, r));
+ glVertexAttribPointer(tex0Loc, 2, GL_FLOAT, GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, u));
glEnableVertexAttribArray(posLoc);
glEnableVertexAttribArray(colLoc);
glEnableVertexAttribArray(tex0Loc);
- // GLES2 version
- // As using triangle strips, have to do in sets of 4.
- // This is due to limitations of ES, in that tex/col has to be same size as ver!
- for (int i=0; i<(m_count*4); i+=4)
- {
- glDrawArrays(GL_TRIANGLE_STRIP, i, 4);
- }
+ glDrawArrays(GL_TRIANGLES, 0, vecVertices.size());
glDisableVertexAttribArray(posLoc);
glDisableVertexAttribArray(colLoc);
Something went wrong with that request. Please try again.