mesa: Set gl_fragment_program::UsesKill in do_set_program_inouts.
[mesa.git] / src / mesa / state_tracker / st_cb_texture.c
index 593dc95cde4bae8fe1cae7070e14a3833336bb03..a7f57b96f2713f121b8ae7ef8eb02bcea8eb877c 100644 (file)
@@ -545,16 +545,16 @@ st_TexImage(struct gl_context * ctx, GLuint dims,
 
 
 static void
-st_CompressedTexImage2D(struct gl_context *ctx,
-                        struct gl_texture_image *texImage,
-                        GLint internalFormat,
-                        GLint width, GLint height, GLint border,
-                        GLsizei imageSize, const GLvoid *data)
+st_CompressedTexImage(struct gl_context *ctx, GLuint dims,
+                      struct gl_texture_image *texImage,
+                      GLint internalFormat,
+                      GLint width, GLint height, GLint border, GLint depth,
+                      GLsizei imageSize, const GLvoid *data)
 {
-   prep_teximage(ctx, texImage, internalFormat, width, 1, 1, border,
+   prep_teximage(ctx, texImage, internalFormat, width, height, depth, border,
                  GL_NONE, GL_NONE);
-   _mesa_store_compressed_teximage2d(ctx, texImage, internalFormat, width,
-                                     height, border, imageSize, data);
+   _mesa_store_compressed_teximage(ctx, dims, texImage, internalFormat, width,
+                                   height, depth, border, imageSize, data);
 }
 
 
@@ -600,6 +600,7 @@ decompress_with_blit(struct gl_context * ctx,
 
       u_sampler_view_default_template(&sv_temp, stObj->pt, stObj->pt->format);
 
+      sv_temp.format = util_format_linear(sv_temp.format);
       sv_temp.u.tex.first_level =
       sv_temp.u.tex.last_level = texImage->Level;
 
@@ -943,7 +944,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
    struct pipe_screen *screen = pipe->screen;
    enum pipe_format dest_format, src_format;
    GLboolean matching_base_formats;
-   GLuint format_writemask, sample_count;
+   GLuint color_writemask, zs_writemask, sample_count;
    struct pipe_surface *dest_surface = NULL;
    GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
    struct pipe_surface surf_tmpl;
@@ -1024,15 +1025,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
    }
 
    if (texBaseFormat == GL_DEPTH_COMPONENT) {
-      format_writemask = TGSI_WRITEMASK_XYZW;
+      color_writemask = 0;
+      zs_writemask = BLIT_WRITEMASK_Z;
       dst_usage = PIPE_BIND_DEPTH_STENCIL;
    }
    else {
-      format_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
+      color_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
+      zs_writemask = 0;
       dst_usage = PIPE_BIND_RENDER_TARGET;
    }
 
-   if (!format_writemask ||
+   if ((!color_writemask && !zs_writemask) ||
        !screen->is_format_supported(screen, src_format,
                                     PIPE_TEXTURE_2D, sample_count,
                                     PIPE_BIND_SAMPLER_VIEW) ||
@@ -1065,17 +1068,17 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
 
    dest_surface = pipe->create_surface(pipe, stImage->pt,
                                        &surf_tmpl);
-   util_blit_pixels_writemask(st->blit,
-                              strb->texture,
-                              strb->surface->u.tex.level,
-                              srcX, srcY0,
-                              srcX + width, srcY1,
-                              strb->surface->u.tex.first_layer,
-                              dest_surface,
-                              destX, destY,
-                              destX + width, destY + height,
-                              0.0, PIPE_TEX_MIPFILTER_NEAREST,
-                              format_writemask);
+   util_blit_pixels(st->blit,
+                    strb->texture,
+                    strb->surface->u.tex.level,
+                    srcX, srcY0,
+                    srcX + width, srcY1,
+                    strb->surface->u.tex.first_layer,
+                    dest_surface,
+                    destX, destY,
+                    destX + width, destY + height,
+                    0.0, PIPE_TEX_MIPFILTER_NEAREST,
+                    color_writemask, zs_writemask);
    pipe_surface_reference(&dest_surface, NULL);
 
    /* Restore conditional rendering state. */
@@ -1354,16 +1357,14 @@ st_init_texture_functions(struct dd_function_table *functions)
    functions->ChooseTextureFormat = st_ChooseTextureFormat;
    functions->TexImage = st_TexImage;
    functions->TexSubImage = _mesa_store_texsubimage;
-   functions->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
-   functions->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
-   functions->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
+   functions->CompressedTexSubImage = _mesa_store_compressed_texsubimage;
    functions->CopyTexSubImage = st_CopyTexSubImage;
    functions->GenerateMipmap = st_generate_mipmap;
 
    functions->GetTexImage = st_GetTexImage;
 
    /* compressed texture functions */
-   functions->CompressedTexImage2D = st_CompressedTexImage2D;
+   functions->CompressedTexImage = st_CompressedTexImage;
    functions->GetCompressedTexImage = _mesa_get_compressed_teximage;
 
    functions->NewTextureObject = st_NewTextureObject;