- if (storage->frame.current_rt->flags[RendererStorage::RENDER_TARGET_DIRECT_TO_SCREEN]) {
- ERR_PRINT_ONCE("Cannot use screen texture copying in render target set to render direct to screen.");
- return;
- }
-
- ERR_FAIL_COND_MSG(storage->frame.current_rt->copy_screen_effect.color == 0, "Can't use screen texture copying in a render target configured without copy buffers.");
- // materials are ignored in 2D meshes, could be added but many things (ie, lighting mode, reading from screen, etc) would break as they are not meant be set up at this point of drawing
- // materials are ignored in 2D meshes, could be added but many things (ie, lighting mode, reading from screen, etc) would break as they are not meant be set up at this point of drawing
- if (r_ris.current_clip != p_ci->final_clip_owner) {
- r_ris.current_clip = p_ci->final_clip_owner;
-
- if (r_ris.current_clip) {
- glEnable(GL_SCISSOR_TEST);
- int y = storage->_dims.rt_height - (r_ris.current_clip->final_clip_rect.position.y + r_ris.current_clip->final_clip_rect.size.y);
- // int y = storage->frame.current_rt->height - (r_ris.current_clip->final_clip_rect.position.y + r_ris.current_clip->final_clip_rect.size.y);
- // FTODO
- // if (storage->frame.current_rt->flags[RendererStorage::RENDER_TARGET_VFLIP])
- // y = r_ris.current_clip->final_clip_rect.position.y;
- glScissor(r_ris.current_clip->final_clip_rect.position.x, y, r_ris.current_clip->final_clip_rect.size.width, r_ris.current_clip->final_clip_rect.size.height);
-
- // debug VFLIP
- // if ((r_ris.current_clip->final_clip_rect.position.x == 223)
- int y = storage->frame.current_rt->height - (r_ris.current_clip->final_clip_rect.position.y + r_ris.current_clip->final_clip_rect.size.y);
- // FTODO
- // if (storage->frame.current_rt->flags[RendererStorage::RENDER_TARGET_VFLIP])
- // y = r_ris.current_clip->final_clip_rect.position.y;
- glScissor(r_ris.current_clip->final_clip_rect.position.x, y, r_ris.current_clip->final_clip_rect.size.width, r_ris.current_clip->final_clip_rect.size.height);
+ // A version is a high-level construct which is a combination of built-in and user-defined shader code
+ // Variants use #idefs to toggle behaviour on and off to change behaviour of the shader
+ // Specializations use #ifdefs to toggle behaviour on and off for performance, on supporting hardware, they will compile a version with everything enabled, and then compile more copies to improve performance
+ // Use specializations to enable and disabled advanced features, use variants to toggle behaviour when different data may be used (e.g. using a samplerArray vs a sampler)