Skip to content

Commit

Permalink
compile fixes (KhronosGroup#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
mre4ce authored Oct 21, 2016
1 parent cba962c commit ce1d0da
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 48 deletions.
4 changes: 2 additions & 2 deletions external/include/utils/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -1066,13 +1066,13 @@ static void Json_WriteValue( const Json_t * node, int recursion, char ** bufferI
else if ( node->type == JSON_INT )
{
char temp[1024];
const int length = sprintf( temp, "%lld", node->valueInt64 );
const int length = sprintf( temp, "%lld", (long long int)node->valueInt64 );
Json_Printf( bufferInOut, lengthInOut, offsetInOut, length + 2, "%s%s\n", temp, lastChild ? "" : "," );
}
else if ( node->type == JSON_UINT )
{
char temp[1024];
const int length = sprintf( temp, "%llu", node->valueUint64 );
const int length = sprintf( temp, "%llu", (unsigned long long int)node->valueUint64 );
Json_Printf( bufferInOut, lengthInOut, offsetInOut, length + 2, "%s%s\n", temp, lastChild ? "" : "," );
}
else if ( node->type == JSON_FLOAT )
Expand Down
3 changes: 3 additions & 0 deletions external/libs/glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ set( SOURCES
${GLSLANG_DIR}/glslang/MachineIndependent/Initialize.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/IntermTraverse.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/Intermediate.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/ParseContextBase.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/ParseHelper.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/PoolAlloc.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/RemoveTree.cpp
Expand All @@ -82,6 +83,7 @@ set( SOURCES
${GLSLANG_DIR}/glslang/MachineIndependent/SymbolTable.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/Versions.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/intermOut.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/iomapper.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/limits.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/linkValidate.cpp
${GLSLANG_DIR}/glslang/MachineIndependent/parseConst.cpp
Expand Down Expand Up @@ -113,6 +115,7 @@ set( HEADERS
${GLSLANG_DIR}/glslang/MachineIndependent/glslang_tab.cpp.h
${GLSLANG_DIR}/glslang/MachineIndependent/gl_types.h
${GLSLANG_DIR}/glslang/MachineIndependent/Initialize.h
${GLSLANG_DIR}/glslang/MachineIndependent/iomapper.h
${GLSLANG_DIR}/glslang/MachineIndependent/localintermediate.h
${GLSLANG_DIR}/glslang/MachineIndependent/ParseHelper.h
${GLSLANG_DIR}/glslang/MachineIndependent/reflection.h
Expand Down
2 changes: 2 additions & 0 deletions external/libs/glslang/ndk/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ LOCAL_SRC_FILES := \
$(GLSLANG_DIR)/glslang/GenericCodeGen/CodeGen.cpp \
$(GLSLANG_DIR)/glslang/GenericCodeGen/Link.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/Constant.cpp \
${GLSLANG_DIR}/glslang/MachineIndependent/ParseContextBase.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/glslang_tab.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/InfoSink.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/Initialize.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/Intermediate.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/intermOut.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/IntermTraverse.cpp \
${GLSLANG_DIR}/glslang/MachineIndependent/iomapper.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/limits.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/linkValidate.cpp \
$(GLSLANG_DIR)/glslang/MachineIndependent/parseConst.cpp \
Expand Down
9 changes: 6 additions & 3 deletions samples/apps/atw/atw_cpu_dsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ Windows, x86 or x64
#define _CRT_SECURE_NO_WARNINGS
#endif

#ifdef _MSC_VER
#if defined( _MSC_VER )
#pragma warning( disable : 4204 ) // nonstandard extension used : non-constant aggregate initializer
#pragma warning( disable : 4255 ) // '<name>' : no function prototype given: converting '()' to '(void)'
#pragma warning( disable : 4464 ) // relative include path contains '..'
#pragma warning( disable : 4668 ) // '__cplusplus' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
#pragma warning( disable : 4710 ) // 'int printf(const char *const ,...)': function not inlined
#pragma warning( disable : 4711 ) // function '<name>' selected for automatic inline expansion
Expand All @@ -167,7 +166,11 @@ Windows, x86 or x64
#pragma warning( disable : 4820 ) // '<name>' : 'X' bytes padding added after data member '<member>'
#endif

#ifdef __ICL
#if _MSC_VER >= 1900
#pragma warning( disable : 4464 ) // relative include path contains '..'
#endif

#if defined( __ICL )
#pragma warning( disable : 2415 ) // variable X of static storage duration was declared but never referenced
#endif

Expand Down
61 changes: 35 additions & 26 deletions samples/apps/atw/atw_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Common defines

#define GRAPHICS_API_OPENGL 1

#define USE_GLTF 1
#define USE_GLTF 0
#define PROGRAM( name ) name##GLSL

#define GLSL_EXTENSIONS "#extension GL_EXT_shader_io_blocks : enable\n"
Expand Down Expand Up @@ -3226,14 +3226,19 @@ PFNGLTEXSTORAGE3DMULTISAMPLEPROC glTexStorage3DMultisample;
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#endif

// GL_EXT_texture_border_clamp
#if !defined( GL_CLAMP_TO_BORDER_EXT )
#define GL_CLAMP_TO_BORDER_EXT 0x812D
// GL_EXT_texture_border_clamp or GL_OES_texture_border_clamp
#if !defined( GL_CLAMP_TO_BORDER )
#define GL_CLAMP_TO_BORDER 0x812D
#endif

// GL_OES_texture_border_clamp
#if !defined( GL_CLAMP_TO_BORDER_OES )
#define GL_CLAMP_TO_BORDER_OES 0x812D
// No 1D textures in OpenGL ES.
#if !defined( GL_TEXTURE_1D )
#define GL_TEXTURE_1D 0x0DE0
#endif

// No 1D texture arrays in OpenGL ES.
#if !defined( GL_TEXTURE_1D_ARRAY )
#define GL_TEXTURE_1D_ARRAY 0x8C18
#endif

// No multi-sampled texture arrays in OpenGL ES.
Expand Down Expand Up @@ -3268,8 +3273,8 @@ static void GlInitExtensions()
glExtensions.multi_sampled_resolve = GlCheckExtension( "GL_EXT_multisampled_render_to_texture" );
glExtensions.multi_view_multi_sampled_resolve = GlCheckExtension( "GL_OVR_multiview_multisampled_render_to_texture" );

glExtensions.texture_clamp_to_border_id = ( GlCheckExtension( "GL_OES_texture_border_clamp" ) ? GL_CLAMP_TO_BORDER_OES :
( GlCheckExtension( "GL_EXT_texture_border_clamp" ) ? GL_CLAMP_TO_BORDER_EXT :
glExtensions.texture_clamp_to_border_id = ( GlCheckExtension( "GL_OES_texture_border_clamp" ) ? GL_CLAMP_TO_BORDER :
( GlCheckExtension( "GL_EXT_texture_border_clamp" ) ? GL_CLAMP_TO_BORDER :
( GL_CLAMP_TO_EDGE ) ) );
}

Expand Down Expand Up @@ -4791,12 +4796,12 @@ static GpuWindowEvent_t GpuWindow_ProcessEvents( GpuWindow_t * window )
}
}

window->input.keyInput[KEY_SHIFT_LEFT] = GetAsyncKeyState( KEY_SHIFT_LEFT );
window->input.keyInput[KEY_SHIFT_LEFT] = GetAsyncKeyState( KEY_SHIFT_LEFT );
window->input.keyInput[KEY_CTRL_LEFT] = GetAsyncKeyState( KEY_CTRL_LEFT );
window->input.keyInput[KEY_ALT_LEFT] = GetAsyncKeyState( KEY_ALT_LEFT );
window->input.keyInput[KEY_CURSOR_UP] = GetAsyncKeyState( KEY_CURSOR_UP );
window->input.keyInput[KEY_CURSOR_DOWN] = GetAsyncKeyState( KEY_CURSOR_DOWN );
window->input.keyInput[KEY_CURSOR_LEFT] = GetAsyncKeyState( KEY_CURSOR_LEFT );
window->input.keyInput[KEY_CURSOR_DOWN] = GetAsyncKeyState( KEY_CURSOR_DOWN );
window->input.keyInput[KEY_CURSOR_LEFT] = GetAsyncKeyState( KEY_CURSOR_LEFT );
window->input.keyInput[KEY_CURSOR_RIGHT] = GetAsyncKeyState( KEY_CURSOR_RIGHT );

if ( window->windowExit )
Expand Down Expand Up @@ -6435,7 +6440,7 @@ typedef enum // https://developer.android.com/ndk/reference/group___input.html
KEY_ESCAPE = AKEYCODE_ESCAPE,
KEY_SHIFT_LEFT = AKEYCODE_SHIFT_LEFT,
KEY_CTRL_LEFT = AKEYCODE_CTRL_LEFT,
KEY_ALT_LEFT = AKEYCODE_ALT_LEFT
KEY_ALT_LEFT = AKEYCODE_ALT_LEFT,
KEY_CURSOR_UP = AKEYCODE_DPAD_UP,
KEY_CURSOR_DOWN = AKEYCODE_DPAD_DOWN,
KEY_CURSOR_LEFT = AKEYCODE_DPAD_LEFT,
Expand Down Expand Up @@ -7987,7 +7992,7 @@ typedef struct
static size_t GpuVertexAttributeArrays_GetDataSize( const GpuVertexAttribute_t * layout, const int vertexCount, const int attribsFlags )
{
size_t totalSize = 0;
for ( int i = 0; i < layout[i].attributeFlag != 0; i++ )
for ( int i = 0; layout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &layout[i];
if ( ( v->attributeFlag & attribsFlags ) != 0 )
Expand All @@ -8000,7 +8005,7 @@ static size_t GpuVertexAttributeArrays_GetDataSize( const GpuVertexAttribute_t *

static void * GpuVertexAttributeArrays_GetDataPointer( const GpuVertexAttributeArraysBase_t * attribs )
{
for ( int i = 0; i < attribs->layout[i].attributeFlag != 0; i++ )
for ( int i = 0; attribs->layout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &attribs->layout[i];
void * attribPtr = *(void **) ( ((char *)attribs) + v->attributeOffset );
Expand All @@ -8015,7 +8020,7 @@ static void * GpuVertexAttributeArrays_GetDataPointer( const GpuVertexAttributeA
static int GpuVertexAttributeArrays_GetAttribsFlags( const GpuVertexAttributeArraysBase_t * attribs )
{
int attribsFlags = 0;
for ( int i = 0; i < attribs->layout[i].attributeFlag != 0; i++ )
for ( int i = 0; attribs->layout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &attribs->layout[i];
void * attribPtr = *(void **) ( ((char *)attribs) + v->attributeOffset );
Expand All @@ -8032,7 +8037,7 @@ static void GpuVertexAttributeArrays_Map( GpuVertexAttributeArraysBase_t * attri
unsigned char * dataBytePtr = (unsigned char *) data;
size_t offset = 0;

for ( int i = 0; i < attribs->layout[i].attributeFlag != 0; i++ )
for ( int i = 0; attribs->layout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &attribs->layout[i];
void ** attribPtr = (void **) ( ((char *)attribs) + v->attributeOffset );
Expand Down Expand Up @@ -8067,7 +8072,7 @@ static void GpuVertexAttributeArrays_Free( GpuVertexAttributeArraysBase_t * attr

static void * GpuVertexAttributeArrays_FindAtribute( GpuVertexAttributeArraysBase_t * attribs, const char * name )
{
for ( int i = 0; i < attribs->layout[i].attributeFlag != 0; i++ )
for ( int i = 0; attribs->layout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &attribs->layout[i];
if ( strcmp( v->name, name ) == 0 )
Expand Down Expand Up @@ -9295,7 +9300,7 @@ static bool GpuGraphicsProgram_Create( GpuContext_t * context, GpuGraphicsProgra

// Bind the vertex attribute locations before linking.
GLuint location = 0;
for ( int i = 0; i < vertexLayout[i].attributeFlag != 0; i++ )
for ( int i = 0; vertexLayout[i].attributeFlag != 0; i++ )
{
if ( ( vertexLayout[i].attributeFlag & vertexAttribsFlags ) != 0 )
{
Expand All @@ -9315,7 +9320,7 @@ static bool GpuGraphicsProgram_Create( GpuContext_t * context, GpuGraphicsProgra
}

// Verify the attributes.
for ( int i = 0; i < vertexLayout[i].attributeFlag != 0; i++ )
for ( int i = 0; vertexLayout[i].attributeFlag != 0; i++ )
{
if ( ( vertexLayout[i].attributeFlag & vertexAttribsFlags ) != 0 )
{
Expand Down Expand Up @@ -9597,7 +9602,7 @@ static void InitVertexAttributes( const bool instance,
GLuint * attribLocationCount )
{
size_t offset = 0;
for ( int i = 0; i < vertexLayout[i].attributeFlag != 0; i++ )
for ( int i = 0; vertexLayout[i].attributeFlag != 0; i++ )
{
const GpuVertexAttribute_t * v = &vertexLayout[i];
if ( ( v->attributeFlag & storedAttribsFlags ) != 0 )
Expand Down Expand Up @@ -14073,9 +14078,9 @@ static void PerfScene_Create( GpuContext_t * context, PerfScene_t * scene, Scene

GpuBuffer_Create( context, &scene->sceneMatrices, GPU_BUFFER_TYPE_UNIFORM, ( settings->useMultiView ? 4 : 2 ) * sizeof( Matrix4x4f_t ), NULL, false );

GpuTexture_CreateDefault( context, &scene->diffuseTexture, GPU_TEXTURE_DEFAULT_CHECKERBOARD, 256, 256, 0, 1, 1, true, false );
GpuTexture_CreateDefault( context, &scene->specularTexture, GPU_TEXTURE_DEFAULT_CHECKERBOARD, 256, 256, 0, 1, 1, true, false );
GpuTexture_CreateDefault( context, &scene->normalTexture, GPU_TEXTURE_DEFAULT_PYRAMIDS, 256, 256, 0, 1, 1, true, false );
GpuTexture_CreateDefault( context, &scene->diffuseTexture, GPU_TEXTURE_DEFAULT_CHECKERBOARD, 256, 256, 0, 0, 1, true, false );
GpuTexture_CreateDefault( context, &scene->specularTexture, GPU_TEXTURE_DEFAULT_CHECKERBOARD, 256, 256, 0, 0, 1, true, false );
GpuTexture_CreateDefault( context, &scene->normalTexture, GPU_TEXTURE_DEFAULT_PYRAMIDS, 256, 256, 0, 0, 1, true, false );

scene->settings = *settings;
scene->newSettings = settings;
Expand Down Expand Up @@ -14817,6 +14822,7 @@ static void Gltf_ParseUniformValue( GltfUniformValue_t * value, const Json_t * j
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X2: Gltf_ParseFloatArray( value->floatValue, 4*2, json ); break;
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X3: Gltf_ParseFloatArray( value->floatValue, 4*3, json ); break;
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X4: Gltf_ParseFloatArray( value->floatValue, 4*4, json ); break;
default: break;
}
}

Expand All @@ -14839,7 +14845,7 @@ static GpuTextureWrapMode_t Gltf_GetTextureWrapMode( const int wrapMode )
switch ( wrapMode )
{
case GL_REPEAT: return GPU_TEXTURE_WRAP_MODE_REPEAT;
case GL_CLAMP: return GPU_TEXTURE_WRAP_MODE_CLAMP_TO_EDGE;
case GL_CLAMP_TO_EDGE: return GPU_TEXTURE_WRAP_MODE_CLAMP_TO_EDGE;
case GL_CLAMP_TO_BORDER: return GPU_TEXTURE_WRAP_MODE_CLAMP_TO_BORDER;
default: return GPU_TEXTURE_WRAP_MODE_REPEAT;
}
Expand Down Expand Up @@ -15576,6 +15582,7 @@ static bool GltfScene_CreateFromFile( GpuContext_t * context, GltfScene_t * scen
}
}
assert( found );
UNUSED_PARM( found );
}
}
}
Expand Down Expand Up @@ -16461,7 +16468,7 @@ static void GltfScene_UpdateBuffers( GpuCommandBuffer_t * commandBuffer, const G

// Update the skin joint buffer.
Matrix4x4f_t * joints = NULL;
GpuBuffer_t * mappedJointBuffer = GpuCommandBuffer_MapBuffer( commandBuffer, &skin->jointBuffer, &joints );
GpuBuffer_t * mappedJointBuffer = GpuCommandBuffer_MapBuffer( commandBuffer, &skin->jointBuffer, (void **)&joints );

for ( int jointIndex = 0; jointIndex < skin->jointCount; jointIndex++ )
{
Expand Down Expand Up @@ -16501,6 +16508,7 @@ static void GltfScene_SetUniformValue( GpuGraphicsCommand_t * command, const Glt
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X2: GpuGraphicsCommand_SetParmFloatMatrix4x2( command, uniform->index, (const Matrix4x2f_t *)value->floatValue ); break;
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X3: GpuGraphicsCommand_SetParmFloatMatrix4x3( command, uniform->index, (const Matrix4x3f_t *)value->floatValue ); break;
case GPU_PROGRAM_PARM_TYPE_PUSH_CONSTANT_FLOAT_MATRIX4X4: GpuGraphicsCommand_SetParmFloatMatrix4x4( command, uniform->index, (const Matrix4x4f_t *)value->floatValue ); break;
default: break;
}
}

Expand Down Expand Up @@ -16628,6 +16636,7 @@ static void GltfScene_Render( GpuCommandBuffer_t * commandBuffer, const GltfScen
case GLTF_UNIFORM_SEMANTIC_MODEL_VIEW_PROJECTION_INVERSE: GpuGraphicsCommand_SetParmFloatMatrix4x4( &command, uniform->index, &builtin.modelViewProjectionInverseMatrix ); break;
case GLTF_UNIFORM_SEMANTIC_VIEWPORT: GpuGraphicsCommand_SetParmFloatVector4( &command, uniform->index, &builtin.viewport ); break;
case GLTF_UNIFORM_SEMANTIC_JOINTMATRIX: GpuGraphicsCommand_SetParmBufferUniform( &command, uniform->index, jointBuffer ); break;
default: break;
}
}

Expand Down
Loading

0 comments on commit ce1d0da

Please sign in to comment.