Mac build fixes.

Reviewed by davep.
meow-7.2.2
Leslie Linden 2011-06-03 16:24:07 -07:00
parent b77e027fcc
commit ffab1eef57
4 changed files with 68 additions and 3 deletions

View File

@ -736,13 +736,55 @@ extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_A
#ifndef GL_ARB_framebuffer_object
#define glGenerateMipmap glGenerateMipmapEXT
#define GL_MAX_SAMPLES 0x8D57
#endif
// GL_ARB_draw_buffers
extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
#ifdef __cplusplus
extern "C" {
#endif
//
// Define map buffer range headers on Mac
//
#ifndef GL_ARB_map_buffer_range
#define GL_MAP_READ_BIT 0x0001
#define GL_MAP_WRITE_BIT 0x0002
#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
#endif
//
// Define multisample headers on Mac
//
#ifndef GL_ARB_texture_multisample
#define GL_SAMPLE_POSITION 0x8E50
#define GL_SAMPLE_MASK 0x8E51
#define GL_SAMPLE_MASK_VALUE 0x8E52
#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
#define GL_TEXTURE_SAMPLES 0x9106
#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
#define GL_MAX_INTEGER_SAMPLES 0x9110
#endif
//
// Define vertex buffer object headers on Mac
//
@ -779,7 +821,7 @@ extern "C" {
#define GL_DYNAMIC_READ_ARB 0x88E9
#define GL_DYNAMIC_COPY_ARB 0x88EA
#endif
#ifndef GL_ARB_vertex_buffer_object

View File

@ -48,7 +48,7 @@ using std::pair;
using std::make_pair;
using std::string;
U32 LLGLSLShader::sCurBoundShader = 0;
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
BOOL shouldChange(const LLVector4& v1, const LLVector4& v2)
{

View File

@ -154,11 +154,15 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt)
stop_glerror();
#ifdef GL_ARB_texture_multisample
if (mSamples > 1)
{
glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, color_fmt, mResX, mResY, GL_TRUE);
}
else
#else
llassert_always(mSamples <= 1);
#endif
{
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
@ -234,10 +238,14 @@ void LLRenderTarget::allocateDepth()
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
}
#ifdef GL_ARB_texture_multisample
else
{
glTexImage2DMultisample(LLTexUnit::getInternalType(mUsage), mSamples, GL_DEPTH_COMPONENT32, mResX, mResY, GL_TRUE);
}
#else
llassert_always(mSamples <= 1);
#endif
}
}

View File

@ -1017,6 +1017,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
else
{
U8* src = NULL;
#ifdef GL_ARB_map_buffer_range
if (gGLManager.mHasMapBufferRange)
{
if (map_range)
@ -1031,6 +1032,9 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
}
}
else
#else
llassert_always(!gGLManager.mHasMapBufferRange);
#endif
{
map_range = false;
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
@ -1156,6 +1160,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
else
{
U8* src = NULL;
#ifdef GL_ARB_map_buffer_range
if (gGLManager.mHasMapBufferRange)
{
if (map_range)
@ -1170,6 +1175,9 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
}
}
else
#else
llassert_always(!gGLManager.mHasMapBufferRange);
#endif
{
map_range = false;
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
@ -1241,6 +1249,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
}
else
{
#ifdef GL_ARB_map_buffer_range
if (gGLManager.mHasMapBufferRange)
{
if (!mMappedVertexRegions.empty())
@ -1258,6 +1267,9 @@ void LLVertexBuffer::unmapBuffer(S32 type)
mMappedVertexRegions.clear();
}
}
#else
llassert_always(!gGLManager.mHasMapBufferRange);
#endif
stop_glerror();
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
stop_glerror();
@ -1279,7 +1291,7 @@ void LLVertexBuffer::unmapBuffer(S32 type)
}
else
{
#ifdef GL_ARB_map_buffer_range
if (gGLManager.mHasMapBufferRange)
{
if (!mMappedIndexRegions.empty())
@ -1296,6 +1308,9 @@ void LLVertexBuffer::unmapBuffer(S32 type)
mMappedIndexRegions.clear();
}
}
#else
llassert_always(!gGLManager.mHasMapBufferRange);
#endif
stop_glerror();
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
stop_glerror();