Host OpenVG building using GCC, without LLVM integration.
Change hostbuild extension to avoid use of "lib" prefix on libraries, to allow other names to be used.
--- a/hostsupport/hostbuild/flm/hostbuild.flm Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostbuild/flm/hostbuild.flm Mon Nov 01 18:10:32 2010 +0000
@@ -91,13 +91,13 @@
# Target names differ depending on what we're building
ifeq ($(TARGET_TYPE),lib)
- TARGET_FULLNAME:=$(TARGET_DIR)lib$(TARGET_NAME)$(if $(findstring .,$(TARGET_NAME)),,.a)
+ TARGET_FULLNAME:=$(TARGET_DIR)$(TARGET_NAME)$(if $(findstring .,$(TARGET_NAME)),,.a)
endif
ifeq ($(TARGET_TYPE),exe)
TARGET_FULLNAME:=$(TARGET_DIR)$(TARGET_NAME)$(if $(findstring .,$(TARGET_NAME)),,$(DOTEXE))
endif
ifeq ($(TARGET_TYPE),dll)
- TARGET_FULLNAME:=$(TARGET_DIR)lib$(TARGET_NAME)$(if $(findstring .,$(TARGET_NAME)),,$(DOTDLL))
+ TARGET_FULLNAME:=$(TARGET_DIR)$(TARGET_NAME)$(if $(findstring .,$(TARGET_NAME)),,$(DOTDLL))
endif
# Object files are the same name as the source files with a .o extension
@@ -123,7 +123,7 @@
$(call endrule,compile)
# Link
- $(TARGET_FULLNAME) : $(OBJECTFILES) $(foreach lib,$(LIBS),$(TARGET_DIR)lib$(lib).a) $(foreach lib,$(SHARED_LIBS),$(TARGET_DIR)lib$(lib)$(DOTDLL))
+ $(TARGET_FULLNAME) : $(OBJECTFILES) $(foreach lib,$(LIBS),$(TARGET_DIR)$(lib).a) $(foreach lib,$(SHARED_LIBS),$(TARGET_DIR)$(lib)$(DOTDLL))
ifeq ($(TARGET_TYPE),lib)
$(call startrule,linklib) \
$(AR) -r $$@ $(OBJECTFILES) \
@@ -131,12 +131,12 @@
endif
ifeq ($(TARGET_TYPE),exe)
$(call startrule,linkexe) \
- $(CXX) -L$(TARGET_DIR) $(if $(GCOVDIR),-L$(GCOVDIR)) -o$$@ $(OBJECTFILES) $(foreach lib,$(LIBS) $(SHARED_LIBS),-l$(lib)) $(if $(CODE_COVERAGE),-lgcov) $(if $(WIN32),-Wl$(CHAR_COMMA)--enable-auto-import,-ldl) \
+ $(CXX) -L$(TARGET_DIR) $(if $(GCOVDIR),-L$(GCOVDIR)) -o$$@ $(OBJECTFILES) $(foreach lib,$(LIBS),$(TARGET_DIR)$(lib).a) $(foreach slib,$(SHARED_LIBS),$(TARGET_DIR)$(slib)$(DOTDLL)) $(if $(CODE_COVERAGE),-lgcov) $(if $(WIN32),-Wl$(CHAR_COMMA)--enable-auto-import,-ldl) \
$(call endrule,linkexe)
endif
ifeq ($(TARGET_TYPE),dll)
$(call startrule,linkdll) \
- $(CXX) -L$(TARGET_DIR) $(if $(GCOVDIR),-L$(GCOVDIR)) -shared -o$$@ $(OBJECTFILES) $(foreach lib,$(LIBS) $(SHARED_LIBS), -l$(lib)) $(if $(WIN32),$(DLL_WIN_LINKER_OPTS),$(DLL_LIN_LINKER_OPTS)) \
+ $(CXX) -L$(TARGET_DIR) $(if $(GCOVDIR),-L$(GCOVDIR)) -shared -o$$@ $(OBJECTFILES) $(foreach lib,$(LIBS),$(TARGET_DIR)$(lib).a) $(foreach slib,$(SHARED_LIBS),$(TARGET_DIR)$(slib)$(DOTDLL)) $(if $(WIN32),$(DLL_WIN_LINKER_OPTS),$(DLL_LIN_LINKER_OPTS)) \
$(call endrule,linkdll)
endif
endef
--- a/hostsupport/hostegl/group/bld.inf Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostegl/group/bld.inf Mon Nov 01 18:10:32 2010 +0000
@@ -43,7 +43,7 @@
// Dynamic library.
start extension graphics_simulator/hostbuild
-option TARGET_NAME EGL
+option TARGET_NAME libEGL
option TARGET_TYPE dll
option SOURCE_DIRS ../src ../src/win32
option INCLUDES ../inc ../../../inc
--- a/hostsupport/hostopengles11/group/bld.inf Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopengles11/group/bld.inf Mon Nov 01 18:10:32 2010 +0000
@@ -25,7 +25,7 @@
* Contributors:
*
* Description:
- * Build information for host EGL
+ * Build information for host OpenGL ES 1.1
*/
PRJ_PLATFORMS
@@ -45,7 +45,7 @@
// Dynamic library.
start extension graphics_simulator/hostbuild
-option TARGET_NAME GLESv1
+option TARGET_NAME libGLESv1
option TARGET_TYPE dll
option SOURCE_DIRS ../src
option INCLUDES ../inc ../../../inc
--- a/hostsupport/hostopengles11/inc/EGLInterface.h Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopengles11/inc/EGLInterface.h Mon Nov 01 18:10:32 2010 +0000
@@ -48,6 +48,7 @@
{
public:
EGLtoGLESInterface();
+ virtual ~EGLtoGLESInterface() {}
void SetEGLInterface(IGLEStoEGLInterface* egl);
void* CreateContext(void* nativeContext);
--- a/hostsupport/hostopengles20/group/bld.inf Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopengles20/group/bld.inf Mon Nov 01 18:10:32 2010 +0000
@@ -0,0 +1,52 @@
+/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE 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 OR COPYRIGHT HOLDERS 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 MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * Build information for host OpenGL ES 2.0
+ */
+
+PRJ_PLATFORMS
+TOOLS2
+
+PRJ_EXPORTS
+
+../inc/GLES2/gl2.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES2/gl2.h)
+../inc/GLES2/gl2ext.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES2/gl2ext.h)
+../inc/GLES2/gl2platform.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES2/gl2platform.h)
+
+PRJ_EXTENSIONS
+
+// Dynamic library.
+start extension graphics_simulator/hostbuild
+option TARGET_NAME libGLESv2
+option TARGET_TYPE dll
+option SOURCE_DIRS ../src
+option INCLUDES ../inc ../../../inc
+option SYS_INCLUDES OS_LAYER_PUBLIC_EXPORT_PATH(tools)
+option MACROS KHRONOS_APICALL_EXPORT CONFIG_OFFSCREEN BUILD_GLES2
+option COMPILE_OPTIONS -msse2 -mfpmath=sse -march=pentium4
+option NO_STD_INCLUDE ON
+end
--- a/hostsupport/hostopenvg/group/bld.inf Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/group/bld.inf Mon Nov 01 18:10:32 2010 +0000
@@ -0,0 +1,54 @@
+/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE 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 OR COPYRIGHT HOLDERS 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 MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ * Build information for host OpenVG
+ */
+
+PRJ_PLATFORMS
+TOOLS2
+
+PRJ_EXPORTS
+
+../inc/VG/openvg.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/VG/openvg.h)
+../inc/VG/vgext.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/VG/vgext.h)
+../inc/VG/vgplatform.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/VG/vgplatform.h)
+../inc/VG/vgu.h OS_LAYER_PUBLIC_EXPORT_PATH(tools/VG/vgu.h)
+
+PRJ_EXTENSIONS
+
+// Dynamic library.
+start extension graphics_simulator/hostbuild
+option TARGET_NAME libOpenVG
+option TARGET_TYPE dll
+option SOURCE_FOLDER ../src
+option SOURCE riApi.cpp riContext.cpp riFont.cpp riImage.cpp riMath.cpp riPath.cpp riPixelPipe.cpp riRasterizer.cpp riUtils.cpp riVGU.cpp sfBlitter.cpp sfDynamicBlitter.cpp sfDynamicPixelPipe.cpp sfEGLInterface.cpp
+option INCLUDES ../inc ../../../inc
+option SYS_INCLUDES OS_LAYER_PUBLIC_EXPORT_PATH(tools)
+option MACROS OPENVG_DLL_EXPORTS NOMINMAX USE_FULL_EGL
+option COMPILE_OPTIONS -msse2 -mfpmath=sse -march=pentium4
+option NO_STD_INCLUDE ON
+end
--- a/hostsupport/hostopenvg/src/riApi.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riApi.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -2002,7 +2002,7 @@
//Drawable drawable(Color::formatToDescriptor(VG_A_8), curr->getWidth(), curr->getHeight(), curr->getNumSamples(), 1); //TODO 0 mask bits (mask buffer is not used)
- Rasterizer& rasterizer = context->m_rasterizer;
+ OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
rasterizer.clear();
rasterizer.setScissoring(context->m_scissoring ? true : false);
@@ -2447,7 +2447,7 @@
if(!drawable)
return false; //no EGL surface is current at the moment
- Rasterizer& rasterizer = context->m_rasterizer;
+ OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
rasterizer.clear();
if(context->m_scissoring)
@@ -3098,7 +3098,7 @@
p2 *= 1.0f/p2.z;
p3 *= 1.0f/p3.z;
- Rasterizer& rasterizer = context->m_rasterizer;
+ OpenVGRI::Rasterizer& rasterizer = context->m_rasterizer;
rasterizer.clear();
rasterizer.setScissoring(context->m_scissoring ? true : false);
@@ -3812,14 +3812,14 @@
eglvgGetImageDescriptor( image, desc, width, height, stride );
// There is some error.
// EGLImage is null or EGLImage target is EGL_VG_PARENT_IMAGE_KHR.
- RI_IF_ERROR(!width || !height || !stride, VG_ILLEGAL_ARGUMENT_ERROR, NULL);
+ RI_IF_ERROR(!width || !height || !stride, VG_ILLEGAL_ARGUMENT_ERROR, VG_INVALID_HANDLE);
// Data is created in EGLImage class.
data = (OpenVGRI::RIuint8*)eglvgGetImageData( image );
// Create VGImage
// allowedQuality = VG_IMAGE_QUALITY_NONANTIALIASED | VG_IMAGE_QUALITY_FASTER | VG_IMAGE_QUALITY_BETTER
ret = vgCreateImage( desc.vgFormat, width, height, VG_IMAGE_QUALITY_NONANTIALIASED );
// If VGImage is not created raise error and return null
- RI_IF_ERROR(!ret, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR, NULL);
+ RI_IF_ERROR(!ret, VG_UNSUPPORTED_IMAGE_FORMAT_ERROR, VG_INVALID_HANDLE);
// Set data for VGImage.
// This will copy that data-object.
vgImageSubData( ret,
--- a/hostsupport/hostopenvg/src/riDefs.h Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riDefs.h Mon Nov 01 18:10:32 2010 +0000
@@ -153,7 +153,7 @@
#endif
#if defined(RI_DEBUG)
-# if defined(_WIN32)
+# if defined(_WIN32) && !defined(__GNUG__)
# define RI_TRACE(...) do { \
char buf[512]; \
snprintf(buf, sizeof(buf), __VA_ARGS__); \
--- a/hostsupport/hostopenvg/src/riMath.h Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riMath.h Mon Nov 01 18:10:32 2010 +0000
@@ -246,7 +246,7 @@
return r;
}
-RI_INLINE RIfloat RI_FLOAT_TO_FX(RIfloat f, unsigned int n) { return (RIfloat)RI_ROUND_TO_INT(f * (RIfloat)RI_SHL(1, n)); }
+RI_INLINE int RI_FLOAT_TO_FX(RIfloat f, unsigned int n) { return RI_ROUND_TO_INT(f * (RIfloat)RI_SHL(1, n)); }
class Matrix3x3;
class Vector2;
--- a/hostsupport/hostopenvg/src/riPixelPipe.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riPixelPipe.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -40,9 +40,11 @@
#ifndef __SFDYNAMICPIXELPIPE_H
# include "sfDynamicPixelPipe.h"
#endif
+#if defined(RI_COMPILE_LLVM_BYTECODE)
#ifndef __SFCOMPILER_H
# include "sfCompiler.h"
#endif
+#endif
//==============================================================================================
@@ -1417,7 +1419,7 @@
void PixelPipe::fillSpans(PPVariants& variants, const Span* spans, int nSpans) const
{
-#if 1
+#if defined(RI_COMPILE_LLVM_BYTECODE)
PPCompiler& compiler = PPCompiler::getCompiler();
PPCompiler::PixelPipeHandle handle = compiler.compilePixelPipeline(m_derivedState);
--- a/hostsupport/hostopenvg/src/riRasterizer.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riRasterizer.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -33,10 +33,12 @@
#include "riRasterizer.h"
+#if defined(RI_COMPILE_LLVM_BYTECODE)
// TEMP!
#ifndef __SFCOMPILER_H
# include "sfCompiler.h"
#endif
+#endif
namespace OpenVGRI
@@ -450,7 +452,12 @@
#if defined(USE_SSE2)
RI_INLINE static __m128i mm_mul4x32(const __m128i a, const __m128i b) {
__m128i res;
-#if (_MSC_VER > 1400 )
+#if defined(__GNUG__)
+ __m128i m0 = _mm_mul_epu32(a, _mm_shuffle_epi32(b, _MM_SHUFFLE(1, 1, 0, 0)));
+ __m128i m1 = _mm_mul_epu32(a, _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 2, 2)));
+
+ res = _mm_cvtps_epi32(_mm_shuffle_ps(_mm_cvtepi32_ps(m0), _mm_cvtepi32_ps(m1), _MM_SHUFFLE(2, 0, 2, 0)));
+#elif (_MSC_VER > 1400)
// \todo Simpler way to do this on intel?
__m128i m0 = _mm_mul_epu32(a, _mm_shuffle_epi32(b, _MM_SHUFFLE(1, 1, 0, 0)));
__m128i m1 = _mm_mul_epu32(a, _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 2, 2)));
@@ -785,8 +792,6 @@
}
#endif
- int debugMagic = 0;
-
m_aet.clear();
#if defined(RI_DEBUG)
--- a/hostsupport/hostopenvg/src/riUtils.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/riUtils.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -131,7 +131,9 @@
}
else
{
+#if defined(RI_DEBUG)
int new_ib = (ib + bitSize) & 0x1f;
+#endif
RI_ASSERT((ib + bitSize == 32) ? new_ib == 0 : true);
hash[idw] |= (bits << ib);
}
--- a/hostsupport/hostopenvg/src/sfBlitter.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/sfBlitter.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -20,9 +20,13 @@
* THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
-#include "sfBlitter.h"
+#ifndef __SFDYNAMICBLITTER_H
+#include "sfDynamicBlitter.h"
+#endif
+#if defined(RI_COMPILE_LLVM_BYTECODE)
#include "sfCompiler.h"
+#endif
namespace OpenVGRI {
@@ -108,7 +112,7 @@
void DynamicBlitter::blit()
{
-#if 1
+#if defined(RI_COMPILE_LLVM_BYTECODE)
bool compiledBlitter = false;
{
PPCompiler& compiler = PPCompiler::getCompiler();
@@ -125,7 +129,7 @@
if (!compiledBlitter)
#endif
{
- executeBlitter(getSignatureState(), getUniforms());
+ OpenVGRI::executeBlitter(getSignatureState(), getUniforms());
}
}
--- a/hostsupport/hostopenvg/src/sfEGLInterface.cpp Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/sfEGLInterface.cpp Mon Nov 01 18:10:32 2010 +0000
@@ -182,8 +182,6 @@
int w = desc->m_width;
int h = desc->m_height;
- int stride = OpenVGRI::Image::descriptorToStride(vgColorDescriptor, w);
- size_t bufSize = h * stride;
OpenVGRI::RIuint8* dataPtr = NULL;
--- a/hostsupport/hostopenvg/src/sfEGLInterface.h Tue Oct 26 14:14:43 2010 +0100
+++ b/hostsupport/hostopenvg/src/sfEGLInterface.h Mon Nov 01 18:10:32 2010 +0000
@@ -48,7 +48,7 @@
{
public:
EGLtoVGInterface();
- ~EGLtoVGInterface();
+ virtual ~EGLtoVGInterface();
void SetEGLInterface( IVGtoEGLInterface* egl );
void* CreateContext( void* shareContext );