Subversion Repositories Kolibri OS

Rev

Rev 3291 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef SNA_RENDER_INLINE_H
  2. #define SNA_RENDER_INLINE_H
  3.  
  4. static inline bool need_tiling(struct sna *sna, int16_t width, int16_t height)
  5. {
  6.         /* Is the damage area too large to fit in 3D pipeline,
  7.          * and so do we need to split the operation up into tiles?
  8.          */
  9.         return (width > sna->render.max_3d_size ||
  10.                 height > sna->render.max_3d_size);
  11. }
  12.  
  13. static inline bool need_redirect(struct sna *sna, PixmapPtr dst)
  14. {
  15.         /* Is the pixmap too large to render to? */
  16.         return (dst->drawable.width > sna->render.max_3d_size ||
  17.                 dst->drawable.height > sna->render.max_3d_size);
  18. }
  19.  
  20. static force_inline float pack_2s(int16_t x, int16_t y)
  21. {
  22.         union {
  23.                 struct sna_coordinate p;
  24.                 float f;
  25.         } u;
  26.         u.p.x = x;
  27.         u.p.y = y;
  28.         return u.f;
  29. }
  30.  
  31. static force_inline int vertex_space(struct sna *sna)
  32. {
  33.         return sna->render.vertex_size - sna->render.vertex_used;
  34. }
  35. static force_inline void vertex_emit(struct sna *sna, float v)
  36. {
  37.         assert(sna->render.vertex_used < sna->render.vertex_size);
  38.         sna->render.vertices[sna->render.vertex_used++] = v;
  39. }
  40. static force_inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y)
  41. {
  42.         vertex_emit(sna, pack_2s(x, y));
  43. }
  44.  
  45. static force_inline int batch_space(struct sna *sna)
  46. {
  47.         assert(sna->kgem.nbatch <= KGEM_BATCH_SIZE(&sna->kgem));
  48.         assert(sna->kgem.nbatch + KGEM_BATCH_RESERVED <= sna->kgem.surface);
  49.         return sna->kgem.surface - sna->kgem.nbatch - KGEM_BATCH_RESERVED;
  50. }
  51.  
  52. static force_inline void batch_emit(struct sna *sna, uint32_t dword)
  53. {
  54.         assert(sna->kgem.mode != KGEM_NONE);
  55.         assert(sna->kgem.nbatch + KGEM_BATCH_RESERVED < sna->kgem.surface);
  56.         sna->kgem.batch[sna->kgem.nbatch++] = dword;
  57. }
  58.  
  59. static force_inline void batch_emit_float(struct sna *sna, float f)
  60. {
  61.         union {
  62.                 uint32_t dw;
  63.                 float f;
  64.         } u;
  65.         u.f = f;
  66.         batch_emit(sna, u.dw);
  67. }
  68.  
  69.  
  70. #endif /* SNA_RENDER_INLINE_H */
  71.