#include "renderer.h"
#include "shaders_cache.h"
#include "shader.h"
-#include "asm_util.h"
#include "vg_manager.h"
#include "api.h"
#include "mask.h"
+#include "handle.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
#include "cso_cache/cso_context.h"
-#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_blit.h"
#include "util/u_sampler.h"
{
struct pipe_screen *screen = ctx->pipe->screen;
enum pipe_format formats[] = {
- PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_FORMAT_S8_USCALED_Z24_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_UINT,
+ PIPE_FORMAT_S8_UINT_Z24_UNORM,
PIPE_FORMAT_NONE
};
enum pipe_format *fmt;
for (fmt = formats; *fmt != PIPE_FORMAT_NONE; fmt++) {
if (screen->is_format_supported(screen, *fmt,
- PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0))
+ PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL))
break;
}
{
obj->type = type;
obj->ctx = ctx;
+ obj->handle = create_handle(obj);
+}
+
+/** free object resources, but not the object itself */
+void vg_free_object(struct vg_object *obj)
+{
+ obj->type = 0;
+ obj->ctx = NULL;
+ destroy_handle(obj->handle);
}
VGboolean vg_context_is_object_valid(struct vg_context *ctx,
enum vg_object_type type,
- void *ptr)
+ VGHandle handle)
{
if (ctx) {
struct cso_hash *hash = ctx->owned_objects[type];
if (!hash)
return VG_FALSE;
- return cso_hash_contains(hash, (unsigned)(long)ptr);
+ return cso_hash_contains(hash, (unsigned) handle);
}
return VG_FALSE;
}
void vg_context_add_object(struct vg_context *ctx,
- enum vg_object_type type,
- void *ptr)
+ struct vg_object *obj)
{
if (ctx) {
- struct cso_hash *hash = ctx->owned_objects[type];
+ struct cso_hash *hash = ctx->owned_objects[obj->type];
if (!hash)
return;
- cso_hash_insert(hash, (unsigned)(long)ptr, ptr);
+ cso_hash_insert(hash, (unsigned) obj->handle, obj);
}
}
void vg_context_remove_object(struct vg_context *ctx,
- enum vg_object_type type,
- void *ptr)
+ struct vg_object *obj)
{
if (ctx) {
- struct cso_hash *hash = ctx->owned_objects[type];
+ struct cso_hash *hash = ctx->owned_objects[obj->type];
if (!hash)
return;
- cso_hash_take(hash, (unsigned)(long)ptr);
+ cso_hash_take(hash, (unsigned) obj->handle);
}
}
if (!dsrb->texture)
return TRUE;
- memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- u_surface_default_template(&surf_tmpl, dsrb->texture,
- PIPE_BIND_DEPTH_STENCIL);
+ u_surface_default_template(&surf_tmpl, dsrb->texture);
dsrb->surface = pipe->create_surface(pipe,
dsrb->texture,
&surf_tmpl);
if (vg_context_update_depth_stencil_rb(ctx, stfb->width, stfb->height))
ctx->state.dirty |= DEPTH_STENCIL_DIRTY;
- /* blend state depends on fb format */
- if (ctx->state.dirty & FRAMEBUFFER_DIRTY)
+ /* blend state depends on fb format and paint color */
+ if ((ctx->state.dirty & FRAMEBUFFER_DIRTY) ||
+ (ctx->state.dirty & PAINT_DIRTY))
ctx->state.dirty |= BLEND_DIRTY;
renderer_validate(ctx->renderer, ctx->state.dirty,
shader_set_color_transform(ctx->shader, ctx->state.vg.color_transform);
}
-VGboolean vg_object_is_valid(void *ptr, enum vg_object_type type)
+VGboolean vg_object_is_valid(VGHandle object, enum vg_object_type type)
{
- struct vg_object *obj = ptr;
- if (ptr && is_aligned(obj) && obj->type == type)
+ struct vg_object *obj = handle_to_object(object);
+ if (obj && is_aligned(obj) && obj->type == type)
return VG_TRUE;
else
return VG_FALSE;
vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
- memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture,
- PIPE_BIND_RENDER_TARGET);
+ u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture);
surf = ctx->pipe->create_surface(ctx->pipe,
stfb->blend_texture_view->texture,
&surf_tmpl);