[Mesa-dev] [PATCH 2/3] noop: set missing functions
Marek Olšák
maraeo at gmail.com
Mon Aug 29 15:29:47 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/noop/noop_pipe.c | 51 +++++++++++++++++++++++++++++++++++
src/gallium/drivers/noop/noop_state.c | 24 +++++++++++++++++
2 files changed, 75 insertions(+)
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index b3e2a3e..25e0c1f 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -264,42 +264,56 @@ noop_flush_resource(struct pipe_context *ctx,
}
/*
* context
*/
static void noop_flush(struct pipe_context *ctx,
struct pipe_fence_handle **fence,
unsigned flags)
{
+ if (fence)
+ *fence = NULL;
}
static void noop_destroy_context(struct pipe_context *ctx)
{
FREE(ctx);
}
+static boolean noop_generate_mipmap(struct pipe_context *ctx,
+ struct pipe_resource *resource,
+ enum pipe_format format,
+ unsigned base_level,
+ unsigned last_level,
+ unsigned first_layer,
+ unsigned last_layer)
+{
+ return true;
+}
+
static struct pipe_context *noop_create_context(struct pipe_screen *screen,
void *priv, unsigned flags)
{
struct pipe_context *ctx = CALLOC_STRUCT(pipe_context);
if (!ctx)
return NULL;
ctx->screen = screen;
ctx->priv = priv;
ctx->destroy = noop_destroy_context;
ctx->flush = noop_flush;
ctx->clear = noop_clear;
ctx->clear_render_target = noop_clear_render_target;
ctx->clear_depth_stencil = noop_clear_depth_stencil;
ctx->resource_copy_region = noop_resource_copy_region;
+ ctx->generate_mipmap = noop_generate_mipmap;
ctx->blit = noop_blit;
ctx->flush_resource = noop_flush_resource;
ctx->create_query = noop_create_query;
ctx->destroy_query = noop_destroy_query;
ctx->begin_query = noop_begin_query;
ctx->end_query = noop_end_query;
ctx->get_query_result = noop_get_query_result;
ctx->set_active_query_state = noop_set_active_query_state;
ctx->transfer_map = noop_transfer_map;
ctx->transfer_flush_region = noop_transfer_flush_region;
@@ -352,20 +366,30 @@ static float noop_get_paramf(struct pipe_screen* pscreen,
return screen->get_paramf(screen, param);
}
static int noop_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
{
struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
return screen->get_shader_param(screen, shader, param);
}
+static int noop_get_compute_param(struct pipe_screen *pscreen,
+ enum pipe_shader_ir ir_type,
+ enum pipe_compute_cap param,
+ void *ret)
+{
+ struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
+
+ return screen->get_compute_param(screen, ir_type, param, ret);
+}
+
static boolean noop_is_format_supported(struct pipe_screen* pscreen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
unsigned usage)
{
struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
return screen->is_format_supported(screen, format, target, sample_count, usage);
}
@@ -377,20 +401,43 @@ static uint64_t noop_get_timestamp(struct pipe_screen *pscreen)
static void noop_destroy_screen(struct pipe_screen *screen)
{
struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen;
struct pipe_screen *oscreen = noop_screen->oscreen;
oscreen->destroy(oscreen);
FREE(screen);
}
+static void noop_fence_reference(struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence)
+{
+}
+
+static boolean noop_fence_finish(struct pipe_screen *screen,
+ struct pipe_context *ctx,
+ struct pipe_fence_handle *fence,
+ uint64_t timeout)
+{
+ return true;
+}
+
+static void noop_query_memory_info(struct pipe_screen *pscreen,
+ struct pipe_memory_info *info)
+{
+ struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)pscreen;
+ struct pipe_screen *screen = noop_screen->oscreen;
+
+ screen->query_memory_info(screen, info);
+}
+
struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
{
struct noop_pipe_screen *noop_screen;
struct pipe_screen *screen;
if (!debug_get_option_noop()) {
return oscreen;
}
noop_screen = CALLOC_STRUCT(noop_pipe_screen);
@@ -399,22 +446,26 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
}
noop_screen->oscreen = oscreen;
screen = &noop_screen->pscreen;
screen->destroy = noop_destroy_screen;
screen->get_name = noop_get_name;
screen->get_vendor = noop_get_vendor;
screen->get_device_vendor = noop_get_device_vendor;
screen->get_param = noop_get_param;
screen->get_shader_param = noop_get_shader_param;
+ screen->get_compute_param = noop_get_compute_param;
screen->get_paramf = noop_get_paramf;
screen->is_format_supported = noop_is_format_supported;
screen->context_create = noop_create_context;
screen->resource_create = noop_resource_create;
screen->resource_from_handle = noop_resource_from_handle;
screen->resource_get_handle = noop_resource_get_handle;
screen->resource_destroy = noop_resource_destroy;
screen->flush_frontbuffer = noop_flush_frontbuffer;
screen->get_timestamp = noop_get_timestamp;
+ screen->fence_reference = noop_fence_reference;
+ screen->fence_finish = noop_fence_finish;
+ screen->query_memory_info = noop_query_memory_info;
return screen;
}
diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
index 01538bfe27..5cbb2fd 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -27,20 +27,25 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_transfer.h"
static void noop_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
{
}
+static void noop_launch_grid(struct pipe_context *ctx,
+ const struct pipe_grid_info *info)
+{
+}
+
static void noop_set_blend_color(struct pipe_context *ctx,
const struct pipe_blend_color *state)
{
}
static void *noop_create_blend_state(struct pipe_context *ctx,
const struct pipe_blend_state *state)
{
return malloc(1);
}
@@ -198,20 +203,26 @@ static void *noop_create_vertex_elements(struct pipe_context *ctx,
{
return malloc(1);
}
static void *noop_create_shader_state(struct pipe_context *ctx,
const struct pipe_shader_state *state)
{
return malloc(1);
}
+static void *noop_create_compute_state(struct pipe_context *ctx,
+ const struct pipe_compute_state *state)
+{
+ return malloc(1);
+}
+
static struct pipe_stream_output_target *noop_create_stream_output_target(
struct pipe_context *ctx,
struct pipe_resource *res,
unsigned buffer_offset,
unsigned buffer_size)
{
struct pipe_stream_output_target *t = CALLOC_STRUCT(pipe_stream_output_target);
if (!t)
return NULL;
@@ -241,44 +252,57 @@ void noop_init_state_functions(struct pipe_context *ctx);
void noop_init_state_functions(struct pipe_context *ctx)
{
ctx->create_blend_state = noop_create_blend_state;
ctx->create_depth_stencil_alpha_state = noop_create_dsa_state;
ctx->create_fs_state = noop_create_shader_state;
ctx->create_rasterizer_state = noop_create_rs_state;
ctx->create_sampler_state = noop_create_sampler_state;
ctx->create_sampler_view = noop_create_sampler_view;
ctx->create_surface = noop_create_surface;
ctx->create_vertex_elements_state = noop_create_vertex_elements;
+ ctx->create_compute_state = noop_create_compute_state;
+ ctx->create_tcs_state = noop_create_shader_state;
+ ctx->create_tes_state = noop_create_shader_state;
+ ctx->create_gs_state = noop_create_shader_state;
ctx->create_vs_state = noop_create_shader_state;
ctx->bind_blend_state = noop_bind_state;
ctx->bind_depth_stencil_alpha_state = noop_bind_state;
ctx->bind_sampler_states = noop_bind_sampler_states;
ctx->bind_fs_state = noop_bind_state;
ctx->bind_rasterizer_state = noop_bind_state;
ctx->bind_vertex_elements_state = noop_bind_state;
+ ctx->bind_compute_state = noop_bind_state;
+ ctx->bind_tcs_state = noop_bind_state;
+ ctx->bind_tes_state = noop_bind_state;
+ ctx->bind_gs_state = noop_bind_state;
ctx->bind_vs_state = noop_bind_state;
ctx->delete_blend_state = noop_delete_state;
ctx->delete_depth_stencil_alpha_state = noop_delete_state;
ctx->delete_fs_state = noop_delete_state;
ctx->delete_rasterizer_state = noop_delete_state;
ctx->delete_sampler_state = noop_delete_state;
ctx->delete_vertex_elements_state = noop_delete_state;
+ ctx->delete_compute_state = noop_delete_state;
+ ctx->delete_tcs_state = noop_delete_state;
+ ctx->delete_tes_state = noop_delete_state;
+ ctx->delete_gs_state = noop_delete_state;
ctx->delete_vs_state = noop_delete_state;
ctx->set_blend_color = noop_set_blend_color;
ctx->set_clip_state = noop_set_clip_state;
ctx->set_constant_buffer = noop_set_constant_buffer;
ctx->set_sampler_views = noop_set_sampler_views;
ctx->set_framebuffer_state = noop_set_framebuffer_state;
ctx->set_polygon_stipple = noop_set_polygon_stipple;
ctx->set_sample_mask = noop_set_sample_mask;
ctx->set_scissor_states = noop_set_scissor_states;
ctx->set_stencil_ref = noop_set_stencil_ref;
ctx->set_vertex_buffers = noop_set_vertex_buffers;
ctx->set_index_buffer = noop_set_index_buffer;
ctx->set_viewport_states = noop_set_viewport_states;
ctx->sampler_view_destroy = noop_sampler_view_destroy;
ctx->surface_destroy = noop_surface_destroy;
ctx->draw_vbo = noop_draw_vbo;
+ ctx->launch_grid = noop_launch_grid;
ctx->create_stream_output_target = noop_create_stream_output_target;
ctx->stream_output_target_destroy = noop_stream_output_target_destroy;
ctx->set_stream_output_targets = noop_set_stream_output_targets;
}
--
2.7.4
More information about the mesa-dev
mailing list