summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llglheaders.h44
-rw-r--r--indra/llrender/llglslshader.cpp2
-rw-r--r--indra/llrender/llrendertarget.cpp8
-rw-r--r--indra/llrender/llvertexbuffer.cpp17
4 files changed, 68 insertions, 3 deletions
diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h
index 94f7a08c92..f35f329f00 100644
--- a/indra/llrender/llglheaders.h
+++ b/indra/llrender/llglheaders.h
@@ -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
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 5473f23d86..8e99f62de6 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -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)
{
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 715f466314..e773a639b0 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -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
}
}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 74fd3bf197..3197866fa9 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -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();