Add a new FLM for building the host side DLLs (based on the x86build FLM). bug235_bringup_0
authorMatt Plumtree <matt.plumtree@nokia.com>
Tue, 26 Oct 2010 14:14:43 +0100
branchbug235_bringup_0
changeset 68 8d4efe9fa1cf
parent 67 ca7e6949bf7a
child 69 3f914c77c2e9
Add a new FLM for building the host side DLLs (based on the x86build FLM). Fixup the OpenGL ES 1.1 code to remove warnings when built with GCC(some remain).
hostsupport/hostbuild/flm/hostbuild.flm
hostsupport/hostbuild/flm/hostbuild.xml
hostsupport/hostbuild/group/bld.inf
hostsupport/hostbuild/inc/hostbuild.h
hostsupport/hostegl/group/bld.inf
hostsupport/hostopengles11/group/bld.inf
hostsupport/hostopengles11/inc/glesInternal.h
hostsupport/hostopengles11/src/EGLInterface.cpp
hostsupport/hostopengles11/src/GLESContext.cpp
hostsupport/hostopengles11/src/GLESDesktopGL.cpp
hostsupport/hostopengles11/src/GLESTexture.cpp
hostsupport/hostopengles11/src/glesapi.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hostsupport/hostbuild/flm/hostbuild.flm	Tue Oct 26 14:14:43 2010 +0100
@@ -0,0 +1,154 @@
+# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# FLM to build x86 exes, libs and dlls
+#
+
+include $(FLMHOME)/flmtools.mk
+include $(FLMHOME)/metaflm.mk
+
+CREATABLEPATHS:=
+CLEANTARGETS:=
+
+# Handle Window/Linux differences
+ifeq ($(OSTYPE),cygwin)
+  DOTDLL:=.dll
+  WIN32:=1
+  GCOVDIR:=$(if $(CODE_COVERAGE),$(EPOCROOT)/epoc32/gcc_mingw/libgcc/mingw32/3.4.5/)
+else
+  DOTDLL:=.so
+endif
+
+# Product include files are different for S60
+ifdef S60_BUILD
+  PRODUCT_INCLUDE:=$(EPOCROOT)/epoc32/include/oem/bldvariant.hrh
+else
+  PRODUCT_INCLUDE:=$(EPOCROOT)/epoc32/include/variant/Symbian_OS.hrh
+endif
+
+# Define macros we need
+CXXDEFS:=$(foreach def,$(MACROS),-D$(def)) -D__GCC32__ -D__EPOC32__ -D__X86__ -D_UNICODE -D__SUPPORT_CPP_EXCEPTIONS__ -D__TOOLS2__ -D'__PRODUCT_INCLUDE__="$(PRODUCT_INCLUDE)"'
+ifeq ($(CFG_PATH),deb)
+  CXXDEFS+= -D_DEBUG
+endif
+
+# Setup the command line options for the compiler
+OPTIMISE:=-fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fif-conversion -fif-conversion2 -fguess-branch-probability -fcprop-registers -fforce-mem -foptimize-sibling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm -fgcse-sm -fgcse-las -fdelete-null-pointer-checks -fexpensive-optimizations -fregmove -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -freorder-blocks -freorder-functions -fstrict-aliasing -funit-at-a-time -falign-functions -falign-jumps -falign-loops -falign-labels -fcrossjumping
+
+PREINC=$(EPOCROOT)/epoc32/include/tools/hostbuild.h
+ifeq ($(CFG_PATH),deb)
+  CXXOPT:=-fshort-wchar -x c++ -O0 -g3 -Wall -c -fmessage-length=0 -include $(PREINC)
+else
+  CXXOPT:=-fshort-wchar -x c++ -Wall -c -fmessage-length=0 -include $(PREINC) $(if $(CODE_COVERAGE),-O0,$(OPTIMISE))
+endif
+
+# Allow specification of additional build include file
+ifdef BUILDINC
+  CXXOPT+= -include $(BUILDINC)
+endif
+
+# Extra options needed for cia files
+ASMOPT:=-fomit-frame-pointer -masm=intel
+
+# Linker options for DLL
+ifndef DLL_WIN_LINKER_OPTS
+  DLL_WIN_LINKER_OPTS:=$(if $(CODE_COVERAGE),-lgcov) -Wl,-export-all-symbols -Wl,--enable-auto-import
+endif
+ifndef DLL_LIN_LINKER_OPTS
+  DLL_LIN_LINKER_OPTS:=$(if $(CODE_COVERAGE),-lgcov) -Wl,-export-all-symbols -ldl
+endif
+
+# Source files to scan for in a directory
+# Note that CPP and cpp will match on the same files - so a sort is necessary on wildcard results
+SOURCE_EXT:=CPP cpp c cia
+
+# Source code assumed to be all cpp/cia files in supplied directories
+SOURCE_FILES:=$(foreach dir,$(SOURCE_DIRS),$(sort $(foreach ext,$(SOURCE_EXT),$(wildcard $(EXTENSION_ROOT)/$(dir)/*.$(ext))))) \
+  $(foreach src,$(SOURCE),$(EXTENSION_ROOT)/$(if $(SOURCE_FOLDER),$(SOURCE_FOLDER)/)$(src))
+
+# Include folders
+CXXINC:=$(foreach inc,$(INCLUDES) $(SOURCE_DIRS),-I$(EXTENSION_ROOT)/$(inc)) \
+  $(foreach inc,$(SYS_INCLUDES),-I$(EPOCROOT)/$(inc)) -I$(EXTENSION_ROOT)
+
+# Add standard include paths?
+ifndef NO_STD_INCLUDE
+  CXXINC+= -I$(EPOCROOT)/epoc32/include
+endif
+
+# Generate target folder names
+TARGET_DIR:=$(EPOCROOT)/epoc32/release/tools2$(TOOLPLATFORMDIR)/$(CFG_PATH)/
+OUTPUTPATH:=$(EPOCROOT)/epoc32/build/x86tools/$(CFG_PATH)/$(TARGET_NAME)/
+
+# 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)
+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))
+endif
+
+# Object files are the same name as the source files with a .o extension
+OBJECTFILES:=$(foreach src,$(SOURCE_FILES),$(OUTPUTPATH)$(subst $(EPOCROOT),,$(src)).o)
+
+# Remember what we're going to create for later
+CLEANTARGETS:=$(TARGET_FULLNAME) $(OBJECTFILES)
+RELEASEABLES:=$(TARGET_FULLNAME)
+CREATABLEPATHS:=$(dir $(OBJECTFILES))
+
+# Standard targets
+$(ALLTARGET):: $(RELEASEABLES)
+TARGET:: $(RELEASEABLES)
+
+# ***
+# hosttargets
+# 
+define hosttargets
+  # Compile
+  $(OBJECTFILES) : $(PREINC) $(SOURCE_FILES)
+		$(call startrule,compile) \
+		$(CXX) $(CXXDEFS) $(CXXINC) -I$(EPOCROOT)$$(subst $(OUTPUTPATH),,$$(dir $$@)) $(CXXOPT) $$(if $$(findstring .cia,$$@),$(ASMOPT),$(if $(CODE_COVERAGE),-fprofile-arcs -ftest-coverage)) $(COMPILE_OPTIONS) -o$$@ $(EPOCROOT)$$(subst $(OUTPUTPATH),,$$(basename $$@)) \
+		$(call endrule,compile)
+
+  # Link
+  $(TARGET_FULLNAME) : $(OBJECTFILES) $(foreach lib,$(LIBS),$(TARGET_DIR)lib$(lib).a) $(foreach lib,$(SHARED_LIBS),$(TARGET_DIR)lib$(lib)$(DOTDLL))
+  ifeq ($(TARGET_TYPE),lib)
+		$(call startrule,linklib) \
+		$(AR) -r $$@ $(OBJECTFILES) \
+		$(call endrule,linklib)
+  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) \
+		$(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)) \
+		$(call endrule,linkdll)
+  endif
+endef
+
+# Generate the rules
+$(eval $(hosttargets))
+
+# Create folders we need
+$(call makepath,$(CREATABLEPATHS))
+
+# Cleanup after ourselves
+$(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS),$(CREATABLEPATHS)))
+
+# Tell SBS what we're building
+$(eval $(call whatmacro,$(RELEASEABLES),WHATTOOLS2))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hostsupport/hostbuild/flm/hostbuild.xml	Tue Oct 26 14:14:43 2010 +0100
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<build xmlns="http://symbian.com/xml/build"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://symbian.com/xml/build http://symbian.com/xml/build/2_0.xsd">
+
+	<interface name="graphics_simulator.hostbuild" extends="Symbian.UserFLM" flm="hostbuild.flm">
+		<param name="OUTPUTPATH" /> 
+		<param name="TARGET_NAME" /> 
+		<param name="TARGET_TYPE" /> 
+		<param name="MACROS" default="" /> 
+		<param name="INCLUDES" default="" /> 
+		<param name="SOURCE_DIRS" default="" /> 
+		<param name="SOURCE_FOLDER" default="" /> 
+		<param name="SOURCE" default="" /> 
+		<param name="NO_STD_INCLUDE" default="" /> 
+		<param name="LIBS" default="" />
+		<param name="SHARED_LIBS" default="" />
+		<param name="CODE_COVERAGE" default="" />
+		<param name="COMPILE_OPTIONS" default="" />
+		<param name="BUILDINC" default="" />
+		<param name="DLL_WIN_LINKER_OPTS" default="" />
+		<param name="DLL_LIN_LINKER_OPTS" default="" />
+		<param name="SYS_INCLUDES" default="" />
+	</interface>
+
+</build>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hostsupport/hostbuild/group/bld.inf	Tue Oct 26 14:14:43 2010 +0100
@@ -0,0 +1,23 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Host build extensions
+
+PRJ_PLATFORMS
+TOOLS2
+
+PRJ_EXPORTS
+
+../inc/hostbuild.h          OS_LAYER_PUBLIC_EXPORT_PATH(tools/hostbuild.h)
+../flm/hostbuild.xml        /epoc32/tools/makefile_templates/graphics_simulator/hostbuild.xml
+../flm/hostbuild.flm        /epoc32/tools/makefile_templates/graphics_simulator/hostbuild.flm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hostsupport/hostbuild/inc/hostbuild.h	Tue Oct 26 14:14:43 2010 +0100
@@ -0,0 +1,112 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This is the preinclude file for hostbuild
+// 
+//
+
+/**
+ @file
+ @publishedAll
+ @released
+*/
+
+// compiler and STLport things first 
+#define _STLP_THREADS
+#define _STLP_DESIGNATED_DLL
+
+// Pick up relevant macros under __GCC32__, since __GCC32__ is not a valid macro for TOOLS2
+
+#define __NO_CLASS_CONSTS__
+#define __NORETURN__  __attribute__ ((noreturn))
+
+#ifdef __GCCV3__
+#define __NORETURN_TERMINATOR()
+#else
+#define __NORETURN_TERMINATOR()		abort()
+#endif
+
+#define IMPORT_C
+#define IMPORT_D
+#ifdef _WIN32
+#define EXPORT_C __declspec(dllexport)
+#define EXPORT_D __declspec(dllexport)
+#else
+#define EXPORT_C 
+#define EXPORT_D
+#endif
+
+#define NONSHARABLE_CLASS(x) class x
+#define NONSHARABLE_STRUCT(x) struct x
+
+#ifndef __TOOLS2__
+#define __NO_THROW
+#else
+#include <new>
+#ifndef _WIN32
+#include <exception>
+#endif
+#define __NO_THROW throw(std::bad_alloc)
+#endif
+
+typedef long long Int64;
+typedef unsigned long long Uint64;
+#define	I64LIT(x)	x##LL
+#define	UI64LIT(x)	x##ULL
+#define TEMPLATE_SPECIALIZATION template<>
+#define __TText_defined
+#ifdef __TOOLS2__
+#ifndef _WIN32
+#include <stddef.h>  // Linux definition of wchar_t
+#endif
+#endif
+
+typedef wchar_t __TText;
+
+// Symbian things next ///////////////////////////////////////////////////////
+
+#ifdef __PRODUCT_INCLUDE__
+#include __PRODUCT_INCLUDE__
+#endif
+
+// Do not use inline new in e32cmn.h
+#define __PLACEMENT_NEW_INLINE
+#define __PLACEMENT_VEC_NEW_INLINE
+// avoid e32tools/filesystem/include/mingw.inl nonsense
+#ifdef _WIN32
+#define _MINGW_INL
+#endif
+
+// Varargs
+typedef __builtin_va_list va_list;
+#define va_start(v, l) __builtin_va_start(v, l)
+#define va_arg(v, l) __builtin_va_arg(v, l)
+#define va_end(v) __builtin_va_end(v)
+#define VA_LIST va_list
+#define _VA_LIST_DEFINED //To deal with stdarg.h
+#define __VA_LIST_defined //To deal with e32def.h
+#define VA_START(ap,pn) va_start(ap, pn)
+#define VA_ARG(ap,type) va_arg(ap,type)
+#define VA_END(ap)      va_end(ap)
+
+#ifdef __TOOLS2__
+#ifndef _WIN32
+	#define asm(EXPR) __asm(".intel_syntax noprefix\n\t" EXPR)
+#else
+	#define asm __asm
+#endif
+#endif
+
+
+// the end of the pre-include
+
--- a/hostsupport/hostegl/group/bld.inf	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostegl/group/bld.inf	Tue Oct 26 14:14:43 2010 +0100
@@ -42,7 +42,7 @@
 PRJ_EXTENSIONS
 
 // Dynamic library.
-start extension tools/x86tool
+start extension graphics_simulator/hostbuild
 option TARGET_NAME EGL
 option TARGET_TYPE dll
 option SOURCE_DIRS ../src ../src/win32
--- a/hostsupport/hostopengles11/group/bld.inf	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/group/bld.inf	Tue Oct 26 14:14:43 2010 +0100
@@ -0,0 +1,56 @@
+/* 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 EGL
+ */
+
+PRJ_PLATFORMS
+TOOLS2
+
+PRJ_EXPORTS
+
+../inc/GLES/gl.h             OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES/gl.h)
+../inc/GLES/glext.h          OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES/glext.h)
+../inc/GLES/glplatform.h     OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES/glplatform.h)
+../inc/GLES/glextplatform.h  OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES/glextplatform.h)
+
+// Backwards-compatibility support header (includes the real egl.h)
+../inc/GLES/egl.h            OS_LAYER_PUBLIC_EXPORT_PATH(tools/GLES/egl.h)
+
+PRJ_EXTENSIONS
+
+// Dynamic library.
+start extension graphics_simulator/hostbuild
+option TARGET_NAME      GLESv1
+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
+option COMPILE_OPTIONS  -msse2 -mfpmath=sse -march=pentium4
+option NO_STD_INCLUDE   ON
+end
--- a/hostsupport/hostopengles11/inc/glesInternal.h	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/inc/glesInternal.h	Tue Oct 26 14:14:43 2010 +0100
@@ -50,7 +50,7 @@
 #if defined(_DEBUG)
 #define GLES_ASSERT assert
 #else // defined(_DEBUG)
