change log tag strings

This commit is contained in:
Gered 2013-08-17 23:28:34 -04:00
parent 82236acfa7
commit 2550d1c13e
5 changed files with 37 additions and 30 deletions

View file

@ -4,6 +4,8 @@ namespace Blarg.GameFramework.Graphics
{
public abstract class GraphicsContextResource : IDisposable
{
public const string LOG_TAG = "GRAPHICS_RESOURCE";
public GraphicsDevice GraphicsDevice { get; private set; }
public bool IsReleased { get; private set; }

View file

@ -9,6 +9,8 @@ namespace Blarg.GameFramework.Graphics
{
public class GraphicsDevice : IDisposable
{
const string LOG_TAG = "GRAPHICS";
private const int MaxTextureUnits = 8;
private const int MaxGpuAttributeSlots = 8;
private const int SolidColorTextureWidth = 8;
@ -82,11 +84,11 @@ namespace Blarg.GameFramework.Graphics
string extensions = Platform.GL.glGetString(GL20.GL_EXTENSIONS);
string shadingLangVersion = Platform.GL.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
Platform.Logger.Info("Graphics", "GL_VENDOR = {0}", vendor);
Platform.Logger.Info("Graphics", "GL_RENDERER = {0}", renderer);
Platform.Logger.Info("Graphics", "GL_VERSION = {0}", version);
Platform.Logger.Info("Graphics", "GL_EXTENSIONS = {0}", extensions);
Platform.Logger.Info("Graphics", "GL_SHADING_LANGUAGE_VERSION = {0}", shadingLangVersion);
Platform.Logger.Info(LOG_TAG, "GL_VENDOR = {0}", vendor);
Platform.Logger.Info(LOG_TAG, "GL_RENDERER = {0}", renderer);
Platform.Logger.Info(LOG_TAG, "GL_VERSION = {0}", version);
Platform.Logger.Info(LOG_TAG, "GL_EXTENSIONS = {0}", extensions);
Platform.Logger.Info(LOG_TAG, "GL_SHADING_LANGUAGE_VERSION = {0}", shadingLangVersion);
if (Platform.Type == PlatformType.Mobile)
{
@ -98,6 +100,8 @@ namespace Blarg.GameFramework.Graphics
IsNonPowerOfTwoTextureSupported = extensions.Contains("ARB_texture_non_power_of_two");
IsDepthTextureSupported = extensions.Contains("ARB_depth_texture");
}
Platform.Logger.Info(LOG_TAG, "Non-Power-Of-2 texture support: {0}", IsNonPowerOfTwoTextureSupported);
Platform.Logger.Info(LOG_TAG, "Depth texture support: {0}", IsDepthTextureSupported);
_defaultViewContext = new ViewContext(this);
_activeViewContext = _defaultViewContext;
@ -137,21 +141,21 @@ namespace Blarg.GameFramework.Graphics
public void OnLostContext()
{
Platform.Logger.Info("Graphics", "Cleaning up objects/state specific to the lost OpenGL context.");
Platform.Logger.Info(LOG_TAG, "Cleaning up objects/state specific to the lost OpenGL context.");
_activeViewContext.OnLostContext();
Platform.Logger.Info("Graphics", "Invoking OnLostContext callback for managed resources.");
Platform.Logger.Info(LOG_TAG, "Invoking OnLostContext callback for managed resources.");
foreach (var resource in _managedResources)
resource.OnLostContext();
Platform.Logger.Info("Graphics", "Finished cleaning up lost managed resources.");
Platform.Logger.Info(LOG_TAG, "Finished cleaning up lost managed resources.");
}
public void OnNewContext()
{
Platform.Logger.Info("Graphics", "Initializing default state for new OpenGL context.");
Platform.Logger.Info(LOG_TAG, "Initializing default state for new OpenGL context.");
_activeViewContext.OnNewContext();
@ -166,14 +170,14 @@ namespace Blarg.GameFramework.Graphics
UnbindRenderbuffer();
UnbindFramebuffer();
Platform.Logger.Info("Graphics", "Invoking OnNewContext callback for managed resources.");
Platform.Logger.Info(LOG_TAG, "Invoking OnNewContext callback for managed resources.");
foreach (var resource in _managedResources)
resource.OnNewContext();
Platform.Logger.Info("Graphics", "Finished restoring managed resources.");
Platform.Logger.Info(LOG_TAG, "Finished restoring managed resources.");
Platform.Logger.Info("Graphics", "Restoring image data for solid color texture cache.");
Platform.Logger.Info(LOG_TAG, "Restoring image data for solid color texture cache.");
foreach (var texture in _solidColorTextures)
{
@ -181,13 +185,13 @@ namespace Blarg.GameFramework.Graphics
FillSolidColorTexture(texture.Value, ref color);
}
Platform.Logger.Info("Graphics", "Restoring standard fonts.");
Platform.Logger.Info(LOG_TAG, "Restoring standard fonts.");
LoadStandardFonts();
}
public void OnUnload()
{
Platform.Logger.Info("Graphics", "Unloading managed resources.");
Platform.Logger.Info(LOG_TAG, "Unloading managed resources.");
while (_managedResources.Count > 0)
{
var resource = _managedResources[0];
@ -202,11 +206,11 @@ namespace Blarg.GameFramework.Graphics
System.Diagnostics.Debug.Assert(error == GL20.GL_NO_ERROR);
if (error != GL20.GL_NO_ERROR)
{
Platform.Logger.Error("OpenGL", "OpenGL error \"{0}\"", error.ToString());
Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString());
// keep checking for and reporting errors until there are no more left
while ((error = Platform.GL.glGetError()) != GL20.GL_NO_ERROR)
Platform.Logger.Error("OpenGL", "OpenGL error \"{0}\"", error.ToString());
Platform.Logger.Error("OPENGL", "OpenGL error \"{0}\"", error.ToString());
}
_activeViewContext.OnRender(delta);
@ -214,9 +218,9 @@ namespace Blarg.GameFramework.Graphics
public void OnResize(ref Rect rect, ScreenOrientation orientation)
{
Platform.Logger.Info("Graphics", "Window resized ({0}, {1}) - ({2}, {3}).", rect.Left, rect.Top, rect.Width, rect.Height);
Platform.Logger.Info(LOG_TAG, "Window resized {0}.", rect);
if (orientation != ScreenOrientation.Rotation0)
Platform.Logger.Info("Graphics", "Screen is rotated (angle = {0}).", (int)orientation);
Platform.Logger.Info(LOG_TAG, "Screen is rotated (angle = {0}).", (int)orientation);
ScreenOrientation = orientation;
_activeViewContext.OnResize(ref rect, orientation);
@ -276,7 +280,7 @@ namespace Blarg.GameFramework.Graphics
private Texture CreateSolidColorTexture(ref Color color)
{
Platform.Logger.Info("Graphics", "Creating texture for solid color 0x{0:x}.", color.RGBA);
Platform.Logger.Info(LOG_TAG, "Creating texture for solid color 0x{0:x}.", color.RGBA);
var solidColorImage = new Image(SolidColorTextureWidth, SolidColorTextureHeight, ImageFormat.RGBA);
solidColorImage.Clear(ref color);
@ -287,7 +291,7 @@ namespace Blarg.GameFramework.Graphics
private void FillSolidColorTexture(Texture texture, ref Color color)
{
Platform.Logger.Info("Graphics", "Filling image data for solid color texture using color 0x{0:x}.", color.RGBA);
Platform.Logger.Info(LOG_TAG, "Filling image data for solid color texture using color 0x{0:x}.", color.RGBA);
if (texture == null || texture.IsInvalidated || texture.Width != SolidColorTextureWidth || texture.Height != SolidColorTextureHeight)
throw new ArgumentException("Invalid texture.");
@ -908,7 +912,7 @@ namespace Blarg.GameFramework.Graphics
_isGlResourcesReleased = true;
Platform.Logger.Info("Graphics", "Managed graphics context resources cleaned up.");
Platform.Logger.Info(LOG_TAG, "Managed graphics context resources cleaned up.");
}
~GraphicsDevice()

View file

@ -13,6 +13,7 @@ namespace Blarg.GameFramework.Graphics
public class Renderbuffer : GraphicsContextResource
{
public int ID { get; private set; }
public int Width { get; private set; }
public int Height { get; private set; }
@ -73,7 +74,7 @@ namespace Blarg.GameFramework.Graphics
Platform.GL.glRenderbufferStorage(GL20.GL_RENDERBUFFER, glFormat, Width, Height);
GraphicsDevice.UnbindRenderbuffer(this);
Platform.Logger.Info("Graphics", "Created renderbuffer. ID = {0}, format = {1}, size = {2}x{3}.", ID, Format.ToString(), Width, Height);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created renderbuffer. ID = {0}, format = {1}, size = {2}x{3}.", ID, Format.ToString(), Width, Height);
}
#region GraphicsContextResource
@ -96,7 +97,7 @@ namespace Blarg.GameFramework.Graphics
Platform.GL.glDeleteRenderbuffers(ID);
Platform.Logger.Info("Graphics", "Deleted Renderbuffer ID = {0}.", ID);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Renderbuffer ID = {0}.", ID);
ID = -1;
}

View file

@ -178,7 +178,7 @@ namespace Blarg.GameFramework.Graphics
if (vertexShaderCompileStatus == 0)
{
string log = GetShaderLog(vertexShaderId);
Platform.Logger.Error("OpenGL", "Error compiling vertex shader:\n{0}", log);
Platform.Logger.Error("OPENGL", "Error compiling vertex shader:\n{0}", log);
}
// and now the fragment shader
@ -201,7 +201,7 @@ namespace Blarg.GameFramework.Graphics
if (fragmentShaderCompileStatus == 0)
{
string log = GetShaderLog(fragmentShaderId);
Platform.Logger.Error("OpenGL", "Error compiling fragment shader:\n{0}", log);
Platform.Logger.Error("OPENGL", "Error compiling fragment shader:\n{0}", log);
}
// only return success if both compiled successfully
@ -242,7 +242,7 @@ namespace Blarg.GameFramework.Graphics
if (programLinkStatus == 0)
{
string log = Platform.GL.glGetProgramInfoLog(programId);
Platform.Logger.Error("OpenGL", "Error linking program:\n{0}", log);
Platform.Logger.Error("OPENGL", "Error linking program:\n{0}", log);
}
if (programLinkStatus != 0)

View file

@ -107,7 +107,7 @@ namespace Blarg.GameFramework.Graphics
Platform.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, image.Pixels);
Platform.Logger.Info("Graphics", "Created texture from image. ID = {0}, bpp = {1}, size = {2}x{3}.", ID, image.BitsPerPixel, Width, Height);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created texture from image. ID = {0}, bpp = {1}, size = {2}x{3}.", ID, image.BitsPerPixel, Width, Height);
}
private void CreateTexture(int width, int height, TextureFormat format, bool useExistingTextureParams = false)
@ -142,9 +142,9 @@ namespace Blarg.GameFramework.Graphics
Platform.GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, internalFormat, Width, Height, 0, pixelFormat, pixelType, IntPtr.Zero);
if (Format == TextureFormat.Depth)
Platform.Logger.Info("Graphics", "Created uninitialized texture. ID = {0}, depth component only, size = {1}x{2}", ID, Width, Height);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, depth component only, size = {1}x{2}", ID, Width, Height);
else
Platform.Logger.Info("Graphics", "Created uninitialized texture. ID = {0}, bpp = {1}, size = {2}x{3}", ID, bpp, Width, Height);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Created uninitialized texture. ID = {0}, bpp = {1}, size = {2}x{3}", ID, bpp, Width, Height);
}
#endregion
@ -273,7 +273,7 @@ namespace Blarg.GameFramework.Graphics
Platform.GL.glDeleteTextures(ID);
Platform.Logger.Info("Graphics", "Deleted Texture ID = {0}.", ID);
Platform.Logger.Info(GraphicsContextResource.LOG_TAG, "Deleted Texture ID = {0}.", ID);
ID = -1;
}