More warning fixes, OSX build fix.

This commit is contained in:
Jordan Cristiano 2013-11-14 03:11:40 -05:00
parent 7e9b970240
commit 0fced651a5
6 changed files with 73 additions and 55 deletions

View File

@ -469,36 +469,42 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
// Mix LRS, AUXA and AUXB depending on mixer_control // Mix LRS, AUXA and AUXB depending on mixer_control
// TODO: Handle DPL2 on AUXB. // TODO: Handle DPL2 on AUXB.
if (mctrl & MIX_L) #define MIX_ON(C) (0 != (mctrl & MIX_##C))
MixAdd(buffers.left, samples, count, &pb.mixer.left, &pb.dpop.left, mctrl & MIX_L_RAMP); #define RAMP_ON(C) (0 != (mctrl & MIX_##C##_RAMP))
if (mctrl & MIX_R)
MixAdd(buffers.right, samples, count, &pb.mixer.right, &pb.dpop.right, mctrl & MIX_R_RAMP);
if (mctrl & MIX_S)
MixAdd(buffers.surround, samples, count, &pb.mixer.surround, &pb.dpop.surround, mctrl & MIX_S_RAMP);
if (mctrl & MIX_AUXA_L) if (MIX_ON(L))
MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, mctrl & MIX_AUXA_L_RAMP); MixAdd(buffers.left, samples, count, &pb.mixer.left, &pb.dpop.left, RAMP_ON(L));
if (mctrl & MIX_AUXA_R) if (MIX_ON(R))
MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, mctrl & MIX_AUXA_R_RAMP); MixAdd(buffers.right, samples, count, &pb.mixer.right, &pb.dpop.right, RAMP_ON(R));
if (mctrl & MIX_AUXA_S) if (MIX_ON(S))
MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, mctrl & MIX_AUXA_S_RAMP); MixAdd(buffers.surround, samples, count, &pb.mixer.surround, &pb.dpop.surround, RAMP_ON(S));
if (mctrl & MIX_AUXB_L) if (MIX_ON(AUXA_L))
MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, mctrl & MIX_AUXB_L_RAMP); MixAdd(buffers.auxA_left, samples, count, &pb.mixer.auxA_left, &pb.dpop.auxA_left, RAMP_ON(AUXA_L));
if (mctrl & MIX_AUXB_R) if (MIX_ON(AUXA_R))
MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, mctrl & MIX_AUXB_R_RAMP); MixAdd(buffers.auxA_right, samples, count, &pb.mixer.auxA_right, &pb.dpop.auxA_right, RAMP_ON(AUXA_R));
if (mctrl & MIX_AUXB_S) if (MIX_ON(AUXA_S))
MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, mctrl & MIX_AUXB_S_RAMP); MixAdd(buffers.auxA_surround, samples, count, &pb.mixer.auxA_surround, &pb.dpop.auxA_surround, RAMP_ON(AUXA_S));
if (MIX_ON(AUXB_L))
MixAdd(buffers.auxB_left, samples, count, &pb.mixer.auxB_left, &pb.dpop.auxB_left, RAMP_ON(AUXB_L));
if (MIX_ON(AUXB_R))
MixAdd(buffers.auxB_right, samples, count, &pb.mixer.auxB_right, &pb.dpop.auxB_right, RAMP_ON(AUXB_R));
if (MIX_ON(AUXB_S))
MixAdd(buffers.auxB_surround, samples, count, &pb.mixer.auxB_surround, &pb.dpop.auxB_surround, RAMP_ON(AUXB_S));
#ifdef AX_WII #ifdef AX_WII
if (mctrl & MIX_AUXC_L) if (MIX_ON(AUXC_L))
MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, mctrl & MIX_AUXC_L_RAMP); MixAdd(buffers.auxC_left, samples, count, &pb.mixer.auxC_left, &pb.dpop.auxC_left, RAMP_ON(AUXC_L));
if (mctrl & MIX_AUXC_R) if (MIX_ON(AUXC_R))
MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, mctrl & MIX_AUXC_R_RAMP); MixAdd(buffers.auxC_right, samples, count, &pb.mixer.auxC_right, &pb.dpop.auxC_right, RAMP_ON(AUXC_R));
if (mctrl & MIX_AUXC_S) if (MIX_ON(AUXC_S))
MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, mctrl & MIX_AUXC_S_RAMP); MixAdd(buffers.auxC_surround, samples, count, &pb.mixer.auxC_surround, &pb.dpop.auxC_surround, RAMP_ON(AUXC_S));
#endif #endif
#undef MIX_ON
#undef RAMP_ON
// Optionally, phase shift left or right channel to simulate 3D sound. // Optionally, phase shift left or right channel to simulate 3D sound.
if (pb.initial_time_delay.on) if (pb.initial_time_delay.on)
{ {
@ -524,8 +530,8 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
pb.remote_src.cur_addr_frac = curr_pos & 0xFFFF; pb.remote_src.cur_addr_frac = curr_pos & 0xFFFF;
// Mix to main[0-3] and aux[0-3] // Mix to main[0-3] and aux[0-3]
#define WMCHAN_MIX_ON(n) ((pb.remote_mixer_control >> (2 * n)) & 3) #define WMCHAN_MIX_ON(n) (0 != ((pb.remote_mixer_control >> (2 * n)) & 3))
#define WMCHAN_MIX_RAMP(n) ((pb.remote_mixer_control >> (2 * n)) & 2) #define WMCHAN_MIX_RAMP(n) (0 != ((pb.remote_mixer_control >> (2 * n)) & 2))
if (WMCHAN_MIX_ON(0)) if (WMCHAN_MIX_ON(0))
MixAdd(buffers.wm_main0, wm_samples, wm_count, &pb.remote_mixer.main0, &pb.remote_dpop.main0, WMCHAN_MIX_RAMP(0)); MixAdd(buffers.wm_main0, wm_samples, wm_count, &pb.remote_mixer.main0, &pb.remote_dpop.main0, WMCHAN_MIX_RAMP(0));
@ -544,6 +550,8 @@ void ProcessVoice(PB_TYPE& pb, const AXBuffers& buffers, u16 count, AXMixControl
if (WMCHAN_MIX_ON(7)) if (WMCHAN_MIX_ON(7))
MixAdd(buffers.wm_aux3, wm_samples, wm_count, &pb.remote_mixer.aux3, &pb.remote_dpop.aux3, WMCHAN_MIX_RAMP(7)); MixAdd(buffers.wm_aux3, wm_samples, wm_count, &pb.remote_mixer.aux3, &pb.remote_dpop.aux3, WMCHAN_MIX_RAMP(7));
} }
#undef WMCHAN_MIX_RAMP
#undef WMCHAN_MIX_ON
#endif #endif
} }

