RegalDispatchCode for direct C code output - initial implementation.
RegalSo optimizations. Merged GLX/EGL and GL/GLES entry-point loading for Linux. x86, x86_64 and ARM. GLenum to string conversion refinements, prefer non-extension, ARB, KHR and so on. GL spec database entries for maxSize of input parameters. (vs output size)
This commit is contained in:
parent
ef137d3953
commit
23dfaeec15
42 changed files with 51208 additions and 719 deletions
1
Makefile
1
Makefile
|
|
@ -174,6 +174,7 @@ LIB.SRCS += src/regal/RegalDispatchGlobal.cpp
|
|||
LIB.SRCS += src/regal/RegalDispatcher.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchEmu.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchLog.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchCode.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchDebug.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchError.cpp
|
||||
LIB.SRCS += src/regal/RegalDispatchCache.cpp
|
||||
|
|
|
|||
|
|
@ -69,6 +69,16 @@
|
|||
BC6C912A15EE3DC60056E4F7 /* RegalDispatchGlobal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6C912915EE3DC60056E4F7 /* RegalDispatchGlobal.cpp */; };
|
||||
BC921A5E15D5624600E52C91 /* RegalDispatchMissing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC921A5C15D5624600E52C91 /* RegalDispatchMissing.cpp */; };
|
||||
BC921A5F15D5624600E52C91 /* RegalDispatchPpapi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC921A5D15D5624600E52C91 /* RegalDispatchPpapi.cpp */; };
|
||||
BCBEC6E9167AD66F00B38E16 /* RegalDispatchCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC6E7167AD66F00B38E16 /* RegalDispatchCache.cpp */; };
|
||||
BCBEC6EA167AD66F00B38E16 /* RegalDispatchCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC6E8167AD66F00B38E16 /* RegalDispatchCode.cpp */; };
|
||||
BCBEC6F4167AD69D00B38E16 /* RegalPush.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6EC167AD69D00B38E16 /* RegalPush.h */; };
|
||||
BCBEC6F5167AD69D00B38E16 /* RegalShaderCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC6ED167AD69D00B38E16 /* RegalShaderCache.cpp */; };
|
||||
BCBEC6F6167AD69D00B38E16 /* RegalShaderCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6EE167AD69D00B38E16 /* RegalShaderCache.h */; };
|
||||
BCBEC6F7167AD69D00B38E16 /* RegalSharedList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6EF167AD69D00B38E16 /* RegalSharedList.h */; };
|
||||
BCBEC6F8167AD69D00B38E16 /* RegalSharedMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6F0167AD69D00B38E16 /* RegalSharedMap.h */; };
|
||||
BCBEC6F9167AD69D00B38E16 /* RegalSharedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6F1167AD69D00B38E16 /* RegalSharedPtr.h */; };
|
||||
BCBEC6FA167AD69D00B38E16 /* RegalSo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC6F2167AD69D00B38E16 /* RegalSo.cpp */; };
|
||||
BCBEC6FB167AD69D00B38E16 /* RegalSo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6F3167AD69D00B38E16 /* RegalSo.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -135,6 +145,16 @@
|
|||
BC6C912915EE3DC60056E4F7 /* RegalDispatchGlobal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchGlobal.cpp; path = ../../../src/regal/RegalDispatchGlobal.cpp; sourceTree = "<group>"; };
|
||||
BC921A5C15D5624600E52C91 /* RegalDispatchMissing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchMissing.cpp; path = ../../../src/regal/RegalDispatchMissing.cpp; sourceTree = "<group>"; };
|
||||
BC921A5D15D5624600E52C91 /* RegalDispatchPpapi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchPpapi.cpp; path = ../../../src/regal/RegalDispatchPpapi.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6E7167AD66F00B38E16 /* RegalDispatchCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchCache.cpp; path = ../../../src/regal/RegalDispatchCache.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6E8167AD66F00B38E16 /* RegalDispatchCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchCode.cpp; path = ../../../src/regal/RegalDispatchCode.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6EC167AD69D00B38E16 /* RegalPush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalPush.h; path = ../../../src/regal/RegalPush.h; sourceTree = "<group>"; };
|
||||
BCBEC6ED167AD69D00B38E16 /* RegalShaderCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalShaderCache.cpp; path = ../../../src/regal/RegalShaderCache.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6EE167AD69D00B38E16 /* RegalShaderCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalShaderCache.h; path = ../../../src/regal/RegalShaderCache.h; sourceTree = "<group>"; };
|
||||
BCBEC6EF167AD69D00B38E16 /* RegalSharedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedList.h; path = ../../../src/regal/RegalSharedList.h; sourceTree = "<group>"; };
|
||||
BCBEC6F0167AD69D00B38E16 /* RegalSharedMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedMap.h; path = ../../../src/regal/RegalSharedMap.h; sourceTree = "<group>"; };
|
||||
BCBEC6F1167AD69D00B38E16 /* RegalSharedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedPtr.h; path = ../../../src/regal/RegalSharedPtr.h; sourceTree = "<group>"; };
|
||||
BCBEC6F2167AD69D00B38E16 /* RegalSo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalSo.cpp; path = ../../../src/regal/RegalSo.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6F3167AD69D00B38E16 /* RegalSo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSo.h; path = ../../../src/regal/RegalSo.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -195,6 +215,8 @@
|
|||
43FC5F5315C4619B00D0177C /* RegalContextInfo.h */,
|
||||
43FC5F5415C4619B00D0177C /* RegalDebugInfo.h */,
|
||||
43FC5F5515C4619B00D0177C /* RegalDispatch.h */,
|
||||
BCBEC6E7167AD66F00B38E16 /* RegalDispatchCache.cpp */,
|
||||
BCBEC6E8167AD66F00B38E16 /* RegalDispatchCode.cpp */,
|
||||
43FC5F5615C4619B00D0177C /* RegalDispatchDebug.cpp */,
|
||||
43FC5F5715C4619B00D0177C /* RegalDispatchEmu.cpp */,
|
||||
43FC5F5815C4619B00D0177C /* RegalDispatchError.cpp */,
|
||||
|
|
@ -232,6 +254,14 @@
|
|||
43FC5F6F15C4619B00D0177C /* RegalPpc.h */,
|
||||
43FC5F7015C4619B00D0177C /* RegalPrecompile.h */,
|
||||
43FC5F7115C4619B00D0177C /* RegalPrivate.h */,
|
||||
BCBEC6EC167AD69D00B38E16 /* RegalPush.h */,
|
||||
BCBEC6ED167AD69D00B38E16 /* RegalShaderCache.cpp */,
|
||||
BCBEC6EE167AD69D00B38E16 /* RegalShaderCache.h */,
|
||||
BCBEC6EF167AD69D00B38E16 /* RegalSharedList.h */,
|
||||
BCBEC6F0167AD69D00B38E16 /* RegalSharedMap.h */,
|
||||
BCBEC6F1167AD69D00B38E16 /* RegalSharedPtr.h */,
|
||||
BCBEC6F2167AD69D00B38E16 /* RegalSo.cpp */,
|
||||
BCBEC6F3167AD69D00B38E16 /* RegalSo.h */,
|
||||
43FC5F7215C4619B00D0177C /* RegalState.h */,
|
||||
43FC5F7315C4619B00D0177C /* RegalToken.cpp */,
|
||||
43FC5F7415C4619B00D0177C /* RegalToken.h */,
|
||||
|
|
@ -296,6 +326,12 @@
|
|||
43EFD6FA15EAADAC004080CE /* RegalDispatcher.h in Headers */,
|
||||
43EFD6FD15EAADAC004080CE /* RegalSystem.h in Headers */,
|
||||
BC640CA516554AA4007DEF69 /* RegalFrame.h in Headers */,
|
||||
BCBEC6F4167AD69D00B38E16 /* RegalPush.h in Headers */,
|
||||
BCBEC6F6167AD69D00B38E16 /* RegalShaderCache.h in Headers */,
|
||||
BCBEC6F7167AD69D00B38E16 /* RegalSharedList.h in Headers */,
|
||||
BCBEC6F8167AD69D00B38E16 /* RegalSharedMap.h in Headers */,
|
||||
BCBEC6F9167AD69D00B38E16 /* RegalSharedPtr.h in Headers */,
|
||||
BCBEC6FB167AD69D00B38E16 /* RegalSo.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -380,6 +416,10 @@
|
|||
BC020947160D1919003FAB99 /* RegalMarker.cpp in Sources */,
|
||||
BC020958160D1C73003FAB99 /* md5.c in Sources */,
|
||||
BC640CA416554AA4007DEF69 /* RegalFrame.cpp in Sources */,
|
||||
BCBEC6E9167AD66F00B38E16 /* RegalDispatchCache.cpp in Sources */,
|
||||
BCBEC6EA167AD66F00B38E16 /* RegalDispatchCode.cpp in Sources */,
|
||||
BCBEC6F5167AD69D00B38E16 /* RegalShaderCache.cpp in Sources */,
|
||||
BCBEC6FA167AD69D00B38E16 /* RegalSo.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -63,6 +63,16 @@
|
|||
BC640C9C16554A52007DEF69 /* RegalFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC640C9A16554A52007DEF69 /* RegalFrame.cpp */; };
|
||||
BC640C9D16554A52007DEF69 /* RegalFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BC640C9B16554A52007DEF69 /* RegalFrame.h */; };
|
||||
BC6C911D15EE3CDF0056E4F7 /* RegalDispatchGlobal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6C911C15EE3CDF0056E4F7 /* RegalDispatchGlobal.cpp */; };
|
||||
BCBEC707167AD72700B38E16 /* RegalPush.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC6FF167AD72700B38E16 /* RegalPush.h */; };
|
||||
BCBEC708167AD72700B38E16 /* RegalShaderCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC700167AD72700B38E16 /* RegalShaderCache.cpp */; };
|
||||
BCBEC709167AD72700B38E16 /* RegalShaderCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC701167AD72700B38E16 /* RegalShaderCache.h */; };
|
||||
BCBEC70A167AD72700B38E16 /* RegalSharedList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC702167AD72700B38E16 /* RegalSharedList.h */; };
|
||||
BCBEC70B167AD72700B38E16 /* RegalSharedMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC703167AD72700B38E16 /* RegalSharedMap.h */; };
|
||||
BCBEC70C167AD72700B38E16 /* RegalSharedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC704167AD72700B38E16 /* RegalSharedPtr.h */; };
|
||||
BCBEC70D167AD72700B38E16 /* RegalSo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC705167AD72700B38E16 /* RegalSo.cpp */; };
|
||||
BCBEC70E167AD72700B38E16 /* RegalSo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBEC706167AD72700B38E16 /* RegalSo.h */; };
|
||||
BCBEC712167AD74400B38E16 /* RegalDispatchCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC710167AD74400B38E16 /* RegalDispatchCache.cpp */; };
|
||||
BCBEC713167AD74400B38E16 /* RegalDispatchCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBEC711167AD74400B38E16 /* RegalDispatchCode.cpp */; };
|
||||
BCF889A715E079C20093B7D5 /* RegalDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF889A515E079C20093B7D5 /* RegalDispatcher.cpp */; };
|
||||
BCF889A815E079C20093B7D5 /* RegalDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF889A615E079C20093B7D5 /* RegalDispatcher.h */; };
|
||||
BCF889AA15E079D80093B7D5 /* RegalDispatchStaticES2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF889A915E079D80093B7D5 /* RegalDispatchStaticES2.cpp */; };
|
||||
|
|
@ -126,6 +136,16 @@
|
|||
BC640C9A16554A52007DEF69 /* RegalFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalFrame.cpp; path = ../../../src/regal/RegalFrame.cpp; sourceTree = "<group>"; };
|
||||
BC640C9B16554A52007DEF69 /* RegalFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalFrame.h; path = ../../../src/regal/RegalFrame.h; sourceTree = "<group>"; };
|
||||
BC6C911C15EE3CDF0056E4F7 /* RegalDispatchGlobal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchGlobal.cpp; path = ../../../src/regal/RegalDispatchGlobal.cpp; sourceTree = "<group>"; };
|
||||
BCBEC6FF167AD72700B38E16 /* RegalPush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalPush.h; path = ../../../src/regal/RegalPush.h; sourceTree = "<group>"; };
|
||||
BCBEC700167AD72700B38E16 /* RegalShaderCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalShaderCache.cpp; path = ../../../src/regal/RegalShaderCache.cpp; sourceTree = "<group>"; };
|
||||
BCBEC701167AD72700B38E16 /* RegalShaderCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalShaderCache.h; path = ../../../src/regal/RegalShaderCache.h; sourceTree = "<group>"; };
|
||||
BCBEC702167AD72700B38E16 /* RegalSharedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedList.h; path = ../../../src/regal/RegalSharedList.h; sourceTree = "<group>"; };
|
||||
BCBEC703167AD72700B38E16 /* RegalSharedMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedMap.h; path = ../../../src/regal/RegalSharedMap.h; sourceTree = "<group>"; };
|
||||
BCBEC704167AD72700B38E16 /* RegalSharedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSharedPtr.h; path = ../../../src/regal/RegalSharedPtr.h; sourceTree = "<group>"; };
|
||||
BCBEC705167AD72700B38E16 /* RegalSo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalSo.cpp; path = ../../../src/regal/RegalSo.cpp; sourceTree = "<group>"; };
|
||||
BCBEC706167AD72700B38E16 /* RegalSo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalSo.h; path = ../../../src/regal/RegalSo.h; sourceTree = "<group>"; };
|
||||
BCBEC710167AD74400B38E16 /* RegalDispatchCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchCache.cpp; path = ../../../src/regal/RegalDispatchCache.cpp; sourceTree = "<group>"; };
|
||||
BCBEC711167AD74400B38E16 /* RegalDispatchCode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchCode.cpp; path = ../../../src/regal/RegalDispatchCode.cpp; sourceTree = "<group>"; };
|
||||
BCF889A515E079C20093B7D5 /* RegalDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatcher.cpp; path = ../../../src/regal/RegalDispatcher.cpp; sourceTree = "<group>"; };
|
||||
BCF889A615E079C20093B7D5 /* RegalDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalDispatcher.h; path = ../../../src/regal/RegalDispatcher.h; sourceTree = "<group>"; };
|
||||
BCF889A915E079D80093B7D5 /* RegalDispatchStaticES2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegalDispatchStaticES2.cpp; path = ../../../src/regal/RegalDispatchStaticES2.cpp; sourceTree = "<group>"; };
|
||||
|
|
@ -179,6 +199,8 @@
|
|||
431D3C0B15C9B6F0009DD04F /* RegalFavicon.h */,
|
||||
BCF889A515E079C20093B7D5 /* RegalDispatcher.cpp */,
|
||||
BCF889A615E079C20093B7D5 /* RegalDispatcher.h */,
|
||||
BCBEC710167AD74400B38E16 /* RegalDispatchCache.cpp */,
|
||||
BCBEC711167AD74400B38E16 /* RegalDispatchCode.cpp */,
|
||||
43A6C1DD15C48D1F0063667E /* RegalDispatchDebug.cpp */,
|
||||
43A6C1DE15C48D1F0063667E /* RegalDispatchEmu.cpp */,
|
||||
43A6C1DF15C48D1F0063667E /* RegalDispatchError.cpp */,
|
||||
|
|
@ -214,6 +236,14 @@
|
|||
43A6C1F615C48D200063667E /* RegalPpc.h */,
|
||||
43A6C1F715C48D200063667E /* RegalPrecompile.h */,
|
||||
43A6C1F815C48D200063667E /* RegalPrivate.h */,
|
||||
BCBEC6FF167AD72700B38E16 /* RegalPush.h */,
|
||||
BCBEC700167AD72700B38E16 /* RegalShaderCache.cpp */,
|
||||
BCBEC701167AD72700B38E16 /* RegalShaderCache.h */,
|
||||
BCBEC702167AD72700B38E16 /* RegalSharedList.h */,
|
||||
BCBEC703167AD72700B38E16 /* RegalSharedMap.h */,
|
||||
BCBEC704167AD72700B38E16 /* RegalSharedPtr.h */,
|
||||
BCBEC705167AD72700B38E16 /* RegalSo.cpp */,
|
||||
BCBEC706167AD72700B38E16 /* RegalSo.h */,
|
||||
43A6C1F915C48D200063667E /* RegalState.h */,
|
||||
43A6C1FA15C48D200063667E /* RegalToken.cpp */,
|
||||
43A6C1FB15C48D200063667E /* RegalToken.h */,
|
||||
|
|
@ -277,6 +307,12 @@
|
|||
431D3C0F15C9B6F0009DD04F /* RegalFavicon.h in Headers */,
|
||||
BCF889A815E079C20093B7D5 /* RegalDispatcher.h in Headers */,
|
||||
BC640C9D16554A52007DEF69 /* RegalFrame.h in Headers */,
|
||||
BCBEC707167AD72700B38E16 /* RegalPush.h in Headers */,
|
||||
BCBEC709167AD72700B38E16 /* RegalShaderCache.h in Headers */,
|
||||
BCBEC70A167AD72700B38E16 /* RegalSharedList.h in Headers */,
|
||||
BCBEC70B167AD72700B38E16 /* RegalSharedMap.h in Headers */,
|
||||
BCBEC70C167AD72700B38E16 /* RegalSharedPtr.h in Headers */,
|
||||
BCBEC70E167AD72700B38E16 /* RegalSo.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -360,6 +396,10 @@
|
|||
BC02094E160D1BA3003FAB99 /* RegalMarker.cpp in Sources */,
|
||||
BC020950160D1BD0003FAB99 /* md5.c in Sources */,
|
||||
BC640C9C16554A52007DEF69 /* RegalFrame.cpp in Sources */,
|
||||
BCBEC708167AD72700B38E16 /* RegalShaderCache.cpp in Sources */,
|
||||
BCBEC70D167AD72700B38E16 /* RegalSo.cpp in Sources */,
|
||||
BCBEC712167AD74400B38E16 /* RegalDispatchCache.cpp in Sources */,
|
||||
BCBEC713167AD74400B38E16 /* RegalDispatchCode.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalDebugInfo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalDispatch.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCache.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCode.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchDebug.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchEmu.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchError.cpp" />
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalDebugInfo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalDispatch.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCache.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCode.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchDebug.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchEmu.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchError.cpp" />
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalDebugInfo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalDispatch.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCache.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCode.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchDebug.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchEmu.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchError.cpp" />
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@
|
|||
<ClInclude Include="..\..\..\..\src\regal\RegalDebugInfo.h" />
|
||||
<ClInclude Include="..\..\..\..\src\regal\RegalDispatch.h" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCache.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchCode.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchDebug.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchEmu.cpp" />
|
||||
<ClCompile Include="..\..\..\..\src\regal\RegalDispatchError.cpp" />
|
||||
|
|
|
|||
74
examples/trace/checker.cpp
Normal file
74
examples/trace/checker.cpp
Normal file
File diff suppressed because one or more lines are too long
85
examples/trace/glut/main.cpp
Normal file
85
examples/trace/glut/main.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
- Created by Cass Everitt on 2/1/12.
|
||||
|
||||
*/
|
||||
|
||||
#include <GL/Regal.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <GL/RegalGLUT.h>
|
||||
#endif
|
||||
|
||||
#include <GL/RegalGLU.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
extern void init();
|
||||
extern void reshape(int w, int h);
|
||||
extern void display(bool clear);
|
||||
|
||||
static void myDisplay()
|
||||
{
|
||||
display(true);
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
static void myKeyboard(unsigned char c, int x, int y)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'q':
|
||||
case 27: /* Esc key */
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
glutInitDisplayString("rgba>=8 depth double");
|
||||
glutInitWindowSize(500, 500);
|
||||
glutInit( &argc, (char **) argv);
|
||||
glutCreateWindow("Regal Trace Harness");
|
||||
|
||||
// Regal workaround for OSX GLUT
|
||||
|
||||
#ifdef __APPLE__
|
||||
RegalMakeCurrent(CGLGetCurrentContext());
|
||||
#endif
|
||||
|
||||
glutDisplayFunc(myDisplay);
|
||||
glutKeyboardFunc(myKeyboard);
|
||||
glutReshapeFunc(reshape);
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ class Typedef:
|
|||
|
||||
class Return:
|
||||
|
||||
def __init__(self, type = '', default = '', cast = None, binary = False, size = None, maxSize = None, intercept = None, trace = True, play = True, filter = None):
|
||||
def __init__(self, type = '', default = '', cast = None, binary = False, size = None, maxSize = None, intercept = None, trace = True, play = True, filter = None, regalLog = None):
|
||||
|
||||
self.type = type # Type string, e.g. int
|
||||
self.default = default # Default value, e.g. 0
|
||||
|
|
@ -83,6 +83,7 @@ class Return:
|
|||
self.trace = trace # Include in text trace
|
||||
self.play = play # Include in playback
|
||||
self.filter = filter # Filtering function
|
||||
self.regalLog = None # Function for Regal logging purposes
|
||||
|
||||
class Parameter:
|
||||
|
||||
|
|
|
|||
183
scripts/ApiRegal.py
Executable file
183
scripts/ApiRegal.py
Executable file
|
|
@ -0,0 +1,183 @@
|
|||
#!/usr/bin/python -B
|
||||
|
||||
#
|
||||
# API utility functions for Regal code generation
|
||||
#
|
||||
|
||||
#from string import Template, upper, replace
|
||||
from copy import deepcopy
|
||||
|
||||
from ApiUtil import typeIsVoid
|
||||
from ApiUtil import toLong
|
||||
from ApiUtil import hexValue
|
||||
from ApiCodeGen import *
|
||||
|
||||
#
|
||||
# Map gl.py helper functions to C++ Regal namespace
|
||||
#
|
||||
|
||||
helperMap = {
|
||||
'helperGLCallListsSize' : 'helper::size::callLists',
|
||||
'helperGLFogvSize' : 'helper::size::fogv',
|
||||
'helperGLLightvSize' : 'helper::size::lightv',
|
||||
'helperGLLightModelvSize' : 'helper::size::lightModelv',
|
||||
'helperGLMaterialvSize' : 'helper::size::materialv',
|
||||
'helperGLTexParametervSize' : 'helper::size::texParameterv',
|
||||
'helperGLTexEnvvSize' : 'helper::size::texEnvv',
|
||||
'helperGLTexGenvSize' : 'helper::size::texGenv',
|
||||
'helperGLNamedStringSize' : 'helper::size::namedString',
|
||||
'helperGLSamplerParametervSize' : 'helper::size::samplerParameterv',
|
||||
# 'helperGLDrawElementsSize' : 'helper::size::drawElements',
|
||||
'helperGLNamedStringParamsSize' : 'helper::size::namedStringParams'
|
||||
# 'helperGLPixelImageSize' : 'helper::size::pixelImageSize'
|
||||
}
|
||||
|
||||
def logParameter(function, parameter):
|
||||
|
||||
t = parameter.type
|
||||
n = parameter.name
|
||||
|
||||
# Use a cast, if necessary
|
||||
|
||||
if parameter.cast != None:
|
||||
t = parameter.cast
|
||||
n = 'reinterpret_cast<%s>(%s)'%(t,n)
|
||||
|
||||
# Quoting for array of strings
|
||||
|
||||
quote = ''
|
||||
if t == 'char **' or t == 'const char **' or t == 'GLchar **' or t == 'const GLchar **' or t == 'GLcharARB *' or t == 'LPCSTR *':
|
||||
quote = ',"\\\""'
|
||||
|
||||
if parameter.regalLog != None:
|
||||
return '%s'%parameter.regalLog
|
||||
elif t == 'GLenum':
|
||||
return 'toString(%s)'%n
|
||||
elif t == 'GLXenum':
|
||||
return 'GLXenumToString(%s)'%n
|
||||
elif t == 'EGLenum':
|
||||
return 'EGLenumToString(%s)'%n
|
||||
elif t == 'GLboolean' or t == 'const GLboolean':
|
||||
return 'toString(%s)'%n
|
||||
elif t == 'char *' or t == 'const char *' or t == 'GLchar *' or t == 'const GLchar *' or t == 'GLcharARB *' or t == 'LPCSTR':
|
||||
return 'boost::print::quote(%s,\'"\')'%n
|
||||
elif parameter.size!=None and (isinstance(parameter.size,int) or isinstance(parameter.size, long)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1:
|
||||
return 'boost::print::array(%s,%s)'%(n,parameter.size)
|
||||
elif parameter.size!=None and (isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and parameter.size.find('helper')==-1:
|
||||
return 'boost::print::array(%s,%s%s)'%(n,parameter.size,quote)
|
||||
# elif parameter.size!=None and (isinstance(parameter.size,int) or isinstance(parameter.size, long) or isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t=='const GLvoid *':
|
||||
# return 'boost::print::raw(%s,%s)'%(n,parameter.size)
|
||||
elif parameter.size!=None and (isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and parameter.size.find('helper')==0:
|
||||
h = parameter.size.split('(')[0]
|
||||
if h in helperMap:
|
||||
return 'boost::print::array(%s,%s(%s%s)'%(n,helperMap[h],parameter.size.split('(',1)[1],quote)
|
||||
else:
|
||||
return n
|
||||
elif t.startswith('GLDEBUG'):
|
||||
return None
|
||||
elif t.startswith('GLLOGPROC'):
|
||||
return None
|
||||
elif n=='data' and (function.name=='glBufferData' or function.name=='glBufferDataARB'):
|
||||
return 'boost::print::raw(data,data ? size : 0)'
|
||||
elif n=='data' and (function.name=='glBufferSubData' or function.name=='glBufferSubDataARB'):
|
||||
return 'boost::print::raw(data,data ? size : 0)'
|
||||
|
||||
return n
|
||||
|
||||
def cCodeParameter(function, parameter):
|
||||
|
||||
t = parameter.type
|
||||
n = parameter.name
|
||||
|
||||
# Use a cast, if necessary
|
||||
|
||||
if parameter.cast != None:
|
||||
t = parameter.cast
|
||||
n = 'reinterpret_cast<%s>(%s)'%(t,n)
|
||||
|
||||
# Quoting for array of strings
|
||||
|
||||
quote = ''
|
||||
if t == 'char **' or t == 'const char **' or t == 'GLchar **' or t == 'const GLchar **' or t == 'GLcharARB *' or t == 'LPCSTR *':
|
||||
quote = ',"\\\""'
|
||||
|
||||
if parameter.regalLog != None:
|
||||
return '%s'%parameter.regalLog
|
||||
elif t == 'GLenum':
|
||||
return 'toString(%s)'%n
|
||||
elif t == 'GLXenum':
|
||||
return 'GLXenumToString(%s)'%n
|
||||
elif t == 'EGLenum':
|
||||
return 'EGLenumToString(%s)'%n
|
||||
elif t == 'GLboolean' or t == 'const GLboolean':
|
||||
return 'toString(%s)'%n
|
||||
elif t == 'char *' or t == 'const char *' or t == 'GLchar *' or t == 'const GLchar *' or t == 'GLcharARB *' or t == 'LPCSTR':
|
||||
return None
|
||||
elif parameter.size!=None and (isinstance(parameter.size,int) or isinstance(parameter.size, long)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1:
|
||||
return None
|
||||
elif parameter.size!=None and (isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and parameter.size.find('helper')==-1:
|
||||
return None
|
||||
# elif parameter.size!=None and (isinstance(parameter.size,int) or isinstance(parameter.size, long) or isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t=='const GLvoid *':
|
||||
# return None
|
||||
elif parameter.size!=None and (isinstance(parameter.size, str) or isinstance(parameter.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and parameter.size.find('helper')==0:
|
||||
h = parameter.size.split('(')[0]
|
||||
if h in helperMap:
|
||||
return None
|
||||
else:
|
||||
return n
|
||||
elif t.startswith('GLDEBUG'):
|
||||
return None
|
||||
elif t.startswith('GLLOGPROC'):
|
||||
return None
|
||||
elif n=='data' and (function.name=='glBufferData' or function.name=='glBufferDataARB'):
|
||||
return None
|
||||
elif n=='data' and (function.name=='glBufferSubData' or function.name=='glBufferSubDataARB'):
|
||||
return None
|
||||
|
||||
return n
|
||||
|
||||
#
|
||||
# debug print function
|
||||
#
|
||||
# trace - logging mode: Internal, App or Driver
|
||||
# input - input parameters
|
||||
# output - output parameters
|
||||
# ret - return value
|
||||
#
|
||||
|
||||
def logFunction(function, trace = 'ITrace', input = True, output = False, ret = False):
|
||||
c = ''
|
||||
args = []
|
||||
for i in function.parameters:
|
||||
|
||||
if not output and i.output:
|
||||
continue
|
||||
|
||||
if not input and not i.output:
|
||||
continue
|
||||
|
||||
j = logParameter(function,i)
|
||||
if j:
|
||||
args.append(j)
|
||||
|
||||
r = None
|
||||
if ret and function.ret != None:
|
||||
tmp = deepcopy(function.ret)
|
||||
tmp.name = 'ret'
|
||||
r = logParameter(function,tmp)
|
||||
|
||||
args = args[:9]
|
||||
if len(args):
|
||||
c += '%s("%s","(", ' % (trace, function.name)
|
||||
c += ', ", ", '.join(args)
|
||||
c += ', ")"'
|
||||
if r != None:
|
||||
c += ', " returned ", %s'%(r)
|
||||
c += ');'
|
||||
else:
|
||||
c += '%s("%s","()"' % (trace, function.name)
|
||||
if r != None:
|
||||
c += ', " returned ", %s'%(r)
|
||||
c += ');'
|
||||
return c
|
||||
|
||||
|
|
@ -146,6 +146,11 @@ def writeFunctions(file,name,functions):
|
|||
print >>file, ',size = \'%s\''%(k.size),
|
||||
else:
|
||||
print >>file, ',size = %s'%(k.size),
|
||||
if getattr(k,'maxSize') != None:
|
||||
if isinstance(k.maxSize, str) or isinstance(k.maxSize, unicode):
|
||||
print >>file, ',maxSize = \'%s\''%(k.maxSize),
|
||||
else:
|
||||
print >>file, ',maxSize = %s'%(k.maxSize),
|
||||
if getattr(k,'cast',None) != None:
|
||||
print >>file, ',cast = \'%s\''%(k.cast),
|
||||
if getattr(k,'regalLog',None) != None:
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ soFormulae = {
|
|||
|
||||
'GenSamplers' : {
|
||||
'entries' : [ 'glGenSamplers' ],
|
||||
'impl' : [ '_context->so->GenSamplers( ${arg0}, ${arg1} );' ],
|
||||
'impl' : [ '_context->so->GenSamplers( ${arg0plus} );' ],
|
||||
},
|
||||
'DeleteSamplers' : {
|
||||
'entries' : [ 'glDeleteSamplers' ],
|
||||
'impl' : [ '_context->so->DeleteSamplers( _context, ${arg0}, ${arg1} );' ],
|
||||
'impl' : [ '_context->so->DeleteSamplers( ${arg0plus} );' ],
|
||||
},
|
||||
'IsSampler' : {
|
||||
'entries' : [ 'glIsSampler' ],
|
||||
|
|
@ -18,12 +18,12 @@ soFormulae = {
|
|||
},
|
||||
'BindSampler' : {
|
||||
'entries' : [ 'glBindSampler' ],
|
||||
'impl' : [ 'return _context->so->BindSampler( _context, ${arg0}, ${arg1} );' ],
|
||||
'impl' : [ '_context->so->BindSampler( ${arg0plus} );' ],
|
||||
},
|
||||
'GetSamplerParameterv' : {
|
||||
'entries' : [ 'glGetSamplerParameter(I|)(u|)(f|i)v' ],
|
||||
'impl' : [
|
||||
'if ( !_context->so->GetSamplerParameterv( ${arg0plus} ) ) {',
|
||||
'if ( !_context->so->GetSamplerParameterv( _context, ${arg0plus} ) ) {',
|
||||
' _context->dispatcher.emulation.glGetSamplerParameter${m1}${m2}${m3}v( ${arg0plus} );',
|
||||
'}',
|
||||
]
|
||||
|
|
@ -38,7 +38,11 @@ soFormulae = {
|
|||
},
|
||||
'ActiveTexture' : {
|
||||
'entries' : [ 'glActiveTexture' ],
|
||||
'prefix' : [ '_context->so->ActiveTexture( ${arg0} );' ],
|
||||
'impl' : [
|
||||
'if ( !_context->so->ActiveTexture( _context, ${arg0plus} ) ) {',
|
||||
' _context->dispatcher.emulation.glActiveTexture( ${arg0plus} );',
|
||||
'}',
|
||||
]
|
||||
},
|
||||
'GenTextures' : {
|
||||
'entries' : [ 'glGenTextures' ],
|
||||
|
|
@ -50,10 +54,26 @@ soFormulae = {
|
|||
},
|
||||
'BindTexture' : {
|
||||
'entries' : [ 'glBindTexture' ],
|
||||
'impl' : [ 'return _context->so->BindTexture( _context, ${arg0plus} );' ],
|
||||
'impl' : [
|
||||
'if ( !_context->so->BindTexture( _context, ${arg0plus} ) ) {',
|
||||
' _context->dispatcher.emulation.glBindTexture( ${arg0plus} );',
|
||||
'}',
|
||||
]
|
||||
},
|
||||
'TexParameter' : {
|
||||
'entries' : [ 'glTexParameter(I|)(u|)(f|i)(v|)(EXT|)' ],
|
||||
'prefix' : [ '_context->so->TexParameter${m4}( ${arg0plus} );' ],
|
||||
'prefix' : [ '_context->so->TexParameter${m4}( _context, ${arg0plus} );', ]
|
||||
},
|
||||
'GetTexParameterv' : {
|
||||
'entries' : [ 'glGetTexParameter(I|)(u|)(f|i)v' ],
|
||||
'impl' : [
|
||||
'if ( !_context->so->GetTexParameterv( _context, ${arg0plus} ) ) {',
|
||||
' _context->dispatcher.emulation.glGetTexParameter${m1}${m2}${m3}v( ${arg0plus} );',
|
||||
'}',
|
||||
]
|
||||
},
|
||||
'PreDraw' : {
|
||||
'entries' : [ 'gl(Multi|)Draw(Arrays|Element|Elements)(Instanced|Indirect|BaseVertex|InstancedBaseVertex|Array|)(ARB|EXT|AMD|ATI|APPLE|)' ],
|
||||
'prefix' : [ '_context->so->PreDraw( _context );', ],
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ from RegalContextInfo import *
|
|||
from RegalLookup import *
|
||||
from RegalToken import *
|
||||
from RegalDispatch import *
|
||||
from RegalDispatchCode import *
|
||||
from RegalDispatchDebug import *
|
||||
from RegalDispatchError import *
|
||||
from RegalDispatchEmu import *
|
||||
|
|
@ -151,6 +152,7 @@ def generate(apis, args):
|
|||
generateSystemHeader(apis, args)
|
||||
generateEmuSource( apis, args )
|
||||
generateDispatchLog( apis, args )
|
||||
generateDispatchCode( apis, args )
|
||||
generateErrorSource( apis, args )
|
||||
generateDebugSource( apis, args )
|
||||
generateLoaderSource( apis, args )
|
||||
|
|
|
|||
|
|
@ -11719,7 +11719,7 @@ gl.add(glBlendFunc)
|
|||
|
||||
glClear = Function('glClear')
|
||||
glClear.ret = Return('void')
|
||||
glClear.add( Input( 'mask','GLbitfield' ))
|
||||
glClear.add( Input( 'mask','GLbitfield' ,regalLog = 'GLclearToString(mask)' ))
|
||||
glClear.version = '1.0'
|
||||
glClear.category = 'GL_VERSION_1_0'
|
||||
glClear.esVersions = [1.0, 1.1, 2.0]
|
||||
|
|
@ -16680,7 +16680,7 @@ glGetActiveAttrib.add( Input( 'bufSize','GLsizei' ))
|
|||
glGetActiveAttrib.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveAttrib.add( Output( 'size','GLint *' ,size = 1 ))
|
||||
glGetActiveAttrib.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetActiveAttrib.add( Output( 'name','GLchar *' ))
|
||||
glGetActiveAttrib.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveAttrib.version = '2.0'
|
||||
glGetActiveAttrib.category = ''
|
||||
glGetActiveAttrib.esVersions = [2.0]
|
||||
|
|
@ -16696,7 +16696,7 @@ glGetActiveUniform.add( Input( 'bufSize','GLsizei' ))
|
|||
glGetActiveUniform.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveUniform.add( Output( 'size','GLint *' ,size = 1 ))
|
||||
glGetActiveUniform.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetActiveUniform.add( Output( 'name','GLchar *' ))
|
||||
glGetActiveUniform.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveUniform.version = '2.0'
|
||||
glGetActiveUniform.category = ''
|
||||
glGetActiveUniform.esVersions = [2.0]
|
||||
|
|
@ -16822,7 +16822,7 @@ glGetProgramInfoLog.ret = Return('void')
|
|||
glGetProgramInfoLog.add( Input( 'program','GLuint' ))
|
||||
glGetProgramInfoLog.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetProgramInfoLog.add( Output( 'length','GLsizei *' ,size = 'length ? 1 : 0' ))
|
||||
glGetProgramInfoLog.add( Output( 'infoLog','GLchar *' ))
|
||||
glGetProgramInfoLog.add( Output( 'infoLog','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetProgramInfoLog.version = '2.0'
|
||||
glGetProgramInfoLog.category = ''
|
||||
glGetProgramInfoLog.esVersions = [2.0]
|
||||
|
|
@ -16880,7 +16880,7 @@ glGetShaderInfoLog.ret = Return('void')
|
|||
glGetShaderInfoLog.add( Input( 'shader','GLuint' ))
|
||||
glGetShaderInfoLog.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetShaderInfoLog.add( Output( 'length','GLsizei *' ,size = 'length ? 1 : 0' ))
|
||||
glGetShaderInfoLog.add( Output( 'infoLog','GLchar *' ))
|
||||
glGetShaderInfoLog.add( Output( 'infoLog','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetShaderInfoLog.version = '2.0'
|
||||
glGetShaderInfoLog.category = ''
|
||||
glGetShaderInfoLog.esVersions = [2.0]
|
||||
|
|
@ -16893,7 +16893,7 @@ glGetShaderSource.ret = Return('void')
|
|||
glGetShaderSource.add( Input( 'shader','GLuint' ))
|
||||
glGetShaderSource.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetShaderSource.add( Output( 'length','GLsizei *' ,size = 'length ? 1 : 0' ))
|
||||
glGetShaderSource.add( Output( 'source','GLchar *' ))
|
||||
glGetShaderSource.add( Output( 'source','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetShaderSource.version = '2.0'
|
||||
glGetShaderSource.category = ''
|
||||
glGetShaderSource.esVersions = [2.0]
|
||||
|
|
@ -18671,7 +18671,7 @@ glGetPerfMonitorCounterStringAMD.add( Input( 'group','GLuint' ))
|
|||
glGetPerfMonitorCounterStringAMD.add( Input( 'counter','GLuint' ))
|
||||
glGetPerfMonitorCounterStringAMD.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetPerfMonitorCounterStringAMD.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetPerfMonitorCounterStringAMD.add( Output( 'counterString','GLchar *' ))
|
||||
glGetPerfMonitorCounterStringAMD.add( Output( 'counterString','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetPerfMonitorCounterStringAMD.version = '1.2'
|
||||
glGetPerfMonitorCounterStringAMD.category = 'GL_AMD_performance_monitor'
|
||||
glGetPerfMonitorCounterStringAMD.trace = True
|
||||
|
|
@ -18696,7 +18696,7 @@ glGetPerfMonitorGroupStringAMD.ret = Return('void')
|
|||
glGetPerfMonitorGroupStringAMD.add( Input( 'group','GLuint' ))
|
||||
glGetPerfMonitorGroupStringAMD.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetPerfMonitorGroupStringAMD.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetPerfMonitorGroupStringAMD.add( Output( 'groupString','GLchar *' ))
|
||||
glGetPerfMonitorGroupStringAMD.add( Output( 'groupString','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetPerfMonitorGroupStringAMD.version = '1.2'
|
||||
glGetPerfMonitorGroupStringAMD.category = 'GL_AMD_performance_monitor'
|
||||
glGetPerfMonitorGroupStringAMD.trace = True
|
||||
|
|
@ -19708,12 +19708,12 @@ glGetDebugMessageLogARB = Function('glGetDebugMessageLogARB')
|
|||
glGetDebugMessageLogARB.ret = Return('GLuint')
|
||||
glGetDebugMessageLogARB.add( Input( 'count','GLuint' ))
|
||||
glGetDebugMessageLogARB.add( Input( 'bufsize','GLsizei' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'sources','GLenum *' ,size = 'ret' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'types','GLenum *' ,size = 'ret' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'ids','GLuint *' ,size = 'ret' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'severities','GLenum *' ,size = 'ret' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'lengths','GLsizei *' ,size = 'ret' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'messageLog','GLchar *' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'sources','GLenum *' ,size = 'ret' ,maxSize = 'count' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'types','GLenum *' ,size = 'ret' ,maxSize = 'count' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'ids','GLuint *' ,size = 'ret' ,maxSize = 'count' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'severities','GLenum *' ,size = 'ret' ,maxSize = 'count' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'lengths','GLsizei *' ,size = 'ret' ,maxSize = 'count' ))
|
||||
glGetDebugMessageLogARB.add( Output( 'messageLog','GLchar *' ,maxSize = 'logsize' ))
|
||||
glGetDebugMessageLogARB.version = '4.1'
|
||||
glGetDebugMessageLogARB.category = 'GL_ARB_debug_output'
|
||||
glGetDebugMessageLogARB.trace = True
|
||||
|
|
@ -20236,7 +20236,7 @@ glGetProgramBinary.add( Input( 'program','GLuint' ))
|
|||
glGetProgramBinary.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetProgramBinary.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetProgramBinary.add( Output( 'binaryFormat','GLenum *' ,size = 1 ))
|
||||
glGetProgramBinary.add( Output( 'binary','GLvoid *' ))
|
||||
glGetProgramBinary.add( Output( 'binary','GLvoid *' ,maxSize = 'bufSize' ))
|
||||
glGetProgramBinary.version = '4.1'
|
||||
glGetProgramBinary.category = 'GL_ARB_get_program_binary'
|
||||
glGetProgramBinary.trace = True
|
||||
|
|
@ -22131,7 +22131,7 @@ glGetProgramPipelineInfoLog.ret = Return('void')
|
|||
glGetProgramPipelineInfoLog.add( Input( 'pipeline','GLuint' ))
|
||||
glGetProgramPipelineInfoLog.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetProgramPipelineInfoLog.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetProgramPipelineInfoLog.add( Output( 'infoLog','GLchar *' ))
|
||||
glGetProgramPipelineInfoLog.add( Output( 'infoLog','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetProgramPipelineInfoLog.version = '4.1'
|
||||
glGetProgramPipelineInfoLog.category = 'GL_ARB_separate_shader_objects'
|
||||
glGetProgramPipelineInfoLog.trace = True
|
||||
|
|
@ -22909,7 +22909,7 @@ glGetActiveUniformARB.add( Input( 'maxLength','GLsizei' ))
|
|||
glGetActiveUniformARB.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveUniformARB.add( Output( 'size','GLint *' ,size = 1 ))
|
||||
glGetActiveUniformARB.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetActiveUniformARB.add( Output( 'name','GLcharARB *' ))
|
||||
glGetActiveUniformARB.add( Output( 'name','GLcharARB *' ,maxSize = 'maxLength' ))
|
||||
glGetActiveUniformARB.version = '1.1'
|
||||
glGetActiveUniformARB.category = 'GL_ARB_shader_objects'
|
||||
glGetActiveUniformARB.trace = True
|
||||
|
|
@ -22942,7 +22942,7 @@ glGetInfoLogARB.ret = Return('void')
|
|||
glGetInfoLogARB.add( Input( 'obj','GLhandleARB' ))
|
||||
glGetInfoLogARB.add( Input( 'maxLength','GLsizei' ))
|
||||
glGetInfoLogARB.add( Output( 'length','GLsizei *' ,size = 'length ? 1 : 0' ))
|
||||
glGetInfoLogARB.add( Output( 'infoLog','GLcharARB *' ))
|
||||
glGetInfoLogARB.add( Output( 'infoLog','GLcharARB *' ,maxSize = 'maxLength' ))
|
||||
glGetInfoLogARB.version = '1.1'
|
||||
glGetInfoLogARB.category = 'GL_ARB_shader_objects'
|
||||
glGetInfoLogARB.trace = True
|
||||
|
|
@ -22976,7 +22976,7 @@ glGetShaderSourceARB.ret = Return('void')
|
|||
glGetShaderSourceARB.add( Input( 'obj','GLhandleARB' ))
|
||||
glGetShaderSourceARB.add( Input( 'maxLength','GLsizei' ))
|
||||
glGetShaderSourceARB.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetShaderSourceARB.add( Output( 'source','GLcharARB *' ))
|
||||
glGetShaderSourceARB.add( Output( 'source','GLcharARB *' ,maxSize = 'maxLength' ))
|
||||
glGetShaderSourceARB.version = '1.1'
|
||||
glGetShaderSourceARB.category = 'GL_ARB_shader_objects'
|
||||
glGetShaderSourceARB.trace = True
|
||||
|
|
@ -23292,7 +23292,7 @@ glGetActiveSubroutineName.add( Input( 'shaderType','GLenum' ))
|
|||
glGetActiveSubroutineName.add( Input( 'index','GLuint' ))
|
||||
glGetActiveSubroutineName.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetActiveSubroutineName.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveSubroutineName.add( Output( 'name','GLchar *' ))
|
||||
glGetActiveSubroutineName.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveSubroutineName.version = '4.0'
|
||||
glGetActiveSubroutineName.category = 'GL_ARB_shader_subroutine'
|
||||
glGetActiveSubroutineName.trace = True
|
||||
|
|
@ -23306,7 +23306,7 @@ glGetActiveSubroutineUniformName.add( Input( 'shaderType','GLenum' ))
|
|||
glGetActiveSubroutineUniformName.add( Input( 'index','GLuint' ))
|
||||
glGetActiveSubroutineUniformName.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetActiveSubroutineUniformName.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveSubroutineUniformName.add( Output( 'name','GLchar *' ))
|
||||
glGetActiveSubroutineUniformName.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveSubroutineUniformName.version = '4.0'
|
||||
glGetActiveSubroutineUniformName.category = 'GL_ARB_shader_subroutine'
|
||||
glGetActiveSubroutineUniformName.trace = True
|
||||
|
|
@ -23412,7 +23412,7 @@ glGetNamedStringARB.add( Input( 'namelen','GLint' ))
|
|||
glGetNamedStringARB.add( Input( 'name','const GLchar *' ,size = 'helperGLNamedStringSize(namelen, name)' ))
|
||||
glGetNamedStringARB.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetNamedStringARB.add( Output( 'stringlen','GLint *' ,size = 1 ))
|
||||
glGetNamedStringARB.add( Output( 'string','GLchar *' ))
|
||||
glGetNamedStringARB.add( Output( 'string','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetNamedStringARB.version = '4.0'
|
||||
glGetNamedStringARB.category = 'GL_ARB_shading_language_include'
|
||||
glGetNamedStringARB.trace = True
|
||||
|
|
@ -24162,7 +24162,7 @@ glGetActiveUniformBlockName.add( Input( 'program','GLuint' ))
|
|||
glGetActiveUniformBlockName.add( Input( 'uniformBlockIndex','GLuint' ))
|
||||
glGetActiveUniformBlockName.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetActiveUniformBlockName.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveUniformBlockName.add( Output( 'uniformBlockName','GLchar *' ))
|
||||
glGetActiveUniformBlockName.add( Output( 'uniformBlockName','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveUniformBlockName.version = '3.1'
|
||||
glGetActiveUniformBlockName.category = 'GL_ARB_uniform_buffer_object'
|
||||
glGetActiveUniformBlockName.trace = True
|
||||
|
|
@ -24187,7 +24187,7 @@ glGetActiveUniformName.add( Input( 'program','GLuint' ))
|
|||
glGetActiveUniformName.add( Input( 'uniformIndex','GLuint' ))
|
||||
glGetActiveUniformName.add( Input( 'bufSize','GLsizei' ))
|
||||
glGetActiveUniformName.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveUniformName.add( Output( 'uniformName','GLchar *' ))
|
||||
glGetActiveUniformName.add( Output( 'uniformName','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveUniformName.version = '3.1'
|
||||
glGetActiveUniformName.category = 'GL_ARB_uniform_buffer_object'
|
||||
glGetActiveUniformName.trace = True
|
||||
|
|
@ -25392,7 +25392,7 @@ glGetActiveAttribARB.add( Input( 'maxLength','GLsizei' ))
|
|||
glGetActiveAttribARB.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveAttribARB.add( Output( 'size','GLint *' ,size = 1 ))
|
||||
glGetActiveAttribARB.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetActiveAttribARB.add( Output( 'name','GLcharARB *' ))
|
||||
glGetActiveAttribARB.add( Output( 'name','GLcharARB *' ,maxSize = 'maxLength' ))
|
||||
glGetActiveAttribARB.version = '1.1'
|
||||
glGetActiveAttribARB.category = 'GL_ARB_vertex_shader'
|
||||
glGetActiveAttribARB.trace = True
|
||||
|
|
@ -32970,7 +32970,7 @@ glGetTransformFeedbackVaryingEXT.add( Input( 'bufSize','GLsizei' ))
|
|||
glGetTransformFeedbackVaryingEXT.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetTransformFeedbackVaryingEXT.add( Output( 'size','GLsizei *' ,size = 1 ))
|
||||
glGetTransformFeedbackVaryingEXT.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetTransformFeedbackVaryingEXT.add( Output( 'name','GLchar *' ))
|
||||
glGetTransformFeedbackVaryingEXT.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetTransformFeedbackVaryingEXT.version = '2.0'
|
||||
glGetTransformFeedbackVaryingEXT.category = 'GL_EXT_transform_feedback'
|
||||
glGetTransformFeedbackVaryingEXT.trace = True
|
||||
|
|
@ -37484,7 +37484,7 @@ glGetActiveVaryingNV.add( Input( 'bufSize','GLsizei' ))
|
|||
glGetActiveVaryingNV.add( Output( 'length','GLsizei *' ,size = 1 ))
|
||||
glGetActiveVaryingNV.add( Output( 'size','GLsizei *' ,size = 1 ))
|
||||
glGetActiveVaryingNV.add( Output( 'type','GLenum *' ,size = 1 ))
|
||||
glGetActiveVaryingNV.add( Output( 'name','GLchar *' ))
|
||||
glGetActiveVaryingNV.add( Output( 'name','GLchar *' ,maxSize = 'bufSize' ))
|
||||
glGetActiveVaryingNV.version = '1.5'
|
||||
glGetActiveVaryingNV.category = 'GL_NV_transform_feedback'
|
||||
glGetActiveVaryingNV.trace = True
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from ApiUtil import typeIsVoid
|
|||
from ApiUtil import toLong
|
||||
from ApiUtil import hexValue
|
||||
from ApiCodeGen import *
|
||||
from ApiRegal import logFunction
|
||||
from Emu import emuFindEntry, emuCodeGen
|
||||
|
||||
from RegalContext import emuRegal
|
||||
|
|
@ -196,23 +197,6 @@ def generatePublicHeader(apis, args):
|
|||
|
||||
outputCode( 'include/GL/Regal.h', publicHeaderTemplate.substitute(substitute))
|
||||
|
||||
## Map gl.py helper functions to Regal namespace
|
||||
|
||||
helpers = {
|
||||
'helperGLCallListsSize' : 'helper::size::callLists',
|
||||
'helperGLFogvSize' : 'helper::size::fogv',
|
||||
'helperGLLightvSize' : 'helper::size::lightv',
|
||||
'helperGLLightModelvSize' : 'helper::size::lightModelv',
|
||||
'helperGLMaterialvSize' : 'helper::size::materialv',
|
||||
'helperGLTexParametervSize' : 'helper::size::texParameterv',
|
||||
'helperGLTexEnvvSize' : 'helper::size::texEnvv',
|
||||
'helperGLTexGenvSize' : 'helper::size::texGenv',
|
||||
'helperGLNamedStringSize' : 'helper::size::namedString',
|
||||
'helperGLSamplerParametervSize' : 'helper::size::samplerParameterv',
|
||||
# 'helperGLDrawElementsSize' : 'helper::size::drawElements',
|
||||
'helperGLNamedStringParamsSize' : 'helper::size::namedStringParams'
|
||||
}
|
||||
|
||||
def apiFuncDefineCode(apis, args):
|
||||
|
||||
code = ''
|
||||
|
|
@ -241,7 +225,7 @@ def apiFuncDefineCode(apis, args):
|
|||
|
||||
if function.needsContext:
|
||||
c += ' RegalContext *_context = REGAL_GET_CONTEXT();\n'
|
||||
c += ' %s\n' % debugPrintFunction( function, 'App' )
|
||||
c += ' %s\n' % logFunction( function, 'App' )
|
||||
c += ' if (!_context) return'
|
||||
if typeIsVoid(rType):
|
||||
c += ';\n'
|
||||
|
|
@ -273,7 +257,7 @@ def apiFuncDefineCode(apis, args):
|
|||
c += 'return '
|
||||
c += '_next->call(&_next->%s)(%s);\n' % ( name, callParams )
|
||||
else:
|
||||
c += ' %s\n' % debugPrintFunction(function, 'App' )
|
||||
c += ' %s\n' % logFunction(function, 'App' )
|
||||
|
||||
c += listToString(indent(emuCodeGen(emue,'prefix'),' '))
|
||||
|
||||
|
|
@ -302,7 +286,7 @@ def apiFuncDefineCode(apis, args):
|
|||
|
||||
c += ' if (dispatchTableGlobal.%s)\n' % name
|
||||
c += ' {\n'
|
||||
c += ' %s\n' % debugPrintFunction( function, 'Driver' )
|
||||
c += ' %s\n' % logFunction( function, 'Driver' )
|
||||
c += ' '
|
||||
if not typeIsVoid(rType):
|
||||
c += 'ret = '
|
||||
|
|
@ -344,85 +328,6 @@ def apiFuncDefineCode(apis, args):
|
|||
|
||||
return code
|
||||
|
||||
#
|
||||
# debug print function
|
||||
#
|
||||
|
||||
def debugPrintFunction(function, trace = 'ITrace', input = True, output = False, ret = None):
|
||||
c = ''
|
||||
args = []
|
||||
for i in function.parameters:
|
||||
|
||||
if not output and i.output:
|
||||
continue
|
||||
|
||||
if not input and not i.output:
|
||||
continue
|
||||
|
||||
# Use a cast, if necessary
|
||||
|
||||
t = i.type
|
||||
n = i.name
|
||||
if i.cast != None:
|
||||
t = i.cast
|
||||
n = 'reinterpret_cast<%s>(%s)'%(t,n)
|
||||
|
||||
# If it's array of strings, quote each string
|
||||
|
||||
quote = ''
|
||||
if t == 'char **' or t == 'const char **' or t == 'GLchar **' or t == 'const GLchar **' or t == 'GLcharARB *' or t == 'LPCSTR *':
|
||||
quote = ',"\\\""'
|
||||
|
||||
if i.regalLog != None:
|
||||
args.append('%s'%i.regalLog)
|
||||
elif t == 'GLenum':
|
||||
args.append('toString(%s)'%n)
|
||||
elif t == 'GLXenum':
|
||||
args.append('GLXenumToString(%s)'%n)
|
||||
elif t == 'EGLenum':
|
||||
args.append('EGLenumToString(%s)'%n)
|
||||
elif t == 'GLboolean' or t == 'const GLboolean':
|
||||
args.append('toString(%s)'%n)
|
||||
elif t == 'char *' or t == 'const char *' or t == 'GLchar *' or t == 'const GLchar *' or t == 'GLcharARB *' or t == 'LPCSTR':
|
||||
args.append('boost::print::quote(%s,\'"\')'%n)
|
||||
elif i.size!=None and (isinstance(i.size,int) or isinstance(i.size, long)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1:
|
||||
args.append('boost::print::array(%s,%s)'%(n,i.size))
|
||||
elif i.size!=None and (isinstance(i.size, str) or isinstance(i.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and i.size.find('helper')==-1:
|
||||
args.append('boost::print::array(%s,%s%s)'%(n,i.size,quote))
|
||||
# elif i.size!=None and (isinstance(i.size,int) or isinstance(i.size, long) or isinstance(i.size, str) or isinstance(i.size, unicode)) and t=='const GLvoid *':
|
||||
# args.append('boost::print::raw(%s,%s)'%(n,i.size))
|
||||
elif i.size!=None and (isinstance(i.size, str) or isinstance(i.size, unicode)) and t.find('void')==-1 and t.find('PIXELFORMATDESCRIPTOR')==-1 and i.size.find('helper')==0:
|
||||
h = i.size.split('(')[0]
|
||||
if h in helpers:
|
||||
args.append('boost::print::array(%s,%s(%s%s)'%(n,helpers[h],i.size.split('(',1)[1],quote))
|
||||
else:
|
||||
args.append(n)
|
||||
elif t.startswith('GLDEBUG'):
|
||||
pass
|
||||
elif t.startswith('GLLOGPROC'):
|
||||
pass
|
||||
elif n=='data' and (function.name=='glBufferData' or function.name=='glBufferDataARB'):
|
||||
args.append('boost::print::raw(data,data ? size : 0)')
|
||||
elif n=='data' and (function.name=='glBufferSubData' or function.name=='glBufferSubDataARB'):
|
||||
args.append('boost::print::raw(data,data ? size : 0)')
|
||||
else:
|
||||
args.append(n)
|
||||
|
||||
args = args[:9]
|
||||
if len(args):
|
||||
c += '%s("%s","(", ' % (trace, function.name)
|
||||
c += ', ", ", '.join(args)
|
||||
c += ', ")"'
|
||||
if ret:
|
||||
c += ', " returned ", ret'
|
||||
c += ');'
|
||||
else:
|
||||
c += '%s("%s","()"' % (trace, function.name)
|
||||
if ret:
|
||||
c += ', " returned ", ret'
|
||||
c += ');'
|
||||
return c
|
||||
|
||||
def apiTypedefCode( apis, args ):
|
||||
|
||||
code = ''
|
||||
|
|
|
|||
|
|
@ -48,23 +48,23 @@ emuRegal = [
|
|||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : errorStringFormulae },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : logFormulae },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : enableFormulae },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : cacheFormulaeGlobal },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : cacheFormulaeGlobal },
|
||||
]
|
||||
|
||||
|
||||
# RegalDispathEmu.cpp fixed-function emulation
|
||||
|
||||
emu = [
|
||||
{ 'type' : 'RegalObj', 'include' : 'RegalObj.h', 'member' : 'obj', 'conditional' : 'Config::enableEmuObj', 'ifdef' : 'REGAL_EMU_OBJ', 'formulae' : objFormulae },
|
||||
#{ 'type' : 'RegalPpc', 'include' : 'RegalPpc.h', 'member' : 'ppc', 'conditional' : None, 'ifdef' : '', 'formulae' : ppcFormulae },
|
||||
{ 'type' : 'RegalPpa', 'include' : 'RegalPpa.h', 'member' : 'ppa', 'conditional' : 'Config::enableEmuPpa', 'ifdef' : 'REGAL_EMU_PPA', 'formulae' : ppaFormulae },
|
||||
{ 'type' : 'RegalBin', 'include' : 'RegalBin.h', 'member' : 'bin', 'conditional' : 'Config::enableEmuBin', 'ifdef' : 'REGAL_EMU_BIN', 'formulae' : binFormulae },
|
||||
{ 'type' : 'RegalDsa', 'include' : 'RegalDsa.h', 'member' : 'dsa', 'conditional' : 'Config::enableEmuDsa', 'ifdef' : 'REGAL_EMU_DSA', 'formulae' : dsaFormulae },
|
||||
{ 'type' : 'Emu::Iff', 'include' : 'RegalIff.h', 'member' : 'iff', 'conditional' : 'Config::enableEmuIff', 'ifdef' : 'REGAL_EMU_IFF', 'formulae' : iffFormulae },
|
||||
{ 'type' : 'RegalSo', 'include' : 'RegalSo.h', 'member' : 'so', 'conditional' : 'Config::enableEmuSo', 'ifdef' : 'REGAL_EMU_SO', 'formulae' : soFormulae },
|
||||
{ 'type' : 'RegalVao', 'include' : 'RegalVao.h', 'member' : 'vao', 'conditional' : 'Config::enableEmuVao', 'ifdef' : 'REGAL_EMU_VAO', 'formulae' : vaoFormulae },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : 'Config::enableEmuFilter', 'ifdef' : 'REGAL_EMU_FILTER', 'formulae' : filterFormulae },
|
||||
{ 'type' : 'void', 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : None }
|
||||
{ 'type' : 'RegalObj', 'include' : 'RegalObj.h', 'member' : 'obj', 'conditional' : 'Config::enableEmuObj', 'ifdef' : 'REGAL_EMU_OBJ', 'formulae' : objFormulae },
|
||||
#{ 'type' : 'RegalPpc', 'include' : 'RegalPpc.h', 'member' : 'ppc', 'conditional' : None, 'ifdef' : '', 'formulae' : ppcFormulae },
|
||||
{ 'type' : 'RegalPpa', 'include' : 'RegalPpa.h', 'member' : 'ppa', 'conditional' : 'Config::enableEmuPpa', 'ifdef' : 'REGAL_EMU_PPA', 'formulae' : ppaFormulae },
|
||||
{ 'type' : 'RegalBin', 'include' : 'RegalBin.h', 'member' : 'bin', 'conditional' : 'Config::enableEmuBin', 'ifdef' : 'REGAL_EMU_BIN', 'formulae' : binFormulae },
|
||||
{ 'type' : 'RegalDsa', 'include' : 'RegalDsa.h', 'member' : 'dsa', 'conditional' : 'Config::enableEmuDsa', 'ifdef' : 'REGAL_EMU_DSA', 'formulae' : dsaFormulae },
|
||||
{ 'type' : 'Emu::Iff', 'include' : 'RegalIff.h', 'member' : 'iff', 'conditional' : 'Config::enableEmuIff', 'ifdef' : 'REGAL_EMU_IFF', 'formulae' : iffFormulae },
|
||||
{ 'type' : 'RegalSo', 'include' : 'RegalSo.h', 'member' : 'so', 'conditional' : 'Config::enableEmuSo', 'ifdef' : 'REGAL_EMU_SO', 'formulae' : soFormulae },
|
||||
{ 'type' : 'RegalVao', 'include' : 'RegalVao.h', 'member' : 'vao', 'conditional' : 'Config::enableEmuVao', 'ifdef' : 'REGAL_EMU_VAO', 'formulae' : vaoFormulae },
|
||||
{ 'type' : None, 'include' : None, 'member' : None, 'conditional' : 'Config::enableEmuFilter', 'ifdef' : 'REGAL_EMU_FILTER', 'formulae' : filterFormulae },
|
||||
{ 'type' : 'void', 'include' : None, 'member' : None, 'conditional' : None, 'ifdef' : None, 'formulae' : None }
|
||||
]
|
||||
|
||||
contextHeaderTemplate = Template( '''${AUTOGENERATED}
|
||||
|
|
@ -146,6 +146,11 @@ ${EMU_MEMBER_DECLARE}
|
|||
|
||||
size_t depthBeginEnd; // Normally zero or one
|
||||
size_t depthPushAttrib; //
|
||||
|
||||
// For RegalDispatchCode
|
||||
|
||||
size_t codeInputNext;
|
||||
size_t codeOutputNext;
|
||||
};
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
|
@ -191,7 +196,9 @@ ${EMU_MEMBER_CONSTRUCT}#endif
|
|||
thread(0),
|
||||
logCallback(NULL),
|
||||
depthBeginEnd(0),
|
||||
depthPushAttrib(0)
|
||||
depthPushAttrib(0),
|
||||
codeInputNext(0),
|
||||
codeOutputNext(0)
|
||||
{
|
||||
Internal("RegalContext::RegalContext","()");
|
||||
|
||||
|
|
@ -356,7 +363,7 @@ def generateContextSource(apis, args):
|
|||
if i['member']:
|
||||
memberConstruct += ' %s(NULL),\n' % ( i['member'] )
|
||||
memberInit += ' %s = new %s;\n'%(i['member'],i['type'])
|
||||
memberCleanup += ' delete %s;\n' % i['member']
|
||||
memberCleanup += indent(wrapIf(i['ifdef'],'delete %s;\n' % i['member']),' ')
|
||||
|
||||
emuMemberConstruct += ' emuLevel(0),\n'
|
||||
|
||||
|
|
@ -372,7 +379,7 @@ def generateContextSource(apis, args):
|
|||
if emu[i]['include']:
|
||||
emuIncludes += '#include "%s"\n' % emu[i]['include']
|
||||
if emu[i]['member']:
|
||||
emuMemberCleanup += ' delete %s;\n' % emu[i]['member']
|
||||
emuMemberCleanup += indent(wrapIf(emu[i]['ifdef'],'delete %s;\n' % emu[i]['member']),' ')
|
||||
revi = len( emu ) - 2 - i;
|
||||
if emu[revi]['member']:
|
||||
init = ''
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ def traverseContextInfo(apis, args):
|
|||
c.update([i.category for i in api.functions])
|
||||
c.update([i.category for i in api.typedefs])
|
||||
c.update([i.category for i in api.enums])
|
||||
|
||||
|
||||
for i in api.enums:
|
||||
c.update([j.category for j in i.enumerants])
|
||||
|
||||
|
|
|
|||
207
scripts/regal/RegalDispatchCode.py
Executable file
207
scripts/regal/RegalDispatchCode.py
Executable file
|
|
@ -0,0 +1,207 @@
|
|||
#!/usr/bin/python -B
|
||||
|
||||
#
|
||||
# Dispatch for generating C code, similar to
|
||||
# application or driver logging.
|
||||
#
|
||||
|
||||
from string import Template, upper, replace
|
||||
from copy import deepcopy
|
||||
|
||||
from ApiCodeGen import *
|
||||
from ApiUtil import outputCode
|
||||
from ApiUtil import typeIsVoid
|
||||
from ApiType import typeStrip
|
||||
from ApiRegal import logParameter
|
||||
from ApiRegal import cCodeParameter
|
||||
from ApiRegal import helperMap
|
||||
|
||||
from RegalContextInfo import cond
|
||||
|
||||
# Code generation for dispatch table init.
|
||||
|
||||
def apiDispatchCodeInitCode(apis, args, dispatchName):
|
||||
|
||||
code = ''
|
||||
|
||||
for api in apis:
|
||||
if api.name=='gl':
|
||||
|
||||
for function in api.functions:
|
||||
|
||||
if not function.needsContext:
|
||||
continue
|
||||
|
||||
if getattr(function,'regalOnly',False)==True:
|
||||
continue
|
||||
|
||||
name = function.name
|
||||
code += ' tbl.%s = %s_%s;\n' % ( name, dispatchName, name )
|
||||
|
||||
return code
|
||||
|
||||
# Template for RegalDispatchCode.cpp
|
||||
|
||||
dispatchCodeTemplate = Template('''${AUTOGENERATED}
|
||||
${LICENSE}
|
||||
|
||||
#include "pch.h" /* For MS precompiled header support */
|
||||
|
||||
#include "RegalUtil.h"
|
||||
|
||||
#if REGAL_CODE
|
||||
|
||||
REGAL_GLOBAL_BEGIN
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/print/string_list.hpp>
|
||||
|
||||
#include "RegalLog.h"
|
||||
#include "RegalPush.h"
|
||||
#include "RegalToken.h"
|
||||
#include "RegalHelper.h"
|
||||
#include "RegalContext.h"
|
||||
|
||||
using namespace ::REGAL_NAMESPACE_INTERNAL::Logging;
|
||||
using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
||||
using namespace ::boost::print;
|
||||
|
||||
${API_FUNC_DEFINE}
|
||||
|
||||
void InitDispatchTableCode(DispatchTable &tbl)
|
||||
{
|
||||
${API_GLOBAL_DISPATCH_INIT}
|
||||
}
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
''')
|
||||
|
||||
# Code generation for generating C code from GL API calls
|
||||
|
||||
def generateDispatchCode(apis, args):
|
||||
|
||||
code = ''
|
||||
|
||||
for api in apis:
|
||||
if api.name=='gl':
|
||||
|
||||
for function in api.functions:
|
||||
|
||||
if not function.needsContext:
|
||||
continue
|
||||
|
||||
if getattr(function,'regalOnly',False)==True:
|
||||
continue
|
||||
|
||||
f = deepcopy(function)
|
||||
|
||||
name = f.name
|
||||
params = paramsDefaultCode(f.parameters, True)
|
||||
|
||||
callParams = paramsNameCode(f.parameters)
|
||||
rType = typeCode(f.ret.type)
|
||||
|
||||
code += 'static %sREGAL_CALL %s%s(%s) \n{\n' % (rType, 'code_', name, params)
|
||||
code += ' RegalContext *_context = REGAL_GET_CONTEXT();\n'
|
||||
code += ' RegalAssert(_context);\n'
|
||||
|
||||
code += ' DispatchTable *_next = _context->dispatcher.code._next;\n'
|
||||
code += ' RegalAssert(_next);\n'
|
||||
code += ' '
|
||||
if not typeIsVoid(rType):
|
||||
code += '%s _ret = '%(rType)
|
||||
code += '_next->call(&_next->%s)(%s);\n' % ( name, callParams )
|
||||
|
||||
prefix = ''
|
||||
suffix = ''
|
||||
|
||||
if not f.trace:
|
||||
prefix += '/* '
|
||||
suffix += ' */'
|
||||
|
||||
header = ' std::string indent((_context->depthBeginEnd + _context->depthPushAttrib)*2,\' \');\n'
|
||||
header += ' string_list< ::std::string > _code;\n'
|
||||
body = ''
|
||||
|
||||
if len(f.parameters)==0:
|
||||
body += ' %s_code << indent << "%s();%s\\n";\n'%(prefix,f.name,suffix)
|
||||
if len(f.parameters)>0:
|
||||
body += ' %s_code << indent << "%s(";\n'%(prefix,f.name)
|
||||
|
||||
if len(f.parameters)>0:
|
||||
delim = False
|
||||
for i in f.parameters:
|
||||
if delim:
|
||||
body += ' _code << ", "; '
|
||||
else:
|
||||
body += ' '
|
||||
# p = cCodeParameter(f,i)
|
||||
p = logParameter(f,i)
|
||||
if p==None:
|
||||
body += '_code << "/* %s = ?? */";\n'%(i.name)
|
||||
elif p.startswith('boost::print::array'):
|
||||
type = typeStrip(i.type)
|
||||
size = i.size
|
||||
if i.maxSize != None:
|
||||
size = i.maxSize
|
||||
if i.input:
|
||||
if p.find('helper')==-1 and type!='GLchar' and type!='GLcharARB':
|
||||
header += ' size_t _%sIndex = _context->codeInputNext++;\n'%(i.name)
|
||||
header += ' _code << indent << \"const %s i\" << _%sIndex << \"[%s] = \" '%(type,i.name,size)
|
||||
header += '<< array<%s,const char * const>(%s,%s,\"\",\"{ \",\" };\\n\",\", \");\n'%(type,i.name,size)
|
||||
body += '_code << \"i\" << _%sIndex;\n'%(i.name)
|
||||
else:
|
||||
body += '_code << "/* %s = ?? */";\n'%(i.name)
|
||||
else:
|
||||
if p.find('helper')==-1 and type!='GLchar' and type!='GLcharARB':
|
||||
header += ' size_t _%sIndex = _context->codeOutputNext++;\n'%(i.name)
|
||||
header += ' _code << indent << \"%s o\" << _%sIndex << \"[\" << (%s) << \"];\\n";\n'%(type,i.name,size)
|
||||
body += '_code << \"o\" << _%sIndex;\n'%(i.name)
|
||||
else:
|
||||
body += '_code << "/* %s = ?? */";\n'%(i.name)
|
||||
|
||||
# glTexImage2D etc
|
||||
|
||||
elif i.size != None and (isinstance(i.size, str) or isinstance(i.size, unicode)) and i.size.startswith('helperGLPixelImageSize'):
|
||||
header += ' size_t _%sIndex = _context->codeInputNext++;\n'%(i.name)
|
||||
header += ' _code << indent << \"const GLubyte i\" << _%sIndex << \"[\" << helper::size::pixelImage(%s << \"] = \" '%(i.name,i.size.split('(',1)[1])
|
||||
header += '<< array<GLubyte,const char * const>(static_cast<const GLubyte *>(%s),helper::size::pixelImage(%s,\"\",\"{ \",\" }\",\",\") '%(i.name,i.size.split('(',1)[1])
|
||||
header += '<< \";\\n\";\n'
|
||||
body += '_code << \"i\" << _%sIndex;\n'%(i.name)
|
||||
|
||||
else:
|
||||
body += '_code << %s;\n'%(p)
|
||||
delim = True
|
||||
|
||||
body += ' _code << ");%s\\n";\n'%(suffix)
|
||||
|
||||
body += ' printf("%s",_code.str().c_str());\n'
|
||||
|
||||
code += header + body
|
||||
|
||||
if not typeIsVoid(rType):
|
||||
code += ' return _ret;\n'
|
||||
code += '}\n\n'
|
||||
|
||||
code += '\n'
|
||||
|
||||
funcInit = apiDispatchCodeInitCode( apis, args, 'code' )
|
||||
|
||||
# Output
|
||||
|
||||
substitute = {}
|
||||
substitute['LICENSE'] = args.license
|
||||
substitute['AUTOGENERATED'] = args.generated
|
||||
substitute['COPYRIGHT'] = args.copyright
|
||||
substitute['API_FUNC_DEFINE'] = code
|
||||
substitute['API_GLOBAL_DISPATCH_INIT'] = funcInit
|
||||
|
||||
outputCode( '%s/RegalDispatchCode.cpp' % args.outdir, dispatchCodeTemplate.substitute(substitute))
|
||||
|
|
@ -7,7 +7,6 @@ from ApiUtil import typeIsVoid
|
|||
|
||||
from ApiCodeGen import *
|
||||
|
||||
from Regal import debugPrintFunction
|
||||
from RegalContext import emu
|
||||
from RegalContextInfo import cond
|
||||
|
||||
|
|
@ -316,7 +315,7 @@ def apiEmuFuncDefineCode(apis, args):
|
|||
code += ' }\n'
|
||||
code += ' if (format!=GLenum(internalformat))\n'
|
||||
code += ' {\n'
|
||||
code += ' Warning("%s does not support mismatching format and internalformat ",GLenumToString(format),"!=",GLenumToString(internalformat)," for ES 2.0.");\n'%(name)
|
||||
code += ' Warning("%s does not support mismatching format and internalformat ",GLenumToString(format),"!=",GLenumToString(internalformat)," for ES 2.0.");\n'%(name)
|
||||
code += ' return;\n'
|
||||
code += ' }\n'
|
||||
code += ' }\n'
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from string import Template, upper, replace
|
|||
from ApiCodeGen import *
|
||||
from ApiUtil import outputCode
|
||||
from ApiUtil import typeIsVoid
|
||||
from ApiRegal import logFunction
|
||||
|
||||
from Regal import debugPrintFunction
|
||||
from RegalContextInfo import cond
|
||||
|
||||
# CodeGen for dispatch table init.
|
||||
|
|
@ -144,9 +144,18 @@ def generateDispatchLog(apis, args):
|
|||
categoryPrev = category
|
||||
|
||||
code += 'static %sREGAL_CALL %s%s(%s) \n{\n' % (rType, 'log_', name, params)
|
||||
# code += ' %s\n' % debugPrintFunction( function, 'Driver', True, False )
|
||||
# code += ' %s\n' % logFunction( function, 'Driver', True, False )
|
||||
code += ' RegalContext *_context = REGAL_GET_CONTEXT();\n'
|
||||
code += ' RegalAssert(_context);\n'
|
||||
|
||||
# Temporarily adjust the context begin/end depth for proper indentation
|
||||
# of the glBegin call
|
||||
|
||||
if name=='glBegin':
|
||||
code += ' RegalAssert(_context->depthBeginEnd>0);\n'
|
||||
code += ' Push<size_t> pushDepth(_context->depthBeginEnd);\n'
|
||||
code += ' _context->depthBeginEnd--;\n'
|
||||
|
||||
code += ' DispatchTable *_next = _context->dispatcher.logging._next;\n'
|
||||
code += ' RegalAssert(_next);\n'
|
||||
code += ' '
|
||||
|
|
@ -155,9 +164,9 @@ def generateDispatchLog(apis, args):
|
|||
code += '_next->call(&_next->%s)(%s);\n' % ( name, callParams )
|
||||
|
||||
if typeIsVoid(rType):
|
||||
code += ' %s\n' % debugPrintFunction( function, 'Driver', True, True )
|
||||
code += ' %s\n' % logFunction( function, 'Driver', True, True )
|
||||
else:
|
||||
code += ' %s\n' % debugPrintFunction( function, 'Driver', True, True, "ret" )
|
||||
code += ' %s\n' % logFunction( function, 'Driver', True, True, "ret" )
|
||||
|
||||
# Special handling for glUseProgram - log the attached shaders.
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ REGAL_GLOBAL_BEGIN
|
|||
#include "RegalPrivate.h"
|
||||
#include "RegalToken.h"
|
||||
|
||||
#include <boost/print/string_list.hpp>
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
|
@ -35,6 +37,19 @@ namespace Token {
|
|||
return 1<=v && v<=4 ? integer[v] : GLenumToString(v);
|
||||
}
|
||||
|
||||
std::string GLclearToString(GLbitfield v)
|
||||
{
|
||||
const GLbitfield other = v & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
boost::print::string_list<std::string> tmp;
|
||||
if (v & GL_COLOR_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_COLOR_BUFFER_BIT"; }
|
||||
if (v & GL_DEPTH_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_DEPTH_BUFFER_BIT"; }
|
||||
if (v & GL_STENCIL_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_STENCIL_BUFFER_BIT"; }
|
||||
if (other || v==0) { if (tmp.size()) tmp += " | "; tmp += size_t(other); }
|
||||
|
||||
return tmp.str();
|
||||
}
|
||||
|
||||
${CODE}
|
||||
|
||||
}
|
||||
|
|
@ -47,8 +62,54 @@ REGAL_NAMESPACE_END
|
|||
|
||||
def filterTokens(tokens):
|
||||
|
||||
suffixes = ['_ARB','_KHR','_EXT','_NV','_ATI','_PGI','_OES','_IBM','_SUN','_SGI','_SGIX','_SGIS','_APPLE','_QCOM','_ANGLE']
|
||||
suffixes2 = ['_BIT','_BITS','_BIT_NV','_BITS_NV','_BIT_PGI','_BITS_PGI','_BIT_EXT','_BITS_EXT','_BIT_SGIX','_BITS_SGIX']
|
||||
|
||||
def suffixCompare(i,j):
|
||||
|
||||
# Prefer anything to _BIT, _BITS
|
||||
|
||||
im = [ 1 for k in suffixes2 if i.endswith(k) ]
|
||||
jm = [ 1 for k in suffixes2 if j.endswith(k) ]
|
||||
|
||||
if len(im)>0 and len(jm)==0:
|
||||
return 1
|
||||
|
||||
if len(im)==0 and len(jm)>0:
|
||||
return -1
|
||||
|
||||
# prefer the string with none of the above suffixes
|
||||
|
||||
im = [ 1 for k in suffixes if i.endswith(k) ]
|
||||
jm = [ 1 for k in suffixes if j.endswith(k) ]
|
||||
|
||||
if len(im)>0 and len(jm)==0:
|
||||
return 1
|
||||
|
||||
if len(im)==0 and len(jm)>0:
|
||||
return -1
|
||||
|
||||
# prefer the string with earliest of the above suffixes
|
||||
|
||||
for k in suffixes:
|
||||
if i.endswith(k):
|
||||
if j.endswith(k):
|
||||
return 0
|
||||
else:
|
||||
return -1
|
||||
else:
|
||||
if j.endswith(k):
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
# Sort names into preferred suffix order
|
||||
|
||||
tokens = [ (j[0], sorted(j[1],cmp=suffixCompare)) for j in tokens ]
|
||||
|
||||
u = tokens
|
||||
for i in ['_ARB','_KHR','_EXT','_NV','_ATI','_PGI','_OES','_IBM','_SUN','_SGI','_SGIX','_SGIS','_APPLE','_QCOM','_ANGLE']:
|
||||
|
||||
for i in suffixes:
|
||||
u = [ (j[0], [ k for k in j[1] if not k.endswith(i) ]) for j in u ]
|
||||
|
||||
# Filter out _BIT duplicates
|
||||
|
|
@ -231,23 +292,27 @@ REGAL_GLOBAL_BEGIN
|
|||
|
||||
#include <GL/Regal.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
||||
namespace Token {
|
||||
|
||||
const char * GLenumToString (GLenum v);
|
||||
const char * GLerrorToString (GLenum v); // gluErrorString
|
||||
const char * GLbooleanToString (GLboolean v);
|
||||
const char * internalFormatToString(GLint v);
|
||||
const char * GLenumToString (GLenum v);
|
||||
const char * GLerrorToString (GLenum v); // gluErrorString
|
||||
const char * GLbooleanToString (GLboolean v);
|
||||
const char * internalFormatToString(GLint v);
|
||||
|
||||
std::string GLclearToString (GLbitfield v);
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
const char * GLXenumToString (int v);
|
||||
const char * GLXenumToString (int v);
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_EGL
|
||||
const char * EGLenumToString (int v);
|
||||
const char * EGLenumToString (int v);
|
||||
#endif
|
||||
|
||||
inline const char *toString(const GLenum v) { return GLenumToString(v); }
|
||||
|
|
|
|||
|
|
@ -48,9 +48,14 @@ public:
|
|||
string_list &operator=(const string_list &other);
|
||||
|
||||
void clear();
|
||||
void push_back (const char *string);
|
||||
void push_back (const T &string);
|
||||
void push_back_swap( T &string);
|
||||
|
||||
void push_front (const char *string);
|
||||
void push_front (const T &string);
|
||||
void push_front_swap( T &string);
|
||||
|
||||
void push_back (const char *string);
|
||||
void push_back (const T &string);
|
||||
void push_back_swap ( T &string);
|
||||
|
||||
template<typename I>
|
||||
string_list<T> &
|
||||
|
|
@ -61,6 +66,15 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename I>
|
||||
string_list<T> &
|
||||
operator+=(I i)
|
||||
{
|
||||
PushBack p(*this);
|
||||
::boost::print::print(static_cast<T &>(p),i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void sort();
|
||||
void split(const T &input, const char_type delim = ' ');
|
||||
|
||||
|
|
@ -79,6 +93,29 @@ public:
|
|||
T &operator[](const size_type i);
|
||||
const T &operator[](const size_type i) const;
|
||||
|
||||
// Zero-copy push_front to string_list
|
||||
|
||||
struct PushFront : public T
|
||||
{
|
||||
public:
|
||||
inline PushFront(string_list<T> &list) : _list(list) {}
|
||||
inline ~PushFront()
|
||||
{
|
||||
if (T::length())
|
||||
{
|
||||
_list._count += T::length();
|
||||
_list._list.push_front(T());
|
||||
_list._list.front().swap(*this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PushFront(); // Not implemented
|
||||
PushFront &operator=(const PushFront &other); // Not implemented
|
||||
|
||||
string_list<T> &_list;
|
||||
};
|
||||
|
||||
// Zero-copy push_back to string_list
|
||||
|
||||
struct PushBack : public T
|
||||
|
|
@ -175,6 +212,25 @@ string_list<T>::operator=(const string_list<T> &other)
|
|||
|
||||
template<typename T> void string_list<T>::clear() { _list.clear(); _count = 0; }
|
||||
|
||||
template<typename T> void string_list<T>::push_front(const typename string_list<T>::char_type *string)
|
||||
{
|
||||
_list.push_front(string ? string : T());
|
||||
_count += _list.front().length();
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_front(const T &string)
|
||||
{
|
||||
_list.push_front(string);
|
||||
_count += string.length();
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_front_swap(T &string)
|
||||
{
|
||||
_list.push_front(T());
|
||||
_count += string.length();
|
||||
_list.front().swap(string);
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::push_back(const typename string_list<T>::char_type *string)
|
||||
{
|
||||
_list.push_back(string ? string : T());
|
||||
|
|
@ -190,8 +246,8 @@ template<typename T> void string_list<T>::push_back(const T &string)
|
|||
template<typename T> void string_list<T>::push_back_swap(T &string)
|
||||
{
|
||||
_list.push_back(T());
|
||||
_list.back().swap(string);
|
||||
_count += string.length();
|
||||
_list.back().swap(string);
|
||||
}
|
||||
|
||||
template<typename T> void string_list<T>::sort()
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ extern "C" {
|
|||
REGAL_DECL void REGAL_CALL glClear(GLbitfield mask)
|
||||
{
|
||||
RegalContext *_context = REGAL_GET_CONTEXT();
|
||||
App("glClear","(", mask, ")");
|
||||
App("glClear","(", GLclearToString(mask), ")");
|
||||
if (!_context) return;
|
||||
DispatchTable *_next = &_context->dispatcher.front();
|
||||
RegalAssert(_next);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ bool forceEmulation = REGAL_FORCE_EMULATION;
|
|||
bool enableEmulation = REGAL_EMULATION;
|
||||
bool enableDebug = false;
|
||||
bool enableError = false;
|
||||
bool enableCode = false;
|
||||
bool enableLog = REGAL_LOG;
|
||||
bool enableDriver = REGAL_DRIVER;
|
||||
|
||||
|
|
@ -141,6 +142,11 @@ void Init()
|
|||
if (tmp) enableError = atoi(tmp)!=0;
|
||||
#endif
|
||||
|
||||
#if REGAL_CODE
|
||||
tmp = GetEnv( "REGAL_CODE" );
|
||||
if (tmp) enableCode = atoi(tmp)!=0;
|
||||
#endif
|
||||
|
||||
#if REGAL_LOG
|
||||
tmp = GetEnv( "REGAL_LOG" );
|
||||
if (tmp) enableLog = atoi(tmp)!=0;
|
||||
|
|
@ -252,6 +258,7 @@ void Init()
|
|||
Info("REGAL_FORCE_EMULATION ", forceEmulation ? "enabled" : "disabled");
|
||||
Info("REGAL_DEBUG ", enableDebug ? "enabled" : "disabled");
|
||||
Info("REGAL_ERROR ", enableError ? "enabled" : "disabled");
|
||||
Info("REGAL_CODE ", enableCode ? "enabled" : "disabled");
|
||||
Info("REGAL_EMULATION ", enableEmulation ? "enabled" : "disabled");
|
||||
Info("REGAL_LOG ", enableLog ? "enabled" : "disabled");
|
||||
Info("REGAL_DRIVER ", enableDriver ? "enabled" : "disabled");
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ namespace Config
|
|||
extern bool enableEmulation;
|
||||
extern bool enableDebug;
|
||||
extern bool enableError;
|
||||
extern bool enableCode;
|
||||
extern bool enableLog;
|
||||
extern bool enableDriver;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,9 @@ RegalContext::RegalContext()
|
|||
thread(0),
|
||||
logCallback(NULL),
|
||||
depthBeginEnd(0),
|
||||
depthPushAttrib(0)
|
||||
depthPushAttrib(0),
|
||||
codeInputNext(0),
|
||||
codeOutputNext(0)
|
||||
{
|
||||
Internal("RegalContext::RegalContext","()");
|
||||
|
||||
|
|
@ -220,13 +222,27 @@ RegalContext::~RegalContext()
|
|||
|
||||
#if REGAL_EMULATION
|
||||
// emu
|
||||
#if REGAL_EMU_OBJ
|
||||
delete obj;
|
||||
#endif /* REGAL_EMU_OBJ */
|
||||
#if REGAL_EMU_PPA
|
||||
delete ppa;
|
||||
#endif /* REGAL_EMU_PPA */
|
||||
#if REGAL_EMU_BIN
|
||||
delete bin;
|
||||
#endif /* REGAL_EMU_BIN */
|
||||
#if REGAL_EMU_DSA
|
||||
delete dsa;
|
||||
#endif /* REGAL_EMU_DSA */
|
||||
#if REGAL_EMU_IFF
|
||||
delete iff;
|
||||
#endif /* REGAL_EMU_IFF */
|
||||
#if REGAL_EMU_SO
|
||||
delete so;
|
||||
#endif /* REGAL_EMU_SO */
|
||||
#if REGAL_EMU_VAO
|
||||
delete vao;
|
||||
#endif /* REGAL_EMU_VAO */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,11 @@ struct RegalContext
|
|||
|
||||
size_t depthBeginEnd; // Normally zero or one
|
||||
size_t depthPushAttrib; //
|
||||
|
||||
// For RegalDispatchCode
|
||||
|
||||
size_t codeInputNext;
|
||||
size_t codeOutputNext;
|
||||
};
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
|
|
|||
|
|
@ -37,8 +37,11 @@
|
|||
|
||||
#include "RegalUtil.h"
|
||||
|
||||
#if REGAL_CACHE && REGAL_CACHE_SHADER
|
||||
|
||||
REGAL_GLOBAL_BEGIN
|
||||
|
||||
#include "RegalConfig.h"
|
||||
#include "RegalThread.h"
|
||||
#include "RegalContext.h"
|
||||
#include "RegalDispatcher.h"
|
||||
|
|
@ -54,7 +57,7 @@ static void REGAL_CALL cache_glShaderSource(GLuint shader, GLsizei count, const
|
|||
RegalAssert(_context);
|
||||
DispatchTable *_next = _context->dispatcher.cache._next;
|
||||
RegalAssert(_next);
|
||||
if (REGAL_CACHE && REGAL_CACHE_SHADER)
|
||||
if (Config::cache && Config::cacheShader)
|
||||
ShaderCache::shaderSource(_next->call(&_next->glShaderSource), shader, count, string, length);
|
||||
else
|
||||
_next->call(&_next->glShaderSource)(shader, count, string, length);
|
||||
|
|
@ -67,3 +70,5 @@ void InitDispatchTableCache(DispatchTable &tbl)
|
|||
|
||||
REGAL_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
48832
src/regal/RegalDispatchCode.cpp
Normal file
48832
src/regal/RegalDispatchCode.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -3397,14 +3397,47 @@ static void REGAL_CALL emu_glGetTexParameterfv(GLenum target, GLenum pname, GLfl
|
|||
_context->dsa->RestoreActiveTexture( _context );
|
||||
}
|
||||
#endif
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so) break;
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(& _next->glGetTexParameterfv)(target, pname, params);
|
||||
// impl
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetTexParameterv( _context, target, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetTexParameterfv( target, pname, params );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
{
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glGetTexParameterfv)(target, pname, params);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void REGAL_CALL emu_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
|
|
@ -3428,14 +3461,47 @@ static void REGAL_CALL emu_glGetTexParameteriv(GLenum target, GLenum pname, GLin
|
|||
_context->dsa->RestoreActiveTexture( _context );
|
||||
}
|
||||
#endif
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so) break;
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(& _next->glGetTexParameteriv)(target, pname, params);
|
||||
// impl
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetTexParameterv( _context, target, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetTexParameteriv( target, pname, params );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
{
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glGetTexParameteriv)(target, pname, params);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void REGAL_CALL emu_glHint(GLenum target, GLenum mode)
|
||||
|
|
@ -8012,7 +8078,7 @@ static void REGAL_CALL emu_glTexParameterf(GLenum target, GLenum pname, GLfloat
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameter( target, pname, param );
|
||||
_context->so->TexParameter( _context, target, pname, param );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -8053,7 +8119,7 @@ static void REGAL_CALL emu_glTexParameterfv(GLenum target, GLenum pname, const G
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -8094,7 +8160,7 @@ static void REGAL_CALL emu_glTexParameteri(GLenum target, GLenum pname, GLint pa
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameter( target, pname, param );
|
||||
_context->so->TexParameter( _context, target, pname, param );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -8135,7 +8201,7 @@ static void REGAL_CALL emu_glTexParameteriv(GLenum target, GLenum pname, const G
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -9550,7 +9616,10 @@ static void REGAL_CALL emu_glBindTexture(GLenum target, GLuint texture)
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
return _context->so->BindTexture( _context, target, texture );
|
||||
if ( !_context->so->BindTexture( _context, target, texture ) ) {
|
||||
_context->dispatcher.emulation.glBindTexture( target, texture );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -9822,6 +9891,14 @@ static void REGAL_CALL emu_glDrawArrays(GLenum mode, GLint first, GLsizei count)
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -9871,6 +9948,14 @@ static void REGAL_CALL emu_glDrawElements(GLenum mode, GLsizei count, GLenum typ
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -10435,12 +10520,7 @@ static void REGAL_CALL emu_glActiveTexture(GLenum texture)
|
|||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->ActiveTexture( texture );
|
||||
}
|
||||
if (_context->so) break;
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
|
|
@ -10477,6 +10557,18 @@ static void REGAL_CALL emu_glActiveTexture(GLenum texture)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->ActiveTexture( _context, texture ) ) {
|
||||
_context->dispatcher.emulation.glActiveTexture( texture );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
{
|
||||
|
|
@ -12538,6 +12630,14 @@ static void REGAL_CALL emu_glMultiDrawArrays(GLenum mode, const GLint *first, co
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -12587,6 +12687,14 @@ static void REGAL_CALL emu_glMultiDrawElements(GLenum mode, const GLsizei *count
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -17299,6 +17407,116 @@ static void REGAL_CALL emu_glEnablei(GLenum cap, GLuint index)
|
|||
|
||||
}
|
||||
|
||||
static void REGAL_CALL emu_glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
RegalContext *_context = REGAL_GET_CONTEXT();
|
||||
RegalAssert(_context);
|
||||
|
||||
// prefix
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so) break;
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// impl
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetTexParameterv( _context, target, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetTexParameterIiv( target, pname, params );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
{
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glGetTexParameterIiv)(target, pname, params);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void REGAL_CALL emu_glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
|
||||
{
|
||||
RegalContext *_context = REGAL_GET_CONTEXT();
|
||||
RegalAssert(_context);
|
||||
|
||||
// prefix
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so) break;
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// impl
|
||||
switch( _context->emuLevel )
|
||||
{
|
||||
case 8 :
|
||||
case 7 :
|
||||
case 6 :
|
||||
case 5 :
|
||||
case 4 :
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetTexParameterv( _context, target, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetTexParameterIuiv( target, pname, params );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
default:
|
||||
{
|
||||
DispatchTable *_next = _context->dispatcher.emulation._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glGetTexParameterIuiv)(target, pname, params);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void REGAL_CALL emu_glTexParameterIiv(GLenum target, GLenum pname, const GLint *params)
|
||||
{
|
||||
RegalContext *_context = REGAL_GET_CONTEXT();
|
||||
|
|
@ -17318,7 +17536,7 @@ static void REGAL_CALL emu_glTexParameterIiv(GLenum target, GLenum pname, const
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -17350,7 +17568,7 @@ static void REGAL_CALL emu_glTexParameterIuiv(GLenum target, GLenum pname, const
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -17635,6 +17853,14 @@ static void REGAL_CALL emu_glDrawArraysInstanced(GLenum mode, GLint start, GLsiz
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -17684,6 +17910,14 @@ static void REGAL_CALL emu_glDrawElementsInstanced(GLenum mode, GLsizei count, G
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -17838,6 +18072,14 @@ static void REGAL_CALL emu_glMultiDrawArraysIndirectAMD(GLenum mode, const GLvoi
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -17887,6 +18129,14 @@ static void REGAL_CALL emu_glMultiDrawElementsIndirectAMD(GLenum mode, GLenum ty
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -17958,6 +18208,14 @@ static void REGAL_CALL emu_glDrawElementArrayAPPLE(GLenum mode, GLint first, GLs
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18007,6 +18265,14 @@ static void REGAL_CALL emu_glMultiDrawElementArrayAPPLE(GLenum mode, const GLint
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18210,6 +18476,14 @@ static void REGAL_CALL emu_glDrawElementsBaseVertex(GLenum mode, GLsizei count,
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18259,6 +18533,14 @@ static void REGAL_CALL emu_glDrawElementsInstancedBaseVertex(GLenum mode, GLsize
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18308,6 +18590,14 @@ static void REGAL_CALL emu_glMultiDrawElementsBaseVertex(GLenum mode, GLsizei *c
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18359,6 +18649,14 @@ static void REGAL_CALL emu_glDrawArraysIndirect(GLenum mode, const GLvoid *indir
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18408,6 +18706,14 @@ static void REGAL_CALL emu_glDrawElementsIndirect(GLenum mode, GLenum type, cons
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18459,6 +18765,14 @@ static void REGAL_CALL emu_glDrawArraysInstancedARB(GLenum mode, GLint start, GL
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -18508,6 +18822,14 @@ static void REGAL_CALL emu_glDrawElementsInstancedARB(GLenum mode, GLsizei count
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -19535,6 +19857,14 @@ static void REGAL_CALL emu_glMultiDrawArraysIndirect(GLenum mode, const GLvoid *
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -19584,6 +19914,14 @@ static void REGAL_CALL emu_glMultiDrawElementsIndirect(GLenum mode, GLenum type,
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -19741,7 +20079,8 @@ static void REGAL_CALL emu_glBindSampler(GLuint unit, GLuint sampler)
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
return _context->so->BindSampler( _context, unit, sampler );
|
||||
_context->so->BindSampler( unit, sampler );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -19793,7 +20132,7 @@ static void REGAL_CALL emu_glDeleteSamplers(GLsizei count, const GLuint *sampler
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->DeleteSamplers( _context, count, samplers );
|
||||
_context->so->DeleteSamplers( count, samplers );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -19899,7 +20238,7 @@ static void REGAL_CALL emu_glGetSamplerParameterIiv(GLuint sampler, GLenum pname
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetSamplerParameterv( sampler, pname, params ) ) {
|
||||
if ( !_context->so->GetSamplerParameterv( _context, sampler, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetSamplerParameterIiv( sampler, pname, params );
|
||||
}
|
||||
return;
|
||||
|
|
@ -19954,7 +20293,7 @@ static void REGAL_CALL emu_glGetSamplerParameterIuiv(GLuint sampler, GLenum pnam
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetSamplerParameterv( sampler, pname, params ) ) {
|
||||
if ( !_context->so->GetSamplerParameterv( _context, sampler, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetSamplerParameterIuiv( sampler, pname, params );
|
||||
}
|
||||
return;
|
||||
|
|
@ -20009,7 +20348,7 @@ static void REGAL_CALL emu_glGetSamplerParameterfv(GLuint sampler, GLenum pname,
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetSamplerParameterv( sampler, pname, params ) ) {
|
||||
if ( !_context->so->GetSamplerParameterv( _context, sampler, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetSamplerParameterfv( sampler, pname, params );
|
||||
}
|
||||
return;
|
||||
|
|
@ -20064,7 +20403,7 @@ static void REGAL_CALL emu_glGetSamplerParameteriv(GLuint sampler, GLenum pname,
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
if ( !_context->so->GetSamplerParameterv( sampler, pname, params ) ) {
|
||||
if ( !_context->so->GetSamplerParameterv( _context, sampler, pname, params ) ) {
|
||||
_context->dispatcher.emulation.glGetSamplerParameteriv( sampler, pname, params );
|
||||
}
|
||||
return;
|
||||
|
|
@ -22188,6 +22527,14 @@ static void REGAL_CALL emu_glDrawElementArrayATI(GLenum mode, GLsizei count)
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -33399,6 +33746,14 @@ static void REGAL_CALL emu_glDrawArraysInstancedEXT(GLenum mode, GLint start, GL
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -33448,6 +33803,14 @@ static void REGAL_CALL emu_glDrawElementsInstancedEXT(GLenum mode, GLsizei count
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -33858,6 +34221,14 @@ static void REGAL_CALL emu_glMultiDrawArraysEXT(GLenum mode, const GLint *first,
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -33907,6 +34278,14 @@ static void REGAL_CALL emu_glMultiDrawElementsEXT(GLenum mode, GLsizei *count, G
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -34864,7 +35243,7 @@ static void REGAL_CALL emu_glTexParameterIivEXT(GLenum target, GLenum pname, con
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -34896,7 +35275,7 @@ static void REGAL_CALL emu_glTexParameterIuivEXT(GLenum target, GLenum pname, co
|
|||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->TexParameterv( target, pname, params );
|
||||
_context->so->TexParameterv( _context, target, pname, params );
|
||||
}
|
||||
#endif
|
||||
case 1 :
|
||||
|
|
@ -34982,6 +35361,14 @@ static void REGAL_CALL emu_glDrawArraysEXT(GLenum mode, GLint first, GLsizei cou
|
|||
}
|
||||
#endif
|
||||
case 3 :
|
||||
#if REGAL_EMU_SO
|
||||
if (_context->so)
|
||||
{
|
||||
Push<int> pushLevel(_context->emuLevel);
|
||||
_context->emuLevel = 2;
|
||||
_context->so->PreDraw( _context );
|
||||
}
|
||||
#endif
|
||||
case 2 :
|
||||
#if REGAL_EMU_VAO
|
||||
if (_context->vao)
|
||||
|
|
@ -36245,6 +36632,8 @@ void InitDispatchTableEmu(DispatchTable &tbl)
|
|||
|
||||
tbl.glDisablei = emu_glDisablei;
|
||||
tbl.glEnablei = emu_glEnablei;
|
||||
tbl.glGetTexParameterIiv = emu_glGetTexParameterIiv;
|
||||
tbl.glGetTexParameterIuiv = emu_glGetTexParameterIuiv;
|
||||
tbl.glTexParameterIiv = emu_glTexParameterIiv;
|
||||
tbl.glTexParameterIuiv = emu_glTexParameterIuiv;
|
||||
tbl.glUniform1ui = emu_glUniform1ui;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ static void REGAL_CALL log_glBegin(GLenum mode)
|
|||
{
|
||||
RegalContext *_context = REGAL_GET_CONTEXT();
|
||||
RegalAssert(_context);
|
||||
RegalAssert(_context->depthBeginEnd>0);
|
||||
Push<size_t> pushDepth(_context->depthBeginEnd);
|
||||
_context->depthBeginEnd--;
|
||||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glBegin)(mode);
|
||||
|
|
@ -137,7 +140,7 @@ static void REGAL_CALL log_glClear(GLbitfield mask)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
_next->call(&_next->glClear)(mask);
|
||||
Driver("glClear","(", mask, ")");
|
||||
Driver("glClear","(", GLclearToString(mask), ")");
|
||||
}
|
||||
|
||||
static void REGAL_CALL log_glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||
|
|
@ -938,7 +941,7 @@ static GLenum REGAL_CALL log_glGetError(void)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glGetError)();
|
||||
Driver("glGetError","()", " returned ", ret);
|
||||
Driver("glGetError","()", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1300,7 +1303,7 @@ static GLboolean REGAL_CALL log_glIsEnabled(GLenum cap)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsEnabled)(cap);
|
||||
Driver("glIsEnabled","(", toString(cap), ")", " returned ", ret);
|
||||
Driver("glIsEnabled","(", toString(cap), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1311,7 +1314,7 @@ static GLboolean REGAL_CALL log_glIsList(GLuint list)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsList)(list);
|
||||
Driver("glIsList","(", list, ")", " returned ", ret);
|
||||
Driver("glIsList","(", list, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3135,7 +3138,7 @@ static GLboolean REGAL_CALL log_glAreTexturesResident(GLsizei n, const GLuint *t
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glAreTexturesResident)(n, textures, residences);
|
||||
Driver("glAreTexturesResident","(", n, ", ", boost::print::array(textures,n), ", ", boost::print::array(residences,n), ")", " returned ", ret);
|
||||
Driver("glAreTexturesResident","(", n, ", ", boost::print::array(textures,n), ", ", boost::print::array(residences,n), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3336,7 +3339,7 @@ static GLboolean REGAL_CALL log_glIsTexture(GLuint texture)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsTexture)(texture);
|
||||
Driver("glIsTexture","(", texture, ")", " returned ", ret);
|
||||
Driver("glIsTexture","(", texture, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4565,7 +4568,7 @@ static GLboolean REGAL_CALL log_glIsBuffer(GLuint buffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsBuffer)(buffer);
|
||||
Driver("glIsBuffer","(", buffer, ")", " returned ", ret);
|
||||
Driver("glIsBuffer","(", buffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4576,7 +4579,7 @@ static GLboolean REGAL_CALL log_glIsQuery(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsQuery)(id);
|
||||
Driver("glIsQuery","(", id, ")", " returned ", ret);
|
||||
Driver("glIsQuery","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4598,7 +4601,7 @@ static GLboolean REGAL_CALL log_glUnmapBuffer(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glUnmapBuffer)(target);
|
||||
Driver("glUnmapBuffer","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glUnmapBuffer","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4895,7 +4898,7 @@ static GLboolean REGAL_CALL log_glIsProgram(GLuint program)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsProgram)(program);
|
||||
Driver("glIsProgram","(", program, ")", " returned ", ret);
|
||||
Driver("glIsProgram","(", program, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -4906,7 +4909,7 @@ static GLboolean REGAL_CALL log_glIsShader(GLuint shader)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsShader)(shader);
|
||||
Driver("glIsShader","(", shader, ")", " returned ", ret);
|
||||
Driver("glIsShader","(", shader, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -5839,7 +5842,7 @@ static GLboolean REGAL_CALL log_glIsEnabledi(GLenum target, GLuint index)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsEnabledi)(target, index);
|
||||
Driver("glIsEnabledi","(", toString(target), ", ", index, ")", " returned ", ret);
|
||||
Driver("glIsEnabledi","(", toString(target), ", ", index, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6449,7 +6452,7 @@ static GLboolean REGAL_CALL log_glIsNameAMD(GLenum identifier, GLuint name)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsNameAMD)(identifier, name);
|
||||
Driver("glIsNameAMD","(", toString(identifier), ", ", name, ")", " returned ", ret);
|
||||
Driver("glIsNameAMD","(", toString(identifier), ", ", name, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6792,7 +6795,7 @@ static GLboolean REGAL_CALL log_glIsFenceAPPLE(GLuint fence)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsFenceAPPLE)(fence);
|
||||
Driver("glIsFenceAPPLE","(", fence, ")", " returned ", ret);
|
||||
Driver("glIsFenceAPPLE","(", fence, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6813,7 +6816,7 @@ static GLboolean REGAL_CALL log_glTestFenceAPPLE(GLuint fence)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glTestFenceAPPLE)(fence);
|
||||
Driver("glTestFenceAPPLE","(", fence, ")", " returned ", ret);
|
||||
Driver("glTestFenceAPPLE","(", fence, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6824,7 +6827,7 @@ static GLboolean REGAL_CALL log_glTestObjectAPPLE(GLenum object, GLuint name)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glTestObjectAPPLE)(object, name);
|
||||
Driver("glTestObjectAPPLE","(", toString(object), ", ", name, ")", " returned ", ret);
|
||||
Driver("glTestObjectAPPLE","(", toString(object), ", ", name, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6923,7 +6926,7 @@ static GLenum REGAL_CALL log_glObjectPurgeableAPPLE(GLenum objectType, GLuint na
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glObjectPurgeableAPPLE)(objectType, name, option);
|
||||
Driver("glObjectPurgeableAPPLE","(", toString(objectType), ", ", name, ", ", toString(option), ")", " returned ", ret);
|
||||
Driver("glObjectPurgeableAPPLE","(", toString(objectType), ", ", name, ", ", toString(option), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6934,7 +6937,7 @@ static GLenum REGAL_CALL log_glObjectUnpurgeableAPPLE(GLenum objectType, GLuint
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glObjectUnpurgeableAPPLE)(objectType, name, option);
|
||||
Driver("glObjectUnpurgeableAPPLE","(", toString(objectType), ", ", name, ", ", toString(option), ")", " returned ", ret);
|
||||
Driver("glObjectUnpurgeableAPPLE","(", toString(objectType), ", ", name, ", ", toString(option), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6947,7 +6950,7 @@ static GLenum REGAL_CALL log_glClientWaitSyncAPPLE(GLsync sync, GLbitfield flags
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glClientWaitSyncAPPLE)(sync, flags, timeout);
|
||||
Driver("glClientWaitSyncAPPLE","(", sync, ", ", flags, ", ", timeout, ")", " returned ", ret);
|
||||
Driver("glClientWaitSyncAPPLE","(", sync, ", ", flags, ", ", timeout, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -6999,7 +7002,7 @@ static GLboolean REGAL_CALL log_glIsSyncAPPLE(GLsync sync)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsSyncAPPLE)(sync);
|
||||
Driver("glIsSyncAPPLE","(", sync, ")", " returned ", ret);
|
||||
Driver("glIsSyncAPPLE","(", sync, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -7074,7 +7077,7 @@ static GLboolean REGAL_CALL log_glIsVertexArrayAPPLE(GLuint array)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsVertexArrayAPPLE)(array);
|
||||
Driver("glIsVertexArrayAPPLE","(", array, ")", " returned ", ret);
|
||||
Driver("glIsVertexArrayAPPLE","(", array, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -7139,7 +7142,7 @@ static GLboolean REGAL_CALL log_glIsVertexAttribEnabledAPPLE(GLuint index, GLenu
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsVertexAttribEnabledAPPLE)(index, pname);
|
||||
Driver("glIsVertexAttribEnabledAPPLE","(", index, ", ", toString(pname), ")", " returned ", ret);
|
||||
Driver("glIsVertexAttribEnabledAPPLE","(", index, ", ", toString(pname), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -7667,7 +7670,7 @@ static GLenum REGAL_CALL log_glCheckFramebufferStatus(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glCheckFramebufferStatus)(target);
|
||||
Driver("glCheckFramebufferStatus","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glCheckFramebufferStatus","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -7798,7 +7801,7 @@ static GLboolean REGAL_CALL log_glIsFramebuffer(GLuint framebuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsFramebuffer)(framebuffer);
|
||||
Driver("glIsFramebuffer","(", framebuffer, ")", " returned ", ret);
|
||||
Driver("glIsFramebuffer","(", framebuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -7809,7 +7812,7 @@ static GLboolean REGAL_CALL log_glIsRenderbuffer(GLuint renderbuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsRenderbuffer)(renderbuffer);
|
||||
Driver("glIsRenderbuffer","(", renderbuffer, ")", " returned ", ret);
|
||||
Driver("glIsRenderbuffer","(", renderbuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -9039,7 +9042,7 @@ static GLboolean REGAL_CALL log_glIsQueryARB(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsQueryARB)(id);
|
||||
Driver("glIsQueryARB","(", id, ")", " returned ", ret);
|
||||
Driver("glIsQueryARB","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -9151,7 +9154,7 @@ static GLenum REGAL_CALL log_glGetGraphicsResetStatusARB(void)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glGetGraphicsResetStatusARB)();
|
||||
Driver("glGetGraphicsResetStatusARB","()", " returned ", ret);
|
||||
Driver("glGetGraphicsResetStatusARB","()", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -9446,7 +9449,7 @@ static GLboolean REGAL_CALL log_glIsSampler(GLuint sampler)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsSampler)(sampler);
|
||||
Driver("glIsSampler","(", sampler, ")", " returned ", ret);
|
||||
Driver("glIsSampler","(", sampler, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -9590,7 +9593,7 @@ static GLboolean REGAL_CALL log_glIsProgramPipeline(GLuint pipeline)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsProgramPipeline)(pipeline);
|
||||
Driver("glIsProgramPipeline","(", pipeline, ")", " returned ", ret);
|
||||
Driver("glIsProgramPipeline","(", pipeline, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -10689,7 +10692,7 @@ static GLboolean REGAL_CALL log_glIsNamedStringARB(GLint namelen, const GLchar *
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsNamedStringARB)(namelen, name);
|
||||
Driver("glIsNamedStringARB","(", namelen, ", ", boost::print::quote(name,'"'), ")", " returned ", ret);
|
||||
Driver("glIsNamedStringARB","(", namelen, ", ", boost::print::quote(name,'"'), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -10712,7 +10715,7 @@ static GLenum REGAL_CALL log_glClientWaitSync(GLsync sync, GLbitfield flags, GLu
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glClientWaitSync)(sync, flags, timeout);
|
||||
Driver("glClientWaitSync","(", reinterpret_cast<void *>(sync), ", ", flags, ", ", timeout, ")", " returned ", ret);
|
||||
Driver("glClientWaitSync","(", reinterpret_cast<void *>(sync), ", ", flags, ", ", timeout, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -10764,7 +10767,7 @@ static GLboolean REGAL_CALL log_glIsSync(GLsync sync)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsSync)(sync);
|
||||
Driver("glIsSync","(", reinterpret_cast<void *>(sync), ")", " returned ", ret);
|
||||
Driver("glIsSync","(", reinterpret_cast<void *>(sync), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11145,7 +11148,7 @@ static GLboolean REGAL_CALL log_glIsTransformFeedback(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsTransformFeedback)(id);
|
||||
Driver("glIsTransformFeedback","(", id, ")", " returned ", ret);
|
||||
Driver("glIsTransformFeedback","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11417,7 +11420,7 @@ static GLboolean REGAL_CALL log_glIsVertexArray(GLuint array)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsVertexArray)(array);
|
||||
Driver("glIsVertexArray","(", array, ")", " returned ", ret);
|
||||
Driver("glIsVertexArray","(", array, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11776,7 +11779,7 @@ static GLboolean REGAL_CALL log_glIsBufferARB(GLuint buffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsBufferARB)(buffer);
|
||||
Driver("glIsBufferARB","(", buffer, ")", " returned ", ret);
|
||||
Driver("glIsBufferARB","(", buffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11798,7 +11801,7 @@ static GLboolean REGAL_CALL log_glUnmapBufferARB(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glUnmapBufferARB)(target);
|
||||
Driver("glUnmapBufferARB","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glUnmapBufferARB","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -11961,7 +11964,7 @@ static GLboolean REGAL_CALL log_glIsProgramARB(GLuint program)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsProgramARB)(program);
|
||||
Driver("glIsProgramARB","(", program, ")", " returned ", ret);
|
||||
Driver("glIsProgramARB","(", program, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -13489,7 +13492,7 @@ static GLboolean REGAL_CALL log_glIsObjectBufferATI(GLuint buffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsObjectBufferATI)(buffer);
|
||||
Driver("glIsObjectBufferATI","(", buffer, ")", " returned ", ret);
|
||||
Driver("glIsObjectBufferATI","(", buffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -14647,7 +14650,7 @@ static GLenum REGAL_CALL log_glCheckNamedFramebufferStatusEXT(GLuint framebuffer
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glCheckNamedFramebufferStatusEXT)(framebuffer, target);
|
||||
Driver("glCheckNamedFramebufferStatusEXT","(", framebuffer, ", ", toString(target), ")", " returned ", ret);
|
||||
Driver("glCheckNamedFramebufferStatusEXT","(", framebuffer, ", ", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -16820,7 +16823,7 @@ static GLboolean REGAL_CALL log_glUnmapNamedBufferEXT(GLuint buffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glUnmapNamedBufferEXT)(buffer);
|
||||
Driver("glUnmapNamedBufferEXT","(", buffer, ")", " returned ", ret);
|
||||
Driver("glUnmapNamedBufferEXT","(", buffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -17005,7 +17008,7 @@ static GLboolean REGAL_CALL log_glIsEnabledIndexedEXT(GLenum target, GLuint inde
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsEnabledIndexedEXT)(target, index);
|
||||
Driver("glIsEnabledIndexedEXT","(", toString(target), ", ", index, ")", " returned ", ret);
|
||||
Driver("glIsEnabledIndexedEXT","(", toString(target), ", ", index, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -17330,7 +17333,7 @@ static GLenum REGAL_CALL log_glCheckFramebufferStatusEXT(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glCheckFramebufferStatusEXT)(target);
|
||||
Driver("glCheckFramebufferStatusEXT","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glCheckFramebufferStatusEXT","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -17451,7 +17454,7 @@ static GLboolean REGAL_CALL log_glIsFramebufferEXT(GLuint framebuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsFramebufferEXT)(framebuffer);
|
||||
Driver("glIsFramebufferEXT","(", framebuffer, ")", " returned ", ret);
|
||||
Driver("glIsFramebufferEXT","(", framebuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -17462,7 +17465,7 @@ static GLboolean REGAL_CALL log_glIsRenderbufferEXT(GLuint renderbuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsRenderbufferEXT)(renderbuffer);
|
||||
Driver("glIsRenderbufferEXT","(", renderbuffer, ")", " returned ", ret);
|
||||
Driver("glIsRenderbufferEXT","(", renderbuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -18211,7 +18214,7 @@ static GLboolean REGAL_CALL log_glIsQueryEXT(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsQueryEXT)(id);
|
||||
Driver("glIsQueryEXT","(", id, ")", " returned ", ret);
|
||||
Driver("glIsQueryEXT","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -18809,7 +18812,7 @@ static GLboolean REGAL_CALL log_glAreTexturesResidentEXT(GLsizei n, const GLuint
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glAreTexturesResidentEXT)(n, textures, residences);
|
||||
Driver("glAreTexturesResidentEXT","(", n, ", ", boost::print::array(textures,n), ", ", boost::print::array(residences,n), ")", " returned ", ret);
|
||||
Driver("glAreTexturesResidentEXT","(", n, ", ", boost::print::array(textures,n), ", ", boost::print::array(residences,n), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -18850,7 +18853,7 @@ static GLboolean REGAL_CALL log_glIsTextureEXT(GLuint texture)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsTextureEXT)(texture);
|
||||
Driver("glIsTextureEXT","(", texture, ")", " returned ", ret);
|
||||
Driver("glIsTextureEXT","(", texture, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -19472,7 +19475,7 @@ static GLboolean REGAL_CALL log_glIsVariantEnabledEXT(GLuint id, GLenum cap)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsVariantEnabledEXT)(id, cap);
|
||||
Driver("glIsVariantEnabledEXT","(", id, ", ", toString(cap), ")", " returned ", ret);
|
||||
Driver("glIsVariantEnabledEXT","(", id, ", ", toString(cap), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -20444,7 +20447,7 @@ static GLboolean REGAL_CALL log_glIsImageHandleResidentNV(GLuint64 handle)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsImageHandleResidentNV)(handle);
|
||||
Driver("glIsImageHandleResidentNV","(", handle, ")", " returned ", ret);
|
||||
Driver("glIsImageHandleResidentNV","(", handle, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -20455,7 +20458,7 @@ static GLboolean REGAL_CALL log_glIsTextureHandleResidentNV(GLuint64 handle)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsTextureHandleResidentNV)(handle);
|
||||
Driver("glIsTextureHandleResidentNV","(", handle, ")", " returned ", ret);
|
||||
Driver("glIsTextureHandleResidentNV","(", handle, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -20812,7 +20815,7 @@ static GLboolean REGAL_CALL log_glIsFenceNV(GLuint fence)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsFenceNV)(fence);
|
||||
Driver("glIsFenceNV","(", fence, ")", " returned ", ret);
|
||||
Driver("glIsFenceNV","(", fence, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -20833,7 +20836,7 @@ static GLboolean REGAL_CALL log_glTestFenceNV(GLuint fence)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glTestFenceNV)(fence);
|
||||
Driver("glTestFenceNV","(", fence, ")", " returned ", ret);
|
||||
Driver("glTestFenceNV","(", fence, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -21948,7 +21951,7 @@ static GLboolean REGAL_CALL log_glIsOcclusionQueryNV(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsOcclusionQueryNV)(id);
|
||||
Driver("glIsOcclusionQueryNV","(", id, ")", " returned ", ret);
|
||||
Driver("glIsOcclusionQueryNV","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22205,7 +22208,7 @@ static GLboolean REGAL_CALL log_glIsPathNV(GLuint path)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsPathNV)(path);
|
||||
Driver("glIsPathNV","(", path, ")", " returned ", ret);
|
||||
Driver("glIsPathNV","(", path, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22216,7 +22219,7 @@ static GLboolean REGAL_CALL log_glIsPointInFillPathNV(GLuint path, GLuint mask,
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsPointInFillPathNV)(path, mask, x, y);
|
||||
Driver("glIsPointInFillPathNV","(", path, ", ", mask, ", ", x, ", ", y, ")", " returned ", ret);
|
||||
Driver("glIsPointInFillPathNV","(", path, ", ", mask, ", ", x, ", ", y, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22227,7 +22230,7 @@ static GLboolean REGAL_CALL log_glIsPointInStrokePathNV(GLuint path, GLfloat x,
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsPointInStrokePathNV)(path, x, y);
|
||||
Driver("glIsPointInStrokePathNV","(", path, ", ", x, ", ", y, ")", " returned ", ret);
|
||||
Driver("glIsPointInStrokePathNV","(", path, ", ", x, ", ", y, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22418,7 +22421,7 @@ static GLboolean REGAL_CALL log_glPointAlongPathNV(GLuint path, GLsizei startSeg
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glPointAlongPathNV)(path, startSegment, numSegments, distance, x, y, tangentX, tangentY);
|
||||
Driver("glPointAlongPathNV","(", path, ", ", startSegment, ", ", numSegments, ", ", distance, ", ", x, ", ", y, ", ", tangentX, ", ", tangentY, ")", " returned ", ret);
|
||||
Driver("glPointAlongPathNV","(", path, ", ", startSegment, ", ", numSegments, ", ", distance, ", ", x, ", ", y, ", ", tangentX, ", ", tangentY, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22825,7 +22828,7 @@ static GLboolean REGAL_CALL log_glIsBufferResidentNV(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsBufferResidentNV)(target);
|
||||
Driver("glIsBufferResidentNV","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glIsBufferResidentNV","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -22836,7 +22839,7 @@ static GLboolean REGAL_CALL log_glIsNamedBufferResidentNV(GLuint buffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsNamedBufferResidentNV)(buffer);
|
||||
Driver("glIsNamedBufferResidentNV","(", buffer, ")", " returned ", ret);
|
||||
Driver("glIsNamedBufferResidentNV","(", buffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -23156,7 +23159,7 @@ static GLboolean REGAL_CALL log_glIsTransformFeedbackNV(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsTransformFeedbackNV)(id);
|
||||
Driver("glIsTransformFeedbackNV","(", id, ")", " returned ", ret);
|
||||
Driver("glIsTransformFeedbackNV","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -23219,7 +23222,7 @@ static GLboolean REGAL_CALL log_glVDPAUIsSurfaceNV(GLvdpauSurfaceNV surface)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glVDPAUIsSurfaceNV)(surface);
|
||||
Driver("glVDPAUIsSurfaceNV","(", surface, ")", " returned ", ret);
|
||||
Driver("glVDPAUIsSurfaceNV","(", surface, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -23630,7 +23633,7 @@ static GLboolean REGAL_CALL log_glAreProgramsResidentNV(GLsizei n, const GLuint
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glAreProgramsResidentNV)(n, programs, residences);
|
||||
Driver("glAreProgramsResidentNV","(", n, ", ", boost::print::array(programs,n), ", ", boost::print::array(residences,n), ")", " returned ", ret);
|
||||
Driver("glAreProgramsResidentNV","(", n, ", ", boost::print::array(programs,n), ", ", boost::print::array(residences,n), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -23771,7 +23774,7 @@ static GLboolean REGAL_CALL log_glIsProgramNV(GLuint id)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsProgramNV)(id);
|
||||
Driver("glIsProgramNV","(", id, ")", " returned ", ret);
|
||||
Driver("glIsProgramNV","(", id, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24354,7 +24357,7 @@ static GLenum REGAL_CALL log_glVideoCaptureNV(GLuint video_capture_slot, GLuint
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glVideoCaptureNV)(video_capture_slot, sequence_num, capture_time);
|
||||
Driver("glVideoCaptureNV","(", video_capture_slot, ", ", boost::print::array(sequence_num,1), ", ", boost::print::array(capture_time,1), ")", " returned ", ret);
|
||||
Driver("glVideoCaptureNV","(", video_capture_slot, ", ", boost::print::array(sequence_num,1), ", ", boost::print::array(capture_time,1), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24453,7 +24456,7 @@ static GLenum REGAL_CALL log_glCheckFramebufferStatusOES(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLenum ret = _next->call(&_next->glCheckFramebufferStatusOES)(target);
|
||||
Driver("glCheckFramebufferStatusOES","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glCheckFramebufferStatusOES","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24554,7 +24557,7 @@ static GLboolean REGAL_CALL log_glIsFramebufferOES(GLuint framebuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsFramebufferOES)(framebuffer);
|
||||
Driver("glIsFramebufferOES","(", framebuffer, ")", " returned ", ret);
|
||||
Driver("glIsFramebufferOES","(", framebuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24565,7 +24568,7 @@ static GLboolean REGAL_CALL log_glIsRenderbufferOES(GLuint renderbuffer)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsRenderbufferOES)(renderbuffer);
|
||||
Driver("glIsRenderbufferOES","(", renderbuffer, ")", " returned ", ret);
|
||||
Driver("glIsRenderbufferOES","(", renderbuffer, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24631,7 +24634,7 @@ static GLboolean REGAL_CALL log_glUnmapBufferOES(GLenum target)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glUnmapBufferOES)(target);
|
||||
Driver("glUnmapBufferOES","(", toString(target), ")", " returned ", ret);
|
||||
Driver("glUnmapBufferOES","(", toString(target), ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -24922,7 +24925,7 @@ static GLboolean REGAL_CALL log_glIsVertexArrayOES(GLuint array)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsVertexArrayOES)(array);
|
||||
Driver("glIsVertexArrayOES","(", array, ")", " returned ", ret);
|
||||
Driver("glIsVertexArrayOES","(", array, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -25113,7 +25116,7 @@ static GLboolean REGAL_CALL log_glExtIsProgramBinaryQCOM(GLuint program)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glExtIsProgramBinaryQCOM)(program);
|
||||
Driver("glExtIsProgramBinaryQCOM","(", program, ")", " returned ", ret);
|
||||
Driver("glExtIsProgramBinaryQCOM","(", program, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -25442,7 +25445,7 @@ static GLboolean REGAL_CALL log_glIsAsyncMarkerSGIX(GLuint marker)
|
|||
DispatchTable *_next = _context->dispatcher.logging._next;
|
||||
RegalAssert(_next);
|
||||
GLboolean ret = _next->call(&_next->glIsAsyncMarkerSGIX)(marker);
|
||||
Driver("glIsAsyncMarkerSGIX","(", marker, ")", " returned ", ret);
|
||||
Driver("glIsAsyncMarkerSGIX","(", marker, ")", " returned ", toString(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ REGAL_GLOBAL_END
|
|||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
||||
void InitDispatchTableCode (DispatchTable &tbl);
|
||||
void InitDispatchTableDebug (DispatchTable &tbl);
|
||||
void InitDispatchTableError (DispatchTable &tbl);
|
||||
void InitDispatchTableEmu (DispatchTable &tbl);
|
||||
|
|
@ -77,6 +78,12 @@ Dispatcher::Dispatcher()
|
|||
push_back(cache,true);
|
||||
#endif
|
||||
|
||||
#if REGAL_CODE
|
||||
::memset(&code,0,sizeof(DispatchTable));
|
||||
InitDispatchTableCode(code);
|
||||
push_back(code,Config::enableCode);
|
||||
#endif
|
||||
|
||||
#if REGAL_LOG
|
||||
InitDispatchTableLog(logging);
|
||||
push_back(logging,Config::enableLog);
|
||||
|
|
|
|||
|
|
@ -62,13 +62,17 @@ public:
|
|||
DispatchTable cache;
|
||||
#endif
|
||||
|
||||
#if REGAL_CODE
|
||||
DispatchTable code;
|
||||
#endif
|
||||
|
||||
#if REGAL_LOG
|
||||
DispatchTable logging;
|
||||
#endif
|
||||
|
||||
DispatchTable driver; // Underlying OpenGL/ES implementation
|
||||
DispatchTable driver; // Underlying OpenGL/ES implementation
|
||||
|
||||
DispatchTable missing; // Must have this last
|
||||
DispatchTable missing; // Must have this last
|
||||
|
||||
public:
|
||||
Dispatcher();
|
||||
|
|
@ -96,7 +100,6 @@ public:
|
|||
inline std::size_t size() const
|
||||
{
|
||||
return _size;
|
||||
// return _table.size();
|
||||
}
|
||||
|
||||
inline DispatchTable &operator[](const std::size_t i)
|
||||
|
|
@ -109,7 +112,6 @@ public:
|
|||
{
|
||||
RegalAssert(size());
|
||||
return *_front;
|
||||
// return *_table.front();
|
||||
}
|
||||
|
||||
inline DispatchTable &back()
|
||||
|
|
|
|||
|
|
@ -304,6 +304,201 @@ materialv(GLenum pname)
|
|||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
pixelImage(GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint pack, GLenum target)
|
||||
{
|
||||
/* TODO: Review later: Does texture "level" affect size? */
|
||||
/* TODO: Review later: Properly account for effects of glPixelStore. */
|
||||
|
||||
size_t numComponent = 0;
|
||||
size_t sizeElement = 8; /* bits */
|
||||
|
||||
size_t dataWidth = 0;
|
||||
size_t dataHeight = 0;
|
||||
size_t dataDepth = 0;
|
||||
|
||||
// if (!traceGL_Native.glGetIntegerv)
|
||||
// return 0;
|
||||
|
||||
if (width < 0 || height < 0 || depth < 0)
|
||||
return 0;
|
||||
|
||||
if (pack != 0 && pack != 1)
|
||||
return 0;
|
||||
|
||||
/* When target is a GL_PROXY_TEXUTRE_xx, size is 0. */
|
||||
|
||||
if ((target == GL_PROXY_TEXTURE_1D) ||
|
||||
(target == GL_PROXY_TEXTURE_2D) ||
|
||||
(target == GL_PROXY_TEXTURE_3D))
|
||||
return 0;
|
||||
|
||||
/* TODO: If an unpack buffer is bound for glDrawPixels... */
|
||||
if (!pack)
|
||||
{
|
||||
#if 0
|
||||
GLint bufferBinding = 0;
|
||||
traceGL_Native.glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &bufferBinding);
|
||||
if (bufferBinding > 0)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
/* TODO: Data is treated as byte offset when a non-zero named buffer is bound. */
|
||||
GLint bufferBinding = 0;
|
||||
traceGL_Native.glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &bufferBinding);
|
||||
if (bufferBinding > 0)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Compute number of components in each element. */
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case GL_COLOR_INDEX: numComponent = 1; break;
|
||||
case GL_STENCIL_INDEX: numComponent = 1; break;
|
||||
case GL_DEPTH_COMPONENT: numComponent = 1; break;
|
||||
case GL_RED:
|
||||
case GL_GREEN:
|
||||
case GL_BLUE:
|
||||
case GL_ALPHA: numComponent = 1; break;
|
||||
case GL_INTENSITY: numComponent = 1; break;
|
||||
case GL_RGB:
|
||||
case GL_BGR: numComponent = 3; break;
|
||||
case GL_RGBA:
|
||||
case GL_BGRA: numComponent = 4; break;
|
||||
case GL_LUMINANCE: numComponent = 1; break;
|
||||
case GL_LUMINANCE_ALPHA: numComponent = 2; break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
/* Compute size of each element. */
|
||||
|
||||
switch (type)
|
||||
{
|
||||
/* Each value is one component per element. */
|
||||
|
||||
case GL_UNSIGNED_BYTE: sizeElement *= sizeof(GLubyte) * numComponent; break;
|
||||
case GL_BYTE: sizeElement *= sizeof(GLbyte) * numComponent; break;
|
||||
case GL_BITMAP: sizeElement *= sizeof(GLubyte) * numComponent; break;
|
||||
case GL_UNSIGNED_SHORT: sizeElement *= sizeof(GLushort) * numComponent; break;
|
||||
case GL_SHORT: sizeElement *= sizeof(GLshort) * numComponent; break;
|
||||
case GL_UNSIGNED_INT: sizeElement *= sizeof(GLuint) * numComponent; break;
|
||||
case GL_INT: sizeElement *= sizeof(GLint) * numComponent; break;
|
||||
case GL_FLOAT: sizeElement *= sizeof(GLfloat) * numComponent; break;
|
||||
|
||||
/* Each unsigned value contains all the components per element. */
|
||||
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
case GL_UNSIGNED_BYTE_2_3_3_REV: sizeElement *= sizeof(GLbyte); break;
|
||||
|
||||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
case GL_UNSIGNED_SHORT_5_6_5_REV:
|
||||
case GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
|
||||
case GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
case GL_UNSIGNED_SHORT_1_5_5_5_REV: sizeElement *= sizeof(GLushort); break;
|
||||
|
||||
case GL_UNSIGNED_INT_8_8_8_8:
|
||||
case GL_UNSIGNED_INT_8_8_8_8_REV:
|
||||
case GL_UNSIGNED_INT_10_10_10_2:
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV: sizeElement *= sizeof(GLuint); break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
/* Special case: GL_BITMAP. */
|
||||
|
||||
if (type == GL_BITMAP)
|
||||
{
|
||||
/* TODO: Confirm calculations. */
|
||||
if ((format == GL_COLOR_INDEX) || (format == GL_STENCIL_INDEX))
|
||||
sizeElement = sizeElement/8;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Take into account client state set by glPixelStore. */
|
||||
|
||||
if (depth)
|
||||
{
|
||||
#if 0
|
||||
GLint skipImages = 0;
|
||||
|
||||
/* GL_PACK_SKIP_IMAGES */
|
||||
if (pack)
|
||||
traceGL_Native.glGetIntegerv(GL_PACK_SKIP_IMAGES, &skipImages);
|
||||
else
|
||||
traceGL_Native.glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &skipImages);
|
||||
dataDepth += skipImages > 0 ? skipImages : 0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
dataDepth = 1;
|
||||
}
|
||||
|
||||
if (height)
|
||||
{
|
||||
GLint imageHeight = 0;
|
||||
GLint skipRows = 0;
|
||||
GLint rowLength = 0;
|
||||
GLint alignment = 1; /* Allowed values: 1,2,4,8 */
|
||||
|
||||
#if 0
|
||||
/* GL_PACK_IMAGE_HEIGHT */
|
||||
if (pack)
|
||||
traceGL_Native.glGetIntegerv(GL_PACK_IMAGE_HEIGHT, &imageHeight);
|
||||
else
|
||||
traceGL_Native.glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &imageHeight);
|
||||
#endif
|
||||
dataHeight = imageHeight > 0 ? imageHeight : height;
|
||||
|
||||
#if 0
|
||||
/* GL_PACK_SKIP_ROWS */
|
||||
if (pack)
|
||||
traceGL_Native.glGetIntegerv(GL_PACK_SKIP_ROWS, &skipRows);
|
||||
else
|
||||
traceGL_Native.glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skipRows);
|
||||
#endif
|
||||
dataHeight += skipRows > 0 ? skipRows : 0;
|
||||
|
||||
#if 0
|
||||
/* GL_PACK_ROW_LENGTH */
|
||||
if (pack)
|
||||
traceGL_Native.glGetIntegerv(GL_PACK_ROW_LENGTH, &rowLength);
|
||||
else
|
||||
traceGL_Native.glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowLength);
|
||||
#endif
|
||||
dataWidth = rowLength > 0 ? rowLength : width;
|
||||
|
||||
/* Align byte boundary */
|
||||
dataWidth = (dataWidth * sizeElement + 7)/8;
|
||||
|
||||
#if 0
|
||||
/* GL_PACK_ALIGNMENT */
|
||||
if (pack)
|
||||
traceGL_Native.glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
|
||||
else
|
||||
traceGL_Native.glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||
#endif
|
||||
dataWidth = alignment > 0 ? alignment * (dataWidth + alignment - 1)/alignment : dataWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataHeight = 1;
|
||||
|
||||
/* Align byte boundary */
|
||||
dataWidth = (width * sizeElement + 7)/8;
|
||||
}
|
||||
|
||||
return dataWidth * dataHeight * dataDepth;
|
||||
}
|
||||
|
||||
/* TODO: Extension enums. */
|
||||
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace helper {
|
|||
std::size_t lightModelv(GLenum);
|
||||
std::size_t materialv(GLenum);
|
||||
std::size_t texParameterv(GLenum);
|
||||
// std::size_t pixelImage(GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLint, GLenum);
|
||||
std::size_t pixelImage(GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLint, GLenum);
|
||||
std::size_t texEnvv(GLenum, GLenum);
|
||||
std::size_t texGenv(GLenum);
|
||||
std::size_t samplerParameterv(GLenum);
|
||||
|
|
|
|||
|
|
@ -58,14 +58,13 @@ using namespace ::REGAL_NAMESPACE_INTERNAL::Logging;
|
|||
using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
|
||||
|
||||
typedef RegalSo RSO;
|
||||
typedef RegalSo::SamplerObject RSSO;
|
||||
|
||||
void
|
||||
RSO::GenSamplers(GLsizei count, GLuint *samplers)
|
||||
{
|
||||
for (GLsizei ii=0; ii<count; ii++)
|
||||
{
|
||||
SamplerObject* s = new SamplerObject();
|
||||
SamplingState* s = new SamplingState();
|
||||
samplerObjects[ nextSamplerObjectId ] = s;
|
||||
*samplers = nextSamplerObjectId;
|
||||
samplers++;
|
||||
|
|
@ -74,19 +73,19 @@ RSO::GenSamplers(GLsizei count, GLuint *samplers)
|
|||
}
|
||||
|
||||
void
|
||||
RSO::DeleteSamplers(RegalContext * ctx, GLsizei count, const GLuint * samplers)
|
||||
RSO::DeleteSamplers(GLsizei count, const GLuint * samplers)
|
||||
{
|
||||
for (GLsizei ii=0; ii<count; ii++)
|
||||
{
|
||||
GLuint s = samplers[ii];
|
||||
if (s && samplerObjects.count(s) > 0)
|
||||
{
|
||||
SamplingState* p = samplerObjects[s];
|
||||
for (GLsizei unit=0; unit < REGAL_EMU_MAX_TEXTURE_UNITS; unit++)
|
||||
{
|
||||
if (textureUnits[unit].boundSamplerObject == s)
|
||||
BindSampler(ctx, unit, 0);
|
||||
if (textureUnits[unit].boundSamplerObject == p)
|
||||
BindSampler(unit, 0);
|
||||
}
|
||||
SamplerObject* p = samplerObjects[s];
|
||||
samplerObjects.erase(s);
|
||||
delete p;
|
||||
}
|
||||
|
|
@ -100,7 +99,7 @@ RSO::IsSampler(GLuint sampler)
|
|||
}
|
||||
|
||||
void
|
||||
RSO::BindSampler(RegalContext * ctx, GLuint unit, GLuint newSO)
|
||||
RSO::BindSampler(GLuint unit, GLuint so)
|
||||
{
|
||||
if (unit >= REGAL_EMU_MAX_TEXTURE_UNITS)
|
||||
{
|
||||
|
|
@ -108,51 +107,14 @@ RSO::BindSampler(RegalContext * ctx, GLuint unit, GLuint newSO)
|
|||
return;
|
||||
}
|
||||
|
||||
if (newSO && samplerObjects.count(newSO) < 1)
|
||||
if (so && samplerObjects.count(so) < 1)
|
||||
{
|
||||
Warning("Unrecognized sampler object: newSO = ", newSO);
|
||||
Warning("Unrecognized sampler object: so = ", so);
|
||||
return;
|
||||
}
|
||||
|
||||
TextureUnit &tu = textureUnits[unit];
|
||||
|
||||
if (tu.boundSamplerObject == newSO)
|
||||
return;
|
||||
|
||||
DispatchTable &tbl = ctx->dispatcher.emulation;
|
||||
|
||||
GLuint originallyActiveUnit = activeTextureUnit;
|
||||
|
||||
if (unit != activeTextureUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + unit );
|
||||
|
||||
SamplerObject *pSO = NULL;
|
||||
|
||||
if (newSO)
|
||||
pSO = samplerObjects[newSO];
|
||||
|
||||
for (GLsizei tti=0; tti < REGAL_NUM_TEXTURE_TARGETS; tti++)
|
||||
{
|
||||
GLenum target = TT_Index2Enum(tti);
|
||||
|
||||
if (pSO)
|
||||
{
|
||||
pSO->SendStateToTextureUnit(target, unit, unit, tbl);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLuint to = tu.boundTextureObjects[tti];
|
||||
if (to)
|
||||
textureObjects[to]->self.SendStateToTextureUnit(target, unit, unit, ctx->dispatcher.emulation);
|
||||
else
|
||||
defaultTextureObjects[tti].SendStateToTextureUnit(target, unit, unit, ctx->dispatcher.emulation);
|
||||
}
|
||||
}
|
||||
|
||||
if (unit != originallyActiveUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + originallyActiveUnit );
|
||||
|
||||
tu.boundSamplerObject = newSO;
|
||||
textureUnits[unit].boundSamplerVersion = mainVer.Update();
|
||||
textureUnits[unit].boundSamplerObject = samplerObjects[so];
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -162,18 +124,15 @@ RSO::GenTextures(RegalContext * ctx, GLsizei count, GLuint *textures)
|
|||
|
||||
for (GLsizei ii=0; ii<count; ii++)
|
||||
{
|
||||
GLuint name = textures[ii];
|
||||
TextureObject* t = new TextureObject();
|
||||
t->name = name;
|
||||
textureObjects[ name ] = t;
|
||||
GLuint to = textures[ii];
|
||||
TextureState* ts = new TextureState();
|
||||
textureObjects[ to ] = ts;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RSO::DeleteTextures(RegalContext * ctx, GLsizei count, const GLuint * textures)
|
||||
{
|
||||
DispatchTable &tbl = ctx->dispatcher.emulation;
|
||||
|
||||
GLuint originallyActiveUnit = activeTextureUnit;
|
||||
|
||||
for (GLsizei ii=0; ii<count; ii++)
|
||||
|
|
@ -181,44 +140,46 @@ RSO::DeleteTextures(RegalContext * ctx, GLsizei count, const GLuint * textures)
|
|||
GLuint t = textures[ii];
|
||||
if (t && textureObjects.count(t) > 0)
|
||||
{
|
||||
TextureState* p = textureObjects[t];
|
||||
|
||||
for (GLuint unit=0; unit < REGAL_EMU_MAX_TEXTURE_UNITS; unit++)
|
||||
{
|
||||
TextureUnit &tu = textureUnits[unit];
|
||||
|
||||
for (GLuint jj=0; jj < REGAL_NUM_TEXTURE_TARGETS; jj++)
|
||||
{
|
||||
if (t == tu.boundTextureObjects[jj])
|
||||
if (p == tu.boundTextureObjects[jj])
|
||||
{
|
||||
if (unit != activeTextureUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + unit );
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
|
||||
BindTexture(ctx, unit, TT_Index2Enum(jj), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
TextureObject* p = textureObjects[t];
|
||||
|
||||
textureObjects.erase(t);
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTextureUnit != originallyActiveUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + originallyActiveUnit );
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + originallyActiveUnit );
|
||||
}
|
||||
|
||||
void
|
||||
RSO::BindTexture(RegalContext * ctx, GLenum target, GLuint newTO)
|
||||
bool
|
||||
RSO::BindTexture(RegalContext * ctx, GLenum target, GLuint to)
|
||||
{
|
||||
BindTexture(ctx, activeTextureUnit, target, newTO);
|
||||
return BindTexture(ctx, activeTextureUnit, target, to);
|
||||
}
|
||||
|
||||
void
|
||||
RSO::BindTexture(RegalContext * ctx, GLuint unit, GLenum target, GLuint newTO)
|
||||
bool
|
||||
RSO::BindTexture(RegalContext * ctx, GLuint unit, GLenum target, GLuint to)
|
||||
{
|
||||
if (unit >= REGAL_EMU_MAX_TEXTURE_UNITS)
|
||||
{
|
||||
Warning("Texture unit out of range: ", unit, " >= ", REGAL_EMU_MAX_TEXTURE_UNITS);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
GLuint tti = TT_Enum2Index(target);
|
||||
|
|
@ -226,74 +187,248 @@ RSO::BindTexture(RegalContext * ctx, GLuint unit, GLenum target, GLuint newTO)
|
|||
if (tti >= REGAL_NUM_TEXTURE_TARGETS)
|
||||
{
|
||||
Warning("Invalid texture target: target = ", Token::GLenumToString(target));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newTO && textureObjects.count(newTO) < 1)
|
||||
TextureState* ts = NULL;
|
||||
|
||||
if (to && textureObjects.count(to) < 1)
|
||||
{
|
||||
TextureObject* t = new TextureObject();
|
||||
t->name = newTO;
|
||||
textureObjects[ newTO ] = t;
|
||||
}
|
||||
|
||||
TextureUnit &tu = textureUnits[unit];
|
||||
|
||||
GLuint oldTO = tu.boundTextureObjects[tti];
|
||||
|
||||
if (tu.boundSamplerObject)
|
||||
{
|
||||
if (oldTO)
|
||||
{
|
||||
RegalAssert(textureObjects.count(oldTO) > 0);
|
||||
textureObjects[oldTO]->self.SendStateToTextureUnit(target, unit, activeTextureUnit, ctx->dispatcher.emulation);
|
||||
}
|
||||
else
|
||||
{
|
||||
defaultTextureObjects[tti].SendStateToTextureUnit(target, unit, activeTextureUnit, ctx->dispatcher.emulation);
|
||||
}
|
||||
}
|
||||
|
||||
ctx->dispatcher.emulation.glBindTexture(target, newTO);
|
||||
|
||||
if (tu.boundSamplerObject)
|
||||
{
|
||||
samplerObjects[tu.boundSamplerObject]->SendStateToTextureUnit(target, unit, activeTextureUnit, ctx->dispatcher.emulation);
|
||||
ts = new TextureState();
|
||||
textureObjects[ to ] = ts;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newTO)
|
||||
textureObjects[newTO]->self.SendStateToTextureUnit(target, unit, activeTextureUnit, ctx->dispatcher.emulation);
|
||||
else
|
||||
defaultTextureObjects[tti].SendStateToTextureUnit(target, unit, activeTextureUnit, ctx->dispatcher.emulation);
|
||||
ts = textureObjects[to];
|
||||
}
|
||||
|
||||
tu.boundTextureObjects[tti] = newTO;
|
||||
DispatchTable &tbl = ctx->dispatcher.emulation;
|
||||
|
||||
GLuint originallyActiveUnit = activeTextureUnit;
|
||||
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
|
||||
tbl.glBindTexture(target, to);
|
||||
|
||||
if (activeTextureUnit != originallyActiveUnit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + originallyActiveUnit );
|
||||
|
||||
textureUnits[unit].boundTextureVersions[tti] = mainVer.Update();
|
||||
textureUnits[unit].boundTextureObjects[tti] = ts;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RSO::ActiveTexture( RegalContext * ctx, GLenum tex )
|
||||
{
|
||||
GLuint unit = tex - GL_TEXTURE0;
|
||||
if (unit >= REGAL_EMU_MAX_TEXTURE_UNITS)
|
||||
{
|
||||
Warning( "Active texture out of range: ", tex, " >= ",
|
||||
Token::GLenumToString(GL_TEXTURE0 + REGAL_EMU_MAX_TEXTURE_UNITS));
|
||||
return false;
|
||||
}
|
||||
activeTextureUnit = unit;
|
||||
ctx->dispatcher.emulation.glActiveTexture( tex );
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
RSSO::SendStateToTextureUnit(GLenum target, GLuint unit, GLuint currentlyActiveUnit, DispatchTable &tbl)
|
||||
RSO::PreDraw( RegalContext * ctx )
|
||||
{
|
||||
GLuint originallyActiveUnit = currentlyActiveUnit;
|
||||
GLuint originallyActiveUnit = activeTextureUnit;
|
||||
|
||||
if (unit != currentlyActiveUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + unit );
|
||||
for (GLuint unit=0; unit < REGAL_EMU_MAX_TEXTURE_UNITS; unit++)
|
||||
{
|
||||
TextureUnit &tu = textureUnits[unit];
|
||||
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_BORDER_COLOR, BorderColor);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_MIN_FILTER, (GLint*)&MinFilter);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_MAG_FILTER, (GLint*)&MagFilter);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_WRAP_S, (GLint*)&WrapS);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_WRAP_T, (GLint*)&WrapT);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_WRAP_R, (GLint*)&WrapR);
|
||||
tbl.glTexParameterfv(target, GL_TEXTURE_MIN_LOD, &MinLod);
|
||||
tbl.glTexParameterfv(target, GL_TEXTURE_MAX_LOD, &MaxLod);
|
||||
tbl.glTexParameterfv(target, GL_TEXTURE_LOD_BIAS, &LodBias);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_COMPARE_MODE, (GLint*)&CompareMode);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_COMPARE_FUNC, (GLint*)&CompareFunc);
|
||||
tbl.glTexParameteriv(target, GL_TEXTURE_SRGB_DECODE_EXT, (GLint*)&SrgbDecodeExt);
|
||||
tbl.glTexParameterfv(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, &MaxAnisotropyExt);
|
||||
SamplingState *pSS = tu.boundSamplerObject;
|
||||
|
||||
if (unit != originallyActiveUnit)
|
||||
tbl.glActiveTexture( GL_TEXTURE0 + originallyActiveUnit );
|
||||
bool needToUpdate = (tu.boundSamplerVersion > tu.ver);
|
||||
|
||||
for (GLuint tt=0; tt < REGAL_NUM_TEXTURE_TARGETS; tt++)
|
||||
{
|
||||
SamplingState *app = pSS;
|
||||
SamplingState *drv = NULL;
|
||||
|
||||
TextureState* ts = tu.boundTextureObjects[tt];
|
||||
|
||||
if (tu.boundTextureVersions[tt] > tu.ver)
|
||||
needToUpdate = true;
|
||||
|
||||
if (ts)
|
||||
{
|
||||
if (!app)
|
||||
app = &ts->app;
|
||||
drv = &ts->drv;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!app)
|
||||
app = &defaultTextureObjects[tt].app;
|
||||
drv = &defaultTextureObjects[tt].drv;
|
||||
}
|
||||
|
||||
if (!app || !drv)
|
||||
continue;
|
||||
|
||||
if (app->ver > tu.ver)
|
||||
needToUpdate = true;
|
||||
|
||||
if (needToUpdate)
|
||||
{
|
||||
GLenum target = TT_Index2Enum(tt);
|
||||
SendStateToDriver(ctx, unit, target, *app, *drv);
|
||||
}
|
||||
}
|
||||
tu.ver = mainVer.Current();
|
||||
}
|
||||
|
||||
if (activeTextureUnit != originallyActiveUnit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + originallyActiveUnit );
|
||||
|
||||
mainVer.Reset();
|
||||
}
|
||||
|
||||
void
|
||||
RSO::SendStateToDriver(RegalContext * ctx, GLuint unit, GLenum target, SamplingState& app, SamplingState& drv)
|
||||
{
|
||||
if (target == GL_TEXTURE_2D_MULTISAMPLE ||
|
||||
target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
|
||||
return;
|
||||
|
||||
DispatchTable &tbl = ctx->dispatcher.emulation;
|
||||
|
||||
if (app.BorderColor[0] != drv.BorderColor[0] ||
|
||||
app.BorderColor[1] != drv.BorderColor[1] ||
|
||||
app.BorderColor[2] != drv.BorderColor[2] ||
|
||||
app.BorderColor[3] != drv.BorderColor[3])
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteriv( target, GL_TEXTURE_BORDER_COLOR, app.BorderColor);
|
||||
drv.BorderColor[0] = app.BorderColor[0];
|
||||
drv.BorderColor[1] = app.BorderColor[1];
|
||||
drv.BorderColor[2] = app.BorderColor[2];
|
||||
drv.BorderColor[3] = app.BorderColor[3];
|
||||
}
|
||||
|
||||
if (target != GL_TEXTURE_RECTANGLE)
|
||||
{
|
||||
if (app.MinFilter != drv.MinFilter)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_MIN_FILTER, app.MinFilter);
|
||||
drv.MinFilter = app.MinFilter;
|
||||
}
|
||||
|
||||
if (app.MagFilter != drv.MagFilter)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_MAG_FILTER, app.MagFilter);
|
||||
drv.MagFilter = app.MagFilter;
|
||||
}
|
||||
|
||||
if (app.WrapS != drv.WrapS)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_WRAP_S, app.WrapS);
|
||||
drv.WrapS = app.WrapS;
|
||||
}
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_2D ||
|
||||
target == GL_TEXTURE_3D ||
|
||||
target == GL_TEXTURE_CUBE_MAP)
|
||||
{
|
||||
if (app.WrapT != drv.WrapT)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_WRAP_T, app.WrapT);
|
||||
drv.WrapT = app.WrapT;
|
||||
}
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_3D)
|
||||
{
|
||||
if (app.WrapR != drv.WrapR)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_WRAP_R, app.WrapR);
|
||||
drv.WrapR = app.WrapR;
|
||||
}
|
||||
}
|
||||
|
||||
if (app.MinLod != drv.MinLod)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameterf( target, GL_TEXTURE_MIN_LOD, app.MinLod);
|
||||
drv.MinLod = app.MinLod;
|
||||
}
|
||||
|
||||
if (app.MaxLod != drv.MaxLod)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameterf( target, GL_TEXTURE_MAX_LOD, app.MaxLod);
|
||||
drv.MaxLod = app.MaxLod;
|
||||
}
|
||||
|
||||
if (app.LodBias != drv.LodBias)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameterf( target, GL_TEXTURE_LOD_BIAS, app.LodBias);
|
||||
drv.LodBias = app.LodBias;
|
||||
}
|
||||
|
||||
if (app.CompareMode != drv.CompareMode)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_COMPARE_MODE, app.CompareMode);
|
||||
drv.CompareMode = app.CompareMode;
|
||||
}
|
||||
|
||||
if (app.CompareFunc != drv.CompareFunc)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_COMPARE_FUNC, app.CompareFunc);
|
||||
drv.CompareFunc = app.CompareFunc;
|
||||
}
|
||||
|
||||
if (ctx->info->gl_ext_texture_srgb_decode)
|
||||
{
|
||||
if (app.SrgbDecodeExt != drv.SrgbDecodeExt)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameteri( target, GL_TEXTURE_SRGB_DECODE_EXT, app.SrgbDecodeExt);
|
||||
drv.SrgbDecodeExt = app.SrgbDecodeExt;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->info->gl_ext_texture_filter_anisotropic)
|
||||
{
|
||||
if (app.MaxAnisotropyExt != drv.MaxAnisotropyExt)
|
||||
{
|
||||
if (activeTextureUnit != unit)
|
||||
ActiveTexture(ctx, GL_TEXTURE0 + unit );
|
||||
tbl.glTexParameterf( target, GL_TEXTURE_MAX_ANISOTROPY_EXT, app.MaxAnisotropyExt);
|
||||
drv.MaxAnisotropyExt = app.MaxAnisotropyExt;
|
||||
}
|
||||
}
|
||||
|
||||
drv.ver = mainVer.Current();
|
||||
}
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ struct RegalSo : public RegalEmu
|
|||
|
||||
RegalSo(const RegalSo &other)
|
||||
{
|
||||
memcpy(this,&other,sizeof(SamplerObject));
|
||||
memcpy(this,&other,sizeof(RegalSo));
|
||||
}
|
||||
|
||||
RegalSo &operator=(const RegalSo &other)
|
||||
{
|
||||
if (&other!=this)
|
||||
memcpy(this,&other,sizeof(SamplerObject));
|
||||
memcpy(this,&other,sizeof(RegalSo));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ struct RegalSo : public RegalEmu
|
|||
nextSamplerObjectId = 1;
|
||||
}
|
||||
|
||||
GLenum TT_Index2Enum(GLuint index)
|
||||
static GLenum TT_Index2Enum(GLuint index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
|
|
@ -108,8 +108,8 @@ struct RegalSo : public RegalEmu
|
|||
case 3: return GL_TEXTURE_1D_ARRAY;
|
||||
case 4: return GL_TEXTURE_2D_ARRAY;
|
||||
case 5: return GL_TEXTURE_RECTANGLE;
|
||||
case 6: return GL_TEXTURE_BUFFER;
|
||||
case 7: return GL_TEXTURE_CUBE_MAP;
|
||||
case 6: return GL_TEXTURE_CUBE_MAP;
|
||||
case 7: return GL_TEXTURE_CUBE_MAP_ARRAY;
|
||||
case 8: return GL_TEXTURE_2D_MULTISAMPLE;
|
||||
case 9: return GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
|
||||
default:
|
||||
|
|
@ -119,7 +119,7 @@ struct RegalSo : public RegalEmu
|
|||
return REGAL_NUM_TEXTURE_TARGETS;
|
||||
}
|
||||
|
||||
GLuint TT_Enum2Index(GLenum texture)
|
||||
static GLuint TT_Enum2Index(GLenum texture)
|
||||
{
|
||||
switch (texture)
|
||||
{
|
||||
|
|
@ -129,8 +129,8 @@ struct RegalSo : public RegalEmu
|
|||
case GL_TEXTURE_1D_ARRAY: return 3;
|
||||
case GL_TEXTURE_2D_ARRAY: return 4;
|
||||
case GL_TEXTURE_RECTANGLE: return 5;
|
||||
case GL_TEXTURE_BUFFER: return 6;
|
||||
case GL_TEXTURE_CUBE_MAP: return 7;
|
||||
case GL_TEXTURE_CUBE_MAP: return 6;
|
||||
case GL_TEXTURE_CUBE_MAP_ARRAY: return 7;
|
||||
case GL_TEXTURE_2D_MULTISAMPLE: return 8;
|
||||
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return 9;
|
||||
default:
|
||||
|
|
@ -140,8 +140,33 @@ struct RegalSo : public RegalEmu
|
|||
return ~(GLuint(0));
|
||||
}
|
||||
|
||||
struct SamplerObject
|
||||
struct Version
|
||||
{
|
||||
Version()
|
||||
: val( 0 )
|
||||
, updated( false )
|
||||
{}
|
||||
GLuint64 Current() const {
|
||||
return val;
|
||||
}
|
||||
GLuint64 Update() {
|
||||
if( updated == false ) {
|
||||
val++;
|
||||
updated = true;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
void Reset() {
|
||||
updated = false;
|
||||
}
|
||||
GLuint64 val;
|
||||
bool updated;
|
||||
};
|
||||
|
||||
struct SamplingState
|
||||
{
|
||||
GLuint64 ver;
|
||||
|
||||
GLint BorderColor[4]; // Border color
|
||||
GLenum MinFilter; // Minification function
|
||||
GLenum MagFilter; // Magnification function
|
||||
|
|
@ -156,8 +181,9 @@ struct RegalSo : public RegalEmu
|
|||
GLenum SrgbDecodeExt; // sRGB decode mode
|
||||
GLfloat MaxAnisotropyExt; // maximum degree of anisotropy
|
||||
|
||||
SamplerObject()
|
||||
: MinFilter(GL_NEAREST_MIPMAP_LINEAR)
|
||||
SamplingState()
|
||||
: ver(0)
|
||||
, MinFilter(GL_NEAREST_MIPMAP_LINEAR)
|
||||
, MagFilter(GL_LINEAR)
|
||||
, WrapS(GL_REPEAT)
|
||||
, WrapT(GL_REPEAT)
|
||||
|
|
@ -173,41 +199,43 @@ struct RegalSo : public RegalEmu
|
|||
BorderColor[0] = BorderColor[1] = BorderColor[2] = BorderColor[3] = 0;
|
||||
}
|
||||
|
||||
SamplerObject(const SamplerObject &other)
|
||||
SamplingState(const SamplingState &other)
|
||||
{
|
||||
memcpy(this,&other,sizeof(SamplerObject));
|
||||
memcpy(this,&other,sizeof(SamplingState));
|
||||
}
|
||||
|
||||
SamplerObject &operator=(const SamplerObject &other)
|
||||
SamplingState &operator=(const SamplingState &other)
|
||||
{
|
||||
if (&other!=this)
|
||||
memcpy(this,&other,sizeof(SamplerObject));
|
||||
memcpy(this,&other,sizeof(SamplingState));
|
||||
return *this;
|
||||
}
|
||||
|
||||
void SendStateToTextureUnit(GLenum target, GLuint unit, GLuint activeUnit, DispatchTable &tbl);
|
||||
};
|
||||
|
||||
struct TextureObject
|
||||
struct TextureState
|
||||
{
|
||||
GLuint name;
|
||||
SamplerObject self;
|
||||
|
||||
TextureObject()
|
||||
: name(0)
|
||||
{
|
||||
}
|
||||
SamplingState app;
|
||||
SamplingState drv;
|
||||
};
|
||||
|
||||
struct TextureUnit
|
||||
{
|
||||
GLuint boundTextureObjects[REGAL_NUM_TEXTURE_TARGETS];
|
||||
GLuint boundSamplerObject;
|
||||
GLuint64 ver;
|
||||
GLuint64 boundSamplerVersion;
|
||||
GLuint64 boundTextureVersions[REGAL_NUM_TEXTURE_TARGETS];
|
||||
SamplingState* boundSamplerObject;
|
||||
TextureState* boundTextureObjects[REGAL_NUM_TEXTURE_TARGETS];
|
||||
|
||||
TextureUnit()
|
||||
: boundSamplerObject(0)
|
||||
: ver(0)
|
||||
, boundSamplerVersion(0)
|
||||
, boundSamplerObject(NULL)
|
||||
{
|
||||
memset(boundTextureObjects,0,sizeof(boundTextureObjects));
|
||||
for (int tti = 0; tti< REGAL_NUM_TEXTURE_TARGETS; tti++)
|
||||
{
|
||||
boundTextureVersions[tti] = 0;
|
||||
boundTextureObjects[tti] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TextureUnit(const TextureUnit &other)
|
||||
|
|
@ -230,83 +258,75 @@ struct RegalSo : public RegalEmu
|
|||
return SamplerParameterv(ctx, sampler, pname, ¶m);
|
||||
}
|
||||
|
||||
void TexParameterV( RegalContext * ctx, GLenum target, GLenum pname, const GLint * params )
|
||||
{
|
||||
ctx->dispatcher.emulation.glTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
void TexParameterV( RegalContext * ctx, GLenum target, GLenum pname, const GLuint * params )
|
||||
{
|
||||
ctx->dispatcher.emulation.glTexParameterIuiv(target, pname, params);
|
||||
}
|
||||
|
||||
void TexParameterV( RegalContext * ctx, GLenum target, GLenum pname, const GLfloat * params )
|
||||
{
|
||||
ctx->dispatcher.emulation.glTexParameterfv(target, pname, params);
|
||||
}
|
||||
|
||||
template <typename T> bool SamplerParameterv( RegalContext * ctx, GLuint sampler, GLenum pname, T * params )
|
||||
{
|
||||
if (!sampler || samplerObjects.count(sampler) < 1)
|
||||
return false;
|
||||
|
||||
SamplerObject *so = samplerObjects[sampler];
|
||||
SamplingState *ss = samplerObjects[sampler];
|
||||
|
||||
if (!ss)
|
||||
return false;
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
so->BorderColor[0] = static_cast<GLint>(params[0]);
|
||||
so->BorderColor[1] = static_cast<GLint>(params[1]);
|
||||
so->BorderColor[2] = static_cast<GLint>(params[2]);
|
||||
so->BorderColor[3] = static_cast<GLint>(params[3]);
|
||||
ss->BorderColor[0] = static_cast<GLint>(params[0]);
|
||||
ss->BorderColor[1] = static_cast<GLint>(params[1]);
|
||||
ss->BorderColor[2] = static_cast<GLint>(params[2]);
|
||||
ss->BorderColor[3] = static_cast<GLint>(params[3]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
so->CompareFunc = static_cast<GLenum>(*params);
|
||||
ss->CompareFunc = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
so->CompareMode = static_cast<GLenum>(*params);
|
||||
ss->CompareMode = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
so->LodBias = static_cast<GLfloat>(*params);
|
||||
ss->LodBias = static_cast<GLfloat>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
||||
so->MaxAnisotropyExt = static_cast<GLfloat>(*params);
|
||||
if (!ctx->info->gl_ext_texture_filter_anisotropic)
|
||||
return false;
|
||||
ss->MaxAnisotropyExt = static_cast<GLfloat>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
so->MagFilter = static_cast<GLenum>(*params);
|
||||
ss->MagFilter = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_LOD:
|
||||
so->MaxLod = static_cast<GLfloat>(*params);
|
||||
ss->MaxLod = static_cast<GLfloat>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
so->MinFilter = static_cast<GLenum>(*params);
|
||||
ss->MinFilter = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
so->MinLod = static_cast<GLfloat>(*params);
|
||||
ss->MinLod = static_cast<GLfloat>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
so->WrapR = static_cast<GLenum>(*params);
|
||||
ss->WrapR = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
so->WrapS = static_cast<GLenum>(*params);
|
||||
ss->WrapS = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
so->WrapT = static_cast<GLenum>(*params);
|
||||
ss->WrapT = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
so->SrgbDecodeExt = static_cast<GLenum>(*params);
|
||||
if (!ctx->info->gl_ext_texture_srgb_decode)
|
||||
return false;
|
||||
ss->SrgbDecodeExt = static_cast<GLenum>(*params);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -314,231 +334,282 @@ struct RegalSo : public RegalEmu
|
|||
return false;
|
||||
}
|
||||
|
||||
GLuint originalActiveUnit = activeTextureUnit;
|
||||
|
||||
for (GLuint unit=0; unit < REGAL_EMU_MAX_TEXTURE_UNITS; unit++)
|
||||
{
|
||||
TextureUnit &tu = textureUnits[unit];
|
||||
|
||||
if (tu.boundSamplerObject == sampler)
|
||||
{
|
||||
for (GLuint tti=0; tti < REGAL_NUM_TEXTURE_TARGETS; tti++)
|
||||
{
|
||||
GLuint to = tu.boundTextureObjects[tti];
|
||||
if (to)
|
||||
{
|
||||
if (unit != activeTextureUnit)
|
||||
ctx->dispatcher.emulation.glActiveTexture( GL_TEXTURE0 + unit );
|
||||
|
||||
TexParameterV( ctx, TT_Index2Enum(tti), pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTextureUnit != originalActiveUnit)
|
||||
ctx->dispatcher.emulation.glActiveTexture( GL_TEXTURE0 + originalActiveUnit );
|
||||
ss->ver = mainVer.Update();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T> bool GetSamplerParameterv( GLuint sampler, GLenum pname, T * params )
|
||||
template <typename T> bool GetSamplerParameterv( RegalContext * ctx, GLuint sampler, GLenum pname, T * params )
|
||||
{
|
||||
if (!sampler || samplerObjects.count(sampler) < 1)
|
||||
return false;
|
||||
|
||||
SamplerObject *so = samplerObjects[sampler];
|
||||
SamplingState *ss = samplerObjects[sampler];
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
params[0] = static_cast<T>(so->BorderColor[0]);
|
||||
params[1] = static_cast<T>(so->BorderColor[1]);
|
||||
params[2] = static_cast<T>(so->BorderColor[2]);
|
||||
params[3] = static_cast<T>(so->BorderColor[3]);
|
||||
params[0] = static_cast<T>(ss->BorderColor[0]);
|
||||
params[1] = static_cast<T>(ss->BorderColor[1]);
|
||||
params[2] = static_cast<T>(ss->BorderColor[2]);
|
||||
params[3] = static_cast<T>(ss->BorderColor[3]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
*params = static_cast<T>(so->CompareFunc);
|
||||
*params = static_cast<T>(ss->CompareFunc);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
*params = static_cast<T>(so->CompareMode);
|
||||
*params = static_cast<T>(ss->CompareMode);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
*params = static_cast<T>(so->LodBias);
|
||||
*params = static_cast<T>(ss->LodBias);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
||||
*params = static_cast<T>(so->MaxAnisotropyExt);
|
||||
if (!ctx->info->gl_ext_texture_filter_anisotropic)
|
||||
return false;
|
||||
*params = static_cast<T>(ss->MaxAnisotropyExt);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
*params = static_cast<T>(so->MagFilter);
|
||||
*params = static_cast<T>(ss->MagFilter);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_LOD:
|
||||
*params = static_cast<T>(so->MaxLod);
|
||||
*params = static_cast<T>(ss->MaxLod);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
*params = static_cast<T>(so->MinFilter);
|
||||
*params = static_cast<T>(ss->MinFilter);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
*params = static_cast<T>(so->MinLod);
|
||||
*params = static_cast<T>(ss->MinLod);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
*params = static_cast<T>(so->WrapR);
|
||||
*params = static_cast<T>(ss->WrapR);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
*params = static_cast<T>(so->WrapS);
|
||||
*params = static_cast<T>(ss->WrapS);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
*params = static_cast<T>(so->WrapT);
|
||||
*params = static_cast<T>(ss->WrapT);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
*params = static_cast<T>(so->SrgbDecodeExt);
|
||||
if (!ctx->info->gl_ext_texture_srgb_decode)
|
||||
return false;
|
||||
*params = static_cast<T>(ss->SrgbDecodeExt);
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning( "Unhandled texture parameter enum: pname = ", Token::GLenumToString(pname));
|
||||
Warning( "Unhandled sampler parameter enum: pname = ", Token::GLenumToString(pname));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T> void TexParameter( GLenum target, GLenum pname, T param )
|
||||
template <typename T> void TexParameter( RegalContext * ctx, GLenum target, GLenum pname, T param )
|
||||
{
|
||||
if ( target != GL_TEXTURE_BORDER_COLOR)
|
||||
TexParameterv(target, pname, ¶m);
|
||||
TexParameterv(ctx, target, pname, ¶m);
|
||||
}
|
||||
|
||||
template <typename T> void TexParameterv( GLenum target, GLenum pname, T * params )
|
||||
template <typename T> void TexParameterv( RegalContext * ctx, GLenum target, GLenum pname, T * params )
|
||||
{
|
||||
GLuint tti = TT_Enum2Index(target);
|
||||
|
||||
if (tti == ~(GLuint(0)))
|
||||
if (tti >= REGAL_NUM_TEXTURE_TARGETS)
|
||||
return;
|
||||
|
||||
TextureUnit &tu = textureUnits[activeTextureUnit];
|
||||
|
||||
GLuint t = tu.boundTextureObjects[tti];
|
||||
TextureState* ts = tu.boundTextureObjects[tti];
|
||||
|
||||
if (t)
|
||||
SamplingState *as = NULL;
|
||||
SamplingState *ds = NULL;
|
||||
|
||||
if (ts)
|
||||
{
|
||||
TextureObject *to = textureObjects[t];
|
||||
|
||||
if (!to)
|
||||
return;
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
to->self.BorderColor[0] = (GLint)(params[0]);
|
||||
to->self.BorderColor[1] = (GLint)(params[1]);
|
||||
to->self.BorderColor[2] = (GLint)(params[2]);
|
||||
to->self.BorderColor[3] = (GLint)(params[3]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
to->self.MinFilter = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
to->self.MagFilter = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
to->self.WrapS = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
to->self.WrapT = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
to->self.WrapR = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
to->self.CompareMode = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
to->self.CompareFunc = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
to->self.MinLod = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_LOD:
|
||||
to->self.MaxLod = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
to->self.LodBias = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
||||
to->self.MaxAnisotropyExt = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
to->self.SrgbDecodeExt = (GLenum)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_BASE_LEVEL:
|
||||
case GL_TEXTURE_MAX_LEVEL:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
// Known texture object state that is not in a sampler object.
|
||||
// Everything is cool, just return silently
|
||||
return;
|
||||
|
||||
default:
|
||||
// Otherwise an unrecognezed enum. Issue a warning...
|
||||
Warning( "Unhandled texture parameter enum: pname = ", Token::GLenumToString(pname));
|
||||
return;
|
||||
}
|
||||
as = &ts->app;
|
||||
ds = &ts->drv;
|
||||
}
|
||||
else
|
||||
{
|
||||
as = &defaultTextureObjects[tti].app;
|
||||
ds = &defaultTextureObjects[tti].drv;
|
||||
}
|
||||
|
||||
if (!as || !ds)
|
||||
return;
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
as->BorderColor[0] = ds->BorderColor[0] = (GLint)(params[0]);
|
||||
as->BorderColor[1] = ds->BorderColor[1] = (GLint)(params[1]);
|
||||
as->BorderColor[2] = ds->BorderColor[2] = (GLint)(params[2]);
|
||||
as->BorderColor[3] = ds->BorderColor[3] = (GLint)(params[3]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
as->MinFilter = ds->MinFilter = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
as->MagFilter = ds->MagFilter = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
as->WrapS = ds->WrapS = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
as->WrapT = ds->WrapT = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
as->WrapR = ds->WrapR = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
as->CompareMode = ds->CompareMode = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
as->CompareFunc = ds->CompareFunc = (GLint)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
as->MinLod = ds->MinLod = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_LOD:
|
||||
as->MaxLod = ds->MaxLod = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
as->LodBias = ds->LodBias = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
||||
if (!ctx->info->gl_ext_texture_filter_anisotropic)
|
||||
return;
|
||||
as->MaxAnisotropyExt = ds->MaxAnisotropyExt = (GLfloat)(params[0]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
if (!ctx->info->gl_ext_texture_srgb_decode)
|
||||
return;
|
||||
as->SrgbDecodeExt = ds->SrgbDecodeExt = (GLenum)(params[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
as->ver = ds->ver = mainVer.Update();
|
||||
}
|
||||
|
||||
void ActiveTexture( GLenum tex )
|
||||
template <typename T> bool GetTexParameterv( RegalContext * ctx, GLuint tex, GLenum pname, T * params )
|
||||
{
|
||||
GLuint unit = tex - GL_TEXTURE0;
|
||||
if (unit < REGAL_EMU_MAX_TEXTURE_UNITS)
|
||||
activeTextureUnit = unit;
|
||||
else
|
||||
Warning( "Active texture out of range: ", tex, " >= ",
|
||||
Token::GLenumToString(GL_TEXTURE0 + REGAL_EMU_MAX_TEXTURE_UNITS));
|
||||
if (!tex || textureObjects.count(tex) < 1)
|
||||
return false;
|
||||
|
||||
SamplingState *ts = &textureObjects[tex]->app;
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
params[0] = static_cast<T>(ts->BorderColor[0]);
|
||||
params[1] = static_cast<T>(ts->BorderColor[1]);
|
||||
params[2] = static_cast<T>(ts->BorderColor[2]);
|
||||
params[3] = static_cast<T>(ts->BorderColor[3]);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_FUNC:
|
||||
*params = static_cast<T>(ts->CompareFunc);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COMPARE_MODE:
|
||||
*params = static_cast<T>(ts->CompareMode);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
*params = static_cast<T>(ts->LodBias);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
|
||||
if (!ctx->info->gl_ext_texture_filter_anisotropic)
|
||||
return false;
|
||||
*params = static_cast<T>(ts->MaxAnisotropyExt);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
*params = static_cast<T>(ts->MagFilter);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MAX_LOD:
|
||||
*params = static_cast<T>(ts->MaxLod);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
*params = static_cast<T>(ts->MinFilter);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
*params = static_cast<T>(ts->MinLod);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_R:
|
||||
*params = static_cast<T>(ts->WrapR);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_S:
|
||||
*params = static_cast<T>(ts->WrapS);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_WRAP_T:
|
||||
*params = static_cast<T>(ts->WrapT);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
if (!ctx->info->gl_ext_texture_srgb_decode)
|
||||
return false;
|
||||
*params = static_cast<T>(ts->SrgbDecodeExt);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void GenTextures(RegalContext * ctx, GLsizei count, GLuint *textures);
|
||||
void DeleteTextures(RegalContext * ctx, GLsizei count, const GLuint * textures);
|
||||
void BindTexture(RegalContext * ctx, GLuint unit, GLenum target, GLuint texture);
|
||||
void BindTexture(RegalContext * ctx, GLenum target, GLuint texture);
|
||||
bool BindTexture(RegalContext * ctx, GLuint unit, GLenum target, GLuint texture);
|
||||
bool BindTexture(RegalContext * ctx, GLenum target, GLuint texture);
|
||||
|
||||
void GenSamplers(GLsizei count, GLuint *samplers);
|
||||
void DeleteSamplers(RegalContext * ctx, GLsizei count, const GLuint * samplers);
|
||||
void DeleteSamplers(GLsizei count, const GLuint * samplers);
|
||||
GLboolean IsSampler(GLuint sampler);
|
||||
void BindSampler(RegalContext * ctx, GLuint unit, GLuint sampler);
|
||||
void BindSampler(GLuint unit, GLuint sampler);
|
||||
|
||||
bool ActiveTexture(RegalContext * ctx, GLenum tex);
|
||||
void PreDraw(RegalContext * ctx);
|
||||
void SendStateToDriver(RegalContext * ctx, GLuint unit, GLenum target, SamplingState& newSS, SamplingState& oldSS);
|
||||
|
||||
Version mainVer;
|
||||
GLuint activeTextureUnit;
|
||||
GLuint nextSamplerObjectId;
|
||||
TextureUnit textureUnits[ REGAL_EMU_MAX_TEXTURE_UNITS ];
|
||||
SamplerObject defaultTextureObjects[ REGAL_NUM_TEXTURE_TARGETS ];
|
||||
std::map<GLuint, SamplerObject*> samplerObjects;
|
||||
std::map<GLuint, TextureObject*> textureObjects;
|
||||
TextureUnit textureUnits[REGAL_EMU_MAX_TEXTURE_UNITS];
|
||||
TextureState defaultTextureObjects[REGAL_NUM_TEXTURE_TARGETS];
|
||||
std::map<GLuint, SamplingState*> samplerObjects;
|
||||
std::map<GLuint, TextureState*> textureObjects;
|
||||
};
|
||||
|
||||
REGAL_NAMESPACE_END
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ REGAL_GLOBAL_BEGIN
|
|||
#include "RegalPrivate.h"
|
||||
#include "RegalToken.h"
|
||||
|
||||
#include <boost/print/string_list.hpp>
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
|
@ -63,6 +65,19 @@ namespace Token {
|
|||
return 1<=v && v<=4 ? integer[v] : GLenumToString(v);
|
||||
}
|
||||
|
||||
std::string GLclearToString(GLbitfield v)
|
||||
{
|
||||
const GLbitfield other = v & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
boost::print::string_list<std::string> tmp;
|
||||
if (v & GL_COLOR_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_COLOR_BUFFER_BIT"; }
|
||||
if (v & GL_DEPTH_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_DEPTH_BUFFER_BIT"; }
|
||||
if (v & GL_STENCIL_BUFFER_BIT) { if (tmp.size()) tmp += " | "; tmp += "GL_STENCIL_BUFFER_BIT"; }
|
||||
if (other || v==0) { if (tmp.size()) tmp += " | "; tmp += size_t(other); }
|
||||
|
||||
return tmp.str();
|
||||
}
|
||||
|
||||
const char * GLenumToString( GLenum e ) {
|
||||
switch( e ) {
|
||||
case 0x00000000: return "GL_ZERO";
|
||||
|
|
@ -81,7 +96,7 @@ namespace Token {
|
|||
case 0x0000000d: return "GL_TRIANGLE_STRIP_ADJACENCY";
|
||||
case 0x0000000e: return "GL_PATCHES";
|
||||
case 0x0000000f: return "GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV";
|
||||
case 0x00000010: return "GL_COLOR_BUFFER_BIT4_QCOM";
|
||||
case 0x00000010: return "GL_SMOOTH_CUBIC_CURVE_TO_NV";
|
||||
case 0x00000011: return "GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV";
|
||||
case 0x00000012: return "GL_SMALL_CCW_ARC_TO_NV";
|
||||
case 0x00000013: return "GL_RELATIVE_SMALL_CCW_ARC_TO_NV";
|
||||
|
|
@ -91,8 +106,8 @@ namespace Token {
|
|||
case 0x00000017: return "GL_RELATIVE_LARGE_CCW_ARC_TO_NV";
|
||||
case 0x00000018: return "GL_LARGE_CW_ARC_TO_NV";
|
||||
case 0x00000019: return "GL_RELATIVE_LARGE_CW_ARC_TO_NV";
|
||||
case 0x00000020: return "GL_COLOR_BUFFER_BIT5_QCOM";
|
||||
case 0x00000040: return "GL_COLOR_BUFFER_BIT6_QCOM";
|
||||
case 0x00000020: return "GL_EIGHTH_BIT_ATI";
|
||||
case 0x00000040: return "GL_SATURATE_BIT_ATI";
|
||||
case 0x00000080: return "GL_COLOR_BUFFER_BIT7_QCOM";
|
||||
case 0x000000f0: return "GL_RESTART_PATH_NV";
|
||||
case 0x000000f2: return "GL_DUP_FIRST_CUBIC_CURVE_TO_NV";
|
||||
|
|
@ -704,7 +719,7 @@ namespace Token {
|
|||
case 0x000080bb: return "GL_POST_COLOR_MATRIX_ALPHA_BIAS";
|
||||
case 0x000080bc: return "GL_TEXTURE_COLOR_TABLE_SGI";
|
||||
case 0x000080bd: return "GL_PROXY_TEXTURE_COLOR_TABLE_SGI";
|
||||
case 0x000080bf: return "GL_SHADOW_AMBIENT_SGIX";
|
||||
case 0x000080bf: return "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB";
|
||||
case 0x000080c8: return "GL_BLEND_DST_RGB";
|
||||
case 0x000080c9: return "GL_BLEND_SRC_RGB";
|
||||
case 0x000080ca: return "GL_BLEND_DST_ALPHA";
|
||||
|
|
@ -1056,8 +1071,8 @@ namespace Token {
|
|||
case 0x000083ef: return "GL_VERTEX_PRECLIP_HINT_SGIX";
|
||||
case 0x000083f0: return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
|
||||
case 0x000083f1: return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
|
||||
case 0x000083f2: return "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE";
|
||||
case 0x000083f3: return "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE";
|
||||
case 0x000083f2: return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
|
||||
case 0x000083f3: return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
|
||||
case 0x000083f4: return "GL_PARALLEL_ARRAYS_INTEL";
|
||||
case 0x000083f5: return "GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL";
|
||||
case 0x000083f6: return "GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL";
|
||||
|
|
@ -1207,11 +1222,11 @@ namespace Token {
|
|||
case 0x0000851a: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";
|
||||
case 0x0000851b: return "GL_PROXY_TEXTURE_CUBE_MAP";
|
||||
case 0x0000851c: return "GL_MAX_CUBE_MAP_TEXTURE_SIZE";
|
||||
case 0x0000851d: return "GL_VERTEX_ARRAY_RANGE_APPLE";
|
||||
case 0x0000851e: return "GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE";
|
||||
case 0x0000851d: return "GL_VERTEX_ARRAY_RANGE_NV";
|
||||
case 0x0000851e: return "GL_VERTEX_ARRAY_RANGE_LENGTH_NV";
|
||||
case 0x0000851f: return "GL_VERTEX_ARRAY_RANGE_VALID_NV";
|
||||
case 0x00008520: return "GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_APPLE";
|
||||
case 0x00008521: return "GL_VERTEX_ARRAY_RANGE_POINTER_APPLE";
|
||||
case 0x00008520: return "GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV";
|
||||
case 0x00008521: return "GL_VERTEX_ARRAY_RANGE_POINTER_NV";
|
||||
case 0x00008522: return "GL_REGISTER_COMBINERS_NV";
|
||||
case 0x00008523: return "GL_VARIABLE_A_NV";
|
||||
case 0x00008524: return "GL_VARIABLE_B_NV";
|
||||
|
|
@ -1456,7 +1471,7 @@ namespace Token {
|
|||
case 0x00008674: return "GL_MAP2_VERTEX_ATTRIB4_4_NV";
|
||||
case 0x00008675: return "GL_MAP2_VERTEX_ATTRIB5_4_NV";
|
||||
case 0x00008676: return "GL_MAP2_VERTEX_ATTRIB6_4_NV";
|
||||
case 0x00008677: return "GL_MAP2_VERTEX_ATTRIB7_4_NV";
|
||||
case 0x00008677: return "GL_PROGRAM_BINDING_ARB";
|
||||
case 0x00008678: return "GL_MAP2_VERTEX_ATTRIB8_4_NV";
|
||||
case 0x00008679: return "GL_MAP2_VERTEX_ATTRIB9_4_NV";
|
||||
case 0x0000867a: return "GL_MAP2_VERTEX_ATTRIB10_4_NV";
|
||||
|
|
@ -1614,8 +1629,8 @@ namespace Token {
|
|||
case 0x0000873f: return "GL_MODELVIEW31_ARB";
|
||||
case 0x00008740: return "GL_Z400_BINARY_AMD";
|
||||
case 0x00008741: return "GL_PROGRAM_BINARY_LENGTH";
|
||||
case 0x00008742: return "GL_MIRROR_CLAMP_ATI";
|
||||
case 0x00008743: return "GL_MIRROR_CLAMP_TO_EDGE_ATI";
|
||||
case 0x00008742: return "GL_MIRROR_CLAMP_EXT";
|
||||
case 0x00008743: return "GL_MIRROR_CLAMP_TO_EDGE_EXT";
|
||||
case 0x00008744: return "GL_MODULATE_ADD_ATI";
|
||||
case 0x00008745: return "GL_MODULATE_SIGNED_ADD_ATI";
|
||||
case 0x00008746: return "GL_MODULATE_SUBTRACT_ATI";
|
||||
|
|
@ -1875,7 +1890,7 @@ namespace Token {
|
|||
case 0x00008861: return "GL_POINT_SPRITE";
|
||||
case 0x00008862: return "GL_COORD_REPLACE";
|
||||
case 0x00008863: return "GL_POINT_SPRITE_R_MODE_NV";
|
||||
case 0x00008864: return "GL_PIXEL_COUNTER_BITS_NV";
|
||||
case 0x00008864: return "GL_QUERY_COUNTER_BITS_ARB";
|
||||
case 0x00008865: return "GL_CURRENT_QUERY";
|
||||
case 0x00008866: return "GL_QUERY_RESULT";
|
||||
case 0x00008867: return "GL_QUERY_RESULT_AVAILABLE";
|
||||
|
|
@ -3181,7 +3196,7 @@ namespace Token {
|
|||
case 0x000093db: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
|
||||
case 0x000093dc: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
|
||||
case 0x000093dd: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
|
||||
case 0x00010000: return "GL_COLOR3_BIT_PGI";
|
||||
case 0x00010000: return "GL_STENCIL_BUFFER_BIT0_QCOM";
|
||||
case 0x00019262: return "GL_RASTER_POSITION_UNCLIPPED_IBM";
|
||||
case 0x0001928a: return "GL_CULL_VERTEX_IBM";
|
||||
case 0x00019294: return "GL_ALL_STATIC_DATA_IBM";
|
||||
|
|
@ -3226,19 +3241,19 @@ namespace Token {
|
|||
case 0x0001a22b: return "GL_VERTEX_CONSISTENT_HINT_PGI";
|
||||
case 0x0001a22c: return "GL_MATERIAL_SIDE_HINT_PGI";
|
||||
case 0x0001a22d: return "GL_MAX_VERTEX_HINT_PGI";
|
||||
case 0x00020000: return "GL_COLOR4_BIT_PGI";
|
||||
case 0x00040000: return "GL_EDGEFLAG_BIT_PGI";
|
||||
case 0x00080000: return "GL_FONT_Y_MAX_BOUNDS_BIT_NV";
|
||||
case 0x00020000: return "GL_STENCIL_BUFFER_BIT1_QCOM";
|
||||
case 0x00040000: return "GL_STENCIL_BUFFER_BIT2_QCOM";
|
||||
case 0x00080000: return "GL_STENCIL_BUFFER_BIT3_QCOM";
|
||||
case 0x000fffff: return "GL_ALL_ATTRIB_BITS";
|
||||
case 0x00100000: return "GL_FONT_UNITS_PER_EM_BIT_NV";
|
||||
case 0x00200000: return "GL_FONT_ASCENDER_BIT_NV";
|
||||
case 0x00400000: return "GL_FONT_DESCENDER_BIT_NV";
|
||||
case 0x00800000: return "GL_FONT_HEIGHT_BIT_NV";
|
||||
case 0x01000000: return "GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV";
|
||||
case 0x02000000: return "GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV";
|
||||
case 0x04000000: return "GL_FONT_UNDERLINE_POSITION_BIT_NV";
|
||||
case 0x08000000: return "GL_FONT_UNDERLINE_THICKNESS_BIT_NV";
|
||||
case 0x10000000: return "GL_FONT_HAS_KERNING_BIT_NV";
|
||||
case 0x00100000: return "GL_STENCIL_BUFFER_BIT4_QCOM";
|
||||
case 0x00200000: return "GL_STENCIL_BUFFER_BIT5_QCOM";
|
||||
case 0x00400000: return "GL_STENCIL_BUFFER_BIT6_QCOM";
|
||||
case 0x00800000: return "GL_STENCIL_BUFFER_BIT7_QCOM";
|
||||
case 0x01000000: return "GL_MULTISAMPLE_BUFFER_BIT0_QCOM";
|
||||
case 0x02000000: return "GL_MULTISAMPLE_BUFFER_BIT1_QCOM";
|
||||
case 0x04000000: return "GL_MULTISAMPLE_BUFFER_BIT2_QCOM";
|
||||
case 0x08000000: return "GL_MULTISAMPLE_BUFFER_BIT3_QCOM";
|
||||
case 0x10000000: return "GL_MULTISAMPLE_BUFFER_BIT4_QCOM";
|
||||
case 0x20000000: return "GL_MULTISAMPLE_BIT_3DFX";
|
||||
case 0x40000000: return "GL_MULTISAMPLE_BUFFER_BIT6_QCOM";
|
||||
case 0x80000000: return "GL_MULTISAMPLE_BUFFER_BIT7_QCOM";
|
||||
|
|
@ -3267,7 +3282,7 @@ namespace Token {
|
|||
#if REGAL_SYS_GLX
|
||||
const char * GLXenumToString(int v) {
|
||||
switch( v ) {
|
||||
case 0x00000000: return "GLX_EXTENDED_RANGE_SGIS";
|
||||
case 0x00000000: return "GLX_SYNC_FRAME_SGIX";
|
||||
case 0x00000001: return "GLX_3DFX_WINDOW_MODE_MESA";
|
||||
case 0x00000002: return "GLX_3DFX_FULLSCREEN_MODE_MESA";
|
||||
case 0x00000003: return "GLX_EXTENSIONS";
|
||||
|
|
@ -3473,7 +3488,7 @@ namespace Token {
|
|||
case 0x00000002: return "EGL_DRM_BUFFER_USE_SHARE_MESA";
|
||||
case 0x00000004: return "EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR";
|
||||
case 0x00000008: return "EGL_OPENGL_BIT";
|
||||
case 0x00000020: return "EGL_VG_COLORSPACE_LINEAR_BIT";
|
||||
case 0x00000020: return "EGL_VG_COLORSPACE_LINEAR_BIT_KHR";
|
||||
case 0x00000040: return "EGL_OPENGL_ES3_BIT_KHR";
|
||||
case 0x00000080: return "EGL_LOCK_SURFACE_BIT_KHR";
|
||||
case 0x00000100: return "EGL_OPTIMAL_FORMAT_BIT_KHR";
|
||||
|
|
@ -3648,8 +3663,8 @@ namespace Token {
|
|||
case 0x00003134: return "EGL_MULTIVIEW_VIEW_COUNT_EXT";
|
||||
case 0x00003138: return "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT";
|
||||
case 0x000031bd: return "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR";
|
||||
case 0x000031be: return "EGL_NO_RESET_NOTIFICATION_EXT";
|
||||
case 0x000031bf: return "EGL_LOSE_CONTEXT_ON_RESET_EXT";
|
||||
case 0x000031be: return "EGL_NO_RESET_NOTIFICATION_KHR";
|
||||
case 0x000031bf: return "EGL_LOSE_CONTEXT_ON_RESET_KHR";
|
||||
case 0x000031d0: return "EGL_DRM_BUFFER_FORMAT_MESA";
|
||||
case 0x000031d1: return "EGL_DRM_BUFFER_USE_MESA";
|
||||
case 0x000031d2: return "EGL_DRM_BUFFER_FORMAT_ARGB32_MESA";
|
||||
|
|
|
|||
|
|
@ -46,23 +46,27 @@ REGAL_GLOBAL_BEGIN
|
|||
|
||||
#include <GL/Regal.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
REGAL_GLOBAL_END
|
||||
|
||||
REGAL_NAMESPACE_BEGIN
|
||||
|
||||
namespace Token {
|
||||
|
||||
const char * GLenumToString (GLenum v);
|
||||
const char * GLerrorToString (GLenum v); // gluErrorString
|
||||
const char * GLbooleanToString (GLboolean v);
|
||||
const char * internalFormatToString(GLint v);
|
||||
const char * GLenumToString (GLenum v);
|
||||
const char * GLerrorToString (GLenum v); // gluErrorString
|
||||
const char * GLbooleanToString (GLboolean v);
|
||||
const char * internalFormatToString(GLint v);
|
||||
|
||||
std::string GLclearToString (GLbitfield v);
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
const char * GLXenumToString (int v);
|
||||
const char * GLXenumToString (int v);
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_EGL
|
||||
const char * EGLenumToString (int v);
|
||||
const char * EGLenumToString (int v);
|
||||
#endif
|
||||
|
||||
inline const char *toString(const GLenum v) { return GLenumToString(v); }
|
||||
|
|
|
|||
|
|
@ -169,6 +169,20 @@ const char *libraryLocation(const Library &library)
|
|||
|
||||
// GLES
|
||||
|
||||
/* Ubuntu 12.04 x86
|
||||
|
||||
$ find /usr/lib/i386-linux-gnu/ -name "libEGL*" | xargs ls -la
|
||||
lrwxrwxrwx 1 root root 18 Oct 12 05:02 /usr/lib/i386-linux-gnu/libEGL.so -> mesa-egl/libEGL.so
|
||||
lrwxrwxrwx 1 root root 15 Oct 12 05:02 /usr/lib/i386-linux-gnu/mesa-egl/libEGL.so -> libEGL.so.1.0.0
|
||||
lrwxrwxrwx 1 root root 15 Oct 12 05:02 /usr/lib/i386-linux-gnu/mesa-egl/libEGL.so.1 -> libEGL.so.1.0.0
|
||||
-rw-r--r-- 1 root root 129660 Oct 12 05:02 /usr/lib/i386-linux-gnu/mesa-egl/libEGL.so.1.0.0
|
||||
|
||||
$ find /usr/lib/i386-linux-gnu/ -name "libGLES*" | xargs ls -la
|
||||
lrwxrwxrwx 1 root root 18 Oct 12 05:02 /usr/lib/i386-linux-gnu/mesa-egl/libGLESv2.so.2 -> libGLESv2.so.2.0.0
|
||||
-rw-r--r-- 1 root root 16248 Oct 12 05:02 /usr/lib/i386-linux-gnu/mesa-egl/libGLESv2.so.2.0.0
|
||||
|
||||
*/
|
||||
|
||||
if (library==LIBRARY_GLES)
|
||||
{
|
||||
// First, try ... variable
|
||||
|
|
@ -178,7 +192,13 @@ const char *libraryLocation(const Library &library)
|
|||
if (!ret)
|
||||
{
|
||||
#if REGAL_SYS_GLX
|
||||
#if defined(__arm__)
|
||||
return "/usr/lib/libGLESv2.so";
|
||||
#elif defined(__x86_64__) || defined(__x86_64)
|
||||
return "/usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2";
|
||||
#else
|
||||
return "/usr/lib/i386-linux-gnu/mesa-egl/libGLESv2.so.2";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -193,8 +213,14 @@ const char *libraryLocation(const Library &library)
|
|||
|
||||
if (!ret)
|
||||
{
|
||||
#if REGAL_SYS_GLX
|
||||
#if REGAL_SYS_EGL
|
||||
#if defined(__arm__)
|
||||
return "/usr/lib/libEGL.so";
|
||||
#elif defined(__x86_64__) || defined(__x86_64)
|
||||
return "/usr/lib/x86_64-linux-gnu/mesa-egl/libEGL.so";
|
||||
#else
|
||||
return "/usr/lib/i386-linux-gnu/mesa-egl/libEGL.so";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -285,9 +311,10 @@ void *GetProcAddress( const char * entry )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#elif REGAL_SYS_GLX && REGAL_SYS_EGL
|
||||
#elif REGAL_SYS_GLX || REGAL_SYS_EGL
|
||||
|
||||
// GLX and EGL
|
||||
// General purpose GetProcAddress for GLX or EGL,
|
||||
// GL or ES 2.0 for Linux, so far.
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
|
|
@ -298,71 +325,165 @@ void *GetProcAddress(const char *entry)
|
|||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
// EGL
|
||||
// GL ES 2.0
|
||||
// REVISIT - Eventually we need REGAL_SYS_ES2
|
||||
|
||||
static void *lib_EGL = NULL;
|
||||
static const char *lib_EGL_filename = NULL;
|
||||
|
||||
// Search for EGL library (libEGL.so usually) as necessary
|
||||
|
||||
if (!lib_EGL_filename)
|
||||
{
|
||||
lib_EGL_filename = libraryLocation(LIBRARY_EGL);
|
||||
if (!lib_EGL_filename)
|
||||
Warning("EGL library not found: ",lib_EGL_filename);
|
||||
}
|
||||
|
||||
// Load the EGL library as necessary
|
||||
|
||||
if (!lib_EGL && lib_EGL_filename)
|
||||
{
|
||||
Info("Loading EGL from ",lib_EGL_filename);
|
||||
lib_EGL = dlopen( lib_EGL_filename, RTLD_LAZY );
|
||||
}
|
||||
|
||||
// GL ES
|
||||
#if REGAL_SYS_EGL
|
||||
|
||||
static void *lib_GLES = NULL;
|
||||
static const char *lib_GLES_filename = NULL;
|
||||
|
||||
// Search for OpenGL ES library (libGLESv2.so usually) as necessary
|
||||
|
||||
if (!lib_GLES_filename)
|
||||
if (Regal::Config::sysEGL) // REVISIT - Eventually we need REGAL_SYS_ES2
|
||||
{
|
||||
lib_GLES_filename = libraryLocation(LIBRARY_GLES);
|
||||
// Search for OpenGL ES library (libGLESv2.so usually) as necessary
|
||||
|
||||
if (!lib_GLES_filename)
|
||||
Warning("OpenGL ES library not found: ",lib_GLES_filename);
|
||||
{
|
||||
lib_GLES_filename = libraryLocation(LIBRARY_GLES);
|
||||
if (!lib_GLES_filename)
|
||||
Warning("OpenGL ES library not found.");
|
||||
}
|
||||
|
||||
// Load the OpenGL ES library as necessary
|
||||
|
||||
if (!lib_GLES && lib_GLES_filename)
|
||||
{
|
||||
Info("Loading OpenGL ES from ",lib_GLES_filename);
|
||||
lib_GLES = dlopen( lib_GLES_filename, RTLD_LAZY );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Load the OpenGL ES library as necessary
|
||||
// GL
|
||||
// REVISIT - Eventually we need REGAL_SYS_GL
|
||||
|
||||
if (!lib_GLES && lib_GLES_filename)
|
||||
#if REGAL_SYS_GLX
|
||||
|
||||
static void *lib_GL = NULL;
|
||||
static const char *lib_GL_filename = NULL;
|
||||
|
||||
if (Regal::Config::sysGLX) // REVISIT - Eventually we need REGAL_SYS_GL
|
||||
{
|
||||
Info("Loading OpenGL ES from ",lib_GLES_filename);
|
||||
lib_GLES = dlopen( lib_GLES_filename, RTLD_LAZY );
|
||||
// Search for OpenGL library (libGL.so.1 usually) as necessary
|
||||
|
||||
if (!lib_GL_filename)
|
||||
{
|
||||
lib_GL_filename = libraryLocation(LIBRARY_GL);
|
||||
if (!lib_GL_filename)
|
||||
Warning("OpenGL library not found.");
|
||||
}
|
||||
|
||||
// Load the OpenGL library as necessary
|
||||
|
||||
if (!lib_GL && lib_GL_filename)
|
||||
{
|
||||
Info("Loading OpenGL from ",lib_GL_filename);
|
||||
lib_GL = dlopen( lib_GL_filename, RTLD_LAZY );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// EGL
|
||||
|
||||
#if REGAL_SYS_EGL
|
||||
|
||||
static void *lib_EGL = NULL;
|
||||
static const char *lib_EGL_filename = NULL;
|
||||
|
||||
if (Regal::Config::sysEGL)
|
||||
{
|
||||
// Search for EGL library (libEGL.so usually) as necessary
|
||||
|
||||
if (!lib_EGL_filename)
|
||||
{
|
||||
lib_EGL_filename = libraryLocation(LIBRARY_EGL);
|
||||
if (!lib_EGL_filename)
|
||||
Warning("EGL library not found.");
|
||||
}
|
||||
|
||||
// Load the EGL library as necessary
|
||||
|
||||
if (!lib_EGL && lib_EGL_filename)
|
||||
{
|
||||
Info("Loading EGL from ",lib_EGL_filename);
|
||||
lib_EGL = dlopen( lib_EGL_filename, RTLD_LAZY );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// GLX
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
|
||||
static void *lib_GLX = NULL;
|
||||
static const char *lib_GLX_filename = NULL;
|
||||
|
||||
if (Regal::Config::sysGLX)
|
||||
{
|
||||
// Search for OpenGL library (libGL.so.1 usually) as necessary
|
||||
|
||||
if (!lib_GLX_filename)
|
||||
{
|
||||
lib_GLX_filename = libraryLocation(LIBRARY_GL);
|
||||
if (!lib_GLX_filename)
|
||||
Warning("GL/GLX library not found.");
|
||||
}
|
||||
|
||||
// Load the OpenGL library as necessary
|
||||
|
||||
if (!lib_GLX && lib_GLX_filename)
|
||||
{
|
||||
Info("Loading GL/GLX from: ",lib_GLX_filename);
|
||||
lib_GLX = dlopen( lib_GLX_filename, RTLD_LAZY );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Load the entry-point by name, if possible
|
||||
|
||||
if (lib_EGL)
|
||||
{
|
||||
void *sym = dlsym(lib_EGL,entry);
|
||||
Internal("Regal::GetProcAddress ","loading ",entry," from ",lib_EGL_filename,sym ? " succeeded." : " failed.");
|
||||
if (sym)
|
||||
return sym;
|
||||
}
|
||||
|
||||
if (lib_GLES)
|
||||
#if REGAL_SYS_EGL
|
||||
if (Regal::Config::sysEGL && lib_GLES)
|
||||
{
|
||||
void *sym = dlsym(lib_GLES,entry);
|
||||
Internal("Regal::GetProcAddress ","loading ",entry," from ",lib_GLES_filename,sym ? " succeeded." : " failed.");
|
||||
Internal("Regal::GetProcAddress","loading ",entry," from ",lib_GLES_filename,sym ? " succeeded." : " failed.");
|
||||
if (sym)
|
||||
return sym;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
if (Regal::Config::sysGLX && lib_GL)
|
||||
{
|
||||
void *sym = dlsym(lib_GL,entry);
|
||||
Internal("Regal::GetProcAddress","loading ",entry," from ",lib_GL_filename,sym ? " succeeded." : " failed.");
|
||||
return sym;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_EGL
|
||||
if (Regal::Config::sysEGL && lib_EGL)
|
||||
{
|
||||
void *sym = dlsym(lib_EGL,entry);
|
||||
Internal("Regal::GetProcAddress","loading ",entry," from ",lib_EGL_filename,sym ? " succeeded." : " failed.");
|
||||
if (sym)
|
||||
return sym;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_GLX
|
||||
if (Regal::Config::sysGLX && lib_GLX)
|
||||
{
|
||||
void *sym = dlsym(lib_GLX,entry);
|
||||
Internal("Regal::GetProcAddress","loading ",entry," from ",lib_GLX_filename,sym ? " succeeded." : " failed.");
|
||||
if (sym)
|
||||
return sym;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if REGAL_SYS_EGL
|
||||
static PFNEGLGETPROCADDRESSPROC eglGetProcAddress = NULL;
|
||||
|
||||
if (lib_EGL)
|
||||
if (Regal::Config::sysEGL && lib_EGL)
|
||||
{
|
||||
if (!eglGetProcAddress)
|
||||
eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC) dlsym(lib_EGL, "eglGetProcAddress");
|
||||
|
|
@ -374,51 +495,12 @@ void *GetProcAddress(const char *entry)
|
|||
return sym;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
// Do we need glxGetProcAddress here?
|
||||
|
||||
#elif REGAL_SYS_GLX
|
||||
|
||||
// Vanilla GLX
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
void *GetProcAddress(const char *entry)
|
||||
{
|
||||
// Early-out for NULL entry name
|
||||
|
||||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
static void *lib_GL = NULL;
|
||||
static const char *lib_GL_filename = NULL;
|
||||
|
||||
// Search for OpenGL library (libGL.so.1 usually) as necessary
|
||||
|
||||
if (!lib_GL_filename)
|
||||
{
|
||||
lib_GL_filename = libraryLocation(LIBRARY_GL);
|
||||
if (!lib_GL_filename)
|
||||
Warning("OpenGL library not found.",lib_GL_filename);
|
||||
}
|
||||
|
||||
// Load the OpenGL library as necessary
|
||||
|
||||
if (!lib_GL && lib_GL_filename)
|
||||
{
|
||||
Info("Loading OpenGL from ",lib_GL_filename);
|
||||
lib_GL = dlopen( lib_GL_filename, RTLD_LAZY );
|
||||
}
|
||||
|
||||
// Load the entry-point by name, if possible
|
||||
|
||||
if (lib_GL)
|
||||
{
|
||||
void *sym = dlsym(lib_GL,entry);
|
||||
Internal("Regal::GetProcAddress ","loading ",entry," from ",lib_GL_filename,sym ? " succeeded." : " failed.");
|
||||
return sym;
|
||||
}
|
||||
#if REGAL_SYS_GLX
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,17 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Code logging disabled by default in
|
||||
// release mode, or embedded
|
||||
|
||||
#ifndef REGAL_CODE
|
||||
# if defined(NDEBUG) || REGAL_SYS_IOS || REGAL_SYS_PPAPI || REGAL_SYS_ANDROID
|
||||
# define REGAL_CODE 0
|
||||
# else
|
||||
# define REGAL_CODE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Emulation dispatch enabled by default
|
||||
|
||||
#ifndef REGAL_EMULATION
|
||||
|
|
@ -186,11 +197,17 @@
|
|||
//
|
||||
|
||||
// Caching enabled by default
|
||||
// ... except for release-mode and embedded platforms
|
||||
|
||||
#ifndef REGAL_CACHE
|
||||
#define REGAL_CACHE 1
|
||||
# if defined(NDEBUG) || REGAL_SYS_IOS || REGAL_SYS_PPAPI || REGAL_SYS_ANDROID
|
||||
# define REGAL_CACHE 0
|
||||
# else
|
||||
# define REGAL_CACHE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// Shader caching support by default
|
||||
|
||||
#ifndef REGAL_CACHE_SHADER
|
||||
|
|
|
|||
Loading…
Reference in a new issue