Add Linux projects for Radiance. Bug 18621031 Change-Id: I33429da66221ccb2c4f46fda91d501d28a2e4aec Reviewed-on: https://swiftshader-review.googlesource.com/1590 Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Radiance/libRAD/Surface.cpp b/src/Radiance/libRAD/Surface.cpp index 14cb562..e126627 100644 --- a/src/Radiance/libRAD/Surface.cpp +++ b/src/Radiance/libRAD/Surface.cpp
@@ -33,7 +33,11 @@ { es2::Image *createBackBuffer(int width, int height, const egl::Config *config); es2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard); + #if defined(_WIN32) sw::FrameBuffer *createFrameBuffer(HDC display, HWND window, int width, int height); + #else + sw::FrameBuffer *createFrameBuffer(void *display, Window window, int width, int height); + #endif } namespace egl @@ -89,13 +93,13 @@ } void Surface::release() -{ +{ if(mDepthStencil) { mDepthStencil->release(); mDepthStencil = NULL; } - + if(backBuffer) { backBuffer->release(); @@ -122,7 +126,7 @@ #else XWindowAttributes windowAttributes; XGetWindowAttributes(mDisplay->getNativeDisplay(), mWindow, &windowAttributes); - + return reset(windowAttributes.width, windowAttributes.height); #endif } @@ -217,7 +221,7 @@ { return; } - + mSwapInterval = interval; mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval()); mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
diff --git a/src/Radiance/libRAD/exports.map b/src/Radiance/libRAD/exports.map index 7d08ed0..ac0b017 100644 --- a/src/Radiance/libRAD/exports.map +++ b/src/Radiance/libRAD/exports.map
@@ -1,184 +1,19 @@ { global: - glActiveTexture; - glAttachShader; - glBindAttribLocation; - glBindBuffer; - glBindFramebuffer; - glBindRenderbuffer; - glBindTexture; - glBlendColor; - glBlendEquation; - glBlendEquationSeparate; - glBlendFunc; - glBlendFuncSeparate; - glBufferData; - glBufferSubData; - glCheckFramebufferStatus; - glClear; - glClearColor; - glClearDepthf; - glClearStencil; - glColorMask; - glCompileShader; - glCompressedTexImage2D; - glCompressedTexSubImage2D; - glCopyTexImage2D; - glCopyTexSubImage2D; - glCreateProgram; - glCreateShader; - glCullFace; - glDeleteBuffers; - glDeleteFramebuffers; - glDeleteProgram; - glDeleteRenderbuffers; - glDeleteShader; - glDeleteTextures; - glDepthFunc; - glDepthMask; - glDepthRangef; - glDetachShader; - glDisable; - glDisableVertexAttribArray; - glDrawArrays; - glDrawElements; - glEnable; - glEnableVertexAttribArray; - glFinish; - glFlush; - glFramebufferRenderbuffer; - glFramebufferTexture2D; - glFrontFace; - glGenBuffers; - glGenFramebuffers; - glGenRenderbuffers; - glGenTextures; - glGenerateMipmap; - glGetActiveAttrib; - glGetActiveUniform; - glGetAttachedShaders; - glGetAttribLocation; - glGetBooleanv; - glGetBufferParameteriv; - glGetError; - glGetFloatv; - glGetFramebufferAttachmentParameteriv; - glGetIntegerv; - glGetProgramInfoLog; - glGetProgramiv; - glGetRenderbufferParameteriv; - glGetShaderInfoLog; - glGetShaderPrecisionFormat; - glGetShaderSource; - glGetShaderiv; - glGetString; - glGetTexParameterfv; - glGetTexParameteriv; - glGetUniformLocation; - glGetUniformfv; - glGetUniformiv; - glGetVertexAttribPointerv; - glGetVertexAttribfv; - glGetVertexAttribiv; - glHint; - glIsBuffer; - glIsEnabled; - glIsFramebuffer; - glIsProgram; - glIsRenderbuffer; - glIsShader; - glIsTexture; - glLineWidth; - glLinkProgram; - glPixelStorei; - glPolygonOffset; - glReadPixels; - glReleaseShaderCompiler; - glRenderbufferStorage; - glSampleCoverage; - glScissor; - glShaderBinary; - glShaderSource; - glStencilFunc; - glStencilFuncSeparate; - glStencilMask; - glStencilMaskSeparate; - glStencilOp; - glStencilOpSeparate; - glTexImage2D; - glTexParameterf; - glTexParameterfv; - glTexParameteri; - glTexParameteriv; - glTexSubImage2D; - glUniform1f; - glUniform1fv; - glUniform1i; - glUniform1iv; - glUniform2f; - glUniform2fv; - glUniform2i; - glUniform2iv; - glUniform3f; - glUniform3fv; - glUniform3i; - glUniform3iv; - glUniform4f; - glUniform4fv; - glUniform4i; - glUniform4iv; - glUniformMatrix2fv; - glUniformMatrix3fv; - glUniformMatrix4fv; - glUseProgram; - glValidateProgram; - glVertexAttrib1f; - glVertexAttrib1fv; - glVertexAttrib2f; - glVertexAttrib2fv; - glVertexAttrib3f; - glVertexAttrib3fv; - glVertexAttrib4f; - glVertexAttrib4fv; - glVertexAttribPointer; - glViewport; - - # Extensions - glTexImage3DOES; - glBlitFramebufferANGLE; - glRenderbufferStorageMultisampleANGLE; - glDeleteFencesNV; - glFinishFenceNV; - glGenFencesNV; - glGetFenceivNV; - glIsFenceNV; - glSetFenceNV; - glTestFenceNV; - glGetGraphicsResetStatusEXT; - glReadnPixelsEXT; - glGetnUniformfvEXT; - glGetnUniformivEXT; - glGenQueriesEXT; - glDeleteQueriesEXT; - glIsQueryEXT; - glBeginQueryEXT; - glEndQueryEXT; - glGetQueryivEXT; - glGetQueryObjectuivEXT; - - # EGL dependencies - glCreateContext; - glDestroyContext; - glMakeCurrent; - glGetCurrentContext; - glGetProcAddress; - glBindTexImage; - - createFrameBuffer; - createBackBuffer; - createDevice; - - Register; + radGetProcAddress; + + eglBindAPI; + eglChooseConfig; + eglCreateContext; + eglCreateWindowSurface; + eglGetDisplay; + eglGetError; + eglGetProcAddress; + eglInitialize; + eglMakeCurrent; + eglTerminate; + + Register; local: *;
diff --git a/src/Radiance/libRAD/libEGL.cbp b/src/Radiance/libRAD/libEGL.cbp deleted file mode 100644 index 72049bf..0000000 --- a/src/Radiance/libRAD/libEGL.cbp +++ /dev/null
@@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<CodeBlocks_project_file> - <FileVersion major="1" minor="6" /> - <Project> - <Option title="libEGL" /> - <Option pch_mode="2" /> - <Option compiler="gcc" /> - <Build> - <Target title="Debug x86"> - <Option output="./../../bin/x86/Debug/libEGL.so.1" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x86/Debug/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-g" /> - <Add option="-m32" /> - </Compiler> - <Linker> - <Add option="-m32" /> - </Linker> - </Target> - <Target title="Release x86"> - <Option output="./../../bin/x86/Release/libEGL.so.1" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x86/Release/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-O2" /> - <Add option="-m32" /> - <Add option="-DNDEBUG" /> - <Add option="-DANGLE_DISABLE_TRACE" /> - </Compiler> - <Linker> - <Add option="-s" /> - <Add option="-m32" /> - </Linker> - </Target> - <Target title="Debug x64"> - <Option output="./../../bin/x64/Debug/libEGL.so.1" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x64/Debug/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-g" /> - <Add option="-m64" /> - <Add option="-fPIC" /> - </Compiler> - <Linker> - <Add option="-m64" /> - </Linker> - </Target> - <Target title="Release x64"> - <Option output="./../../bin/x64/Release/libEGL.so.1" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x64/Release/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-march=core2" /> - <Add option="-O2" /> - <Add option="-m64" /> - <Add option="-fPIC" /> - <Add option="-DNDEBUG" /> - <Add option="-DANGLE_DISABLE_TRACE" /> - </Compiler> - <Linker> - <Add option="-s" /> - <Add option="-m64" /> - </Linker> - </Target> - </Build> - <Compiler> - <Add option="-Wall" /> - <Add option="-fexceptions" /> - <Add directory="./../include/" /> - <Add directory="./../" /> - <Add directory="./../../" /> - </Compiler> - <Linker> - <Add library="pthread" /> - </Linker> - <Unit filename="../common/debug.cpp" /> - <Unit filename="./Config.cpp" /> - <Unit filename="./Config.h" /> - <Unit filename="./Display.cpp" /> - <Unit filename="./Display.h" /> - <Unit filename="./Surface.cpp" /> - <Unit filename="./Surface.h" /> - <Unit filename="./libEGL.cpp" /> - <Unit filename="./main.cpp" /> - <Unit filename="./main.h" /> - <Extensions> - <code_completion /> - <debugger /> - </Extensions> - </Project> -</CodeBlocks_project_file>
diff --git a/src/Radiance/libRAD/libRAD.cbp b/src/Radiance/libRAD/libRAD.cbp index 651969c..68a0a6f 100644 --- a/src/Radiance/libRAD/libRAD.cbp +++ b/src/Radiance/libRAD/libRAD.cbp
@@ -1,367 +1,359 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<CodeBlocks_project_file> - <FileVersion major="1" minor="6" /> - <Project> - <Option title="libRAD" /> - <Option pch_mode="2" /> - <Option compiler="gcc" /> - <Build> - <Target title="Debug x86"> - <Option output="./../../bin/x86/Debug/libRAD.so.2" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x86/Debug/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-g" /> - <Add option="-m32" /> - </Compiler> - <Linker> - <Add option="-m32" /> - <Add library="./../../LLVM/bin/x86/Debug/libLLVM.a" /> - </Linker> - </Target> - <Target title="Release x86"> - <Option output="./../../bin/x86/Release/libRAD.so.2" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x86/Release/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-march=i686" /> - <Add option="-fomit-frame-pointer" /> - <Add option="-O2" /> - <Add option="-m32" /> - <Add option="-ffunction-sections" /> - <Add option="-fdata-sections" /> - <Add option="-DNDEBUG" /> - <Add option="-DANGLE_DISABLE_TRACE" /> - </Compiler> - <Linker> - <Add option="-s" /> - <Add option="-m32" /> - <Add option="-Wl,--gc-sections" /> - <Add library="./../../LLVM/bin/x86/Release/libLLVM.a" /> - </Linker> - </Target> - <Target title="Debug x64"> - <Option output="./../../bin/x64/Debug/libRAD.so.2" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x64/Debug/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-g" /> - <Add option="-m64" /> - <Add option="-fPIC" /> - </Compiler> - <Linker> - <Add option="-m64" /> - <Add library="./../../LLVM/bin/x64/Debug/libLLVM.a" /> - </Linker> - </Target> - <Target title="Release x64"> - <Option output="./../../bin/x64/Release/libRAD.so.2" prefix_auto="0" extension_auto="0" /> - <Option object_output="obj/x64/Release/" /> - <Option type="3" /> - <Option compiler="gcc" /> - <Option createDefFile="1" /> - <Option createStaticLib="1" /> - <Compiler> - <Add option="-march=core2" /> - <Add option="-fomit-frame-pointer" /> - <Add option="-O2" /> - <Add option="-m64" /> - <Add option="-fPIC" /> - <Add option="-ffunction-sections" /> - <Add option="-fdata-sections" /> - <Add option="-DNDEBUG" /> - <Add option="-DANGLE_DISABLE_TRACE" /> - </Compiler> - <Linker> - <Add option="-s" /> - <Add option="-m64" /> - <Add option="-Wl,--gc-sections" /> - <Add library="./../../LLVM/bin/x64/Release/libLLVM.a" /> - </Linker> - </Target> - </Build> - <Compiler> - <Add option="-Wall" /> - <Add option="-fexceptions" /> - <Add option="-fno-operator-names" /> - <Add option="-ffriend-injection" /> - <Add option="-msse2" /> - <Add option="-D__STDC_LIMIT_MACROS" /> - <Add option="-D__STDC_CONSTANT_MACROS" /> - <Add directory="./../" /> - <Add directory="./../include/" /> - <Add directory="./../../" /> - <Add directory="./../../LLVM/include-linux/" /> - <Add directory="./../../LLVM/include/" /> - <Add directory="./../../LLVM/lib/Target/X86" /> - <Add directory="./../../Renderer/" /> - <Add directory="./../../Common/" /> - <Add directory="./../../Shader/" /> - <Add directory="./../../Main/" /> - </Compiler> - <Linker> - <Add option="-Wl,--version-script=./exports.map" /> - <Add library="pthread" /> - <Add library="X11" /> - <Add library="Xext" /> - </Linker> - <Unit filename="./../../Common/CPUID.cpp" /> - <Unit filename="./../../Common/CPUID.hpp" /> - <Unit filename="./../../Common/Configurator.cpp" /> - <Unit filename="./../../Common/Configurator.hpp" /> - <Unit filename="./../../Common/Debug.cpp" /> - <Unit filename="./../../Common/Debug.hpp" /> - <Unit filename="./../../Common/ExceptionHandling.hpp" /> - <Unit filename="./../../Common/Half.cpp" /> - <Unit filename="./../../Common/Half.hpp" /> - <Unit filename="./../../Common/Math.cpp" /> - <Unit filename="./../../Common/Math.hpp" /> - <Unit filename="./../../Common/Memory.cpp" /> - <Unit filename="./../../Common/Memory.hpp" /> - <Unit filename="./../../Common/MetaMacro.hpp" /> - <Unit filename="./../../Common/MutexLock.hpp" /> - <Unit filename="./../../Common/Resource.cpp" /> - <Unit filename="./../../Common/Resource.hpp" /> - <Unit filename="./../../Common/Socket.cpp" /> - <Unit filename="./../../Common/Socket.hpp" /> - <Unit filename="./../../Common/Thread.cpp" /> - <Unit filename="./../../Common/Thread.hpp" /> - <Unit filename="./../../Common/Timer.cpp" /> - <Unit filename="./../../Common/Timer.hpp" /> - <Unit filename="./../../Common/Types.hpp" /> - <Unit filename="./../../Common/Version.h" /> - <Unit filename="./../common/debug.cpp" /> - <Unit filename="./../common/debug.h" /> - <Unit filename="../compiler/AnalyzeCallDepth.cpp" /> - <Unit filename="../compiler/AnalyzeCallDepth.h" /> - <Unit filename="../compiler/BaseTypes.h" /> - <Unit filename="../compiler/Common.h" /> - <Unit filename="../compiler/Compiler.cpp" /> - <Unit filename="../compiler/ConstantUnion.h" /> - <Unit filename="../compiler/Diagnostics.cpp" /> - <Unit filename="../compiler/Diagnostics.h" /> - <Unit filename="../compiler/DirectiveHandler.cpp" /> - <Unit filename="../compiler/DirectiveHandler.h" /> - <Unit filename="../compiler/ExtensionBehavior.h" /> - <Unit filename="../compiler/InfoSink.cpp" /> - <Unit filename="../compiler/InfoSink.h" /> - <Unit filename="../compiler/Initialize.cpp" /> - <Unit filename="../compiler/Initialize.h" /> - <Unit filename="../compiler/InitializeDll.cpp" /> - <Unit filename="../compiler/InitializeDll.h" /> - <Unit filename="../compiler/InitializeGlobals.h" /> - <Unit filename="../compiler/InitializeParseContext.cpp" /> - <Unit filename="../compiler/InitializeParseContext.h" /> - <Unit filename="../compiler/IntermTraverse.cpp" /> - <Unit filename="../compiler/Intermediate.cpp" /> - <Unit filename="../compiler/MMap.h" /> - <Unit filename="../compiler/OutputASM.cpp" /> - <Unit filename="../compiler/OutputASM.h" /> - <Unit filename="../compiler/ParseHelper.cpp" /> - <Unit filename="../compiler/ParseHelper.h" /> - <Unit filename="../compiler/PoolAlloc.cpp" /> - <Unit filename="../compiler/PoolAlloc.h" /> - <Unit filename="../compiler/Pragma.h" /> - <Unit filename="../compiler/RemoveTree.cpp" /> - <Unit filename="../compiler/RemoveTree.h" /> - <Unit filename="../compiler/ShHandle.h" /> - <Unit filename="../compiler/ShaderLang.cpp" /> - <Unit filename="../compiler/SymbolTable.cpp" /> - <Unit filename="../compiler/SymbolTable.h" /> - <Unit filename="../compiler/TranslatorASM.cpp" /> - <Unit filename="../compiler/TranslatorASM.h" /> - <Unit filename="../compiler/Types.h" /> - <Unit filename="../compiler/ValidateLimitations.cpp" /> - <Unit filename="../compiler/ValidateLimitations.h" /> - <Unit filename="../compiler/debug.cpp" /> - <Unit filename="../compiler/debug.h" /> - <Unit filename="../compiler/glslang.h" /> - <Unit filename="../compiler/glslang_lex.cpp" /> - <Unit filename="../compiler/glslang_tab.cpp" /> - <Unit filename="../compiler/glslang_tab.h" /> - <Unit filename="../compiler/intermOut.cpp" /> - <Unit filename="../compiler/intermediate.h" /> - <Unit filename="../compiler/localintermediate.h" /> - <Unit filename="../compiler/osinclude.h" /> - <Unit filename="../compiler/ossource_posix.cpp" /> - <Unit filename="../compiler/parseConst.cpp" /> - <Unit filename="../compiler/preprocessor/Diagnostics.cpp" /> - <Unit filename="../compiler/preprocessor/Diagnostics.h" /> - <Unit filename="../compiler/preprocessor/DirectiveHandler.cpp" /> - <Unit filename="../compiler/preprocessor/DirectiveHandler.h" /> - <Unit filename="../compiler/preprocessor/DirectiveParser.cpp" /> - <Unit filename="../compiler/preprocessor/DirectiveParser.h" /> - <Unit filename="../compiler/preprocessor/ExpressionParser.cpp" /> - <Unit filename="../compiler/preprocessor/ExpressionParser.h" /> - <Unit filename="../compiler/preprocessor/Input.cpp" /> - <Unit filename="../compiler/preprocessor/Input.h" /> - <Unit filename="../compiler/preprocessor/Lexer.cpp" /> - <Unit filename="../compiler/preprocessor/Lexer.h" /> - <Unit filename="../compiler/preprocessor/Macro.cpp" /> - <Unit filename="../compiler/preprocessor/Macro.h" /> - <Unit filename="../compiler/preprocessor/MacroExpander.cpp" /> - <Unit filename="../compiler/preprocessor/MacroExpander.h" /> - <Unit filename="../compiler/preprocessor/Preprocessor.cpp" /> - <Unit filename="../compiler/preprocessor/Preprocessor.h" /> - <Unit filename="../compiler/preprocessor/SourceLocation.h" /> - <Unit filename="../compiler/preprocessor/Token.cpp" /> - <Unit filename="../compiler/preprocessor/Token.h" /> - <Unit filename="../compiler/preprocessor/Tokenizer.cpp" /> - <Unit filename="../compiler/preprocessor/Tokenizer.h" /> - <Unit filename="../compiler/preprocessor/length_limits.h" /> - <Unit filename="../compiler/preprocessor/numeric_lex.h" /> - <Unit filename="../compiler/preprocessor/pp_utils.h" /> - <Unit filename="../compiler/util.cpp" /> - <Unit filename="../compiler/util.h" /> - <Unit filename="./../include/EGL/egl.h" /> - <Unit filename="./../include/EGL/eglext.h" /> - <Unit filename="./../include/EGL/eglplatform.h" /> - <Unit filename="./../include/GLES2/gl2.h" /> - <Unit filename="./../include/GLES2/gl2ext.h" /> - <Unit filename="./../include/GLES2/gl2platform.h" /> - <Unit filename="./../include/GLSLANG/ShaderLang.h" /> - <Unit filename="./../include/KHR/khrplatform.h" /> - <Unit filename="./../libRAD/Buffer.cpp" /> - <Unit filename="./../libRAD/Buffer.h" /> - <Unit filename="./../libRAD/Context.cpp" /> - <Unit filename="./../libRAD/Context.h" /> - <Unit filename="./../libRAD/Device.cpp" /> - <Unit filename="./../libRAD/Device.hpp" /> - <Unit filename="./../libRAD/Fence.cpp" /> - <Unit filename="./../libRAD/Fence.h" /> - <Unit filename="./../libRAD/Framebuffer.cpp" /> - <Unit filename="./../libRAD/Framebuffer.h" /> - <Unit filename="./../libRAD/HandleAllocator.cpp" /> - <Unit filename="./../libRAD/HandleAllocator.h" /> - <Unit filename="./../libRAD/Image.cpp" /> - <Unit filename="./../libRAD/Image.hpp" /> - <Unit filename="./../libRAD/IndexDataManager.cpp" /> - <Unit filename="./../libRAD/IndexDataManager.h" /> - <Unit filename="./../libRAD/Program.cpp" /> - <Unit filename="./../libRAD/Program.h" /> - <Unit filename="./../libRAD/Query.cpp" /> - <Unit filename="./../libRAD/Query.h" /> - <Unit filename="./../libRAD/RefCountObject.cpp" /> - <Unit filename="./../libRAD/RefCountObject.h" /> - <Unit filename="./../libRAD/Renderbuffer.cpp" /> - <Unit filename="./../libRAD/Renderbuffer.h" /> - <Unit filename="./../libRAD/ResourceManager.cpp" /> - <Unit filename="./../libRAD/ResourceManager.h" /> - <Unit filename="./../libRAD/Shader.cpp" /> - <Unit filename="./../libRAD/Shader.h" /> - <Unit filename="./../libRAD/Texture.cpp" /> - <Unit filename="./../libRAD/Texture.h" /> - <Unit filename="./../libRAD/Unknown.hpp" /> - <Unit filename="./../libRAD/VertexDataManager.cpp" /> - <Unit filename="./../libRAD/VertexDataManager.h" /> - <Unit filename="./../libRAD/libRAD.cpp" /> - <Unit filename="./../libRAD/main.cpp" /> - <Unit filename="./../libRAD/main.h" /> - <Unit filename="./../libRAD/mathutil.h" /> - <Unit filename="./../libRAD/resource.h" /> - <Unit filename="./../libRAD/utilities.cpp" /> - <Unit filename="./../libRAD/utilities.h" /> - <Unit filename="./../libRAD/vertexconversion.h" /> - <Unit filename="./../../Main/Config.cpp" /> - <Unit filename="./../../Main/Config.hpp" /> - <Unit filename="./../../Main/FrameBuffer.cpp" /> - <Unit filename="./../../Main/FrameBuffer.hpp" /> - <Unit filename="./../../Main/FrameBufferX11.cpp" /> - <Unit filename="./../../Main/FrameBufferX11.hpp" /> - <Unit filename="./../../Main/Logo.cpp" /> - <Unit filename="./../../Main/Register.cpp" /> - <Unit filename="./../../Main/Register.hpp" /> - <Unit filename="./../../Main/SwiftConfig.cpp" /> - <Unit filename="./../../Main/SwiftConfig.hpp" /> - <Unit filename="./../../Main/crc.c"> - <Option compilerVar="CC" /> - </Unit> - <Unit filename="./../../Main/crc.h" /> - <Unit filename="./../../Main/serialcommon.h" /> - <Unit filename="./../../Main/serialvalid.cpp" /> - <Unit filename="./../../Main/serialvalid.h" /> - <Unit filename="./../../Reactor/Routine.cpp" /> - <Unit filename="./../../Reactor/Routine.hpp" /> - <Unit filename="./../../Reactor/RoutineManager.cpp" /> - <Unit filename="./../../Reactor/RoutineManager.hpp" /> - <Unit filename="./../../Reactor/Nucleus.cpp" /> - <Unit filename="./../../Reactor/Nucleus.hpp" /> - <Unit filename="./../../Reactor/Reactor.hpp" /> - <Unit filename="./../../Reactor/x86.hpp" /> - <Unit filename="./../../Renderer/Blitter.cpp" /> - <Unit filename="./../../Renderer/Blitter.hpp" /> - <Unit filename="./../../Renderer/Clipper.cpp" /> - <Unit filename="./../../Renderer/Clipper.hpp" /> - <Unit filename="./../../Renderer/Color.cpp" /> - <Unit filename="./../../Renderer/Color.hpp" /> - <Unit filename="./../../Renderer/Context.cpp" /> - <Unit filename="./../../Renderer/Context.hpp" /> - <Unit filename="./../../Renderer/LRUCache.hpp" /> - <Unit filename="./../../Renderer/Matrix.cpp" /> - <Unit filename="./../../Renderer/Matrix.hpp" /> - <Unit filename="./../../Renderer/PixelProcessor.cpp" /> - <Unit filename="./../../Renderer/PixelProcessor.hpp" /> - <Unit filename="./../../Renderer/Plane.cpp" /> - <Unit filename="./../../Renderer/Plane.hpp" /> - <Unit filename="./../../Renderer/Point.cpp" /> - <Unit filename="./../../Renderer/Point.hpp" /> - <Unit filename="./../../Renderer/Polygon.hpp" /> - <Unit filename="./../../Renderer/Primitive.hpp" /> - <Unit filename="./../../Renderer/QuadRasterizer.cpp" /> - <Unit filename="./../../Renderer/QuadRasterizer.hpp" /> - <Unit filename="./../../Renderer/Rasterizer.cpp" /> - <Unit filename="./../../Renderer/Rasterizer.hpp" /> - <Unit filename="./../../Renderer/Renderer.cpp" /> - <Unit filename="./../../Renderer/Renderer.hpp" /> - <Unit filename="./../../Renderer/Sampler.cpp" /> - <Unit filename="./../../Renderer/Sampler.hpp" /> - <Unit filename="./../../Renderer/SetupProcessor.cpp" /> - <Unit filename="./../../Renderer/SetupProcessor.hpp" /> - <Unit filename="./../../Renderer/Stream.hpp" /> - <Unit filename="./../../Renderer/Surface.cpp" /> - <Unit filename="./../../Renderer/Surface.hpp" /> - <Unit filename="./../../Renderer/TextureStage.cpp" /> - <Unit filename="./../../Renderer/TextureStage.hpp" /> - <Unit filename="./../../Renderer/Triangle.hpp" /> - <Unit filename="./../../Renderer/Vector.cpp" /> - <Unit filename="./../../Renderer/Vector.hpp" /> - <Unit filename="./../../Renderer/Vertex.hpp" /> - <Unit filename="./../../Renderer/VertexProcessor.cpp" /> - <Unit filename="./../../Renderer/VertexProcessor.hpp" /> - <Unit filename="./../../Shader/Constants.cpp" /> - <Unit filename="./../../Shader/Constants.hpp" /> - <Unit filename="./../../Shader/PixelRoutine.cpp" /> - <Unit filename="./../../Shader/PixelRoutine.hpp" /> - <Unit filename="./../../Shader/PixelShader.cpp" /> - <Unit filename="./../../Shader/PixelShader.hpp" /> - <Unit filename="./../../Shader/SamplerCore.cpp" /> - <Unit filename="./../../Shader/SamplerCore.hpp" /> - <Unit filename="./../../Shader/SetupRoutine.cpp" /> - <Unit filename="./../../Shader/SetupRoutine.hpp" /> - <Unit filename="./../../Shader/Shader.cpp" /> - <Unit filename="./../../Shader/Shader.hpp" /> - <Unit filename="./../../Shader/ShaderCore.cpp" /> - <Unit filename="./../../Shader/ShaderCore.hpp" /> - <Unit filename="./../../Shader/VertexPipeline.cpp" /> - <Unit filename="./../../Shader/VertexPipeline.hpp" /> - <Unit filename="./../../Shader/VertexProgram.cpp" /> - <Unit filename="./../../Shader/VertexProgram.hpp" /> - <Unit filename="./../../Shader/VertexRoutine.cpp" /> - <Unit filename="./../../Shader/VertexRoutine.hpp" /> - <Unit filename="./../../Shader/VertexShader.cpp" /> - <Unit filename="./../../Shader/VertexShader.hpp" /> - <Extensions> - <code_completion /> - <debugger /> - </Extensions> - </Project> -</CodeBlocks_project_file> +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="libRAD" /> + <Option pch_mode="2" /> + <Option compiler="clang" /> + <Build> + <Target title="Debug x86"> + <Option output="./../../../lib/Debug_x86/libRAD.so" prefix_auto="0" extension_auto="0" /> + <Option object_output="obj/x86/Debug/" /> + <Option type="3" /> + <Option compiler="clang" /> + <Option createDefFile="1" /> + <Option createStaticLib="1" /> + <Compiler> + <Add option="-g" /> + <Add option="-m32" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add library="./../../LLVM/bin/x86/Debug/libLLVM.a" /> + </Linker> + </Target> + <Target title="Release x86"> + <Option output="./../../../lib/Release_x86/libRAD.so" prefix_auto="0" extension_auto="0" /> + <Option object_output="obj/x86/Release/" /> + <Option type="3" /> + <Option compiler="clang" /> + <Option createDefFile="1" /> + <Option createStaticLib="1" /> + <Compiler> + <Add option="-march=i686" /> + <Add option="-fomit-frame-pointer" /> + <Add option="-O2" /> + <Add option="-m32" /> + <Add option="-ffunction-sections" /> + <Add option="-fdata-sections" /> + <Add option="-DNDEBUG" /> + <Add option="-DANGLE_DISABLE_TRACE" /> + </Compiler> + <Linker> + <Add option="-s" /> + <Add option="-m32" /> + <Add option="-Wl,--gc-sections" /> + <Add library="./../../LLVM/bin/x86/Release/libLLVM.a" /> + </Linker> + </Target> + <Target title="Debug x64"> + <Option output="./../../../lib/Debug_x64/libRAD.so" prefix_auto="0" extension_auto="0" /> + <Option object_output="obj/x64/Debug/" /> + <Option type="3" /> + <Option compiler="clang" /> + <Option createDefFile="1" /> + <Option createStaticLib="1" /> + <Compiler> + <Add option="-g" /> + <Add option="-m64" /> + <Add option="-fPIC" /> + </Compiler> + <Linker> + <Add option="-m64" /> + <Add library="./../../LLVM/bin/x64/Debug/libLLVM.a" /> + </Linker> + </Target> + <Target title="Release x64"> + <Option output="./../../../lib/Release_x64/libRAD.so" prefix_auto="0" extension_auto="0" /> + <Option object_output="obj/x64/Release/" /> + <Option type="3" /> + <Option compiler="clang" /> + <Option createDefFile="1" /> + <Option createStaticLib="1" /> + <Compiler> + <Add option="-march=core2" /> + <Add option="-fomit-frame-pointer" /> + <Add option="-O2" /> + <Add option="-m64" /> + <Add option="-fPIC" /> + <Add option="-ffunction-sections" /> + <Add option="-fdata-sections" /> + <Add option="-DNDEBUG" /> + <Add option="-DANGLE_DISABLE_TRACE" /> + </Compiler> + <Linker> + <Add option="-s" /> + <Add option="-m64" /> + <Add option="-Wl,--gc-sections" /> + <Add library="./../../LLVM/bin/x64/Release/libLLVM.a" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + <Add option="-std=c++11" /> + <Add option="-fexceptions" /> + <Add option="-fno-operator-names" /> + <Add option="-msse2" /> + <Add option="-D__STDC_LIMIT_MACROS" /> + <Add option="-D__STDC_CONSTANT_MACROS" /> + <Add directory="./../" /> + <Add directory="./../include/" /> + <Add directory="./../../" /> + <Add directory="./../../LLVM/include-linux/" /> + <Add directory="./../../LLVM/include/" /> + <Add directory="./../../LLVM/lib/Target/X86" /> + <Add directory="./../../Renderer/" /> + <Add directory="./../../Common/" /> + <Add directory="./../../Shader/" /> + <Add directory="./../../Main/" /> + </Compiler> + <Linker> + <Add option="-Wl,--version-script=./exports.map" /> + <Add library="pthread" /> + <Add library="X11" /> + <Add library="Xext" /> + </Linker> + <Unit filename="../../Common/CPUID.cpp" /> + <Unit filename="../../Common/CPUID.hpp" /> + <Unit filename="../../Common/Configurator.cpp" /> + <Unit filename="../../Common/Configurator.hpp" /> + <Unit filename="../../Common/Debug.cpp" /> + <Unit filename="../../Common/Debug.hpp" /> + <Unit filename="../../Common/ExceptionHandling.hpp" /> + <Unit filename="../../Common/Half.cpp" /> + <Unit filename="../../Common/Half.hpp" /> + <Unit filename="../../Common/Math.cpp" /> + <Unit filename="../../Common/Math.hpp" /> + <Unit filename="../../Common/Memory.cpp" /> + <Unit filename="../../Common/Memory.hpp" /> + <Unit filename="../../Common/MetaMacro.hpp" /> + <Unit filename="../../Common/MutexLock.hpp" /> + <Unit filename="../../Common/Resource.cpp" /> + <Unit filename="../../Common/Resource.hpp" /> + <Unit filename="../../Common/Socket.cpp" /> + <Unit filename="../../Common/Socket.hpp" /> + <Unit filename="../../Common/Thread.cpp" /> + <Unit filename="../../Common/Thread.hpp" /> + <Unit filename="../../Common/Timer.cpp" /> + <Unit filename="../../Common/Timer.hpp" /> + <Unit filename="../../Common/Types.hpp" /> + <Unit filename="../../Common/Version.h" /> + <Unit filename="../../Main/Config.cpp" /> + <Unit filename="../../Main/Config.hpp" /> + <Unit filename="../../Main/FrameBuffer.cpp" /> + <Unit filename="../../Main/FrameBuffer.hpp" /> + <Unit filename="../../Main/FrameBufferX11.cpp" /> + <Unit filename="../../Main/FrameBufferX11.hpp" /> + <Unit filename="../../Main/Logo.cpp" /> + <Unit filename="../../Main/Register.cpp" /> + <Unit filename="../../Main/Register.hpp" /> + <Unit filename="../../Main/SwiftConfig.cpp" /> + <Unit filename="../../Main/SwiftConfig.hpp" /> + <Unit filename="../../Main/crc.cpp" /> + <Unit filename="../../Main/crc.h" /> + <Unit filename="../../Main/serialcommon.h" /> + <Unit filename="../../Main/serialvalid.cpp" /> + <Unit filename="../../Main/serialvalid.h" /> + <Unit filename="../../Reactor/Nucleus.cpp" /> + <Unit filename="../../Reactor/Nucleus.hpp" /> + <Unit filename="../../Reactor/Reactor.hpp" /> + <Unit filename="../../Reactor/Routine.cpp" /> + <Unit filename="../../Reactor/Routine.hpp" /> + <Unit filename="../../Reactor/RoutineManager.cpp" /> + <Unit filename="../../Reactor/RoutineManager.hpp" /> + <Unit filename="../../Reactor/x86.hpp" /> + <Unit filename="../../Renderer/Blitter.cpp" /> + <Unit filename="../../Renderer/Blitter.hpp" /> + <Unit filename="../../Renderer/Clipper.cpp" /> + <Unit filename="../../Renderer/Clipper.hpp" /> + <Unit filename="../../Renderer/Color.cpp" /> + <Unit filename="../../Renderer/Color.hpp" /> + <Unit filename="../../Renderer/Context.cpp" /> + <Unit filename="../../Renderer/Context.hpp" /> + <Unit filename="../../Renderer/LRUCache.hpp" /> + <Unit filename="../../Renderer/Matrix.cpp" /> + <Unit filename="../../Renderer/Matrix.hpp" /> + <Unit filename="../../Renderer/PixelProcessor.cpp" /> + <Unit filename="../../Renderer/PixelProcessor.hpp" /> + <Unit filename="../../Renderer/Plane.cpp" /> + <Unit filename="../../Renderer/Plane.hpp" /> + <Unit filename="../../Renderer/Point.cpp" /> + <Unit filename="../../Renderer/Point.hpp" /> + <Unit filename="../../Renderer/Polygon.hpp" /> + <Unit filename="../../Renderer/Primitive.hpp" /> + <Unit filename="../../Renderer/QuadRasterizer.cpp" /> + <Unit filename="../../Renderer/QuadRasterizer.hpp" /> + <Unit filename="../../Renderer/Rasterizer.cpp" /> + <Unit filename="../../Renderer/Rasterizer.hpp" /> + <Unit filename="../../Renderer/Renderer.cpp" /> + <Unit filename="../../Renderer/Renderer.hpp" /> + <Unit filename="../../Renderer/Sampler.cpp" /> + <Unit filename="../../Renderer/Sampler.hpp" /> + <Unit filename="../../Renderer/SetupProcessor.cpp" /> + <Unit filename="../../Renderer/SetupProcessor.hpp" /> + <Unit filename="../../Renderer/Stream.hpp" /> + <Unit filename="../../Renderer/Surface.cpp" /> + <Unit filename="../../Renderer/Surface.hpp" /> + <Unit filename="../../Renderer/TextureStage.cpp" /> + <Unit filename="../../Renderer/TextureStage.hpp" /> + <Unit filename="../../Renderer/Triangle.hpp" /> + <Unit filename="../../Renderer/Vector.cpp" /> + <Unit filename="../../Renderer/Vector.hpp" /> + <Unit filename="../../Renderer/Vertex.hpp" /> + <Unit filename="../../Renderer/VertexProcessor.cpp" /> + <Unit filename="../../Renderer/VertexProcessor.hpp" /> + <Unit filename="../../Shader/Constants.cpp" /> + <Unit filename="../../Shader/Constants.hpp" /> + <Unit filename="../../Shader/PixelRoutine.cpp" /> + <Unit filename="../../Shader/PixelRoutine.hpp" /> + <Unit filename="../../Shader/PixelShader.cpp" /> + <Unit filename="../../Shader/PixelShader.hpp" /> + <Unit filename="../../Shader/SamplerCore.cpp" /> + <Unit filename="../../Shader/SamplerCore.hpp" /> + <Unit filename="../../Shader/SetupRoutine.cpp" /> + <Unit filename="../../Shader/SetupRoutine.hpp" /> + <Unit filename="../../Shader/Shader.cpp" /> + <Unit filename="../../Shader/Shader.hpp" /> + <Unit filename="../../Shader/ShaderCore.cpp" /> + <Unit filename="../../Shader/ShaderCore.hpp" /> + <Unit filename="../../Shader/VertexPipeline.cpp" /> + <Unit filename="../../Shader/VertexPipeline.hpp" /> + <Unit filename="../../Shader/VertexProgram.cpp" /> + <Unit filename="../../Shader/VertexProgram.hpp" /> + <Unit filename="../../Shader/VertexRoutine.cpp" /> + <Unit filename="../../Shader/VertexRoutine.hpp" /> + <Unit filename="../../Shader/VertexShader.cpp" /> + <Unit filename="../../Shader/VertexShader.hpp" /> + <Unit filename="../common/debug.cpp" /> + <Unit filename="../common/debug.h" /> + <Unit filename="../compiler/AnalyzeCallDepth.cpp" /> + <Unit filename="../compiler/AnalyzeCallDepth.h" /> + <Unit filename="../compiler/BaseTypes.h" /> + <Unit filename="../compiler/Common.h" /> + <Unit filename="../compiler/Compiler.cpp" /> + <Unit filename="../compiler/ConstantUnion.h" /> + <Unit filename="../compiler/Diagnostics.cpp" /> + <Unit filename="../compiler/Diagnostics.h" /> + <Unit filename="../compiler/DirectiveHandler.cpp" /> + <Unit filename="../compiler/DirectiveHandler.h" /> + <Unit filename="../compiler/ExtensionBehavior.h" /> + <Unit filename="../compiler/InfoSink.cpp" /> + <Unit filename="../compiler/InfoSink.h" /> + <Unit filename="../compiler/Initialize.cpp" /> + <Unit filename="../compiler/Initialize.h" /> + <Unit filename="../compiler/InitializeDll.cpp" /> + <Unit filename="../compiler/InitializeDll.h" /> + <Unit filename="../compiler/InitializeGlobals.h" /> + <Unit filename="../compiler/InitializeParseContext.cpp" /> + <Unit filename="../compiler/InitializeParseContext.h" /> + <Unit filename="../compiler/IntermTraverse.cpp" /> + <Unit filename="../compiler/Intermediate.cpp" /> + <Unit filename="../compiler/MMap.h" /> + <Unit filename="../compiler/OutputASM.cpp" /> + <Unit filename="../compiler/OutputASM.h" /> + <Unit filename="../compiler/ParseHelper.cpp" /> + <Unit filename="../compiler/ParseHelper.h" /> + <Unit filename="../compiler/PoolAlloc.cpp" /> + <Unit filename="../compiler/PoolAlloc.h" /> + <Unit filename="../compiler/Pragma.h" /> + <Unit filename="../compiler/ShHandle.h" /> + <Unit filename="../compiler/ShaderLang.cpp" /> + <Unit filename="../compiler/SymbolTable.cpp" /> + <Unit filename="../compiler/SymbolTable.h" /> + <Unit filename="../compiler/TranslatorASM.cpp" /> + <Unit filename="../compiler/TranslatorASM.h" /> + <Unit filename="../compiler/Types.h" /> + <Unit filename="../compiler/ValidateLimitations.cpp" /> + <Unit filename="../compiler/ValidateLimitations.h" /> + <Unit filename="../compiler/debug.cpp" /> + <Unit filename="../compiler/debug.h" /> + <Unit filename="../compiler/glslang.h" /> + <Unit filename="../compiler/glslang_lex.cpp" /> + <Unit filename="../compiler/glslang_tab.cpp" /> + <Unit filename="../compiler/glslang_tab.h" /> + <Unit filename="../compiler/intermOut.cpp" /> + <Unit filename="../compiler/intermediate.h" /> + <Unit filename="../compiler/localintermediate.h" /> + <Unit filename="../compiler/osinclude.h" /> + <Unit filename="../compiler/ossource_posix.cpp" /> + <Unit filename="../compiler/parseConst.cpp" /> + <Unit filename="../compiler/preprocessor/Diagnostics.cpp" /> + <Unit filename="../compiler/preprocessor/Diagnostics.h" /> + <Unit filename="../compiler/preprocessor/DirectiveHandler.cpp" /> + <Unit filename="../compiler/preprocessor/DirectiveHandler.h" /> + <Unit filename="../compiler/preprocessor/DirectiveParser.cpp" /> + <Unit filename="../compiler/preprocessor/DirectiveParser.h" /> + <Unit filename="../compiler/preprocessor/ExpressionParser.cpp" /> + <Unit filename="../compiler/preprocessor/ExpressionParser.h" /> + <Unit filename="../compiler/preprocessor/Input.cpp" /> + <Unit filename="../compiler/preprocessor/Input.h" /> + <Unit filename="../compiler/preprocessor/Lexer.cpp" /> + <Unit filename="../compiler/preprocessor/Lexer.h" /> + <Unit filename="../compiler/preprocessor/Macro.cpp" /> + <Unit filename="../compiler/preprocessor/Macro.h" /> + <Unit filename="../compiler/preprocessor/MacroExpander.cpp" /> + <Unit filename="../compiler/preprocessor/MacroExpander.h" /> + <Unit filename="../compiler/preprocessor/Preprocessor.cpp" /> + <Unit filename="../compiler/preprocessor/Preprocessor.h" /> + <Unit filename="../compiler/preprocessor/SourceLocation.h" /> + <Unit filename="../compiler/preprocessor/Token.cpp" /> + <Unit filename="../compiler/preprocessor/Token.h" /> + <Unit filename="../compiler/preprocessor/Tokenizer.cpp" /> + <Unit filename="../compiler/preprocessor/Tokenizer.h" /> + <Unit filename="../compiler/preprocessor/length_limits.h" /> + <Unit filename="../compiler/preprocessor/numeric_lex.h" /> + <Unit filename="../compiler/preprocessor/pp_utils.h" /> + <Unit filename="../compiler/util.cpp" /> + <Unit filename="../compiler/util.h" /> + <Unit filename="../include/EGL/egl.h" /> + <Unit filename="../include/EGL/eglext.h" /> + <Unit filename="../include/EGL/eglplatform.h" /> + <Unit filename="../include/GLES/egl.h" /> + <Unit filename="../include/GLES/gl.h" /> + <Unit filename="../include/GLES/glext.h" /> + <Unit filename="../include/GLES/glplatform.h" /> + <Unit filename="../include/GLES2/gl2.h" /> + <Unit filename="../include/GLES2/gl2ext.h" /> + <Unit filename="../include/GLES2/gl2platform.h" /> + <Unit filename="../include/GLSLANG/ShaderLang.h" /> + <Unit filename="../include/KHR/khrplatform.h" /> + <Unit filename="../include/RAD/rad.h" /> + <Unit filename="Config.cpp" /> + <Unit filename="Config.h" /> + <Unit filename="Context.cpp" /> + <Unit filename="Context.h" /> + <Unit filename="Context.hpp" /> + <Unit filename="Device.cpp" /> + <Unit filename="Device.hpp" /> + <Unit filename="Display.cpp" /> + <Unit filename="Display.h" /> + <Unit filename="Fence.cpp" /> + <Unit filename="Fence.h" /> + <Unit filename="Image.cpp" /> + <Unit filename="Image.hpp" /> + <Unit filename="ImageEGL.hpp" /> + <Unit filename="Program.cpp" /> + <Unit filename="Program.h" /> + <Unit filename="Shader.cpp" /> + <Unit filename="Shader.h" /> + <Unit filename="Surface.cpp" /> + <Unit filename="Surface.h" /> + <Unit filename="Texture.cpp" /> + <Unit filename="Texture.h" /> + <Unit filename="Texture2D.hpp" /> + <Unit filename="exports.map" /> + <Unit filename="libEGL.cpp" /> + <Unit filename="libRAD.cpp" /> + <Unit filename="main.cpp" /> + <Unit filename="main.h" /> + <Unit filename="mainEGL.h" /> + <Unit filename="mathutil.h" /> + <Unit filename="utilities.cpp" /> + <Unit filename="utilities.h" /> + <Extensions> + <code_completion /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file>
diff --git a/src/SwiftShader.workspace b/src/SwiftShader.workspace index bceebc3..cc2679f 100644 --- a/src/SwiftShader.workspace +++ b/src/SwiftShader.workspace
@@ -13,5 +13,11 @@ <Depends filename="OpenGL/libEGL/libEGL.cbp" /> <Depends filename="OpenGL/libGLESv2/libGLESv2.cbp" /> </Project> + <Project filename="Radiance/libRAD/libRAD.cbp"> + <Depends filename="LLVM/LLVM.cbp" /> + </Project> + <Project filename="../tests/HelloRAD/rad.cbp"> + <Depends filename="Radiance/libRAD/libRAD.cbp" /> + </Project> </Workspace> </CodeBlocks_workspace_file>
diff --git a/tests/HelloRAD/rad.cbp b/tests/HelloRAD/rad.cbp new file mode 100644 index 0000000..4b201ed --- /dev/null +++ b/tests/HelloRAD/rad.cbp
@@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="rad" /> + <Option pch_mode="2" /> + <Option compiler="clang" /> + <Build> + <Target title="Debug x86"> + <Option output="rad" prefix_auto="1" extension_auto="1" /> + <Option working_dir="../../lib/Debug_x86" /> + <Option object_output="obj/Debug_x86" /> + <Option type="1" /> + <Option compiler="clang" /> + <Compiler> + <Add option="-g" /> + <Add option="-m32" /> + </Compiler> + <Linker> + <Add option="-m32" /> + <Add directory="../../lib/Debug_x86" /> + </Linker> + </Target> + <Target title="Release x86"> + <Option output="rad" prefix_auto="1" extension_auto="1" /> + <Option working_dir="../../lib/Release_x86" /> + <Option object_output="obj/Release_x86" /> + <Option type="1" /> + <Option compiler="clang" /> + <Compiler> + <Add option="-O2" /> + <Add option="-m32" /> + <Add option="-DNDEBUG" /> + <Add option="-DANGLE_DISABLE_TRACE" /> + <Add directory="./src/GL" /> + </Compiler> + <ResourceCompiler> + <Add directory="./src/GL" /> + </ResourceCompiler> + <Linker> + <Add option="-s" /> + <Add option="-m32" /> + <Add directory="../../lib/Release_x86" /> + </Linker> + </Target> + <Target title="Debug x64"> + <Option output="rad" prefix_auto="1" extension_auto="1" /> + <Option working_dir="../../lib/Debug_x64" /> + <Option object_output="obj/Debug_x64" /> + <Option type="1" /> + <Option compiler="clang" /> + <Compiler> + <Add option="-g" /> + <Add option="-m64" /> + </Compiler> + <Linker> + <Add option="-m64" /> + <Add directory="../../lib/Debug_x64" /> + </Linker> + </Target> + <Target title="Release x64"> + <Option output="rad" prefix_auto="1" extension_auto="1" /> + <Option working_dir="../../lib/Release_x64" /> + <Option object_output="obj/Release_x64" /> + <Option type="1" /> + <Option compiler="clang" /> + <Compiler> + <Add option="-O2" /> + <Add option="-march=core2" /> + <Add option="-m64" /> + <Add option="-fPIC" /> + <Add option="-DNDEBUG" /> + <Add option="-DANGLE_DISABLE_TRACE" /> + <Add directory="./src/GL" /> + </Compiler> + <ResourceCompiler> + <Add directory="./src/GL" /> + </ResourceCompiler> + <Linker> + <Add option="-s" /> + <Add option="-m64" /> + <Add directory="../../lib/Release_x64" /> + </Linker> + </Target> + </Build> + <Compiler> + <Add option="-Wall" /> + <Add option="-fexceptions" /> + <Add directory="./src/include/" /> + </Compiler> + <Linker> + <Add library="X11" /> + <Add library="RAD" /> + </Linker> + <Unit filename="src/app/rad_LinuxX11.cpp" /> + <Unit filename="src/app/radexample.cpp" /> + <Unit filename="src/app/radfnptrinit.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="src/app/radfnptrinit.h" /> + <Unit filename="src/include/RAD/rad.h" /> + <Extensions> + <code_completion /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file>
diff --git a/tests/HelloRAD/src/app/rad_LinuxX11.cpp b/tests/HelloRAD/src/app/rad_LinuxX11.cpp new file mode 100644 index 0000000..b077549 --- /dev/null +++ b/tests/HelloRAD/src/app/rad_LinuxX11.cpp
@@ -0,0 +1,511 @@ +/******************************************************************************************************************************************* + + @File rad_LinuxX11.cpp + + @Title Radiance HelloAPI Tutorial + + @Version + + @Copyright Copyright (c) Imagination Technologies Limited. + + @Platform + + @Description Basic Tutorial that shows step-by-step how to initialize Radiance, use it for drawing a triangle and terminate it. + Entry Point: main + +*******************************************************************************************************************************************/ +/******************************************************************************************************************************************* + Include Files +*******************************************************************************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "X11/Xlib.h" +#include "X11/Xutil.h" + +#include <EGL/egl.h> +#include "RAD/rad.h" + +/******************************************************************************************************************************************* + Defines +*******************************************************************************************************************************************/ +// Name of the application +#define APPLICATION_NAME "HelloAPI" + +// Width and height of the window +#define WINDOW_WIDTH 500 +#define WINDOW_HEIGHT 500 + +// Index to bind the attributes to vertex shaders +#define VERTEX_ARRAY 0 + +/******************************************************************************************************************************************* + Helper Functions +*******************************************************************************************************************************************/ + +/*!***************************************************************************************************************************************** + @Function TestEGLError + @Input functionLastCalled Function which triggered the error + @Return True if no EGL error was detected + @Description Tests for an EGL error and prints it. +*******************************************************************************************************************************************/ +bool TestEGLError(const char* functionLastCalled) +{ + /* eglGetError returns the last error that occurred using EGL, not necessarily the status of the last called function. The user has to + check after every single EGL call or at least once every frame. Usually this would be for debugging only, but for this example + it is enabled always. + */ + EGLint lastError = eglGetError(); + if (lastError != EGL_SUCCESS) + { + printf("%s failed (%x).\n", functionLastCalled, lastError); + return false; + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function HandleX11Errors + @Input nativeDisplay Handle to the display + @Input error The error event to handle + @Return Result code to send to the X window system + @Description Processes event messages for the main window +*******************************************************************************************************************************************/ +int HandleX11Errors(Display *nativeDisplay, XErrorEvent *error) +{ + // Get the X Error + char errorStringBuffer[256]; + XGetErrorText(nativeDisplay, error->error_code, errorStringBuffer, 256); + + // Print the error + printf("%s", errorStringBuffer); + + // Exit the application + exit(-1); + + return 0; +} + +/******************************************************************************************************************************************* + Application Functions +*******************************************************************************************************************************************/ + +/*!***************************************************************************************************************************************** + @Function CreateNativeDisplay + @Output nativeDisplay Native display to create + @Return Whether the function succeeded or not. + @Description Creates a native isplay for the application to render into. +*******************************************************************************************************************************************/ +bool CreateNativeDisplay(Display** nativeDisplay) +{ + // Check for a valid display + if (!nativeDisplay) + { + return false; + } + + // Open the display + *nativeDisplay = XOpenDisplay( 0 ); + if (!*nativeDisplay) + { + printf("Error: Unable to open X display\n"); + return false; + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function CreateNativeWindow + @Input nativeDisplay Native display used by the application + @Output nativeWindow Native window type to create + @Return Whether the function succeeded or not. + @Description Creates a native window for the application to render into. +*******************************************************************************************************************************************/ +bool CreateNativeWindow(Display* nativeDisplay, Window* nativeWindow) +{ + // Get the default screen for the display + int defaultScreen = XDefaultScreen(nativeDisplay); + + // Get the default depth of the display + int defaultDepth = DefaultDepth(nativeDisplay, defaultScreen); + + // Select a visual info + XVisualInfo* visualInfo = new XVisualInfo; + XMatchVisualInfo( nativeDisplay, defaultScreen, defaultDepth, TrueColor, visualInfo); + if (!visualInfo) + { + printf("Error: Unable to acquire visual\n"); + return false; + } + + // Get the root window for the display and default screen + Window rootWindow = RootWindow(nativeDisplay, defaultScreen); + + // Create a colour map from the display, root window and visual info + Colormap colourMap = XCreateColormap(nativeDisplay, rootWindow, visualInfo->visual, AllocNone); + + // Now setup the final window by specifying some attributes + XSetWindowAttributes windowAttributes; + + // Set the colour map that was just created + windowAttributes.colormap = colourMap; + + // Set events that will be handled by the app, add to these for other events. + windowAttributes.event_mask = StructureNotifyMask | ExposureMask | ButtonPressMask; + + // Create the window + *nativeWindow =XCreateWindow(nativeDisplay, // The display used to create the window + rootWindow, // The parent (root) window - the desktop + 0, // The horizontal (x) origin of the window + 0, // The vertical (y) origin of the window + WINDOW_WIDTH, // The width of the window + WINDOW_HEIGHT, // The height of the window + 0, // Border size - set it to zero + visualInfo->depth, // Depth from the visual info + InputOutput, // Window type - this specifies InputOutput. + visualInfo->visual, // Visual to use + CWEventMask | CWColormap, // Mask specifying these have been defined in the window attributes + &windowAttributes); // Pointer to the window attribute structure + + // Make the window viewable by mapping it to the display + XMapWindow(nativeDisplay, *nativeWindow); + + // Set the window title + XStoreName(nativeDisplay, *nativeWindow, APPLICATION_NAME); + + // Setup the window manager protocols to handle window deletion events + Atom windowManagerDelete = XInternAtom(nativeDisplay, "WM_DELETE_WINDOW", True); + XSetWMProtocols(nativeDisplay, *nativeWindow, &windowManagerDelete , 1); + + // Delete the visual info + delete visualInfo; + + return true; +} + +/*!***************************************************************************************************************************************** + @Function CreateEGLDisplay + @Input nativeDisplay The native display used by the application + @Output eglDisplay EGLDisplay created from nativeDisplay + @Return Whether the function succeeded or not. + @Description Creates an EGLDisplay from a native native display, and initialises it. +*******************************************************************************************************************************************/ +bool CreateEGLDisplay( Display* nativeDisplay, EGLDisplay &eglDisplay ) +{ + /* Get an EGL display. + EGL uses the concept of a "display" which in most environments corresponds to a single physical screen. After creating a native + display for a given windowing system, EGL can use this handle to get a corresponding EGLDisplay handle to it for use in rendering. + Should this fail, EGL is usually able to provide access to a default display. + */ + eglDisplay = eglGetDisplay((EGLNativeDisplayType)nativeDisplay); + // If a display couldn't be obtained, return an error. + if (eglDisplay == EGL_NO_DISPLAY) + { + printf("Failed to get an EGLDisplay"); + return false; + } + + /* Initialize EGL. + EGL has to be initialized with the display obtained in the previous step. All EGL functions other than eglGetDisplay + and eglGetError need an initialised EGLDisplay. + If an application is not interested in the EGL version number it can just pass NULL for the second and third parameters, but they + are queried here for illustration purposes. + */ + EGLint eglMajorVersion, eglMinorVersion; + if (!eglInitialize(eglDisplay, &eglMajorVersion, &eglMinorVersion)) + { + printf("Failed to initialise the EGLDisplay"); + return false; + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function ChooseEGLConfig + @Input eglDisplay The EGLDisplay used by the application + @Output eglConfig The EGLConfig chosen by the function + @Return Whether the function succeeded or not. + @Description Chooses an appropriate EGLConfig and return it. +*******************************************************************************************************************************************/ +bool ChooseEGLConfig( EGLDisplay eglDisplay, EGLConfig& eglConfig ) +{ + /* Specify the required configuration attributes. + An EGL "configuration" describes the capabilities an application requires and the type of surfaces that can be used for drawing. + Each implementation exposes a number of different configurations, and an application needs to describe to EGL what capabilities it + requires so that an appropriate one can be chosen. The first step in doing this is to create an attribute list, which is an array + of key/value pairs which describe particular capabilities requested. In this application nothing special is required so we can query + the minimum of needing it to render to a window, and being OpenGL ES 2.0 capable. + */ + const EGLint configurationAttributes[] = + { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE + }; + + /* Find a suitable EGLConfig + eglChooseConfig is provided by EGL to provide an easy way to select an appropriate configuration. It takes in the capabilities + specified in the attribute list, and returns a list of available configurations that match or exceed the capabilities requested. + Details of all the possible attributes and how they are selected for by this function are available in the EGL reference pages here: + http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglChooseConfig.html + It is also possible to simply get the entire list of configurations and use a custom algorithm to choose a suitable one, as many + advanced applications choose to do. For this application however, taking the first EGLConfig that the function returns suits + its needs perfectly, so we limit it to returning a single EGLConfig. + */ + EGLint configsReturned; + if (!eglChooseConfig(eglDisplay, configurationAttributes, &eglConfig, 1, &configsReturned) || (configsReturned != 1)) + { + printf("Failed to choose a suitable config."); + return false; + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function CreateEGLSurface + @Input nativeWindow A native window that's been created + @Input eglDisplay The EGLDisplay used by the application + @Input eglConfig An EGLConfig chosen by the application + @Output eglSurface The EGLSurface created from the native window. + @Return Whether the function succeeds or not. + @Description Creates an EGLSurface from a native window +*******************************************************************************************************************************************/ +bool CreateEGLSurface( Window nativeWindow, EGLDisplay eglDisplay, EGLConfig eglConfig, EGLSurface& eglSurface) +{ + /* Create an EGLSurface for rendering. + Using a native window created earlier and a suitable eglConfig, a surface is created that can be used to render OpenGL ES calls to. + There are three main surface types in EGL, which can all be used in the same way once created but work slightly differently: + - Window Surfaces - These are created from a native window and are drawn to the screen. + - Pixmap Surfaces - These are created from a native windowing system as well, but are offscreen and are not displayed to the user. + - PBuffer Surfaces - These are created directly within EGL, and like Pixmap Surfaces are offscreen and thus not displayed. + The offscreen surfaces are useful for non-rendering contexts and in certain other scenarios, but for most applications the main + surface used will be a window surface as performed below. + */ + eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType)nativeWindow, NULL); + if (!TestEGLError("eglCreateWindowSurface")) + { + return false; + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function SetupEGLContext + @Input eglDisplay The EGLDisplay used by the application + @Input eglConfig An EGLConfig chosen by the application + @Input eglSurface The EGLSurface created from the native window. + @Output eglContext The EGLContext created by this function + @Input nativeWindow A native window, used to display error messages + @Return Whether the function succeeds or not. + @Description Sets up the EGLContext, creating it and then installing it to the current thread. +*******************************************************************************************************************************************/ +bool SetupEGLContext( EGLDisplay eglDisplay, EGLConfig eglConfig, EGLSurface eglSurface, EGLContext& eglContext ) +{ + /* Create a context. + EGL has to create what is known as a context for OpenGL ES. The concept of a context is OpenGL ES's way of encapsulating any + resources and state. What appear to be "global" functions in OpenGL actually only operate on the current context. A context + is required for any operations in OpenGL ES. + Similar to an EGLConfig, a context takes in a list of attributes specifying some of its capabilities. However in most cases this + is limited to just requiring the version of the OpenGL ES context required - In this case, OpenGL ES 2.0. + */ + EGLint contextAttributes[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + // Create the context with the context attributes supplied + eglContext = eglCreateContext(eglDisplay, eglConfig, NULL, contextAttributes); + if (!TestEGLError("eglCreateContext")) + { + return false; + } + + /* Make OpenGL ES the current API. + After creating the context, EGL needs a way to know that any subsequent EGL calls are going to be affecting OpenGL ES, + rather than any other API (such as OpenVG). + */ + eglBindAPI(EGL_OPENGL_ES_API); + if (!TestEGLError("eglBindAPI")) + { + return false; + } + + /* Bind the context to the current thread. + Due to the way OpenGL uses global functions, contexts need to be made current so that any function call can operate on the correct + context. Specifically, make current will bind the context to the thread it's called from, and unbind it from any others. To use + multiple contexts at the same time, users should use multiple threads and synchronise between them. + */ + eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); + if (!TestEGLError("eglMakeCurrent")) + { + return false; + } + + + + return true; +} + +/*!***************************************************************************************************************************************** + @Function RenderScene + @Input nativeDisplay The native display used by the application + @Return Whether the function succeeds or not. + @Description Renders the scene to the framebuffer. Usually called within a loop. +*******************************************************************************************************************************************/ +bool RenderScene( Display* nativeDisplay ) +{ + void TestRAD(); + TestRAD(); + + // Check for messages from the windowing system. + int numberOfMessages = XPending(nativeDisplay); + for( int i = 0; i < numberOfMessages; i++ ) + { + XEvent event; + XNextEvent(nativeDisplay, &event); + + switch( event.type ) + { + // Exit on window close + case ClientMessage: + // Exit on mouse click + case ButtonPress: + case DestroyNotify: + return false; + default: + break; + } + } + + return true; +} + +/*!***************************************************************************************************************************************** + @Function ReleaseEGLState + @Input eglDisplay The EGLDisplay used by the application + @Description Releases all resources allocated by EGL +*******************************************************************************************************************************************/ +void ReleaseEGLState(EGLDisplay eglDisplay) +{ + if(eglDisplay != NULL) + { + // To release the resources in the context, first the context has to be released from its binding with the current thread. + eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + + // Terminate the display, and any resources associated with it (including the EGLContext) + eglTerminate(eglDisplay); + } +} + +/*!***************************************************************************************************************************************** + @Function ReleaseWindowAndDisplay + @Input nativeDisplay The native display to release + @Input nativeWindow The native window to destroy + @Description Releases all resources allocated by the windowing system +*******************************************************************************************************************************************/ +void ReleaseNativeResources(Display* nativeDisplay, Window nativeWindow) +{ + // Destroy the window + if (nativeWindow) + { + XDestroyWindow(nativeDisplay, nativeWindow); + } + + // Release the display. + if (nativeDisplay) + { + XCloseDisplay(nativeDisplay); + } +} + +/*!***************************************************************************************************************************************** + @Function main + @Input argc Number of arguments passed to the application, ignored. + @Input argv Command line strings passed to the application, ignored. + @Return Result code to send to the Operating System + @Description Main function of the program, executes other functions. +*******************************************************************************************************************************************/ +int main(int /*argc*/, char **/*argv*/) +{ + // X11 variables + Display* nativeDisplay = NULL; + Window nativeWindow = 0; + + // EGL variables + EGLDisplay eglDisplay = NULL; + EGLConfig eglConfig = NULL; + EGLSurface eglSurface = NULL; + EGLContext eglContext = NULL; + + // Get access to a native display + if (!CreateNativeDisplay(&nativeDisplay)) + { + goto cleanup; + } + + // Setup the windowing system, create a window + if (!CreateNativeWindow(nativeDisplay, &nativeWindow)) + { + goto cleanup; + } + + // Create and Initialise an EGLDisplay from the native display + if (!CreateEGLDisplay(nativeDisplay, eglDisplay)) + { + goto cleanup; + } + + // Choose an EGLConfig for the application, used when setting up the rendering surface and EGLContext + if (!ChooseEGLConfig(eglDisplay, eglConfig)) + { + goto cleanup; + } + + // Create an EGLSurface for rendering from the native window + if (!CreateEGLSurface(nativeWindow, eglDisplay, eglConfig, eglSurface)) + { + goto cleanup; + } + + // Setup the EGL Context from the other EGL constructs created so far, so that the application is ready to submit OpenGL ES commands + if (!SetupEGLContext(eglDisplay, eglConfig, eglSurface, eglContext)) + { + goto cleanup; + } + + // Initialise the fragment and vertex shaders used in the application + void InitRAD(); + InitRAD(); + + // Renders a triangle for 800 frames using the state setup in the previous function + for (int i = 0; i < 800; ++i) + { + if (!RenderScene(nativeDisplay)) + { + break; + } + } + +cleanup: + void CleanRAD(); + CleanRAD(); + + // Release the EGL State + ReleaseEGLState(eglDisplay); + + // Release the windowing system resources + ReleaseNativeResources(nativeDisplay, nativeWindow); + + // Destroy the eglWindow + return 0; +} + +/******************************************************************************************************************************************* + End of file (rad_LinuxX11.cpp) +*******************************************************************************************************************************************/