View File

@ -209,5 +209,5 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
bool GCPad::GetMicButton() const bool GCPad::GetMicButton() const
{ {
return (0 != m_buttons->controls.back()->control_ref->State()); return (0.0f != m_buttons->controls.back()->control_ref->State());
} }

View File

@ -310,14 +310,14 @@ int Wiimote::IORead(unsigned char *buf)
return inputlen; return inputlen;
} }
int Wiimote::IOWrite(const unsigned char *buf, int len) int Wiimote::IOWrite(const unsigned char *buf, size_t len)
{ {
IOReturn ret; IOReturn ret;
if (!IsConnected()) if (!IsConnected())
return 0; return 0;
ret = [ichan writeAsync: const_cast<void*>((void *)buf) length: len refcon: nil]; ret = [ichan writeAsync: const_cast<void*>((void *)buf) length: (int)len refcon: nil];
if (ret == kIOReturnSuccess) if (ret == kIOReturnSuccess)
return len; return len;

View File

@ -485,19 +485,23 @@ Renderer::Renderer()
} }
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended; #define TO_BOOL(c) (0 != (c))
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
g_Config.backend_info.bSupportsPrimitiveRestart = GLEW_VERSION_3_1 || GLEW_NV_primitive_restart;
g_Config.backend_info.bSupportsEarlyZ = GLEW_ARB_shader_image_load_store;
g_ogl_config.bSupportsGLSLCache = GLEW_ARB_get_program_binary; g_Config.backend_info.bSupportsDualSourceBlend = TO_BOOL(GLEW_ARB_blend_func_extended);
g_ogl_config.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory; g_Config.backend_info.bSupportsGLSLUBO = TO_BOOL(GLEW_ARB_uniform_buffer_object);
g_ogl_config.bSupportsGLSync = GLEW_ARB_sync; g_Config.backend_info.bSupportsPrimitiveRestart = TO_BOOL(GLEW_VERSION_3_1) || TO_BOOL(GLEW_NV_primitive_restart);
g_ogl_config.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex; g_Config.backend_info.bSupportsEarlyZ = TO_BOOL(GLEW_ARB_shader_image_load_store);
g_ogl_config.bSupportCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
g_ogl_config.bSupportSampleShading = GLEW_ARB_sample_shading; g_ogl_config.bSupportsGLSLCache = TO_BOOL(GLEW_ARB_get_program_binary);
g_ogl_config.bSupportOGL31 = GLEW_VERSION_3_1; g_ogl_config.bSupportsGLPinnedMemory = TO_BOOL(GLEW_AMD_pinned_memory);
g_ogl_config.bSupportViewportFloat = GLEW_ARB_viewport_array; g_ogl_config.bSupportsGLSync = TO_BOOL(GLEW_ARB_sync);
g_ogl_config.bSupportsGLBaseVertex = TO_BOOL(GLEW_ARB_draw_elements_base_vertex);
g_ogl_config.bSupportCoverageMSAA = TO_BOOL(GLEW_NV_framebuffer_multisample_coverage);
g_ogl_config.bSupportSampleShading = TO_BOOL(GLEW_ARB_sample_shading);
g_ogl_config.bSupportOGL31 = TO_BOOL(GLEW_VERSION_3_1);
g_ogl_config.bSupportViewportFloat = TO_BOOL(GLEW_ARB_viewport_array);
#undef TO_BOOL
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20")) if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20"))
{ {

View File

@ -59,7 +59,7 @@ StreamBuffer::~StreamBuffer()
glDeleteBuffers(1, &m_buffer); glDeleteBuffers(1, &m_buffer);
} }
#define SLOT(x) (x)*SYNC_POINTS/m_size #define SLOT(x) ((x)*SYNC_POINTS/m_size)
void StreamBuffer::Alloc ( size_t size, u32 stride ) void StreamBuffer::Alloc ( size_t size, u32 stride )
{ {
@ -81,14 +81,14 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
case PINNED_MEMORY: case PINNED_MEMORY:
// insert waiting slots for used memory // insert waiting slots for used memory
for(u32 i=SLOT(m_used_iterator); i<SLOT(m_iterator); i++) for(size_t i=SLOT(m_used_iterator); i<SLOT(m_iterator); i++)
{ {
fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
} }
m_used_iterator = m_iterator; m_used_iterator = m_iterator;
// wait for new slots to end of buffer // wait for new slots to end of buffer
for(u32 i=SLOT(m_free_iterator)+1; i<=SLOT(iter_end) && i < SYNC_POINTS; i++) for (size_t i = SLOT(m_free_iterator) + 1; i <= SLOT(iter_end) && i < SYNC_POINTS; i++)
{ {
glClientWaitSync(fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); glClientWaitSync(fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
glDeleteSync(fences[i]); glDeleteSync(fences[i]);
@ -99,8 +99,10 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
if(iter_end >= m_size) { if(iter_end >= m_size) {
// insert waiting slots in unused space at the end of the buffer // insert waiting slots in unused space at the end of the buffer
for(u32 i=SLOT(m_used_iterator); i < SYNC_POINTS; i++) for (size_t i = SLOT(m_used_iterator); i < SYNC_POINTS; i++)
{
fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
}
// move to the start // move to the start
m_used_iterator = m_iterator_aligned = m_iterator = 0; // offset 0 is always aligned m_used_iterator = m_iterator_aligned = m_iterator = 0; // offset 0 is always aligned
@ -244,10 +246,14 @@ void StreamBuffer::Shutdown()
void StreamBuffer::DeleteFences() void StreamBuffer::DeleteFences()
{ {
for(u32 i=SLOT(m_free_iterator)+1; i < SYNC_POINTS; i++) for (size_t i = SLOT(m_free_iterator) + 1; i < SYNC_POINTS; i++)
{
glDeleteSync(fences[i]); glDeleteSync(fences[i]);
for(u32 i=0; i<SLOT(m_iterator); i++) }
for (size_t i = 0; i < SLOT(m_iterator); i++)
{
glDeleteSync(fences[i]); glDeleteSync(fences[i]);
}
delete [] fences; delete [] fences;
} }

View File

@ -43,8 +43,8 @@ const u32 MAX_VBUFFER_SIZE = 16*1024*1024;
static StreamBuffer *s_vertexBuffer; static StreamBuffer *s_vertexBuffer;
static StreamBuffer *s_indexBuffer; static StreamBuffer *s_indexBuffer;
static u32 s_baseVertex; static size_t s_baseVertex;
static u32 s_offset[3]; static size_t s_offset[3];
VertexManager::VertexManager() VertexManager::VertexManager()
{ {
@ -89,7 +89,7 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
u32 index_size = (triangle_index_size+line_index_size+point_index_size) * sizeof(u16); u32 index_size = (triangle_index_size+line_index_size+point_index_size) * sizeof(u16);
s_vertexBuffer->Alloc(vertex_data_size, stride); s_vertexBuffer->Alloc(vertex_data_size, stride);
u32 offset = s_vertexBuffer->Upload(GetVertexBuffer(), vertex_data_size); size_t offset = s_vertexBuffer->Upload(GetVertexBuffer(), vertex_data_size);
s_baseVertex = offset / stride; s_baseVertex = offset / stride;
s_indexBuffer->Alloc(index_size); s_indexBuffer->Alloc(index_size);
@ -121,17 +121,17 @@ void VertexManager::Draw(u32 stride)
if(g_ogl_config.bSupportsGLBaseVertex) { if(g_ogl_config.bSupportsGLBaseVertex) {
if (triangle_index_size > 0) if (triangle_index_size > 0)
{ {
glDrawRangeElementsBaseVertex(triangle_mode, 0, max_index, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex); glDrawRangeElementsBaseVertex(triangle_mode, 0, max_index, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], (GLint)s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
if (line_index_size > 0) if (line_index_size > 0)
{ {
glDrawRangeElementsBaseVertex(GL_LINES, 0, max_index, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1], s_baseVertex); glDrawRangeElementsBaseVertex(GL_LINES, 0, max_index, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1], (GLint)s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
if (point_index_size > 0) if (point_index_size > 0)
{ {
glDrawRangeElementsBaseVertex(GL_POINTS, 0, max_index, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], s_baseVertex); glDrawRangeElementsBaseVertex(GL_POINTS, 0, max_index, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], (GLint)s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
} }
@ -236,9 +236,9 @@ void VertexManager::vFlush()
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1, tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9, tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9,
tex.texTlut[i&3].tlut_format, tex.texTlut[i&3].tlut_format,
(tex.texMode0[i&3].min_filter & 3), (0 != (tex.texMode0[i&3].min_filter & 3)),
(tex.texMode1[i&3].max_lod + 0xf) / 0x10, (tex.texMode1[i&3].max_lod + 0xf) / 0x10,
tex.texImage1[i&3].image_type); (0 != tex.texImage1[i&3].image_type));
if (tentry) if (tentry)
{ {