[Mesa-dev] [PATCH 4/9] st/mesa: change st_pbo_create_upload_fs to st_pbo_get_upload_fs
Nicolai Hähnle
nhaehnle at gmail.com
Wed Nov 9 15:01:52 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
For consistency with st_pbo_get_download_fs.
---
src/mesa/state_tracker/st_cb_texture.c | 12 +++++-------
src/mesa/state_tracker/st_pbo.c | 7 +++++--
src/mesa/state_tracker/st_pbo.h | 2 +-
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index fa52a4e..ef59041 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1131,27 +1131,25 @@ reinterpret_formats(enum pipe_format *src_format, enum pipe_format *dst_format)
static bool
try_pbo_upload_common(struct gl_context *ctx,
struct pipe_surface *surface,
const struct st_pbo_addresses *addr,
enum pipe_format src_format)
{
struct st_context *st = st_context(ctx);
struct cso_context *cso = st->cso_context;
struct pipe_context *pipe = st->pipe;
bool success = false;
+ void *fs;
- /* Create fragment shader */
- if (!st->pbo.upload_fs) {
- st->pbo.upload_fs = st_pbo_create_upload_fs(st);
- if (!st->pbo.upload_fs)
- return false;
- }
+ fs = st_pbo_get_upload_fs(st);
+ if (!fs)
+ return false;
cso_save_state(cso, (CSO_BIT_FRAGMENT_SAMPLER_VIEWS |
CSO_BIT_FRAGMENT_SAMPLERS |
CSO_BIT_VERTEX_ELEMENTS |
CSO_BIT_AUX_VERTEX_BUFFER_SLOT |
CSO_BIT_FRAMEBUFFER |
CSO_BIT_VIEWPORT |
CSO_BIT_BLEND |
CSO_BIT_DEPTH_STENCIL_ALPHA |
CSO_BIT_RASTERIZER |
@@ -1210,21 +1208,21 @@ try_pbo_upload_common(struct gl_context *ctx,
cso_set_blend(cso, &st->pbo.upload_blend);
/* Depth/stencil/alpha state */
{
struct pipe_depth_stencil_alpha_state dsa;
memset(&dsa, 0, sizeof(dsa));
cso_set_depth_stencil_alpha(cso, &dsa);
}
/* Set up the fragment shader */
- cso_set_fragment_shader_handle(cso, st->pbo.upload_fs);
+ cso_set_fragment_shader_handle(cso, fs);
success = st_pbo_draw(st, addr, surface->width, surface->height);
fail:
cso_restore_state(cso);
cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT);
return success;
}
diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
index ca6bdea..1e21554 100644
--- a/src/mesa/state_tracker/st_pbo.c
+++ b/src/mesa/state_tracker/st_pbo.c
@@ -508,23 +508,26 @@ create_fs(struct st_context *st, bool download, enum pipe_texture_target target)
}
ureg_release_temporary(ureg, temp0);
ureg_END(ureg);
return ureg_create_shader_and_destroy(ureg, pipe);
}
void *
-st_pbo_create_upload_fs(struct st_context *st)
+st_pbo_get_upload_fs(struct st_context *st)
{
- return create_fs(st, false, 0);
+ if (!st->pbo.upload_fs)
+ st->pbo.upload_fs = create_fs(st, false, 0);
+
+ return st->pbo.upload_fs;
}
void *
st_pbo_get_download_fs(struct st_context *st, enum pipe_texture_target target)
{
assert(target < PIPE_MAX_TEXTURE_TYPES);
if (!st->pbo.download_fs[target])
st->pbo.download_fs[target] = create_fs(st, true, target);
diff --git a/src/mesa/state_tracker/st_pbo.h b/src/mesa/state_tracker/st_pbo.h
index 17359c4..6513093 100644
--- a/src/mesa/state_tracker/st_pbo.h
+++ b/src/mesa/state_tracker/st_pbo.h
@@ -78,21 +78,21 @@ bool
st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
unsigned surface_width, unsigned surface_height);
void *
st_pbo_create_vs(struct st_context *st);
void *
st_pbo_create_gs(struct st_context *st);
void *
-st_pbo_create_upload_fs(struct st_context *st);
+st_pbo_get_upload_fs(struct st_context *st);
void *
st_pbo_get_download_fs(struct st_context *st, enum pipe_texture_target target);
extern void
st_init_pbo_helpers(struct st_context *st);
extern void
st_destroy_pbo_helpers(struct st_context *st);
--
2.7.4
More information about the mesa-dev
mailing list