Warning fixes. add comments about OpenGL 3 context in SDL.

This commit is contained in:
Henrik Rydgard 2012-09-01 15:16:23 +02:00
parent 4de7dc1b06
commit 743631c217
2 changed files with 12 additions and 28 deletions

View file

@ -15,6 +15,7 @@
#include "SDL/SDL.h"
#include "SDL/SDL_timer.h"
#include "SDL/SDL_audio.h"
#include "SDL/SDL_video.h"
#include "base/display.h"
#include "base/logging.h"
@ -158,6 +159,13 @@ int main(int argc, char *argv[]) {
net::Init();
#ifdef __APPLE__
// Make sure to request a somewhat modern GL context at least - the
// latest supported by MacOSX (really, really sad...)
// Requires SDL 2.0 (which is even more sad, as that hasn't been released yet)
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
//SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
#endif
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
@ -174,6 +182,7 @@ int main(int argc, char *argv[]) {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
if (SDL_SetVideoMode(pixel_xres, pixel_yres, 0, SDL_OPENGL) == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: Unable to create OpenGL screen: %s\n", SDL_GetError());
SDL_Quit();

View file

@ -1202,14 +1202,6 @@ static uint32 get_bits(vorb *f, int n)
return z;
}
static int32 get_bits_signed(vorb *f, int n)
{
uint32 z = get_bits(f, n);
if (z & (1 << (n-1)))
z += ~((1 << n) - 1);
return (int32) z;
}
// @OPTIMIZE: primary accumulator for huffman
// expand the buffer to as many bits as possible without reading off end of packet
// it might be nice to allow f->valid_bits and f->acc to be stored in registers,
@ -1293,23 +1285,6 @@ static int codebook_decode_scalar_raw(vorb *f, Codebook *c)
return -1;
}
static int codebook_decode_scalar(vorb *f, Codebook *c)
{
int i;
if (f->valid_bits < STB_VORBIS_FAST_HUFFMAN_LENGTH)
prep_huffman(f);
// fast huffman table lookup
i = f->acc & FAST_HUFFMAN_TABLE_MASK;
i = c->fast_huffman[i];
if (i >= 0) {
f->acc >>= c->codeword_lengths[i];
f->valid_bits -= c->codeword_lengths[i];
if (f->valid_bits < 0) { f->valid_bits = 0; return -1; }
return i;
}
return codebook_decode_scalar_raw(f,c);
}
#ifndef STB_VORBIS_NO_INLINE_DECODE
#define DECODE_RAW(var, f,c) \
@ -2030,7 +2005,7 @@ void dct_iv_slow(float *buffer, int n)
float mcos[16384];
float x[2048];
int i,j;
int n2 = n >> 1, nmask = (n << 3) - 1;
int nmask = (n << 3) - 1;
memcpy(x, buffer, sizeof(*x) * n);
for (i=0; i < 8*n; ++i)
mcos[i] = (float) cos(M_PI / 4 * i / n);
@ -2282,7 +2257,6 @@ static __forceinline void iter_54(float *z)
static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, float *A, int base_n)
{
int k_off = -8;
int a_off = base_n >> 3;
float A2 = A[0+a_off];
float *z = e + i_off;
@ -4156,10 +4130,12 @@ static uint32 vorbis_find_page(stb_vorbis *f, uint32 *end, uint32 *last)
if (end)
*end = stb_vorbis_get_file_offset(f);
if (last)
{
if (header[5] & 0x04)
*last = 1;
else
*last = 0;
}
set_file_offset(f, retry_loc-1);
return 1;
}
@ -4775,7 +4751,6 @@ static void compute_samples(int mask, short *output, int num_c, float **data, in
}
}
static int channel_selector[3][2] = { {0}, {PLAYBACK_MONO}, {PLAYBACK_LEFT, PLAYBACK_RIGHT} };
static void compute_stereo_samples(short *output, int num_c, float **data, int d_offset, int len)
{
#define BUFFER_SIZE 32