summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-07-04 07:43:01 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-07-04 07:43:01 +0200
commit28471cfa970702128d822c2ecbb1703eedbca245 (patch)
treefa91f0d366ba857e228946ac88966e1717dc879f /src/mesa
parent9982821cdaf2205443c6297368eaab4115bf92f6 (diff)
parent71633abafc935c25da9731bab48c228ceb9b4097 (diff)
Merge branch 'mesa_7_5_branch'
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c21
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c35
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c3
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c9
-rw-r--r--src/mesa/state_tracker/st_program.c34
6 files changed, 78 insertions, 36 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index c02ccc3528..299aa762c2 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -137,22 +137,15 @@ find_translated_vp(struct st_context *st,
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
if (fragInputsRead & (1 << inAttr)) {
+ stfp->input_to_slot[inAttr] = numIn;
+ numIn++;
if ((fragInputsRead & FRAG_BIT_FOGC)) {
- if (stfp->Base.UsesPointCoord) {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
+ /* leave placeholders for the
+ * extra registers we extract from fog */
+ if (stfp->Base.UsesFrontFacing ||
+ stfp->Base.UsesPointCoord) {
+ numIn += 2;
}
- if (stfp->Base.UsesFrontFacing) {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
- }
- if (stfp->Base.UsesFogFragCoord) {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
- }
- } else {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
}
}
else {
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 2027b713ce..8b5094a04f 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1037,10 +1037,16 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0,
PIPE_TRANSFER_READ, srcx, srcy, width,
height);
+ struct pipe_transfer *ptTex;
+ enum pipe_transfer_usage transfer_usage;
- struct pipe_transfer *ptTex =
- st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, width, height);
+ if (type == GL_DEPTH && pf_is_depth_and_stencil(pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
+ ptTex = st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, transfer_usage,
+ 0, 0, width, height);
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 0a72784ce0..909189f9d3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -529,6 +529,7 @@ st_TexImage(GLcontext * ctx,
GLint texelBytes, sizeInBytes;
GLuint dstRowStride;
struct gl_pixelstore_attrib unpackNB;
+ enum pipe_transfer_usage transfer_usage;
DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target), level, width, height, depth, border);
@@ -680,8 +681,14 @@ st_TexImage(GLcontext * ctx,
}
if (stImage->pt) {
+ if (format == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
texImage->Data = st_texture_image_map(ctx->st, stImage, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
+ transfer_usage, 0, 0,
stImage->base.Width,
stImage->base.Height);
if(stImage->transfer)
@@ -742,7 +749,7 @@ st_TexImage(GLcontext * ctx,
st_texture_image_unmap(ctx->st, stImage);
/* map next slice of 3D texture */
texImage->Data = st_texture_image_map(ctx->st, stImage, i + 1,
- PIPE_TRANSFER_WRITE, 0, 0,
+ transfer_usage, 0, 0,
stImage->base.Width,
stImage->base.Height);
src += srcImageStride;
@@ -1041,6 +1048,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
_mesa_image_image_stride(packing, width, height, format, type);
GLint i;
const GLubyte *src;
+ enum pipe_transfer_usage transfer_usage;
DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
@@ -1072,10 +1080,16 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
* from uploading the buffer under us.
*/
if (stImage->pt) {
+ if (format == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, level,
- PIPE_TRANSFER_WRITE);
+ transfer_usage);
texImage->Data = st_texture_image_map(ctx->st, stImage, zoffset,
- PIPE_TRANSFER_WRITE,
+ transfer_usage,
xoffset, yoffset,
width, height);
}
@@ -1106,7 +1120,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
/* map next slice of 3D texture */
texImage->Data = st_texture_image_map(ctx->st, stImage,
zoffset + i + 1,
- PIPE_TRANSFER_WRITE,
+ transfer_usage,
xoffset, yoffset,
width, height);
src += srcImageStride;
@@ -1274,6 +1288,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans;
GLvoid *texDest;
+ enum pipe_transfer_usage transfer_usage;
assert(width <= MAX_WIDTH);
@@ -1288,10 +1303,16 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
srcX, srcY,
width, height);
+ if (baseFormat == GL_DEPTH_COMPONENT &&
+ pf_is_depth_and_stencil(stImage->pt->format))
+ transfer_usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ transfer_usage = PIPE_TRANSFER_WRITE;
+
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0,
- PIPE_TRANSFER_WRITE);
+ transfer_usage);
- texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE,
+ texDest = st_texture_image_map(ctx->st, stImage, 0, transfer_usage,
destX, destY, width, height);
if (baseFormat == GL_DEPTH_COMPONENT ||
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 13589151ba..ca32b2e573 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -280,7 +280,8 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
PIPE_FLUSH_SWAPBUFFERS |
PIPE_FLUSH_FRAME,
NULL );
- ctx->st->frontbuffer_status = FRONT_STATUS_COPY_OF_BACK;
+ if (st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer))
+ ctx->st->frontbuffer_status = FRONT_STATUS_COPY_OF_BACK;
}
}
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 3140ebe04a..8aef3fc6dc 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -122,8 +122,15 @@ map_register_file_index(
SWIZZLE_X,
SWIZZLE_X,
SWIZZLE_X);
+ /* register after fog */
+ return inputMapping[index] + 1;
} else {
- /* fixme: point coord */
+ *swizzle = MAKE_SWIZZLE4(SWIZZLE_Z,
+ SWIZZLE_W,
+ SWIZZLE_Z,
+ SWIZZLE_W);
+ /* register after frontface */
+ return inputMapping[index] + 2;
}
}
/* inputs are mapped according to the user-defined map */
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 3365bc0b8b..e4d3bb33c7 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -453,20 +453,34 @@ st_translate_fragment_program(struct st_context *st,
stfp->input_semantic_index[slot] = 1;
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
break;
- case FRAG_ATTRIB_FOGC:
- if (stfp->Base.UsesPointCoord) {
- stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stfp->input_semantic_index[slot] = num_generic++;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
- } else if (stfp->Base.UsesFrontFacing) {
- stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
- stfp->input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
- } else {
+ case FRAG_ATTRIB_FOGC: {
+ int extra_decls = 0;
+ if (stfp->Base.UsesFogFragCoord) {
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
stfp->input_semantic_index[slot] = 0;
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ input_flags[slot] = stfp->Base.Base.InputFlags[attr];
+ ++extra_decls;
}
+ if (stfp->Base.UsesFrontFacing) {
+ GLint idx = slot + extra_decls;
+ stfp->input_semantic_name[idx] = TGSI_SEMANTIC_FACE;
+ stfp->input_semantic_index[idx] = 0;
+ interpMode[idx] = TGSI_INTERPOLATE_CONSTANT;
+ input_flags[idx] = stfp->Base.Base.InputFlags[attr];
+ ++extra_decls;
+ }
+ if (stfp->Base.UsesPointCoord) {
+ GLint idx = slot + extra_decls;
+ stfp->input_semantic_name[idx] = TGSI_SEMANTIC_GENERIC;
+ stfp->input_semantic_index[idx] = num_generic++;
+ interpMode[idx] = TGSI_INTERPOLATE_PERSPECTIVE;
+ input_flags[idx] = stfp->Base.Base.InputFlags[attr];
+ ++extra_decls;
+ }
+ fs_num_inputs += extra_decls - 1;
+ continue;
+ }
break;
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1: