Lines Matching refs:ctx
80 delete_dummy_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
93 _mesa_init_fbobjects(struct gl_context *ctx)
113 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id)
121 _mesa_HashLookup(ctx->Shared->RenderBuffers, id);
130 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id)
138 _mesa_HashLookup(ctx->Shared->FrameBuffers, id);
163 get_framebuffer_target(struct gl_context *ctx, GLenum target)
167 return ctx->Extensions.EXT_framebuffer_blit && _mesa_is_desktop_gl(ctx)
168 ? ctx->DrawBuffer : NULL;
170 return ctx->Extensions.EXT_framebuffer_blit && _mesa_is_desktop_gl(ctx)
171 ? ctx->ReadBuffer : NULL;
173 return ctx->DrawBuffer;
189 _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
218 if (i >= ctx->Const.MaxColorAttachments
219 || (i > 0 && ctx->API == API_OPENGLES)) {
224 if (!_mesa_is_desktop_gl(ctx))
242 _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
302 _mesa_remove_attachment(struct gl_context *ctx,
307 if (ctx->Driver.FinishRenderTexture) {
309 ctx->Driver.FinishRenderTexture(ctx, att);
329 _mesa_set_texture_attachment(struct gl_context *ctx,
338 if (ctx->Driver.FinishRenderTexture)
339 ctx->Driver.FinishRenderTexture(ctx, att);
343 if (ctx->Driver.FinishRenderTexture && att->Texture)
344 ctx->Driver.FinishRenderTexture(ctx, att);
345 _mesa_remove_attachment(ctx, att);
358 ctx->Driver.RenderTexture(ctx, fb, att);
370 _mesa_set_renderbuffer_attachment(struct gl_context *ctx,
375 _mesa_remove_attachment(ctx, att);
384 * Fallback for ctx->Driver.FramebufferRenderbuffer()
388 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
396 att = _mesa_get_attachment(ctx, fb, attachment);
399 _mesa_set_renderbuffer_attachment(ctx, att, rb);
402 att = _mesa_get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT);
404 _mesa_set_renderbuffer_attachment(ctx, att, rb);
409 _mesa_remove_attachment(ctx, att);
419 * Fallback for ctx->Driver.ValidateFramebuffer()
425 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
484 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
494 return ctx->Extensions.ARB_framebuffer_object;
497 return ctx->Extensions.ARB_texture_rg;
508 is_legal_depth_format(const struct gl_context *ctx, GLenum baseFormat)
527 test_attachment_completeness(const struct gl_context *ctx, GLenum format,
569 if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
584 else if (ctx->Extensions.EXT_packed_depth_stencil &&
585 ctx->Extensions.ARB_depth_texture &&
597 if (ctx->Extensions.EXT_packed_depth_stencil &&
598 ctx->Extensions.ARB_depth_texture &&
623 if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
633 else if (ctx->Extensions.EXT_packed_depth_stencil &&
648 else if (ctx->Extensions.EXT_packed_depth_stencil &&
670 * Calls the ctx->Driver.ValidateFramebuffer() function to allow the
676 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
689 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
700 for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) {
714 test_attachment_completeness(ctx, GL_DEPTH, att);
723 test_attachment_completeness(ctx, GL_STENCIL, att);
732 test_attachment_completeness(ctx, GL_COLOR, att);
752 if (!_mesa_is_legal_color_format(ctx, f) &&
753 !is_legal_depth_format(ctx, f)) {
790 if (!ctx->Extensions.ARB_framebuffer_object) {
823 if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) {
825 for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
828 = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]);
841 = _mesa_get_attachment(ctx, fb, fb->ColorReadBuffer);
867 if (ctx->Driver.ValidateFramebuffer) {
868 ctx->Driver.ValidateFramebuffer(ctx, fb);
884 _mesa_update_framebuffer_visual(ctx, fb);
892 GET_CURRENT_CONTEXT(ctx);
893 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
895 struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
907 GET_CURRENT_CONTEXT(ctx);
909 ASSERT_OUTSIDE_BEGIN_END(ctx);
912 _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)");
921 newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
926 else if (!newRb && ctx->Extensions.ARB_framebuffer_object) {
928 _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(buffer)");
934 newRb = ctx->Driver.NewRenderbuffer(ctx, renderbuffer);
936 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindRenderbufferEXT");
940 _mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb);
950 _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb);
961 detach_renderbuffer(struct gl_context *ctx,
968 _mesa_remove_attachment(ctx, &fb->Attachment[i]);
979 GET_CURRENT_CONTEXT(ctx);
981 ASSERT_OUTSIDE_BEGIN_END(ctx);
982 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
987 rb = _mesa_lookup_renderbuffer(ctx, renderbuffers[i]);
990 if (rb == ctx->CurrentRenderbuffer) {
996 if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
997 detach_renderbuffer(ctx, ctx->DrawBuffer, rb);
999 if (_mesa_is_user_fbo(ctx->ReadBuffer)
1000 && ctx->ReadBuffer != ctx->DrawBuffer) {
1001 detach_renderbuffer(ctx, ctx->ReadBuffer, rb);
1008 _mesa_HashRemove(ctx->Shared->RenderBuffers, renderbuffers[i]);
1023 GET_CURRENT_CONTEXT(ctx);
1027 ASSERT_OUTSIDE_BEGIN_END(ctx);
1030 _mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)");
1037 first = _mesa_HashFindFreeKeyBlock(ctx->Shared->RenderBuffers, n);
1043 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
1044 _mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer);
1045 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1066 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
1078 return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
1085 return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
1094 return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
1101 return ctx->API == API_OPENGL && ctx->Extensions.ARB_framebuffer_object
1112 return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
1114 return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGB : 0;
1123 return _mesa_is_desktop_gl(ctx) ? GL_RGBA : 0;
1126 return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGBA : 0;
1134 return _mesa_is_desktop_gl(ctx) ? GL_STENCIL_INDEX : 0;
1139 return _mesa_is_desktop_gl(ctx) ? GL_DEPTH_COMPONENT : 0;
1144 return _mesa_is_desktop_gl(ctx)
1145 && ctx->Extensions.EXT_packed_depth_stencil
1148 return ctx->Extensions.EXT_packed_depth_stencil
1151 return ctx->Version >= 30
1152 || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
1155 return ctx->Version >= 30
1156 || (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_buffer_float)
1160 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_rg
1163 return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
1167 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_rg
1170 return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
1174 return ctx->Version >= 30
1175 || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
1179 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
1182 return ctx->Version >= 30
1183 || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
1187 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
1190 return ctx->Version >= 30
1191 || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
1195 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
1198 return ctx->Version >= 30
1199 || (ctx->API == API_OPENGL && ctx->Extensions.EXT_texture_snorm)
1203 return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
1208 return ctx->API == API_OPENGL &&
1209 ctx->Extensions.EXT_texture_snorm &&
1210 ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
1214 return ctx->API == API_OPENGL &&
1215 ctx->Extensions.EXT_texture_snorm &&
1216 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
1220 return ctx->API == API_OPENGL &&
1221 ctx->Extensions.EXT_texture_snorm &&
1222 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
1226 return ctx->API == API_OPENGL &&
1227 ctx->Extensions.EXT_texture_snorm &&
1228 ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
1231 return ctx->Version >= 30
1232 || (ctx->API == API_OPENGL &&
1233 ctx->Extensions.ARB_texture_rg &&
1234 ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
1237 return ctx->Version >= 30
1238 || (ctx->API == API_OPENGL &&
1239 ctx->Extensions.ARB_texture_rg &&
1240 ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
1243 return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
1244 || _mesa_is_gles3(ctx)
1248 return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
1249 || _mesa_is_gles3(ctx)
1253 return ctx->API == API_OPENGL &&
1254 ctx->Extensions.ARB_texture_float &&
1255 ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
1258 return ctx->API == API_OPENGL &&
1259 ctx->Extensions.ARB_texture_float &&
1260 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
1263 return ctx->API == API_OPENGL &&
1264 ctx->Extensions.ARB_texture_float &&
1265 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
1268 return ctx->API == API_OPENGL &&
1269 ctx->Extensions.ARB_texture_float &&
1270 ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
1272 return (_mesa_is_desktop_gl(ctx)
1273 && ctx->Extensions.EXT_texture_shared_exponent)
1274 || _mesa_is_gles3(ctx) ? GL_RGB : 0;
1276 return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
1277 || _mesa_is_gles3(ctx) ? GL_RGB : 0;
1285 return ctx->Version >= 30
1286 || (_mesa_is_desktop_gl(ctx) &&
1287 ctx->Extensions.EXT_texture_integer) ? GL_RGBA : 0;
1295 return ctx->Version >= 30
1296 || (_mesa_is_desktop_gl(ctx) &&
1297 ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
1305 return ctx->Version >= 30
1306 || (_mesa_is_desktop_gl(ctx) &&
1307 ctx->Extensions.ARB_texture_rg &&
1308 ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
1316 return ctx->Version >= 30
1317 || (_mesa_is_desktop_gl(ctx) &&
1318 ctx->Extensions.ARB_texture_rg &&
1319 ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
1327 return ctx->API == API_OPENGL &&
1328 ctx->Extensions.EXT_texture_integer &&
1329 ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
1337 return ctx->API == API_OPENGL &&
1338 ctx->Extensions.EXT_texture_integer &&
1339 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
1347 return ctx->API == API_OPENGL &&
1348 ctx->Extensions.EXT_texture_integer &&
1349 ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
1357 return ctx->API == API_OPENGL &&
1358 ctx->Extensions.EXT_texture_integer &&
1359 ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
1362 return (_mesa_is_desktop_gl(ctx) &&
1363 ctx->Extensions.ARB_texture_rgb10_a2ui)
1364 || _mesa_is_gles3(ctx) ? GL_RGBA : 0;
1367 return _mesa_is_gles(ctx) || ctx->Extensions.ARB_ES2_compatibility
1417 GET_CURRENT_CONTEXT(ctx);
1419 ASSERT_OUTSIDE_BEGIN_END(ctx);
1422 _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", func);
1426 baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
1428 _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat)", func);
1432 if (width < 0 || width > (GLsizei) ctx->Const.MaxRenderbufferSize) {
1433 _mesa_error(ctx, GL_INVALID_VALUE, "%s(width)", func);
1437 if (height < 0 || height > (GLsizei) ctx->Const.MaxRenderbufferSize) {
1438 _mesa_error(ctx, GL_INVALID_VALUE, "%s(height)", func);
1446 else if (samples > (GLsizei) ctx->Const.MaxSamples) {
1448 _mesa_error(ctx, GL_INVALID_VALUE, "%s(samples)", func);
1452 rb = ctx->CurrentRenderbuffer;
1454 _mesa_error(ctx, GL_INVALID_OPERATION, "%s", func);
1458 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
1474 if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
1495 _mesa_HashWalk(ctx->Shared->FrameBuffers, invalidate_rb, rb);
1505 GET_CURRENT_CONTEXT(ctx);
1506 ASSERT_OUTSIDE_BEGIN_END(ctx);
1508 if (!ctx->Extensions.OES_EGL_image) {
1509 _mesa_error(ctx, GL_INVALID_OPERATION,
1515 _mesa_error(ctx, GL_INVALID_ENUM,
1520 rb = ctx->CurrentRenderbuffer;
1522 _mesa_error(ctx, GL_INVALID_OPERATION,
1527 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
1529 ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
1599 GET_CURRENT_CONTEXT(ctx);
1601 ASSERT_OUTSIDE_BEGIN_END(ctx);
1604 _mesa_error(ctx, GL_INVALID_ENUM,
1609 rb = ctx->CurrentRenderbuffer;
1611 _mesa_error(ctx, GL_INVALID_OPERATION,
1639 if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_framebuffer_object)
1640 || _mesa_is_gles3(ctx)) {
1646 _mesa_error(ctx, GL_INVALID_ENUM,
1656 GET_CURRENT_CONTEXT(ctx);
1657 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
1659 struct gl_framebuffer *rb = _mesa_lookup_framebuffer(ctx, framebuffer);
1669 * (render to texture). Call ctx->Driver.RenderTexture() for such
1673 check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
1676 ASSERT(ctx->Driver.RenderTexture);
1684 ctx->Driver.RenderTexture(ctx, fb, att);
1692 * If so, call ctx->Driver.FinishRenderTexture() for each texture to
1696 check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
1701 if (ctx->Driver.FinishRenderTexture) {
1706 ctx->Driver.FinishRenderTexture(ctx, att);
1719 GET_CURRENT_CONTEXT(ctx);
1722 if (ctx->Extensions.ARB_framebuffer_object) {
1723 ASSERT(ctx->Extensions.EXT_framebuffer_object);
1724 ASSERT(ctx->Extensions.EXT_framebuffer_blit);
1728 ASSERT_OUTSIDE_BEGIN_END(ctx);
1730 if (!ctx->Extensions.EXT_framebuffer_object) {
1731 _mesa_error(ctx, GL_INVALID_OPERATION,
1739 if (!ctx->Extensions.EXT_framebuffer_blit) {
1740 _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)");
1747 if (!ctx->Extensions.EXT_framebuffer_blit) {
1748 _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)");
1760 _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)");
1766 newDrawFb = _mesa_lookup_framebuffer(ctx, framebuffer);
1771 else if (!newDrawFb && ctx->Extensions.ARB_framebuffer_object) {
1773 _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)");
1779 newDrawFb = ctx->Driver.NewFramebuffer(ctx, framebuffer);
1781 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT");
1784 _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newDrawFb);
1792 newDrawFb = ctx->WinSysDrawBuffer;
1793 newReadFb = ctx->WinSysReadBuffer;
1800 oldDrawFb = ctx->DrawBuffer;
1801 oldReadFb = ctx->ReadBuffer;
1814 * ctx->Driver.FinishRenderTexture().
1816 * ctx->Driver.RenderTexture().
1822 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
1825 check_end_texture_render(ctx, oldReadFb);
1827 _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb);
1831 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
1835 check_end_texture_render(ctx, oldDrawFb);
1838 check_begin_texture_render(ctx, newDrawFb);
1840 _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb);
1843 if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) {
1844 ctx->Driver.BindFramebuffer(ctx, target, newDrawFb, newReadFb);
1853 GET_CURRENT_CONTEXT(ctx);
1855 ASSERT_OUTSIDE_BEGIN_END(ctx);
1856 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
1861 fb = _mesa_lookup_framebuffer(ctx, framebuffers[i]);
1866 if (ctx->Extensions.EXT_framebuffer_blit) {
1868 if (fb == ctx->DrawBuffer) {
1873 if (fb == ctx->ReadBuffer) {
1881 if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer) {
1889 _mesa_HashRemove(ctx->Shared->FrameBuffers, framebuffers[i]);
1906 GET_CURRENT_CONTEXT(ctx);
1910 ASSERT_OUTSIDE_BEGIN_END(ctx);
1913 _mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)");
1920 first = _mesa_HashFindFreeKeyBlock(ctx->Shared->FrameBuffers, n);
1926 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
1927 _mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer);
1928 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
1938 GET_CURRENT_CONTEXT(ctx);
1940 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
1942 buffer = get_framebuffer_target(ctx, target);
1944 _mesa_error(ctx, GL_INVALID_ENUM, "glCheckFramebufferStatus(target)");
1956 _mesa_test_framebuffer_completeness(ctx, buffer);
1995 framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
2004 ASSERT_OUTSIDE_BEGIN_END(ctx);
2006 fb = get_framebuffer_target(ctx, target);
2008 _mesa_error(ctx, GL_INVALID_ENUM,
2015 _mesa_error(ctx, GL_INVALID_OPERATION,
2026 texObj = _mesa_lookup_texture(ctx, texture);
2047 _mesa_error(ctx, GL_INVALID_OPERATION,
2054 _mesa_error(ctx, GL_INVALID_OPERATION,
2061 const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
2063 _mesa_error(ctx, GL_INVALID_VALUE,
2070 if (zoffset < 0 || zoffset >= ctx->Const.MaxArrayTextureLayers) {
2071 _mesa_error(ctx, GL_INVALID_VALUE,
2079 (level >= _mesa_max_texture_levels(ctx, maxLevelsTarget))) {
2080 _mesa_error(ctx, GL_INVALID_VALUE,
2086 att = _mesa_get_attachment(ctx, fb, attachment);
2088 _mesa_error(ctx, GL_INVALID_ENUM,
2093 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
2120 _mesa_set_texture_attachment(ctx, fb, att, texObj, textarget,
2144 _mesa_remove_attachment(ctx, att);
2147 _mesa_remove_attachment(ctx, &fb->Attachment[BUFFER_STENCIL]);
2162 GET_CURRENT_CONTEXT(ctx);
2172 error = !ctx->Extensions.EXT_texture_array;
2179 _mesa_error(ctx, GL_INVALID_OPERATION,
2186 framebuffer_texture(ctx, "1D", target, attachment, textarget, texture,
2195 GET_CURRENT_CONTEXT(ctx);
2205 error = _mesa_is_gles(ctx)
2206 || !ctx->Extensions.NV_texture_rectangle;
2214 error = !ctx->Extensions.ARB_texture_cube_map;
2217 error = (_mesa_is_gles(ctx) && ctx->Version < 30)
2218 || !ctx->Extensions.EXT_texture_array;
2225 _mesa_error(ctx, GL_INVALID_OPERATION,
2232 framebuffer_texture(ctx, "2D", target, attachment, textarget, texture,
2242 GET_CURRENT_CONTEXT(ctx);
2245 _mesa_error(ctx, GL_INVALID_OPERATION,
2250 framebuffer_texture(ctx, "3D", target, attachment, textarget, texture,
2259 GET_CURRENT_CONTEXT(ctx);
2261 framebuffer_texture(ctx, "Layer", target, attachment, 0, texture,
2274 GET_CURRENT_CONTEXT(ctx);
2276 ASSERT_OUTSIDE_BEGIN_END(ctx);
2278 fb = get_framebuffer_target(ctx, target);
2280 _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(target)");
2285 _mesa_error(ctx, GL_INVALID_ENUM,
2292 _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT");
2296 att = _mesa_get_attachment(ctx, fb, attachment);
2298 _mesa_error(ctx, GL_INVALID_ENUM,
2305 rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
2307 _mesa_error(ctx, GL_INVALID_OPERATION,
2314 _mesa_error(ctx, GL_INVALID_VALUE,
2330 _mesa_error(ctx, GL_INVALID_OPERATION,
2338 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
2340 assert(ctx->Driver.FramebufferRenderbuffer);
2341 ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
2346 _mesa_update_framebuffer_visual(ctx, fb);
2357 GET_CURRENT_CONTEXT(ctx);
2359 ASSERT_OUTSIDE_BEGIN_END(ctx);
2362 err = _mesa_is_desktop_gl(ctx) ? GL_INVALID_OPERATION : GL_INVALID_ENUM;
2364 buffer = get_framebuffer_target(ctx, target);
2366 _mesa_error(ctx, GL_INVALID_ENUM,
2382 if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object) {
2383 _mesa_error(ctx, GL_INVALID_OPERATION,
2388 att = _mesa_get_fb0_attachment(ctx, buffer, attachment);
2392 att = _mesa_get_attachment(ctx, buffer, attachment);
2396 _mesa_error(ctx, GL_INVALID_ENUM,
2404 depthAtt = _mesa_get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT);
2405 stencilAtt = _mesa_get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT);
2407 _mesa_error(ctx, GL_INVALID_OPERATION,
2430 if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
2442 _mesa_error(ctx, err,
2459 _mesa_error(ctx, err,
2467 if (ctx->API == API_OPENGLES) {
2470 _mesa_error(ctx, err,
2485 if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object)
2486 && !_mesa_is_gles3(ctx)) {
2490 _mesa_error(ctx, err,
2494 if (ctx->Extensions.EXT_framebuffer_sRGB) {
2505 if ((ctx->API != API_OPENGL || !ctx->Extensions.ARB_framebuffer_object)
2506 && ctx->API != API_OPENGL_CORE
2507 && !_mesa_is_gles3(ctx)) {
2511 _mesa_error(ctx, err,
2540 if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_framebuffer_object)
2541 && !_mesa_is_gles3(ctx)) {
2545 _mesa_error(ctx, err,
2550 _mesa_select_tex_image(ctx, att->Texture, att->Texture->Target,
2565 _mesa_problem(ctx, "glGetFramebufferAttachmentParameterivEXT:"
2576 _mesa_error(ctx, GL_INVALID_ENUM,
2589 GET_CURRENT_CONTEXT(ctx);
2591 ASSERT_OUTSIDE_BEGIN_END(ctx);
2592 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
2596 error = _mesa_is_gles(ctx);
2602 error = ctx->API == API_OPENGLES;
2605 error = !ctx->Extensions.ARB_texture_cube_map;
2608 error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array;
2611 error = (_mesa_is_gles(ctx) && ctx->Version < 30)
2612 || !ctx->Extensions.EXT_texture_array;
2619 _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target=%s)",
2624 texObj = _mesa_get_current_tex_object(ctx, target);
2633 _mesa_error(ctx, GL_INVALID_OPERATION,
2638 _mesa_lock_texture(ctx, texObj);
2640 srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
2642 _mesa_unlock_texture(ctx, texObj);
2643 _mesa_error(ctx, GL_INVALID_OPERATION,
2651 _mesa_unlock_texture(ctx, texObj);
2652 _mesa_error(ctx, GL_INVALID_OPERATION,
2660 ctx->Driver.GenerateMipmap(ctx,
2665 ctxctx, target, texObj);
2667 _mesa_unlock_texture(ctx, texObj);
2888 GET_CURRENT_CONTEXT(ctx);
2890 ASSERT_OUTSIDE_BEGIN_END(ctx);
2891 FLUSH_VERTICES(ctx, _NEW_BUFFERS);
2894 _mesa_debug(ctx,
2900 if (ctx->NewState) {
2901 _mesa_update_state(ctx);
2904 readFb = ctx->ReadBuffer;
2905 drawFb = ctx->DrawBuffer;
2917 _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
2923 _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)");
2928 _mesa_error( ctx, GL_INVALID_VALUE, "glBlitFramebufferEXT(mask)");
2935 _mesa_error(ctx, GL_INVALID_OPERATION,
2957 _mesa_error(ctx, GL_INVALID_OPERATION,
2986 _mesa_error(ctx, GL_INVALID_OPERATION,
3011 _mesa_error(ctx, GL_INVALID_OPERATION,
3020 _mesa_error(ctx, GL_INVALID_OPERATION,
3030 _mesa_error(ctx, GL_INVALID_OPERATION,
3039 _mesa_error(ctx, GL_INVALID_OPERATION,
3052 _mesa_error(ctx, GL_INVALID_OPERATION,
3058 if (!ctx->Extensions.EXT_framebuffer_blit) {
3059 _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT");
3105 ASSERT(ctx->Driver.BlitFramebuffer);
3106 ctx->Driver.BlitFramebuffer(ctx,
3119 GET_CURRENT_CONTEXT(ctx);
3120 _mesa_error(ctx, GL_INVALID_OPERATION,
3130 GET_CURRENT_CONTEXT(ctx);
3131 _mesa_error(ctx, GL_INVALID_OPERATION,
3144 GET_CURRENT_CONTEXT(ctx);
3146 ASSERT_OUTSIDE_BEGIN_END(ctx);
3148 fb = get_framebuffer_target(ctx, target);
3150 _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name);
3155 _mesa_error(ctx, GL_INVALID_VALUE,
3186 if (ctx->API != API_OPENGL)
3197 if (!_mesa_is_desktop_gl(ctx))
3225 if (k >= ctx->Const.MaxColorAttachments) {
3226 _mesa_error(ctx, GL_INVALID_OPERATION,
3243 _mesa_error(ctx, GL_INVALID_ENUM, "%s(attachment)", name);