summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Sapountzis <[email protected]>2010-03-25 17:01:52 +0200
committerGeorge Sapountzis <[email protected]>2010-03-25 17:01:52 +0200
commit96c152b4b066f6e3583821ad44ec8a527ab55e05 (patch)
treea03463242ee16bf59d879d3c4cc785dfc7a30675
parenta21c30308db206467a54394b1ddda444861ee9b6 (diff)
st/dri: make get_texture into validate_att
This is a wrapper around dri_st_framebuffer_validate for a single attachment. Also, call validate through hook to make it more generic.
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c7
-rw-r--r--src/gallium/state_trackers/dri/dri_st_api.c36
-rw-r--r--src/gallium/state_trackers/dri/dri_st_api.h6
3 files changed, 26 insertions, 23 deletions
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 930387f8a67..4e2300d78fd 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -48,8 +48,11 @@ void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
{
struct dri_context *ctx = dri_context(pDRICtx);
struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_texture *pt =
- dri_get_st_framebuffer_texture(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);
+ struct pipe_texture *pt;
+
+ dri_st_framebuffer_validate_att(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);
+
+ pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
if (pt) {
ctx->st->teximage(ctx->st,
diff --git a/src/gallium/state_trackers/dri/dri_st_api.c b/src/gallium/state_trackers/dri/dri_st_api.c
index 84c94cb06db..c067cee66cf 100644
--- a/src/gallium/state_trackers/dri/dri_st_api.c
+++ b/src/gallium/state_trackers/dri/dri_st_api.c
@@ -390,33 +390,33 @@ dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
}
/**
- * Return the texture at an attachment. Allocate the texture if it does not
+ * Validate the texture at an attachment. Allocate the texture if it does not
* exist.
*/
-struct pipe_texture *
-dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi,
- enum st_attachment_type statt)
+void
+dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
{
struct dri_drawable *drawable =
(struct dri_drawable *) stfbi->st_manager_private;
-
- if (!(drawable->texture_mask & (1 << statt))) {
- enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
- unsigned i, count = 0;
+ enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
+ unsigned i, count = 0;
- /* make sure DRI2 does not destroy existing buffers */
- for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
- if (drawable->texture_mask & (1 << i)) {
- statts[count++] = i;
- }
- }
- statts[count++] = statt;
+ /* check if buffer already exists */
+ if (drawable->texture_mask & (1 << statt))
+ return;
- drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
- dri_st_framebuffer_validate(stfbi, statts, count, NULL);
+ /* make sure DRI2 does not destroy existing buffers */
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ if (drawable->texture_mask & (1 << i)) {
+ statts[count++] = i;
+ }
}
+ statts[count++] = statt;
+
+ drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
- return drawable->textures[statt];
+ stfbi->validate(stfbi, statts, count, NULL);
}
/**
diff --git a/src/gallium/state_trackers/dri/dri_st_api.h b/src/gallium/state_trackers/dri/dri_st_api.h
index 7cf522e4690..99a217bfa79 100644
--- a/src/gallium/state_trackers/dri/dri_st_api.h
+++ b/src/gallium/state_trackers/dri/dri_st_api.h
@@ -48,8 +48,8 @@ dri_create_st_framebuffer(struct dri_drawable *drawable);
void
dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
-struct pipe_texture *
-dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi,
- enum st_attachment_type statt);
+void
+dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt);
#endif /* _DRI_ST_API_H_ */