Merged default into minor

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-08-26 23:23:17 -03:00
6 changed files with 34 additions and 86 deletions
+11 -15
View File
@@ -98,11 +98,7 @@ bool Pool::isPlaying(Source *s)
bool p = false; bool p = false;
{ {
thread::Lock lock(mutex); thread::Lock lock(mutex);
for (auto i = playing.begin(); i != playing.end(); i++) p = (playing.find(s) != playing.end());
{
if (i->first == s)
p = true;
}
} }
return p; return p;
} }
@@ -181,11 +177,11 @@ bool Pool::play(Source *source, ALuint &out)
void Pool::stop() void Pool::stop()
{ {
thread::Lock lock(mutex); thread::Lock lock(mutex);
for (auto i = playing.begin(); i != playing.end(); i++) for (const auto &i : playing)
{ {
i->first->stopAtomic(); i.first->stopAtomic();
i->first->release(); i.first->release();
available.push(i->second); available.push(i.second);
} }
playing.clear(); playing.clear();
@@ -200,8 +196,8 @@ void Pool::stop(Source *source)
void Pool::pause() void Pool::pause()
{ {
thread::Lock lock(mutex); thread::Lock lock(mutex);
for (auto i = playing.begin(); i != playing.end(); i++) for (const auto &i : playing)
i->first->pauseAtomic(); i.first->pauseAtomic();
} }
void Pool::pause(Source *source) void Pool::pause(Source *source)
@@ -215,8 +211,8 @@ void Pool::pause(Source *source)
void Pool::resume() void Pool::resume()
{ {
thread::Lock lock(mutex); thread::Lock lock(mutex);
for (auto i = playing.begin(); i != playing.end(); i++) for (const auto &i : playing)
i->first->resumeAtomic(); i.first->resumeAtomic();
} }
void Pool::resume(Source *source) void Pool::resume(Source *source)
@@ -230,8 +226,8 @@ void Pool::resume(Source *source)
void Pool::rewind() void Pool::rewind()
{ {
thread::Lock lock(mutex); thread::Lock lock(mutex);
for (auto i = playing.begin(); i != playing.end(); i++) for (const auto &i : playing)
i->first->rewindAtomic(); i.first->rewindAtomic();
} }
// For those times we don't need it backed. // For those times we don't need it backed.
+4 -13
View File
@@ -43,26 +43,17 @@ Volatile::~Volatile()
bool Volatile::loadAll() bool Volatile::loadAll()
{ {
bool success = true; bool success = true;
std::list<Volatile *>::iterator i = all.begin();
while (i != all.end()) for (Volatile *v : all)
{ success = success && v->loadVolatile();
success = success && (*i)->loadVolatile();
i++;
}
return success; return success;
} }
void Volatile::unloadAll() void Volatile::unloadAll()
{ {
std::list<Volatile *>::iterator i = all.begin(); for (Volatile *v : all)
v->unloadVolatile();
while (i != all.end())
{
(*i)->unloadVolatile();
i++;
}
} }
} // graphics } // graphics
+3 -38
View File
@@ -468,11 +468,10 @@ void OpenGL::deleteTexture(GLuint texture)
{ {
// glDeleteTextures binds texture 0 to all texture units the deleted texture // glDeleteTextures binds texture 0 to all texture units the deleted texture
// was bound to before deletion. // was bound to before deletion.
std::vector<GLuint>::iterator it; for (GLuint &texid : state.textureUnits)
for (it = state.textureUnits.begin(); it != state.textureUnits.end(); ++it)
{ {
if (*it == texture) if (texid == texture)
*it = 0; texid = 0;
} }
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
@@ -609,40 +608,6 @@ void OpenGL::setTextureWrap(const graphics::Texture::Wrap &w)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gt); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gt);
} }
graphics::Texture::Wrap OpenGL::getTextureWrap()
{
GLint gs, gt;
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &gs);
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &gt);
Texture::Wrap w;
switch (gs)
{
case GL_CLAMP_TO_EDGE:
w.s = Texture::WRAP_CLAMP;
break;
case GL_REPEAT:
default:
w.s = Texture::WRAP_REPEAT;
break;
}
switch (gt)
{
case GL_CLAMP_TO_EDGE:
w.t = Texture::WRAP_CLAMP;
break;
case GL_REPEAT:
default:
w.t = Texture::WRAP_REPEAT;
break;
}
return w;
}
int OpenGL::getMaxTextureSize() const int OpenGL::getMaxTextureSize() const
{ {
return maxTextureSize; return maxTextureSize;
-5
View File
@@ -286,11 +286,6 @@ public:
**/ **/
void setTextureWrap(const graphics::Texture::Wrap &w); void setTextureWrap(const graphics::Texture::Wrap &w);
/**
* Returns the texture wrap mode for the currently bound texture.
**/
graphics::Texture::Wrap getTextureWrap();
/** /**
* Returns the maximum supported width or height of a texture. * Returns the maximum supported width or height of a texture.
**/ **/
+6 -5
View File
@@ -1295,8 +1295,7 @@ do
#define number float #define number float
#define Image sampler2D #define Image sampler2D
#define extern uniform #define extern uniform
#define Texel texture2D #define Texel texture2D]]
#define love_Canvases gl_FragData]]
local GLSL_UNIFORMS = [[ local GLSL_UNIFORMS = [[
#define TransformMatrix gl_ModelViewMatrix #define TransformMatrix gl_ModelViewMatrix
@@ -1339,12 +1338,14 @@ void main() {
#define PIXEL #define PIXEL
varying vec4 VaryingTexCoord; varying vec4 VaryingTexCoord;
varying vec4 VaryingColor;]], varying vec4 VaryingColor;
#define love_Canvases gl_FragData]],
FOOTER = [[ FOOTER = [[
void main() { void main() {
// fix crashing issue in OSX when _tex0_ is unused within effect() // fix crashing issue in OSX when _tex0_ is unused within effect()
float dummy = texture2D(_tex0_, vec2(.5)).r; float dummy = Texel(_tex0_, vec2(.5)).r;
// See Shader::checkSetScreenParams in Shader.cpp. // See Shader::checkSetScreenParams in Shader.cpp.
vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w); vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w);
@@ -1355,7 +1356,7 @@ void main() {
FOOTER_MULTI_CANVAS = [[ FOOTER_MULTI_CANVAS = [[
void main() { void main() {
// fix crashing issue in OSX when _tex0_ is unused within effect() // fix crashing issue in OSX when _tex0_ is unused within effect()
float dummy = texture2D(_tex0_, vec2(.5)).r; float dummy = Texel(_tex0_, vec2(.5)).r;
// See Shader::checkSetScreenParams in Shader.cpp. // See Shader::checkSetScreenParams in Shader.cpp.
vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w); vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w);
+10 -10
View File
@@ -6276,9 +6276,7 @@ const unsigned char graphics_lua[] =
0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x75, 0x6e, 0x69,
0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x66, 0x6f, 0x72, 0x6d, 0x0a,
0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74,
0x75, 0x72, 0x65, 0x32, 0x44, 0x0a, 0x75, 0x72, 0x65, 0x32, 0x44, 0x5d, 0x5d, 0x0a,
0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x5f, 0x43, 0x61, 0x6e, 0x76, 0x61,
0x73, 0x65, 0x73, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5d, 0x5d, 0x0a,
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x55, 0x4e, 0x49, 0x46, 0x4f, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x55, 0x4e, 0x49, 0x46, 0x4f, 0x52,
0x4d, 0x53, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a, 0x4d, 0x53, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a,
0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4d, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4d,
@@ -6348,16 +6346,18 @@ const unsigned char graphics_lua[] =
0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69,
0x6e, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x6e, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a,
0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69,
0x6e, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x5d, 0x5d, 0x2c, 0x0a, 0x6e, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a,
0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x5f, 0x43, 0x61, 0x6e, 0x76, 0x61,
0x73, 0x65, 0x73, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5d, 0x5d, 0x2c, 0x0a,
0x09, 0x09, 0x46, 0x4f, 0x4f, 0x54, 0x45, 0x52, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a, 0x09, 0x09, 0x46, 0x4f, 0x4f, 0x54, 0x45, 0x52, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a,
0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a,
0x09, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x78, 0x20, 0x63, 0x72, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x09, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x78, 0x20, 0x63, 0x72, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69,
0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f, 0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f,
0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69,
0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a,
0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x54, 0x65, 0x78,
0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x65, 0x6c, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x2e, 0x35,
0x32, 0x28, 0x2e, 0x35, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68, 0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68,
0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a, 0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a,
@@ -6380,9 +6380,9 @@ const unsigned char graphics_lua[] =
0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f, 0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f,
0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69,
0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a, 0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a,
0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x54, 0x65, 0x78,
0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x65, 0x6c, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x2e, 0x35,
0x32, 0x28, 0x2e, 0x35, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68, 0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68,
0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a, 0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a,