summaryrefslogtreecommitdiff
path: root/cogl/cogl-clip-state.c
Commit message (Collapse)AuthorAgeFilesLines
* framebuffer: expose experimental cogl_get_draw_framebufferRobert Bragg2011-04-111-6/+6
| | | | | | This renames the two internal functions _cogl_get_draw/read_buffer as cogl_get_draw_framebuffer and _cogl_get_read_framebuffer. The former is now also exposed as experimental API.
* cogl: rename cogl-context.h cogl-context-private.hRobert Bragg2011-04-111-1/+1
| | | | | Since we plan to add public cogl_context_* API we need to rename the current cogl-context.h which contains private member details.
* cogl-clip-state: Adapt to experimental cogl2 API.Jasper St. Pierre2011-03-101-16/+4
| | | | | | | | | The current clip state implementation couldn't be used in conjunction with the CoglPath experimental API. http://bugzilla.clutter-project.org/show_bug.cgi?id=2594 Signed-off-by: Neil Roberts <neil@linux.intel.com>
* cogl-framebuffer: Separate the draw and read bufferNeil Roberts2011-02-151-7/+7
| | | | | | | | | | | | | | | | | | | The current framebuffer is now internally separated so that there can be a different draw and read buffer. This is required to use the GL_EXT_framebuffer_blit extension. The current draw and read buffers are stored as a pair in a single stack so that pushing the draw and read buffer is done simultaneously with the new _cogl_push_framebuffers internal function. Calling cogl_pop_framebuffer will restore both the draw and read buffer to the previous state. The public cogl_push_framebuffer function is layered on top of the new function so that it just pushes the same buffer for both drawing and reading. When flushing the framebuffer state, the cogl_framebuffer_flush_state function now tackes a pointer to both the draw and the read buffer. Anywhere that was just flushing the state for the current framebuffer with _cogl_get_framebuffer now needs to call both _cogl_get_draw_buffer and _cogl_get_read_buffer.
* clip: rename get_clip_stack + add framebuffer_get_stackRobert Bragg2011-01-211-18/+3
| | | | | | | | | | | | Instead of having _cogl_get/set_clip stack which reference the global CoglContext this instead makes those into CoglClipState method functions named _cogl_clip_state_get/set_stack that take an explicit pointer to a CoglClipState. This also adds _cogl_framebuffer_get/set_clip_stack convenience functions that avoid having to first get the ClipState from a framebuffer then the stack from that - so we can maintain the convenience of _cogl_get_clip_stack.
* journal: Support per-framebuffer journalsRobert Bragg2011-01-211-2/+3
| | | | | | | | | | | | | | | Instead of having a single journal per context, we now have a CoglJournal object for each CoglFramebuffer. This means we now don't have to flush the journal when switching/pushing/popping between different framebuffers so for example a Clutter scene that involves some ClutterEffect actors that transiently redirect to an FBO can still be batched. This also allows us to track state in the journal that relates to the current frame of its associated framebuffer which we'll need for our optimization for using the CPU to handle reading a single pixel back from a framebuffer when we know the whole scene is currently comprised of simple rectangles in a journal.
* cogl-clip-stack: Don't convert rect clips to window clipsNeil Roberts2010-12-031-55/+0
| | | | | | | | | | | | | | Previously in cogl-clip-state.c when it detected that the current modelview matrix is screen-aligned it would convert the clip entry to a window clip. Instead of doing this cogl-clip-stack.c now contains the detection and keeps the entry as a rectangle clip but marks that it is entirely described by its scissor rect. When flusing the clip stack it doesn't do anything extra for entries that have this mark (because the clip will already been setup by the scissor). This is needed so that we can still track the original rectangle coordinates and modelview matrix to help detect when it would be faster to modify the rectangle when adding it to the journal rather than having to break up the batch to set the clip state.
* path 2.0: update path API for experimental 2.0 APIRobert Bragg2010-11-111-2/+6
| | | | | | | | | | | | | | | | | When COGL_ENABLE_EXPERIMENTAL_2_0_API is defined cogl.h will now include cogl2-path.h which changes cogl_path_new() so it can directly return a CoglPath pointer; it no longer exposes a prototype for cogl_{get,set}_path and all the remaining cogl_path_ functions now take an explicit path as their first argument. The idea is that we want to encourage developers to retain path objects for as long as possible so they can take advantage of us uploading the path geometry to the GPU. Currently although it is possible to start a new path and query the current path, it is not convenient. The other thing is that we want to get Cogl to the point where nothing depends on a global, current context variable. This will allow us to one day define a sensible threading model if/when that is ever desired.
* cogl-journal: Log the clip state in the journalNeil Roberts2010-11-041-24/+0
| | | | | | | | | | | | | When adding a new entry to the journal a reference is now taken on the current clip stack. Modifying the current clip state no longer causes a journal flush. The journal flushing code now has an extra stage to compare the clip state of each entry. The comparison can simply be done by comparing the pointers. Although different clip states will still end up with multiple draw calls this at leasts allows a scene comprising of multiple different clips to be upload with one vbo. It also lays the groundwork to do certain tricks when drawing clipped rectangles such as modifying the geometry instead of setting a clip state.
* cogl: Don't flush the journal when flushing clip stateNeil Roberts2010-11-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | Flushing the clip state no longer does anything that would cause the journal to flush. The clip state is only flushed when flushing the framebuffer state and in all cases this ends up flushing the journal in one way or another anyway. Avoiding flushing the journal will make it easier to log the clip state in the journal. Previously when trying to set up a rectangle clip that can't be scissored or when using a path clip the code would use cogl_rectangle as part of the process to fill the stencil buffer. This is now changed to use a new internal _cogl_rectangle_immediate function which directly uses the vertex array API to draw a triangle strip without affecting the journal. This should be just as efficient as the previous journalled code because these places would end up flushing the journal immediately before and after submitting the single rectangle anyway and flushing the journal always creates a new vbo so it would effectively do the same thing. Similarly there is also a new internal _cogl_clear function that does not flush the journal.
* cogl: Move the clip stack dirtiness to the context rather than the FBNeil Roberts2010-11-041-37/+3
| | | | | | | | | | | | | | | | | | Previously we tracked whether the clip stack needs flushing as part of the CoglClipState which is part of the CoglFramebuffer state. This is a bit odd because most of the clipping state (such as the clip planes and the scissor) are part of the GL context's state rather than the framebuffer. We were marking the clip state on the framebuffer dirty every time we change the framebuffer anyway so it seems to make more sense to have the dirtiness be part of the global context. Instead of a just a single boolean to record whether the state needs flushing, the CoglContext now holds a reference to the clip stack that was flushed. That way we can flush arbitrary stack states and if it happens to be the same as the state already flushed then Cogl will do nothing. This will be useful if we log the clip stack in the journal because then we will need to flush unrelated clip stack states for each batch.
* cogl-clip-stack: Don't allocate a separate struct for CoglClipStackNeil Roberts2010-11-041-35/+20
| | | | | | | | | | | | | | | | Instead of having a separate CoglHandle for CoglClipStack the code is now expected to directly hold a pointer to the top entry on the stack. The empty stack is then the NULL pointer. This saves an allocation when we want to copy the stack because we can just take a reference on a stack entry. The idea is that this will make it possible to store the clip stack in the journal without any extra allocations. The _cogl_get_clip_stack and set functions now take a CoglClipStack pointer instead of a handle so it would no longer make sense to make them public. However I think the only reason we would have wanted that in the first place would be to save the clip state between switching FBOs and that is no longer necessary.
* framebuffer: Replace CoglHandle with CoglFramebuffer *Robert Bragg2010-07-071-8/+8
| | | | One more object converted to stop using CoglHandle re:a8c8cbee513
* cogl-clip-state: Export transform_point internally to CoglNeil Roberts2010-06-101-42/+3
| | | | | | | | The transform_point function takes a modelview matrix, projection matrix and a viewport and performs all three transformations on a point to give a Cogl window coordinate. This is useful in a number of places in Cogl so this patch moves it to cogl.c and adds it to cogl-internal.h
* cogl-path: Renames cogl_path_get/set cogl_get/set_pathRobert Bragg2010-06-041-1/+1
| | | | | These aren't path methods so aren't consistent with the cogl_object_method naming style we are aiming for.
* analysis: Use static functions when possibleDamien Lespiau2010-06-011-1/+1
| | | | | It's best to ensure the functions only used in one compilation unit are marked as static so GCC can inline them if it feels like it.
* cogl: Implement retained clip stacksNeil Roberts2010-04-151-0/+34
| | | | | | | | | | | | | | | | | | | | | This adds three new internal API functions which can be used to retain the clip stack state and restore it later: _cogl_get_clip_stack _cogl_set_clip_stack _cogl_clip_stack_copy The functions are currently internal and not yet used but we may want to make them public in future to replace the cogl_clip_stack_save() and cogl_clip_stack_restore() APIs. The get function just returns the handle to the clip stack at the top of the stack of stacks and the set function just replaces it. The copy function makes a cheap copy of an existing stack by taking a reference to the top stack entry. This ends up working like a deep copy because there is no way to modify entries of a stack but it doesn't actually copy the data.
* cogl-clip-stack: Convert to be a CoglHandleNeil Roberts2010-04-151-8/+8
| | | | | | CoglClipStacks can now be reference counted via a CoglHandle. The ClipClipState now stores handles in the list rather than CoglClipStack pointers.
* Separate out CoglClipStackState from cogl-clip-stack.cNeil Roberts2010-04-151-0/+405
CoglClipStackState has now been renamed to CoglClipState and is moved to a separate file. CoglClipStack now just maintains a stack and doesn't worry about the rest of the state. CoglClipStack sill contains the code to flush the stack to GL.