Commit f04f1362 authored by Marek Olšák's avatar Marek Olšák

st/mesa: implement ARB_copy_image

I wonder if the craziness was worth it.
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent ce9db16e
......@@ -153,7 +153,7 @@ GL 4.3, GLSL 4.30:
GL_ARB_ES3_compatibility DONE (all drivers that support GLSL 3.30)
GL_ARB_clear_buffer_object DONE (all drivers)
GL_ARB_compute_shader in progress (jljusten)
GL_ARB_copy_image DONE (i965) (gallium - in progress, VMware)
GL_ARB_copy_image DONE (i965, radeonsi)
GL_KHR_debug DONE (all drivers)
GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL)
GL_ARB_fragment_layer_viewport DONE (nv50, nvc0, r600, radeonsi, llvmpipe)
......
......@@ -45,6 +45,7 @@ Note: some of the new features are only available with certain drivers.
<ul>
<li>GL_ARB_blend_func_extended on freedreno (a3xx)</li>
<li>GL_ARB_copy_image on radeonsi</li>
<li>GL_ARB_gpu_shader_fp64 on r600 for Cypress/Cayman/Aruba chips</li>
<li>GL_ARB_gpu_shader5 on r600 for Evergreen and later chips</li>
<li>GL_ARB_shader_stencil_export on i965 (gen9+)</li>
......
......@@ -423,6 +423,8 @@ STATETRACKER_FILES = \
state_tracker/st_cb_clear.h \
state_tracker/st_cb_condrender.c \
state_tracker/st_cb_condrender.h \
state_tracker/st_cb_copyimage.c \
state_tracker/st_cb_copyimage.h \
state_tracker/st_cb_drawpixels.c \
state_tracker/st_cb_drawpixels.h \
state_tracker/st_cb_drawpixels_shader.c \
......
This diff is collapsed.
/*
* Copyright 2015 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef ST_CB_COPY_IMAGE_H
#define ST_CB_COPY_IMAGE_H
struct dd_function_table;
extern void
st_init_copy_image_functions(struct dd_function_table *functions);
#endif /* ST_CB_COPY_IMAGE_H */
......@@ -1873,55 +1873,6 @@ st_TextureView(struct gl_context *ctx,
return GL_TRUE;
}
/* HACK: this is only enough for the most basic uses of CopyImage. Must fix
* before actually exposing the extension.
*/
static void
st_CopyImageSubData(struct gl_context *ctx,
struct gl_texture_image *src_image,
struct gl_renderbuffer *src_renderbuffer,
int src_x, int src_y, int src_z,
struct gl_texture_image *dst_image,
struct gl_renderbuffer *dst_renderbuffer,
int dst_x, int dst_y, int dst_z,
int src_width, int src_height)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_resource *src_res, *dst_res;
struct pipe_box box;
int src_level, dst_level;
if (src_image) {
struct st_texture_image *src = st_texture_image(src_image);
src_res = src->pt;
src_level = src_image->Level;
}
else {
struct st_renderbuffer *src = st_renderbuffer(src_renderbuffer);
src_res = src->texture;
src_level = 0;
}
if (dst_image) {
struct st_texture_image *dst = st_texture_image(dst_image);
dst_res = dst->pt;
dst_level = dst_image->Level;
}
else {
struct st_renderbuffer *dst = st_renderbuffer(dst_renderbuffer);
dst_res = dst->texture;
dst_level = 0;
}
u_box_2d_zslice(src_x, src_y, src_z, src_width, src_height, &box);
pipe->resource_copy_region(pipe, dst_res, dst_level,
dst_x, dst_y, dst_z,
src_res, src_level,
&box);
}
void
st_init_texture_functions(struct dd_function_table *functions)
{
......@@ -1953,6 +1904,4 @@ st_init_texture_functions(struct dd_function_table *functions)
functions->AllocTextureStorage = st_AllocTextureStorage;
functions->TextureView = st_TextureView;
functions->CopyImageSubData = st_CopyImageSubData;
}
......@@ -44,6 +44,7 @@
#include "st_cb_bufferobjects.h"
#include "st_cb_clear.h"
#include "st_cb_condrender.h"
#include "st_cb_copyimage.h"
#include "st_cb_drawpixels.h"
#include "st_cb_rasterpos.h"
#include "st_cb_drawtex.h"
......@@ -430,6 +431,7 @@ void st_init_driver_functions(struct pipe_screen *screen,
st_init_bufferobject_functions(functions);
st_init_clear_functions(functions);
st_init_bitmap_functions(functions);
st_init_copy_image_functions(functions);
st_init_drawpixels_functions(functions);
st_init_rasterpos_functions(functions);
......
......@@ -439,6 +439,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_base_instance), PIPE_CAP_START_INSTANCE },
{ o(ARB_buffer_storage), PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT },
{ o(ARB_color_buffer_float), PIPE_CAP_VERTEX_COLOR_UNCLAMPED },
{ o(ARB_copy_image), PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS },
{ o(ARB_depth_clamp), PIPE_CAP_DEPTH_CLIP_DISABLE },
{ o(ARB_depth_texture), PIPE_CAP_TEXTURE_SHADOW_MAP },
{ o(ARB_draw_buffers_blend), PIPE_CAP_INDEP_BLEND_FUNC },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment