| 118 | } |
| 119 | |
| 120 | void GFXGLDevice::initGLState() |
| 121 | { |
| 122 | // We don't currently need to sync device state with a known good place because we are |
| 123 | // going to set everything in GFXGLStateBlock, but if we change our GFXGLStateBlock strategy, this may |
| 124 | // need to happen. |
| 125 | |
| 126 | // Deal with the card profiler here when we know we have a valid context. |
| 127 | mCardProfiler = new GFXGLCardProfiler(); |
| 128 | mCardProfiler->init(); |
| 129 | glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*)&mMaxShaderTextures); |
| 130 | // JTH: Needs removed, ffp |
| 131 | //glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint*)&mMaxFFTextures); |
| 132 | glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, (GLint*)&mMaxTRColors); |
| 133 | mMaxTRColors = getMin( mMaxTRColors, (U32)(GFXTextureTarget::MaxRenderSlotId-1) ); |
| 134 | |
| 135 | glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 136 | |
| 137 | // [JTH 5/6/2016] GLSL 1.50 is really SM 4.0 |
| 138 | // Setting mPixelShaderVersion to 3.0 will allow Advanced Lighting to run. |
| 139 | mPixelShaderVersion = 3.0; |
| 140 | |
| 141 | // Set capability extensions. |
| 142 | mCapabilities.anisotropicFiltering = mCardProfiler->queryProfile("GL_EXT_texture_filter_anisotropic"); |
| 143 | mCapabilities.bufferStorage = mCardProfiler->queryProfile("GL_ARB_buffer_storage"); |
| 144 | mCapabilities.textureStorage = mCardProfiler->queryProfile("GL_ARB_texture_storage"); |
| 145 | mCapabilities.copyImage = mCardProfiler->queryProfile("GL_ARB_copy_image"); |
| 146 | mCapabilities.vertexAttributeBinding = mCardProfiler->queryProfile("GL_ARB_vertex_attrib_binding"); |
| 147 | mCapabilities.khrDebug = mCardProfiler->queryProfile("GL_KHR_debug"); |
| 148 | mCapabilities.extDebugMarker = mCardProfiler->queryProfile("GL_EXT_debug_marker"); |
| 149 | |
| 150 | String vendorStr = (const char*)glGetString( GL_VENDOR ); |
| 151 | if( vendorStr.find("NVIDIA", 0, String::NoCase | String::Left) != String::NPos) |
| 152 | mUseGlMap = false; |
| 153 | |
| 154 | // Workaround for all Mac's, has a problem using glMap* with volatile buffers |
| 155 | #ifdef TORQUE_OS_MAC |
| 156 | mUseGlMap = false; |
| 157 | #endif |
| 158 | |
| 159 | #if TORQUE_DEBUG |
| 160 | if( gglHasExtension(ARB_debug_output) ) |
| 161 | { |
| 162 | glEnable(GL_DEBUG_OUTPUT); |
| 163 | glDebugMessageCallbackARB(glDebugCallback, NULL); |
| 164 | glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); |
| 165 | GLuint unusedIds = 0; |
| 166 | glDebugMessageControlARB(GL_DONT_CARE, |
| 167 | GL_DONT_CARE, |
| 168 | GL_DONT_CARE, |
| 169 | 0, |
| 170 | &unusedIds, |
| 171 | GL_TRUE); |
| 172 | } |
| 173 | else if(gglHasExtension(AMD_debug_output)) |
| 174 | { |
| 175 | glEnable(GL_DEBUG_OUTPUT); |
| 176 | glDebugMessageCallbackAMD(glAmdDebugCallback, NULL); |
| 177 | //glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); |
nothing calls this directly
no test coverage detected