Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sp_flush.c 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**************************************************************************
  2. *
  3. * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  21. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  22. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  23. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  24. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. /* Author:
  28. * Keith Whitwell <keith@tungstengraphics.com>
  29. */
  30. #include "pipe/p_defines.h"
  31. #include "draw/draw_context.h"
  32. #include "sp_flush.h"
  33. #include "sp_context.h"
  34. #include "sp_surface.h"
  35. #include "sp_state.h"
  36. #include "sp_tile_cache.h"
  37. #include "sp_winsys.h"
  38. void
  39. softpipe_flush( struct pipe_context *pipe,
  40. unsigned flags,
  41. struct pipe_fence_handle **fence )
  42. {
  43. struct softpipe_context *softpipe = softpipe_context(pipe);
  44. uint i;
  45. draw_flush(softpipe->draw);
  46. if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
  47. for (i = 0; i < softpipe->num_textures; i++) {
  48. sp_flush_tile_cache(softpipe, softpipe->tex_cache[i]);
  49. }
  50. }
  51. if (flags & PIPE_FLUSH_RENDER_CACHE) {
  52. for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++)
  53. if (softpipe->cbuf_cache[i])
  54. sp_flush_tile_cache(softpipe, softpipe->cbuf_cache[i]);
  55. if (softpipe->zsbuf_cache)
  56. sp_flush_tile_cache(softpipe, softpipe->zsbuf_cache);
  57. /* Need this call for hardware buffers before swapbuffers.
  58. *
  59. * there should probably be another/different flush-type function
  60. * that's called before swapbuffers because we don't always want
  61. * to unmap surfaces when flushing.
  62. */
  63. softpipe_unmap_transfers(softpipe);
  64. }
  65. /* Enable to dump BMPs of the color/depth buffers each frame */
  66. #if 0
  67. if(flags & PIPE_FLUSH_FRAME) {
  68. static unsigned frame_no = 1;
  69. static char filename[256];
  70. util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no);
  71. debug_dump_surface_bmp(filename, softpipe->framebuffer.cbufs[0]);
  72. util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no);
  73. debug_dump_surface_bmp(filename, softpipe->framebuffer.zsbuf);
  74. ++frame_no;
  75. }
  76. #endif
  77. if (fence)
  78. *fence = NULL;
  79. }