| 1286 | } |
| 1287 | |
| 1288 | void GLRenderState::ApplyState(WrappedOpenGL *driver) |
| 1289 | { |
| 1290 | ContextPair &ctx = driver->GetCtx(); |
| 1291 | |
| 1292 | if(!ContextPresent || ctx.ctx == NULL) |
| 1293 | return; |
| 1294 | |
| 1295 | for(GLuint i = 0; i < eEnabled_Count; i++) |
| 1296 | { |
| 1297 | if(!CheckEnableDisableParam(enable_disable_cap[i].cap)) |
| 1298 | continue; |
| 1299 | |
| 1300 | if(Enabled[i]) |
| 1301 | GL.glEnable(enable_disable_cap[i].cap); |
| 1302 | else |
| 1303 | GL.glDisable(enable_disable_cap[i].cap); |
| 1304 | } |
| 1305 | |
| 1306 | GLuint maxTextures = 0; |
| 1307 | GL.glGetIntegerv(eGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, (GLint *)&maxTextures); |
| 1308 | |
| 1309 | for(GLuint i = 0; i < RDCMIN(maxTextures, (GLuint)ARRAY_COUNT(Tex2D)); i++) |
| 1310 | { |
| 1311 | GL.glActiveTexture(GLenum(eGL_TEXTURE0 + i)); |
| 1312 | |
| 1313 | if(!IsGLES) |
| 1314 | GL.glBindTexture(eGL_TEXTURE_1D, Tex1D[i].name); |
| 1315 | |
| 1316 | GL.glBindTexture(eGL_TEXTURE_2D, Tex2D[i].name); |
| 1317 | GL.glBindTexture(eGL_TEXTURE_3D, Tex3D[i].name); |
| 1318 | |
| 1319 | if(!IsGLES) |
| 1320 | GL.glBindTexture(eGL_TEXTURE_1D_ARRAY, Tex1DArray[i].name); |
| 1321 | |
| 1322 | GL.glBindTexture(eGL_TEXTURE_2D_ARRAY, Tex2DArray[i].name); |
| 1323 | |
| 1324 | if(!IsGLES) |
| 1325 | GL.glBindTexture(eGL_TEXTURE_RECTANGLE, TexRect[i].name); |
| 1326 | |
| 1327 | if(HasExt[ARB_texture_buffer_object]) |
| 1328 | GL.glBindTexture(eGL_TEXTURE_BUFFER, TexBuffer[i].name); |
| 1329 | |
| 1330 | GL.glBindTexture(eGL_TEXTURE_CUBE_MAP, TexCube[i].name); |
| 1331 | |
| 1332 | if(HasExt[ARB_texture_multisample_no_array] || HasExt[ARB_texture_multisample]) |
| 1333 | GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE, Tex2DMS[i].name); |
| 1334 | |
| 1335 | if(HasExt[ARB_texture_multisample]) |
| 1336 | GL.glBindTexture(eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, Tex2DMSArray[i].name); |
| 1337 | |
| 1338 | if(HasExt[ARB_sampler_objects]) |
| 1339 | GL.glBindSampler(i, Samplers[i].name); |
| 1340 | |
| 1341 | if(HasExt[ARB_texture_cube_map_array]) |
| 1342 | GL.glBindTexture(eGL_TEXTURE_CUBE_MAP_ARRAY, TexCubeArray[i].name); |
| 1343 | } |
| 1344 | |
| 1345 | if(HasExt[ARB_shader_image_load_store]) |
no test coverage detected