Implemented fallback to simple shader mode when full shader doesn't build, and added test case. Added debug flag to disable callback behaviour, used in shader test suite. Also moved debug flags to their own header.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3144 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
a84f5cc45f
commit
d267cf71bf
@ -30,13 +30,16 @@ debugFlags : Number (integer, read/write)
|
||||
console.DEBUG_DRAW_NORMALS
|
||||
console.DEBUG_NO_DUST
|
||||
console.DEBUG_NO_SHADER_FALLBACK
|
||||
The current flags can be seen in Entity.h in the Oolite source code,
|
||||
for instance at:
|
||||
http://svn.berlios.de/svnroot/repos/oolite-linux/trunk/src/Core/Entities/Entity.h
|
||||
|
||||
The current flags can be seen in OODebugFlags.h in the Oolite source code,
|
||||
for instance at:
|
||||
http://svn.berlios.de/svnroot/repos/oolite-linux/trunk/src/Core/Debug/OODebugFlags.h
|
||||
|
||||
For example, to enable rendering of bounding boxes and surface normals,
|
||||
you might use:
|
||||
console.debugFlags ^= console.DEBUG_BOUNDING_BOXES
|
||||
console.debugFlags ^= console.DEBUG_DRAW_NORMALS
|
||||
|
||||
Explaining bitwise operations is beyond the scope of this comment, but
|
||||
the ^= operator (XOR assign) can be thought of as a “toggle option”
|
||||
command.
|
||||
@ -66,10 +69,6 @@ platformDescription : String (read-only)
|
||||
Information about the system Oolite is running on. The format of this
|
||||
string is not guaranteed, do not attempt to parse it.
|
||||
|
||||
$
|
||||
The value of the last interesting (non-null, non-undefined) value evaluated
|
||||
by the console. This includes values generated by macros.
|
||||
|
||||
|
||||
function consoleMessage(colorCode : String, message : String [, emphasisStart : Number, emphasisLength : Number])
|
||||
Similar to log(), but takes a colour code which is looked up in
|
||||
@ -102,6 +101,17 @@ function writeLogMarker()
|
||||
Writes a separator to the log.
|
||||
|
||||
|
||||
Useful properties of the console script (which can be used directly in the
|
||||
console, e.g. “log($)”):
|
||||
|
||||
$
|
||||
The value of the last interesting (non-null, non-undefined) value evaluated
|
||||
by the console. This includes values generated by macros.
|
||||
|
||||
result
|
||||
Set by some macros, such as :find.
|
||||
|
||||
|
||||
Oolite Debug OXP
|
||||
|
||||
Copyright © 2007-2010 Jens Ayton
|
||||
|
@ -514,6 +514,7 @@
|
||||
1A817DC4106D443B00AA2F97 /* OOFlashEffectEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A817DC2106D443B00AA2F97 /* OOFlashEffectEntity.m */; };
|
||||
1A81F7090A7BAC4D006580AD /* OOCAMusic.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A81F7070A7BAC4D006580AD /* OOCAMusic.m */; };
|
||||
1A81F70A0A7BAC4D006580AD /* OOCAMusic.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A81F7080A7BAC4D006580AD /* OOCAMusic.h */; };
|
||||
1A87063E1172029F003FDD2A /* OODebugFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A87063D1172029F003FDD2A /* OODebugFlags.h */; };
|
||||
1A8A37560B960337007D20B8 /* NSMutableDictionaryOOExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A8A37540B960337007D20B8 /* NSMutableDictionaryOOExtensions.m */; };
|
||||
1A8A37570B960337007D20B8 /* NSMutableDictionaryOOExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8A37550B960337007D20B8 /* NSMutableDictionaryOOExtensions.h */; };
|
||||
1A8A394E0B96229C007D20B8 /* NSFileManagerOOExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A8A394C0B96229C007D20B8 /* NSFileManagerOOExtensions.m */; };
|
||||
@ -1624,6 +1625,7 @@
|
||||
1A81F7070A7BAC4D006580AD /* OOCAMusic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOCAMusic.m; sourceTree = "<group>"; };
|
||||
1A81F7080A7BAC4D006580AD /* OOCAMusic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOCAMusic.h; sourceTree = "<group>"; };
|
||||
1A846BA90D79F9570081280D /* oolite-version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "oolite-version.xcconfig"; path = "src/Cocoa/oolite-version.xcconfig"; sourceTree = "<group>"; };
|
||||
1A87063D1172029F003FDD2A /* OODebugFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OODebugFlags.h; sourceTree = "<group>"; };
|
||||
1A8A37540B960337007D20B8 /* NSMutableDictionaryOOExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSMutableDictionaryOOExtensions.m; sourceTree = "<group>"; };
|
||||
1A8A37550B960337007D20B8 /* NSMutableDictionaryOOExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMutableDictionaryOOExtensions.h; sourceTree = "<group>"; };
|
||||
1A8A394C0B96229C007D20B8 /* NSFileManagerOOExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSFileManagerOOExtensions.m; sourceTree = "<group>"; };
|
||||
@ -2287,6 +2289,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1A2DA3ED0CB4E84900DE6823 /* OODebugSupport.h */,
|
||||
1A87063D1172029F003FDD2A /* OODebugFlags.h */,
|
||||
1A2DA3EC0CB4E84900DE6823 /* OODebugSupport.m */,
|
||||
1A2DA3540CB4D10800DE6823 /* OODebuggerInterface.h */,
|
||||
1A2DA34A0CB4D0D800DE6823 /* OODebugMonitor.h */,
|
||||
@ -3194,6 +3197,7 @@
|
||||
1ADA564810CD68D800E891B8 /* OOStellarBody.h in Headers */,
|
||||
1A01574311034A86008EE36A /* ShipEntityLoadRestore.h in Headers */,
|
||||
1A7E3189113ED496009AAB6D /* ProxyPlayerEntity.h in Headers */,
|
||||
1A87063E1172029F003FDD2A /* OODebugFlags.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -31,6 +31,7 @@ MA 02110-1301, USA.
|
||||
#import "OOPlanetEntity.h"
|
||||
#import "StationEntity.h"
|
||||
#import "PlayerEntity.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
|
||||
@implementation CollisionRegion
|
||||
|
29
src/Core/Debug/OODebugFlags.h
Normal file
29
src/Core/Debug/OODebugFlags.h
Normal file
@ -0,0 +1,29 @@
|
||||
#import <stdint.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
enum OODebugFlags
|
||||
{
|
||||
DEBUG_LINKED_LISTS = 0x00000001,
|
||||
DEBUG_ENTITIES = 0x00000002,
|
||||
DEBUG_COLLISIONS = 0x00000004,
|
||||
DEBUG_DOCKING = 0x00000008,
|
||||
DEBUG_OCTREE = 0x00000010,
|
||||
DEBUG_OCTREE_TEXT = 0x00000020,
|
||||
DEBUG_BOUNDING_BOXES = 0x00000040,
|
||||
DEBUG_OCTREE_DRAW = 0x00000080,
|
||||
DEBUG_DRAW_NORMALS = 0x00000100,
|
||||
DEBUG_NO_DUST = 0x00000200,
|
||||
DEBUG_NO_SHADER_FALLBACK = 0x00000400,
|
||||
|
||||
// Flag for temporary use, always last in list.
|
||||
DEBUG_MISC = 0x10000000
|
||||
};
|
||||
#define DEBUG_ALL 0xffffffff
|
||||
|
||||
|
||||
extern uint32_t gDebugFlags;
|
||||
extern uint32_t gLiveEntityCount;
|
||||
extern size_t gTotalEntityMemory;
|
||||
|
||||
#endif
|
@ -41,6 +41,7 @@ SOFTWARE.
|
||||
#import "OOLoggingExtended.h"
|
||||
#import "OOConstToString.h"
|
||||
#import "OOOpenGLExtensionManager.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
|
||||
@interface Entity (OODebugInspector)
|
||||
|
@ -28,6 +28,7 @@ MA 02110-1301, USA.
|
||||
#import "Universe.h"
|
||||
#import "MyOpenGLView.h"
|
||||
#import "OOGraphicsResetManager.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#import "PlayerEntity.h"
|
||||
|
||||
|
@ -36,32 +36,12 @@ MA 02110-1301, USA.
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
enum OODebugFlags
|
||||
{
|
||||
DEBUG_LINKED_LISTS = 0x00000001,
|
||||
DEBUG_ENTITIES = 0x00000002,
|
||||
DEBUG_COLLISIONS = 0x00000004,
|
||||
DEBUG_DOCKING = 0x00000008,
|
||||
DEBUG_OCTREE = 0x00000010,
|
||||
DEBUG_OCTREE_TEXT = 0x00000020,
|
||||
DEBUG_BOUNDING_BOXES = 0x00000040,
|
||||
DEBUG_OCTREE_DRAW = 0x00000080,
|
||||
DEBUG_DRAW_NORMALS = 0x00000100,
|
||||
DEBUG_NO_DUST = 0x00000200,
|
||||
DEBUG_NO_SHADER_FALLBACK = 0x00000400,
|
||||
|
||||
// Flag for temporary use, always last in list.
|
||||
DEBUG_MISC = 0x10000000
|
||||
};
|
||||
#define DEBUG_ALL 0xffffffff
|
||||
|
||||
|
||||
extern uint32_t gDebugFlags;
|
||||
extern uint32_t gLiveEntityCount;
|
||||
extern size_t gTotalEntityMemory;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define NO_DRAW_DISTANCE_FACTOR 512.0
|
||||
#define ABSOLUTE_NO_DRAW_DISTANCE2 (2500.0 * 2500.0 * NO_DRAW_DISTANCE_FACTOR * NO_DRAW_DISTANCE_FACTOR)
|
||||
// ie. the furthest away thing we can draw is at 1280km (a 2.5km wide object would disappear at that range)
|
||||
|
@ -37,6 +37,7 @@ MA 02110-1301, USA.
|
||||
#import "CollisionRegion.h"
|
||||
|
||||
#import "NSScannerOOExtensions.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#define kOOLogUnconvertedNSLog @"unclassified.Entity"
|
||||
|
||||
|
@ -35,6 +35,7 @@ MA 02110-1301, USA.
|
||||
#import "OOStringParsing.h"
|
||||
#import "PlayerEntity.h"
|
||||
#import "OOCollectionExtractors.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#define kOOLogUnconvertedNSLog @"unclassified.SunEntity"
|
||||
|
||||
|
@ -38,6 +38,7 @@ MA 02110-1301, USA.
|
||||
#import "OOStringParsing.h"
|
||||
#import "PlayerEntity.h"
|
||||
#import "OOCollectionExtractors.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#define kOOLogUnconvertedNSLog @"unclassified.PlanetEntity"
|
||||
|
||||
|
@ -47,6 +47,7 @@ MA 02110-1301, USA.
|
||||
#import "OOLoggingExtended.h"
|
||||
#import "OOMusicController.h"
|
||||
#import "OOTexture.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#import "JoystickHandler.h"
|
||||
|
||||
|
@ -82,6 +82,7 @@ MA 02110-1301, USA.
|
||||
#import "OOEquipmentType.h"
|
||||
|
||||
#import "OODebugGLDrawing.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#import "OOScript.h"
|
||||
|
||||
|
@ -41,6 +41,7 @@ MA 02110-1301, USA.
|
||||
|
||||
#import "OOScript.h"
|
||||
#import "OODebugGLDrawing.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#define kOOLogUnconvertedNSLog @"unclassified.StationEntity"
|
||||
|
||||
|
@ -58,6 +58,7 @@ SOFTWARE.
|
||||
#import "Universe.h"
|
||||
#import "OOIsNumberLiteral.h"
|
||||
#import "OOLogging.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
|
||||
static NSString *MacrosToString(NSDictionary *macros);
|
||||
@ -118,6 +119,7 @@ static NSString *MacrosToString(NSDictionary *macros);
|
||||
if (OK)
|
||||
{
|
||||
modifiedMacros = macros ? [macros mutableCopy] : [[NSMutableDictionary alloc] init];
|
||||
[modifiedMacros autorelease];
|
||||
|
||||
OOGL(glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &textureUnits));
|
||||
[modifiedMacros setObject:[NSNumber numberWithInt:textureUnits] forKey:@"OO_TEXTURE_UNIT_COUNT"];
|
||||
@ -128,7 +130,6 @@ static NSString *MacrosToString(NSDictionary *macros);
|
||||
}
|
||||
|
||||
macroString = MacrosToString(modifiedMacros);
|
||||
[modifiedMacros release];
|
||||
}
|
||||
|
||||
if (OK)
|
||||
@ -150,6 +151,24 @@ static NSString *MacrosToString(NSDictionary *macros);
|
||||
fragmentShaderName:fragmentShader
|
||||
prefix:macroString
|
||||
attributeBindings:attributeBindings];
|
||||
|
||||
if (shaderProgram == nil)
|
||||
{
|
||||
BOOL canFallBack = ![modifiedMacros oo_boolForKey:@"OO_REDUCED_COMPLEXITY"];
|
||||
#ifndef NDEBUG
|
||||
if (gDebugFlags & DEBUG_NO_SHADER_FALLBACK) canFallBack = NO;
|
||||
#endif
|
||||
if (canFallBack)
|
||||
{
|
||||
[modifiedMacros setObject:[NSNumber numberWithInt:1] forKey:@"OO_REDUCED_COMPLEXITY"];
|
||||
macroString = MacrosToString(modifiedMacros);
|
||||
|
||||
shaderProgram = [OOShaderProgram shaderProgramWithVertexShaderName:vertexShader
|
||||
fragmentShaderName:fragmentShader
|
||||
prefix:macroString
|
||||
attributeBindings:attributeBindings];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ MA 02110-1301, USA.
|
||||
#import "OOShaderMaterial.h"
|
||||
#import "OOMacroOpenGL.h"
|
||||
#import "OOProfilingStopwatch.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
|
||||
// If set, collision octree depth varies depending on the size of the mesh.
|
||||
|
@ -22,6 +22,10 @@
|
||||
|
||||
*/
|
||||
|
||||
#import "OOStellarBody.h"
|
||||
#if NEW_PLANETS
|
||||
|
||||
|
||||
#import "OOPlanetDrawable.h"
|
||||
#import "OOPlanetData.h"
|
||||
#import "OOSingleTextureMaterial.h"
|
||||
@ -33,6 +37,7 @@
|
||||
#ifndef NDEBUG
|
||||
#import "Entity.h"
|
||||
#import "OODebugGLDrawing.h"
|
||||
#import "OODebugFlags.h"
|
||||
#endif
|
||||
|
||||
|
||||
@ -372,3 +377,5 @@
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NEW_PLANETS */
|
||||
|
@ -28,6 +28,7 @@ MA 02110-1301, USA.
|
||||
#import "OOOpenGL.h"
|
||||
#import "OODebugGLDrawing.h"
|
||||
#import "OOMacroOpenGL.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -70,6 +70,7 @@ MA 02110-1301, USA.
|
||||
|
||||
#import "OOMusicController.h"
|
||||
#import "OOAsyncWorkManager.h"
|
||||
#import "OODebugFlags.h"
|
||||
|
||||
#if OO_LOCALIZATION_TOOLS
|
||||
#import "OOConvertSystemDescriptions.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user