Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright 2009-2014, Haiku, Inc. All Rights Reserved.
  3.  * Distributed under the terms of the MIT License.
  4.  *
  5.  * Authors:
  6.  *              Alexander von Gluck IV, kallisti5@unixzen.com
  7.  */
  8. #ifndef HGL_CONTEXT_H
  9. #define HGL_CONTEXT_H
  10.  
  11.  
  12. #include "state_tracker/st_api.h"
  13. #include "state_tracker/st_manager.h"
  14. #include "pipe/p_compiler.h"
  15. #include "pipe/p_screen.h"
  16. #include "postprocess/filters.h"
  17. #include "os/os_thread.h"
  18.  
  19. #include "bitmap_wrapper.h"
  20.  
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26.  
  27. #define CONTEXT_MAX 32
  28.  
  29. typedef int64 context_id;
  30.  
  31.  
  32. struct hgl_buffer
  33. {
  34.         struct st_framebuffer_iface *stfbi;
  35.         struct st_visual* visual;
  36.  
  37.         unsigned width;
  38.         unsigned height;
  39.         unsigned mask;
  40.  
  41.         struct pipe_screen* screen;
  42.         enum pipe_texture_target target;
  43.         struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
  44.  
  45.         void *map;
  46.  
  47.         //struct hgl_buffer *next;  /**< next in linked list */
  48. };
  49.  
  50.  
  51. struct hgl_context
  52. {
  53.         struct st_api* api;
  54.                 // State Tracker API
  55.         struct st_manager* manager;
  56.                 // State Tracker Manager
  57.         struct st_context_iface* st;
  58.                 // State Tracker Interface Object
  59.         struct st_visual* stVisual;
  60.                 // State Tracker Visual
  61.  
  62.         struct pipe_screen* screen;
  63.  
  64.         //struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
  65.  
  66.         // Post processing
  67.         struct pp_queue_t* postProcess;
  68.         unsigned int postProcessEnable[PP_FILTERS];
  69.  
  70.         // Desired viewport size
  71.         unsigned width;
  72.         unsigned height;
  73.  
  74.         Bitmap* bitmap;
  75.         color_space colorSpace;
  76.  
  77.         pipe_mutex fbMutex;
  78.  
  79.         struct hgl_buffer* draw;
  80.         struct hgl_buffer* read;
  81. };
  82.  
  83.  
  84. // hgl state_tracker api
  85. struct st_api* hgl_create_st_api(void);
  86.  
  87. // hgl state_tracker framebuffer
  88. struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context);
  89.  
  90. // hgl state_tracker manager
  91. struct st_manager* hgl_create_st_manager(struct hgl_context* screen);
  92. void hgl_destroy_st_manager(struct st_manager *manager);
  93.  
  94. // hgl state_tracker visual
  95. struct st_visual* hgl_create_st_visual(ulong options);
  96. void hgl_destroy_st_visual(struct st_visual* visual);
  97.  
  98.  
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102.  
  103. #endif /* HGL_CONTEXT_H */
  104.