Radeon GLSL video playback [Patch for revission 28256]
#1
The latest subversion checkout for XBMC has the fixes required for the radeon GLSL, however, this is part of two patches.. namely revision 30566 (Identity matrix fix) and Revision 28452 ( Shader Validation fix)

Now for the easy part, The fix is easy to use, just apply the following diff to revision 28256

Code:
Index: guilib/Shader.cpp
===================================================================
--- guilib/Shader.cpp    (revision 28256)
+++ guilib/Shader.cpp    (working copy)
@@ -352,19 +352,8 @@
   }
   VerifyGLState();

-  // validate the program
-  glValidateProgram(m_shaderProgram);
-  glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params);
-  if (params[0]!=GL_TRUE)
-  {
-    GLchar log[LOG_SIZE];
-    CLog::Log(LOGERROR, "GL: Error validating shader");
-    glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, NULL, log);
-    CLog::Log(LOGERROR, "%s", log);
-    goto error;
-  }
   VerifyGLState();
-
+  m_validated = false;
   m_ok = true;
   OnCompiledAndLinked();
   VerifyGLState();
@@ -388,6 +377,21 @@
     glUseProgram(m_shaderProgram);
     if (OnEnabled())
     {
+      if (!m_validated)
+      {
+        // validate the program
+        GLint params[4];
+        glValidateProgram(m_shaderProgram);
+        glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params);
+        if (params[0]!=GL_TRUE)
+        {
+          GLchar log[LOG_SIZE];
+          CLog::Log(LOGERROR, "GL: Error validating shader");
+          glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, NULL, log);
+          CLog::Log(LOGERROR, "%s", log);
+        }
+        m_validated = true;
+      }
       VerifyGLState();
       return true;
     }
Index: guilib/Shader.h
===================================================================
--- guilib/Shader.h    (revision 28256)
+++ guilib/Shader.h    (working copy)
@@ -217,6 +217,7 @@

   protected:
     GLint         m_lastProgram;
+    bool          m_validated;
   };


Index: xbmc/RenderSystemGL.cpp
===================================================================
--- xbmc/RenderSystemGL.cpp    (revision 28256)
+++ xbmc/RenderSystemGL.cpp    (working copy)
@@ -139,6 +139,38 @@
   glEnable(GL_TEXTURE_2D);
   glEnable(GL_SCISSOR_TEST);

+  //ati doesn't init the texture matrix correctly
+  //so we have to do it ourselves
+  glMatrixMode(GL_TEXTURE);
+  glLoadIdentity();
+  if (glewIsSupported("GL_ARB_multitexture"))
+  {
+    glGetError(); //clear error flags
+    GLint maxtex;
+    glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &maxtex);
+
+    //some sanity checks
+    GLenum error = glGetError();
+    if (glGetError() != GL_NO_ERROR)
+    {
+      CLog::Log(LOGERROR, "ResetRenderSystem() GL_MAX_TEXTURE_IMAGE_UNITS_ARB returned error %i", (int)error);
+      maxtex = 3;
+    }
+    else if (maxtex < 1 || maxtex > 32)
+    {
+      CLog::Log(LOGERROR, "ResetRenderSystem() GL_MAX_TEXTURE_IMAGE_UNITS_ARB returned invalid value %i", (int)maxtex);
+      maxtex = 3;
+    }
+
+    //reset texture matrix for all textures
+    for (GLint i = 0; i < maxtex; i++)
+    {
+      glActiveTextureARB(GL_TEXTURE0 + i);
+      glLoadIdentity();
+    }
+    glActiveTextureARB(GL_TEXTURE0);
+  }
+    
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
Reply
#2
does that mean ati users can use glsl ?
Reply
#3
Yes, it should now work without the video being a single colored quad.
Reply
#4
I can confirm that this works with two different radeon video cards, and those cards are the Radeon HD 5770 (catalyst 10.5, Ubuntu 10.04, 64-bit) and Radeon 3100 (Catalyst 10.3, Ubuntu 9.10, 32-bit) integrated graphics.
Reply

Logout Mark Read Team Forum Stats Members Help
Radeon GLSL video playback [Patch for revission 28256]0