summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llfontregistry.cpp3
-rw-r--r--indra/llrender/llgl.cpp81
-rw-r--r--indra/llrender/llgl.h2
-rw-r--r--indra/llrender/llimagegl.cpp89
-rw-r--r--indra/llrender/llimagegl.h3
-rw-r--r--indra/llrender/llrender.cpp88
-rw-r--r--indra/llrender/llrender2dutils.h1
-rw-r--r--indra/llrender/llrendertarget.cpp10
-rw-r--r--indra/llrender/llshadermgr.cpp2
-rw-r--r--indra/llrender/llvertexbuffer.cpp32
10 files changed, 216 insertions, 95 deletions
diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp
index dbe71e2882..33a33af160 100644
--- a/indra/llrender/llfontregistry.cpp
+++ b/indra/llrender/llfontregistry.cpp
@@ -45,6 +45,7 @@ bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc);
bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node);
const std::string MACOSX_FONT_PATH_LIBRARY = "/Library/Fonts/";
+const std::string MACOSX_FONT_SUPPLEMENTAL = "Supplemental/";
LLFontDescriptor::LLFontDescriptor():
mStyle(0)
@@ -473,6 +474,8 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
font_paths.push_back(sys_path + *file_name_it);
#if LL_DARWIN
font_paths.push_back(MACOSX_FONT_PATH_LIBRARY + *file_name_it);
+ font_paths.push_back(MACOSX_FONT_PATH_LIBRARY + MACOSX_FONT_SUPPLEMENTAL + *file_name_it);
+ font_paths.push_back(sys_path + MACOSX_FONT_SUPPLEMENTAL + *file_name_it);
#endif
bool is_ft_collection = (std::find(ft_collection_list.begin(), ft_collection_list.end(), *file_name_it) != ft_collection_list.end());
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 498dfca1a3..ee02a90b54 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -965,6 +965,80 @@ std::string LLGLManager::getRawGLString()
return gl_string;
}
+void LLGLManager::asLLSD(LLSD& info)
+{
+ // Currently these are duplicates of fields in "system".
+ info["gpu_vendor"] = mGLVendorShort;
+ info["gpu_version"] = mDriverVersionVendorString;
+ info["opengl_version"] = mGLVersionString;
+
+ info["vram"] = mVRAM;
+
+ // Extensions used by everyone
+ info["has_multitexture"] = mHasMultitexture;
+ info["has_ati_mem_info"] = mHasATIMemInfo;
+ info["has_nvx_mem_info"] = mHasNVXMemInfo;
+ info["num_texture_units"] = mNumTextureUnits;
+ info["has_mip_map_generation"] = mHasMipMapGeneration;
+ info["has_compressed_textures"] = mHasCompressedTextures;
+ info["has_framebuffer_object"] = mHasFramebufferObject;
+ info["max_samples"] = mMaxSamples;
+ info["has_blend_func_separate"] = mHasBlendFuncSeparate;
+
+ // ARB Extensions
+ info["has_vertex_buffer_object"] = mHasVertexBufferObject;
+ info["has_vertex_array_object"] = mHasVertexArrayObject;
+ info["has_sync"] = mHasSync;
+ info["has_map_buffer_range"] = mHasMapBufferRange;
+ info["has_flush_buffer_range"] = mHasFlushBufferRange;
+ info["has_pbuffer"] = mHasPBuffer;
+ info["has_shader_objects"] = mHasShaderObjects;
+ info["has_vertex_shader"] = mHasVertexShader;
+ info["has_fragment_shader"] = mHasFragmentShader;
+ info["num_texture_image_units"] = mNumTextureImageUnits;
+ info["has_occlusion_query"] = mHasOcclusionQuery;
+ info["has_timer_query"] = mHasTimerQuery;
+ info["has_occlusion_query2"] = mHasOcclusionQuery2;
+ info["has_point_parameters"] = mHasPointParameters;
+ info["has_draw_buffers"] = mHasDrawBuffers;
+ info["has_depth_clamp"] = mHasDepthClamp;
+ info["has_texture_rectangle"] = mHasTextureRectangle;
+ info["has_texture_multisample"] = mHasTextureMultisample;
+ info["has_transform_feedback"] = mHasTransformFeedback;
+ info["max_sample_mask_words"] = mMaxSampleMaskWords;
+ info["max_color_texture_samples"] = mMaxColorTextureSamples;
+ info["max_depth_texture_samples"] = mMaxDepthTextureSamples;
+ info["max_integer_samples"] = mMaxIntegerSamples;
+
+ // Other extensions.
+ info["has_anisotropic"] = mHasAnisotropic;
+ info["has_arb_env_combine"] = mHasARBEnvCombine;
+ info["has_cube_map"] = mHasCubeMap;
+ info["has_debug_output"] = mHasDebugOutput;
+ info["has_srgb_texture"] = mHassRGBTexture;
+ info["has_srgb_framebuffer"] = mHassRGBFramebuffer;
+ info["has_texture_srgb_decode"] = mHasTexturesRGBDecode;
+
+ // Vendor-specific extensions
+ info["is_ati"] = mIsATI;
+ info["is_nvidia"] = mIsNVIDIA;
+ info["is_intel"] = mIsIntel;
+ info["is_gf2or4mx"] = mIsGF2or4MX;
+ info["is_gf3"] = mIsGF3;
+ info["is_gf_gfx"] = mIsGFFX;
+ info["ati_offset_vertical_lines"] = mATIOffsetVerticalLines;
+ info["ati_old_driver"] = mATIOldDriver;
+
+ // Other fields
+ info["has_requirements"] = mHasRequirements;
+ info["has_separate_specular_color"] = mHasSeparateSpecularColor;
+ info["debug_gpu"] = mDebugGPU;
+ info["max_vertex_range"] = mGLMaxVertexRange;
+ info["max_index_range"] = mGLMaxIndexRange;
+ info["max_texture_size"] = mGLMaxTextureSize;
+ info["gl_renderer"] = mGLRenderer;
+}
+
void LLGLManager::shutdownGL()
{
if (mInited)
@@ -2700,10 +2774,11 @@ LLGLSPipelineBlendSkyBox::LLGLSPipelineBlendSkyBox(bool depth_test, bool depth_w
}
#if LL_WINDOWS
-// Expose desired use of high-performance graphics processor to Optimus driver
+// Expose desired use of high-performance graphics processor to Optimus driver and to AMD driver
extern "C"
-{
- _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+{
+ __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 91ef4e9102..966c4b3c77 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -165,6 +165,8 @@ public:
void printGLInfoString();
void getGLInfo(LLSD& info);
+ void asLLSD(LLSD& info);
+
// In ALL CAPS
std::string mGLVendor;
std::string mGLVendorShort;
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index ff74380217..0151d20128 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -985,38 +985,56 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image)
return FALSE;
}
- if( !mHasExplicitFormat )
- {
- switch (mComponents)
- {
- case 1:
- // Use luminance alpha (for fonts)
- mFormatInternal = GL_LUMINANCE8;
- mFormatPrimary = GL_LUMINANCE;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 2:
- // Use luminance alpha (for fonts)
- mFormatInternal = GL_LUMINANCE8_ALPHA8;
- mFormatPrimary = GL_LUMINANCE_ALPHA;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 3:
- mFormatInternal = GL_RGB8;
- mFormatPrimary = GL_RGB;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- case 4:
- mFormatInternal = GL_RGBA8;
- mFormatPrimary = GL_RGBA;
- mFormatType = GL_UNSIGNED_BYTE;
- break;
- default:
- LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL;
- }
- }
+ if (!mHasExplicitFormat)
+ {
+ switch (mComponents)
+ {
+ case 1:
+ // Use luminance alpha (for fonts)
+ mFormatInternal = GL_LUMINANCE8;
+ mFormatPrimary = GL_LUMINANCE;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 2:
+ // Use luminance alpha (for fonts)
+ mFormatInternal = GL_LUMINANCE8_ALPHA8;
+ mFormatPrimary = GL_LUMINANCE_ALPHA;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 3:
+#if USE_SRGB_DECODE
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ mFormatInternal = GL_SRGB8;
+ }
+ else
+#endif
+ {
+ mFormatInternal = GL_RGB8;
+ }
+ mFormatPrimary = GL_RGB;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ case 4:
+#if USE_SRGB_DECODE
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ mFormatInternal = GL_SRGB8_ALPHA8;
+ }
+ else
+#endif
+ {
+ mFormatInternal = GL_RGBA8;
+ }
+ mFormatPrimary = GL_RGBA;
+ mFormatType = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ LL_ERRS() << "Bad number of components for texture: " << (U32) getComponents() << LL_ENDL;
+ }
+ }
- mCurrentDiscardLevel = discard_level;
+ mCurrentDiscardLevel = discard_level;
mDiscardLevelInAtlas = discard_level;
mTexelsInAtlas = raw_image->getWidth() * raw_image->getHeight() ;
mLastBindTime = sLastFrameTime;
@@ -1368,6 +1386,15 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
return FALSE;
}
+ if (mHasExplicitFormat &&
+ ((mFormatPrimary == GL_RGBA && mComponents < 4) ||
+ (mFormatPrimary == GL_RGB && mComponents < 3)))
+
+ {
+ LL_WARNS() << "Incorrect format: " << std::hex << mFormatPrimary << " components: " << (U32)mComponents << LL_ENDL;
+ mHasExplicitFormat = FALSE;
+ }
+
if( !mHasExplicitFormat )
{
switch (mComponents)
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index 4f3d7eed0a..61ddc8d59b 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -133,6 +133,7 @@ public:
S32 getMipBytes(S32 discard_level = -1) const;
BOOL getBoundRecently() const;
BOOL isJustBound() const;
+ BOOL getHasExplicitFormat() const { return mHasExplicitFormat; }
LLGLenum getPrimaryFormat() const { return mFormatPrimary; }
LLGLenum getFormatType() const { return mFormatType; }
@@ -197,7 +198,7 @@ private:
U16 mPickMaskWidth;
U16 mPickMaskHeight;
S8 mUseMipMaps;
- S8 mHasExplicitFormat; // If false (default), GL format is f(mComponents)
+ BOOL mHasExplicitFormat; // If false (default), GL format is f(mComponents)
S8 mAutoGenMips;
BOOL mIsMask;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index ebc4659bcf..11d9ef3f57 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -849,26 +849,32 @@ void LLTexUnit::debugTextureUnit(void)
}
}
-void LLTexUnit::setTextureColorSpace(eTextureColorSpace space) {
+void LLTexUnit::setTextureColorSpace(eTextureColorSpace space)
+{
mTexColorSpace = space;
#if USE_SRGB_DECODE
- if (gGLManager.mHasTexturesRGBDecode) {
-
- if (space == TCS_SRGB) {
+ if (gGLManager.mHasTexturesRGBDecode)
+ {
+ if (space == TCS_SRGB)
+ {
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
}
- else {
+ else
+ {
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
}
- if (gDebugGL) {
+ if (gDebugGL)
+ {
assert_glerror();
}
}
+ else
#endif
- glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
-
+ {
+ glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
+ }
}
LLLightState::LLLightState(S32 index)
@@ -1192,46 +1198,46 @@ void LLRender::refreshState(void)
void LLRender::syncLightState()
{
- LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ LLGLSLShader *shader = LLGLSLShader::sCurBoundShaderPtr;
- if (!shader)
- {
- return;
- }
+ if (!shader)
+ {
+ return;
+ }
- if (shader->mLightHash != mLightHash)
- {
- shader->mLightHash = mLightHash;
+ if (shader->mLightHash != mLightHash)
+ {
+ shader->mLightHash = mLightHash;
- LLVector4 position[8];
- LLVector3 direction[8];
- LLVector4 attenuation[8];
- LLVector3 diffuse[8];
- LLVector3 diffuse_b[8];
- bool sun_primary[8];
+ LLVector4 position[LL_NUM_LIGHT_UNITS];
+ LLVector3 direction[LL_NUM_LIGHT_UNITS];
+ LLVector4 attenuation[LL_NUM_LIGHT_UNITS];
+ LLVector3 diffuse[LL_NUM_LIGHT_UNITS];
+ LLVector3 diffuse_b[LL_NUM_LIGHT_UNITS];
+ bool sun_primary[LL_NUM_LIGHT_UNITS];
- for (U32 i = 0; i < 8; i++)
- {
- LLLightState* light = mLightState[i];
+ for (U32 i = 0; i < LL_NUM_LIGHT_UNITS; i++)
+ {
+ LLLightState *light = mLightState[i];
- position[i] = light->mPosition;
- direction[i] = light->mSpotDirection;
+ position[i] = light->mPosition;
+ direction[i] = light->mSpotDirection;
attenuation[i].set(light->mLinearAtten, light->mQuadraticAtten, light->mSpecular.mV[2], light->mSpecular.mV[3]);
- diffuse[i].set(light->mDiffuse.mV);
+ diffuse[i].set(light->mDiffuse.mV);
diffuse_b[i].set(light->mDiffuseB.mV);
sun_primary[i] = light->mSunIsPrimary;
- }
+ }
- shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, 8, position[0].mV);
- shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, 8, direction[0].mV);
- shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, 8, attenuation[0].mV);
- shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
- shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
+ shader->uniform4fv(LLShaderMgr::LIGHT_POSITION, LL_NUM_LIGHT_UNITS, position[0].mV);
+ shader->uniform3fv(LLShaderMgr::LIGHT_DIRECTION, LL_NUM_LIGHT_UNITS, direction[0].mV);
+ shader->uniform4fv(LLShaderMgr::LIGHT_ATTENUATION, LL_NUM_LIGHT_UNITS, attenuation[0].mV);
+ shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, LL_NUM_LIGHT_UNITS, diffuse[0].mV);
+ shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);
shader->uniform4fv(LLShaderMgr::AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
- }
+ }
}
void LLRender::syncMatrices()
@@ -1539,11 +1545,17 @@ void LLRender::matrixMode(eMatrixMode mode)
{
U32 tex_index = gGL.getCurrentTexUnitIndex();
// the shaders don't actually reference anything beyond texture_matrix0/1 outside of terrain rendering
- llassert_always(tex_index <= 3);
- mode = eMatrixMode(MM_TEXTURE0 + gGL.getCurrentTexUnitIndex());
+ llassert(tex_index <= 3);
+ mode = eMatrixMode(MM_TEXTURE0 + tex_index);
+ if (mode > MM_TEXTURE3)
+ {
+ // getCurrentTexUnitIndex() can go as high as 32 (LL_NUM_TEXTURE_LAYERS)
+ // Large value will result in a crash at mMatrix
+ LL_WARNS_ONCE() << "Attempted to assign matrix mode out of bounds: " << mode << LL_ENDL;
+ mode = MM_TEXTURE0;
+ }
}
- llassert(mode < NUM_MATRIX_MODES);
mMatrixMode = mode;
}
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index 70ab006fd6..8c01784071 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -32,6 +32,7 @@
#include "llpointer.h" // LLPointer<>
#include "llrect.h"
+#include "llsingleton.h"
#include "llglslshader.h"
class LLColor4;
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 9fb4f7f2b0..e3c0255290 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -501,23 +501,23 @@ U32 LLRenderTarget::getNumTextures() const
return mTex.size();
}
-
void LLRenderTarget::bindTexture(U32 index, S32 channel, LLTexUnit::eTextureFilterOptions filter_options)
{
- gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index));
+ gGL.getTexUnit(channel)->bindManual(mUsage, getTexture(index));
bool isSRGB = false;
llassert(mInternalFormat.size() > index);
switch (mInternalFormat[index])
{
- case GL_SRGB_ALPHA:
case GL_SRGB:
+ case GL_SRGB8:
+ case GL_SRGB_ALPHA:
case GL_SRGB8_ALPHA8:
isSRGB = true;
- break;
+ break;
default:
- break;
+ break;
}
gGL.getTexUnit(channel)->setTextureFilteringOption(filter_options);
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 1383020873..236ebbd78f 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1180,7 +1180,7 @@ void LLShaderMgr::initAttribsAndUniforms()
llassert(mReservedUniforms.size() == LLShaderMgr::MULTI_LIGHT_FAR_Z+1);
-
+ //NOTE: MUST match order in eGLSLReservedUniforms
mReservedUniforms.push_back("proj_mat");
mReservedUniforms.push_back("proj_near");
mReservedUniforms.push_back("proj_p");
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 6a02cd9c19..7d2b09ca4a 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1193,7 +1193,7 @@ bool LLVertexBuffer::createGLBuffer(U32 size)
return true;
}
- bool sucsess = true;
+ bool success = true;
mEmpty = true;
@@ -1215,9 +1215,9 @@ bool LLVertexBuffer::createGLBuffer(U32 size)
if (!mMappedData)
{
- sucsess = false;
+ success = false;
}
- return sucsess;
+ return success;
}
bool LLVertexBuffer::createGLIndices(U32 size)
@@ -1232,7 +1232,7 @@ bool LLVertexBuffer::createGLIndices(U32 size)
return true;
}
- bool sucsess = true;
+ bool success = true;
mEmpty = true;
@@ -1257,9 +1257,9 @@ bool LLVertexBuffer::createGLIndices(U32 size)
if (!mMappedIndexData)
{
- sucsess = false;
+ success = false;
}
- return sucsess;
+ return success;
}
void LLVertexBuffer::destroyGLBuffer()
@@ -1306,7 +1306,7 @@ bool LLVertexBuffer::updateNumVerts(S32 nverts)
{
llassert(nverts >= 0);
- bool sucsess = true;
+ bool success = true;
if (nverts > 65536)
{
@@ -1318,34 +1318,34 @@ bool LLVertexBuffer::updateNumVerts(S32 nverts)
if (needed_size > mSize || needed_size <= mSize/2)
{
- sucsess &= createGLBuffer(needed_size);
+ success &= createGLBuffer(needed_size);
}
sVertexCount -= mNumVerts;
mNumVerts = nverts;
sVertexCount += mNumVerts;
- return sucsess;
+ return success;
}
bool LLVertexBuffer::updateNumIndices(S32 nindices)
{
llassert(nindices >= 0);
- bool sucsess = true;
+ bool success = true;
U32 needed_size = sizeof(U16) * nindices;
if (needed_size > mIndicesSize || needed_size <= mIndicesSize/2)
{
- sucsess &= createGLIndices(needed_size);
+ success &= createGLIndices(needed_size);
}
sIndexCount -= mNumIndices;
mNumIndices = nindices;
sIndexCount += mNumIndices;
- return sucsess;
+ return success;
}
bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
@@ -1358,10 +1358,10 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
LL_ERRS() << "Bad vertex buffer allocation: " << nverts << " : " << nindices << LL_ENDL;
}
- bool sucsess = true;
+ bool success = true;
- sucsess &= updateNumVerts(nverts);
- sucsess &= updateNumIndices(nindices);
+ success &= updateNumVerts(nverts);
+ success &= updateNumIndices(nindices);
if (create && (nverts || nindices))
{
@@ -1377,7 +1377,7 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
}
}
- return sucsess;
+ return success;
}
static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO");