st/mesa: rename pbo_upload to pbo

At the same time, rename members that are upload-specific to say so.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2016-04-25 21:49:27 -05:00
parent be82065fbe
commit 979688a027
3 changed files with 48 additions and 48 deletions

View file

@ -1095,7 +1095,7 @@ create_pbo_upload_fs(struct st_context *st)
pos = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0,
TGSI_INTERPOLATE_LINEAR);
}
if (st->pbo_upload.upload_layers) {
if (st->pbo.layers) {
layer = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_LAYER, 0,
TGSI_INTERPOLATE_CONSTANT);
}
@ -1125,7 +1125,7 @@ create_pbo_upload_fs(struct st_context *st)
ureg_scalar(ureg_src(temp0), TGSI_SWIZZLE_Y),
ureg_scalar(ureg_src(temp0), TGSI_SWIZZLE_X));
if (st->pbo_upload.upload_layers) {
if (st->pbo.layers) {
/* temp0.x = const0.w * layer + temp0.x */
ureg_UMAD(ureg, ureg_writemask(temp0, TGSI_WRITEMASK_X),
ureg_scalar(const0, TGSI_SWIZZLE_W),
@ -1178,21 +1178,21 @@ try_pbo_upload_common(struct gl_context *ctx,
}
/* Create the shaders */
if (!st->pbo_upload.vs) {
st->pbo_upload.vs = st_pbo_create_vs(st);
if (!st->pbo_upload.vs)
if (!st->pbo.vs) {
st->pbo.vs = st_pbo_create_vs(st);
if (!st->pbo.vs)
return false;
}
if (depth != 1 && st->pbo_upload.use_gs && !st->pbo_upload.gs) {
st->pbo_upload.gs = st_pbo_create_gs(st);
if (!st->pbo_upload.gs)
if (depth != 1 && st->pbo.use_gs && !st->pbo.gs) {
st->pbo.gs = st_pbo_create_gs(st);
if (!st->pbo.gs)
return false;
}
if (!st->pbo_upload.fs) {
st->pbo_upload.fs = create_pbo_upload_fs(st);
if (!st->pbo_upload.fs)
if (!st->pbo.upload_fs) {
st->pbo.upload_fs = create_pbo_upload_fs(st);
if (!st->pbo.upload_fs)
return false;
}
@ -1348,7 +1348,7 @@ try_pbo_upload_common(struct gl_context *ctx,
cso_set_viewport_dims(cso, surface->width, surface->height, FALSE);
/* Blend state */
cso_set_blend(cso, &st->pbo_upload.blend);
cso_set_blend(cso, &st->pbo.upload_blend);
/* Depth/stencil/alpha state */
{
@ -1358,18 +1358,18 @@ try_pbo_upload_common(struct gl_context *ctx,
}
/* Rasterizer state */
cso_set_rasterizer(cso, &st->pbo_upload.raster);
cso_set_rasterizer(cso, &st->pbo.raster);
/* Set up the shaders */
cso_set_vertex_shader_handle(cso, st->pbo_upload.vs);
cso_set_vertex_shader_handle(cso, st->pbo.vs);
cso_set_geometry_shader_handle(cso, depth != 1 ? st->pbo_upload.gs : NULL);
cso_set_geometry_shader_handle(cso, depth != 1 ? st->pbo.gs : NULL);
cso_set_tessctrl_shader_handle(cso, NULL);
cso_set_tesseval_shader_handle(cso, NULL);
cso_set_fragment_shader_handle(cso, st->pbo_upload.fs);
cso_set_fragment_shader_handle(cso, st->pbo.upload_fs);
/* Disable stream output */
cso_set_stream_outputs(cso, 0, NULL, 0);
@ -1415,7 +1415,7 @@ try_pbo_upload(struct gl_context *ctx, GLuint dims,
unsigned stride, image_height;
bool success;
if (!st->pbo_upload.enabled)
if (!st->pbo.upload_enabled)
return false;
/* From now on, we need the gallium representation of dimensions. */
@ -1429,7 +1429,7 @@ try_pbo_upload(struct gl_context *ctx, GLuint dims,
image_height = unpack->ImageHeight > 0 ? unpack->ImageHeight : height;
}
if (depth != 1 && !st->pbo_upload.upload_layers)
if (depth != 1 && !st->pbo.layers)
return false;
/* Choose the source format. Initially, we do so without checking driver
@ -1450,7 +1450,7 @@ try_pbo_upload(struct gl_context *ctx, GLuint dims,
if (desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB)
return false;
if (st->pbo_upload.rgba_only) {
if (st->pbo.rgba_only) {
enum pipe_format orig_dst_format = dst_format;
if (!reinterpret_formats(&src_format, &dst_format)) {
@ -1860,7 +1860,7 @@ st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims,
goto fallback;
}
if (!st->pbo_upload.enabled ||
if (!st->pbo.upload_enabled ||
!screen->get_param(screen, PIPE_CAP_SURFACE_REINTERPRET_BLOCKS)) {
goto fallback;
}

View file

@ -236,15 +236,15 @@ struct st_context
/* For gl(Compressed)Tex(Sub)Image */
struct {
struct pipe_rasterizer_state raster;
struct pipe_blend_state blend;
struct pipe_blend_state upload_blend;
void *vs;
void *gs;
void *fs;
bool enabled;
void *upload_fs;
bool upload_enabled;
bool rgba_only;
bool upload_layers;
bool layers;
bool use_gs;
} pbo_upload;
} pbo;
/** for drawing with st_util_vertex */
struct pipe_vertex_element util_velems[3];

View file

@ -54,18 +54,18 @@ st_pbo_create_vs(struct st_context *st)
out_pos = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
if (st->pbo_upload.upload_layers) {
if (st->pbo.layers) {
in_instanceid = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_INSTANCEID, 0);
if (!st->pbo_upload.use_gs)
if (!st->pbo.use_gs)
out_layer = ureg_DECL_output(ureg, TGSI_SEMANTIC_LAYER, 0);
}
/* out_pos = in_pos */
ureg_MOV(ureg, out_pos, in_pos);
if (st->pbo_upload.upload_layers) {
if (st->pbo_upload.use_gs) {
if (st->pbo.layers) {
if (st->pbo.use_gs) {
/* out_pos.z = i2f(gl_InstanceID) */
ureg_I2F(ureg, ureg_writemask(out_pos, TGSI_WRITEMASK_Z),
ureg_scalar(in_instanceid, TGSI_SWIZZLE_X));
@ -130,49 +130,49 @@ st_init_pbo_helpers(struct st_context *st)
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
st->pbo_upload.enabled =
st->pbo.upload_enabled =
screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS) &&
screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT) >= 1 &&
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS);
if (!st->pbo_upload.enabled)
if (!st->pbo.upload_enabled)
return;
st->pbo_upload.rgba_only =
st->pbo.rgba_only =
screen->get_param(screen, PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY);
if (screen->get_param(screen, PIPE_CAP_TGSI_INSTANCEID)) {
if (screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) {
st->pbo_upload.upload_layers = true;
st->pbo.layers = true;
} else if (screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES) >= 3) {
st->pbo_upload.upload_layers = true;
st->pbo_upload.use_gs = true;
st->pbo.layers = true;
st->pbo.use_gs = true;
}
}
/* Blend state */
memset(&st->pbo_upload.blend, 0, sizeof(struct pipe_blend_state));
st->pbo_upload.blend.rt[0].colormask = PIPE_MASK_RGBA;
memset(&st->pbo.upload_blend, 0, sizeof(struct pipe_blend_state));
st->pbo.upload_blend.rt[0].colormask = PIPE_MASK_RGBA;
/* Rasterizer state */
memset(&st->pbo_upload.raster, 0, sizeof(struct pipe_rasterizer_state));
st->pbo_upload.raster.half_pixel_center = 1;
memset(&st->pbo.raster, 0, sizeof(struct pipe_rasterizer_state));
st->pbo.raster.half_pixel_center = 1;
}
void
st_destroy_pbo_helpers(struct st_context *st)
{
if (st->pbo_upload.fs) {
cso_delete_fragment_shader(st->cso_context, st->pbo_upload.fs);
st->pbo_upload.fs = NULL;
if (st->pbo.upload_fs) {
cso_delete_fragment_shader(st->cso_context, st->pbo.upload_fs);
st->pbo.upload_fs = NULL;
}
if (st->pbo_upload.gs) {
cso_delete_geometry_shader(st->cso_context, st->pbo_upload.gs);
st->pbo_upload.gs = NULL;
if (st->pbo.gs) {
cso_delete_geometry_shader(st->cso_context, st->pbo.gs);
st->pbo.gs = NULL;
}
if (st->pbo_upload.vs) {
cso_delete_vertex_shader(st->cso_context, st->pbo_upload.vs);
st->pbo_upload.vs = NULL;
if (st->pbo.vs) {
cso_delete_vertex_shader(st->cso_context, st->pbo.vs);
st->pbo.vs = NULL;
}
}