-#define GLES_ASSERT
+#define GLES_ASSERT (void)
 #endif // !defined(_DEBUG)
 
 #define GLES_NEW new(std::nothrow)
--- a/hostsupport/hostopengles11/src/EGLInterface.cpp	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/src/EGLInterface.cpp	Tue Oct 26 14:14:43 2010 +0100
@@ -273,7 +273,7 @@
 
 int EGLtoGLESInterface::BindTexImage( void* surface, int level, bool generateMipmap, const SurfaceDescriptor* desc, void* buffer )
 {
-    GLES_ENTER_RET(NULL);
+    GLES_ENTER_RET(0);
 
 	GLuint ret = 0;
 
--- a/hostsupport/hostopengles11/src/GLESContext.cpp	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/src/GLESContext.cpp	Tue Oct 26 14:14:43 2010 +0100
@@ -32,9 +32,9 @@
 #include "GLESTexture.h"
 
 GLESContext::GLESContext(void* nativeContext) :
+	m_initialized(false),
 	m_nativeContext(nativeContext),
-	m_texCoordArray(NULL),
-	m_initialized(false)
+	m_texCoordArray(NULL)
 {
 }
 
@@ -84,7 +84,7 @@
 	// The maximum number of texture units supported by the wrapper depends on the number
 	// of bits in the array state variable (four bits are used by vertex, normal, color
 	// and point size arrays).
-	m_maxTextureUnits = GLES_MIN(maxTextureUnits, sizeof(m_enabledArrays) * 8 - 4);
+	m_maxTextureUnits = GLES_MIN(maxTextureUnits, (int)(sizeof(m_enabledArrays) * 8 - 4));
 	m_maxClipPlanes = maxClipPlanes;
 	m_maxLights = maxLights;
 
@@ -338,4 +338,4 @@
 {
 	void* context = EGLtoGLESInterface::GetEGLInterface()->GetGLESContext();
 	return context;
-}
\ No newline at end of file
+}
--- a/hostsupport/hostopengles11/src/GLESDesktopGL.cpp	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/src/GLESDesktopGL.cpp	Tue Oct 26 14:14:43 2010 +0100
@@ -192,4 +192,4 @@
 	return success;
 }
 
-#undef LOAD
\ No newline at end of file
+#undef LOAD
--- a/hostsupport/hostopengles11/src/GLESTexture.cpp	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/src/GLESTexture.cpp	Tue Oct 26 14:14:43 2010 +0100
@@ -334,4 +334,4 @@
 	}
 
 	return uncompressedData;
-}
\ No newline at end of file
+}
--- a/hostsupport/hostopengles11/src/glesapi.cpp	Mon Oct 18 18:24:13 2010 +0100
+++ b/hostsupport/hostopengles11/src/glesapi.cpp	Tue Oct 26 14:14:43 2010 +0100
@@ -2105,7 +2105,7 @@
 	GLES_ERROR_IF(!isValidPixelFormatEnum(internalformat), GL_INVALID_ENUM);
 	GLES_ERROR_IF(!isValidPixelFormatEnum(format), GL_INVALID_ENUM);
 	GLES_ERROR_IF(!isValidPixelTypeEnum(type), GL_INVALID_ENUM);
-	GLES_ERROR_IF(internalformat != format, GL_INVALID_ENUM);
+	GLES_ERROR_IF(internalformat != (GLint)format, GL_INVALID_ENUM);
 	GLES_ERROR_IF(isPalettedFormat(internalformat), GL_INVALID_OPERATION);
 	
 	ctx->DGL().glTexImage2D (target, level, internalformat, width, height, border, format, type, pixels);
@@ -2224,4 +2224,4 @@
 
 #ifdef __cplusplus
 }
-#endif
\ No newline at end of file
+#endif