summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-04-04 11:41:30 +0100
committerJosé Fonseca <[email protected]>2011-04-06 08:26:04 +0100
commitafeaf1771d0ccbd2482c5ad7fa237c50b4d3921e (patch)
treefe9bc95a17168a8de07a207a1383f41d27274c95 /src/gallium/state_trackers
parent14b574433c7faedaa18f1c946159cb03630c7d9f (diff)
st/python: Remove bindings, and all its dependencies.
Because: - bindings are not fully automatic, and they are broken most of the time - unit tests/samples can be written in C on top of graw - tracing/retracing is more useful at API levels with stable ABIs such as GL, producing traces that cover more layers of the driver stack and and can be used for regression testing
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/python/README43
-rw-r--r--src/gallium/state_trackers/python/SConscript66
-rw-r--r--src/gallium/state_trackers/python/gallium.i105
-rw-r--r--src/gallium/state_trackers/python/p_compiler.i29
-rw-r--r--src/gallium/state_trackers/python/p_context.i756
-rw-r--r--src/gallium/state_trackers/python/p_device.i138
-rw-r--r--src/gallium/state_trackers/python/p_state.i186
-rw-r--r--src/gallium/state_trackers/python/p_texture.i152
-rw-r--r--src/gallium/state_trackers/python/st_device.c305
-rw-r--r--src/gallium/state_trackers/python/st_device.h111
-rw-r--r--src/gallium/state_trackers/python/st_hardpipe_winsys.c212
-rw-r--r--src/gallium/state_trackers/python/st_sample.c594
-rw-r--r--src/gallium/state_trackers/python/st_sample.h53
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c78
-rw-r--r--src/gallium/state_trackers/python/st_winsys.h43
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.pngbin8750 -> 0 bytes
-rw-r--r--src/gallium/state_trackers/python/u_format.i88
17 files changed, 0 insertions, 2959 deletions
diff --git a/src/gallium/state_trackers/python/README b/src/gallium/state_trackers/python/README
deleted file mode 100644
index e24a262aba9..00000000000
--- a/src/gallium/state_trackers/python/README
+++ /dev/null
@@ -1,43 +0,0 @@
-This directory contains Python bindings to Gallium3D. It looks like a state
-tracker from the pipe driver perspective, and it looks like a pipe driver from
-the python script perspective.
-
-
-To build you'll need:
-* Python (with development packages)
-* SCons
-* SWIG, http://www.swig.org/download.html
-* Python Imaging Library with TK support, http://www.pythonware.com/products/pil/,
- for the samples
-
-On a debian-based distro you can simply do:
-
- aptitude install python-dev scons swig python-imaging python-imaging-tk
-
-On a Windows machine ensure the swig command is in your PATH.
-
-Invoke scons on the top dir as
-
- scons debug=yes statetrackers=python drivers=softpipe winsys=none
-
-To use it set PYTHONPATH appropriately, e.g, in Linux do:
-
- export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/state_trackers/python
-
-or (in Windows)
-
- set PYTHONPATH=%CD%\build\windows-x86-debug\gallium\state_trackers\python
-
-and then try running
-
- python progs/gallium/python/samples/tri.py
-
-which should show a triangle.
-
-
-This is still work in progress:
-- errors are not handled properly and almost always result in crash
-- state atoms with array members are awkward to set
-
---
-Jose Fonseca <[email protected]>
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
deleted file mode 100644
index b8371865a61..00000000000
--- a/src/gallium/state_trackers/python/SConscript
+++ /dev/null
@@ -1,66 +0,0 @@
-import sys
-import os.path
-
-Import('*')
-
-if env['toolchain'] == 'crossmingw':
- # Cross-compilation not supported
- Return()
-
-if not env.Detect(['swig']):
- Return()
-
-env = env.Clone()
-
-env.Tool('python')
-
-env.Tool('swig')
-env.Append(SWIGPATH = ['#src/gallium/include', '#src/gallium/include/pipe'])
-env.Append(SWIGFLAGS = ['-python', '-keyword'])
-
-env.Append(CPPPATH = '.')
-
-if env['platform'] == 'windows':
- env.Append(LIBS = [
- 'opengl32',
- 'gdi32',
- 'user32',
- 'kernel32',
- 'ws2_32',
- ])
-else:
- env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
- env.Append(LIBS = [
- 'GL',
- 'X11',
- ])
-
-sources = [
- 'gallium.i',
- 'st_device.c',
- 'st_sample.c',
- 'st_hardpipe_winsys.c',
- 'st_softpipe_winsys.c',
-]
-
-env.Prepend(LIBS = [
- ws_null,
- trace,
- gallium,
-])
-
-if env['llvm']:
- env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
- env.Prepend(LIBS = [llvmpipe])
-if True:
- env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
- env.Prepend(LIBS = [softpipe])
-
-env['no_import_lib'] = 1
-
-pyst = env.SharedLibrary(
- target = '_gallium',
- source = sources,
-)
-
-env.Alias('python', pyst)
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
deleted file mode 100644
index c6084f78aee..00000000000
--- a/src/gallium/state_trackers/python/gallium.i
+++ /dev/null
@@ -1,105 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * SWIG interface definion for Gallium types.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-%module gallium;
-
-%{
-
-#include <stdio.h>
-
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-#include "pipe/p_shader_tokens.h"
-#include "os/os_stream.h"
-#include "util/u_inlines.h"
-#include "util/u_draw_quad.h"
-#include "util/u_tile.h"
-#include "util/u_math.h"
-#include "util/u_format.h"
-#include "util/u_dump.h"
-#include "util/u_memory.h"
-#include "util/u_sampler.h"
-#include "cso_cache/cso_context.h"
-#include "tgsi/tgsi_text.h"
-#include "tgsi/tgsi_dump.h"
-
-#include "st_device.h"
-#include "st_sample.h"
-
-%}
-
-%include "typemaps.i"
-%include "exception.i"
-%include "cstring.i"
-
-%include "carrays.i"
-%array_class(unsigned char, ByteArray);
-%array_class(int, IntArray);
-%array_class(unsigned, UnsignedArray);
-%array_class(float, FloatArray);
-
-
-%rename(Device) st_device;
-%rename(Context) st_context;
-%rename(Resource) pipe_resource;
-%rename(Surface) st_surface;
-
-%rename(BlendColor) pipe_blend_color;
-%rename(Blend) pipe_blend_state;
-%rename(Clip) pipe_clip_state;
-%rename(Depth) pipe_depth_state;
-%rename(Stencil) pipe_stencil_state;
-%rename(Alpha) pipe_alpha_state;
-%rename(DepthStencilAlpha) pipe_depth_stencil_alpha_state;
-%rename(Framebuffer) pipe_framebuffer_state;
-%rename(PolyStipple) pipe_poly_stipple;
-%rename(Rasterizer) pipe_rasterizer_state;
-%rename(Sampler) pipe_sampler_state;
-%rename(Scissor) pipe_scissor_state;
-%rename(Shader) pipe_shader_state;
-%rename(VertexBuffer) pipe_vertex_buffer;
-%rename(VertexElement) pipe_vertex_element;
-%rename(Viewport) pipe_viewport_state;
-
-
-%include "p_compiler.i"
-%include "p_defines.h"
-%include "p_format.h"
-
-%include "p_device.i"
-%include "p_context.i"
-%include "p_texture.i"
-%include "p_state.i"
-
-%include "u_format.i"
diff --git a/src/gallium/state_trackers/python/p_compiler.i b/src/gallium/state_trackers/python/p_compiler.i
deleted file mode 100644
index 15f6ba5b9db..00000000000
--- a/src/gallium/state_trackers/python/p_compiler.i
+++ /dev/null
@@ -1,29 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-
-typedef unsigned char ubyte;
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
deleted file mode 100644
index 17d25ad0aa6..00000000000
--- a/src/gallium/state_trackers/python/p_context.i
+++ /dev/null
@@ -1,756 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * SWIG interface definion for Gallium types.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-%nodefaultctor st_context;
-%nodefaultdtor st_context;
-
-struct st_context {
-};
-
-%extend st_context {
-
- ~st_context() {
- st_context_destroy($self);
- }
-
- /*
- * State functions (create/bind/destroy state objects)
- */
-
- void set_blend( const struct pipe_blend_state *state ) {
- cso_set_blend($self->cso, state);
- }
-
- void set_fragment_sampler( unsigned index, const struct pipe_sampler_state *state ) {
- cso_single_sampler($self->cso, index, state);
- cso_single_sampler_done($self->cso);
- }
-
- void set_vertex_sampler( unsigned index, const struct pipe_sampler_state *state ) {
- cso_single_vertex_sampler($self->cso, index, state);
- cso_single_vertex_sampler_done($self->cso);
- }
-
- void set_rasterizer( const struct pipe_rasterizer_state *state ) {
- cso_set_rasterizer($self->cso, state);
- }
-
- void set_depth_stencil_alpha(const struct pipe_depth_stencil_alpha_state *state) {
- cso_set_depth_stencil_alpha($self->cso, state);
- }
-
- void set_fragment_shader( const struct pipe_shader_state *state ) {
- void *fs;
-
- if(!state) {
- cso_set_fragment_shader_handle($self->cso, NULL);
- return;
- }
-
- fs = $self->pipe->create_fs_state($self->pipe, state);
- if(!fs)
- return;
-
- if(cso_set_fragment_shader_handle($self->cso, fs) != PIPE_OK)
- return;
-
- cso_delete_fragment_shader($self->cso, $self->fs);
- $self->fs = fs;
- }
-
- void set_vertex_shader( const struct pipe_shader_state *state ) {
- void *vs;
-
- if(!state) {
- cso_set_vertex_shader_handle($self->cso, NULL);
- return;
- }
-
- vs = $self->pipe->create_vs_state($self->pipe, state);
- if(!vs)
- return;
-
- if(cso_set_vertex_shader_handle($self->cso, vs) != PIPE_OK)
- return;
-
- cso_delete_vertex_shader($self->cso, $self->vs);
- $self->vs = vs;
- }
-
- void set_geometry_shader( const struct pipe_shader_state *state ) {
- void *gs;
-
- if(!state) {
- cso_set_geometry_shader_handle($self->cso, NULL);
- return;
- }
-
- gs = $self->pipe->create_gs_state($self->pipe, state);
- if(!gs)
- return;
-
- if(cso_set_geometry_shader_handle($self->cso, gs) != PIPE_OK)
- return;
-
- cso_delete_geometry_shader($self->cso, $self->gs);
- $self->gs = gs;
- }
-
- struct pipe_sampler_view *
- create_sampler_view(struct pipe_resource *texture,
- enum pipe_format format = PIPE_FORMAT_NONE,
- unsigned first_level = 0,
- unsigned last_level = ~0,
- unsigned first_layer = 0,
- unsigned last_layer = ~0,
- unsigned swizzle_r = 0,
- unsigned swizzle_g = 1,
- unsigned swizzle_b = 2,
- unsigned swizzle_a = 3)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_sampler_view templat;
-
- memset(&templat, 0, sizeof templat);
- if (format == PIPE_FORMAT_NONE) {
- templat.format = texture->format;
- } else {
- templat.format = format;
- }
- templat.u.tex.last_level = MIN2(last_level, texture->last_level);
- templat.u.tex.first_level = first_level;
- templat.u.tex.first_layer = first_layer;
- templat.u.tex.last_layer = last_layer;
- templat.swizzle_r = swizzle_r;
- templat.swizzle_g = swizzle_g;
- templat.swizzle_b = swizzle_b;
- templat.swizzle_a = swizzle_a;
-
- return pipe->create_sampler_view(pipe, texture, &templat);
- }
-
- void
- sampler_view_destroy(struct pipe_context *ctx,
- struct pipe_sampler_view *view)
- {
- struct pipe_context *pipe = $self->pipe;
-
- pipe->sampler_view_destroy(pipe, view);
- }
-
- /*
- * Parameter-like state (or properties)
- */
-
- void set_blend_color(const struct pipe_blend_color *state ) {
- cso_set_blend_color($self->cso, state);
- }
-
- void set_stencil_ref(const struct pipe_stencil_ref *state ) {
- cso_set_stencil_ref($self->cso, state);
- }
-
- void set_clip(const struct pipe_clip_state *state ) {
- $self->pipe->set_clip_state($self->pipe, state);
- }
-
- void set_constant_buffer(unsigned shader, unsigned index,
- struct pipe_resource *buffer )
- {
- $self->pipe->set_constant_buffer($self->pipe, shader, index, buffer);
- }
-
- void set_framebuffer(const struct pipe_framebuffer_state *state )
- {
- memcpy(&$self->framebuffer, state, sizeof *state);
- cso_set_framebuffer($self->cso, state);
- }
-
- void set_polygon_stipple(const struct pipe_poly_stipple *state ) {
- $self->pipe->set_polygon_stipple($self->pipe, state);
- }
-
- void set_scissor(const struct pipe_scissor_state *state ) {
- $self->pipe->set_scissor_state($self->pipe, state);
- }
-
- void set_viewport(const struct pipe_viewport_state *state) {
- cso_set_viewport($self->cso, state);
- }
-
- void set_fragment_sampler_view(unsigned index,
- struct pipe_sampler_view *view)
- {
- pipe_sampler_view_reference(&$self->fragment_sampler_views[index], view);
-
- $self->pipe->set_fragment_sampler_views($self->pipe,
- PIPE_MAX_SAMPLERS,
- $self->fragment_sampler_views);
- }
-
- void set_vertex_sampler_view(unsigned index,
- struct pipe_sampler_view *view)
- {
- pipe_sampler_view_reference(&$self->vertex_sampler_views[index], view);
-
- $self->pipe->set_vertex_sampler_views($self->pipe,
- PIPE_MAX_VERTEX_SAMPLERS,
- $self->vertex_sampler_views);
- }
-
- void set_fragment_sampler_texture(unsigned index,
- struct pipe_resource *texture) {
- struct pipe_sampler_view templ;
-
- if(!texture)
- texture = $self->default_texture;
- pipe_sampler_view_reference(&$self->fragment_sampler_views[index], NULL);
- u_sampler_view_default_template(&templ,
- texture,
- texture->format);
- $self->fragment_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe,
- texture,
- &templ);
- $self->pipe->set_fragment_sampler_views($self->pipe,
- PIPE_MAX_SAMPLERS,
- $self->fragment_sampler_views);
- }
-
- void set_vertex_sampler_texture(unsigned index,
- struct pipe_resource *texture) {
- struct pipe_sampler_view templ;
-
- if(!texture)
- texture = $self->default_texture;
- pipe_sampler_view_reference(&$self->vertex_sampler_views[index], NULL);
- u_sampler_view_default_template(&templ,
- texture,
- texture->format);
- $self->vertex_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe,
- texture,
- &templ);
-
- $self->pipe->set_vertex_sampler_views($self->pipe,
- PIPE_MAX_VERTEX_SAMPLERS,
- $self->vertex_sampler_views);
- }
-
- void set_vertex_buffer(unsigned index,
- unsigned stride,
- unsigned buffer_offset,
- struct pipe_resource *buffer)
- {
- unsigned i;
- struct pipe_vertex_buffer state;
-
- memset(&state, 0, sizeof(state));
- state.stride = stride;
- state.buffer_offset = buffer_offset;
- state.buffer = buffer;
-
- memcpy(&$self->vertex_buffers[index], &state, sizeof(state));
-
- for(i = 0; i < PIPE_MAX_ATTRIBS; ++i)
- if(self->vertex_buffers[i].buffer)
- $self->num_vertex_buffers = i + 1;
-
- $self->pipe->set_vertex_buffers($self->pipe,
- $self->num_vertex_buffers,
- $self->vertex_buffers);
- }
-
- void set_index_buffer(unsigned index_size,
- unsigned offset,
- struct pipe_resource *buffer)
- {
- struct pipe_index_buffer ib;
-
- memset(&ib, 0, sizeof(ib));
- ib.index_size = index_size;
- ib.offset = offset;
- ib.buffer = buffer;
-
- $self->pipe->set_index_buffer($self->pipe, &ib);
- }
-
- void set_vertex_element(unsigned index,
- const struct pipe_vertex_element *element)
- {
- memcpy(&$self->vertex_elements[index], element, sizeof(*element));
- }
-
- void set_vertex_elements(unsigned num)
- {
- $self->num_vertex_elements = num;
- cso_set_vertex_elements($self->cso,
- $self->num_vertex_elements,
- $self->vertex_elements);
- }
-
- /*
- * Draw functions
- */
-
- void draw_arrays(unsigned mode, unsigned start, unsigned count) {
- util_draw_arrays($self->pipe, mode, start, count);
- }
-
- void draw_vbo(const struct pipe_draw_info *info)
- {
- $self->pipe->draw_vbo($self->pipe, info);
- }
-
- void draw_vertices(unsigned prim,
- unsigned num_verts,
- unsigned num_attribs,
- const float *vertices)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_resource *vbuf;
- struct pipe_transfer *transfer;
- struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_buffer vbuffer;
- float *map;
- unsigned size;
- unsigned i;
-
- size = num_verts * num_attribs * 4 * sizeof(float);
-
- vbuf = pipe_buffer_create(screen,
- PIPE_BIND_VERTEX_BUFFER,
- PIPE_USAGE_STATIC,
- size);
- if(!vbuf)
- goto error1;
-
- map = pipe_buffer_map(pipe, vbuf, PIPE_TRANSFER_WRITE, &transfer);
- if (!map)
- goto error2;
- memcpy(map, vertices, size);
- pipe_buffer_unmap(pipe, transfer);
-
- cso_save_vertex_elements($self->cso);
-
- /* tell pipe about the vertex attributes */
- for (i = 0; i < num_attribs; i++) {
- velements[i].src_offset = i * 4 * sizeof(float);
- velements[i].instance_divisor = 0;
- velements[i].vertex_buffer_index = 0;
- velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- }
- cso_set_vertex_elements($self->cso, num_attribs, velements);
-
- /* tell pipe about the vertex buffer */
- memset(&vbuffer, 0, sizeof(vbuffer));
- vbuffer.buffer = vbuf;
- vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
- vbuffer.buffer_offset = 0;
- pipe->set_vertex_buffers(pipe, 1, &vbuffer);
-
- /* draw */
- util_draw_arrays(pipe, prim, 0, num_verts);
-
- cso_restore_vertex_elements($self->cso);
-
-error2:
- pipe_resource_reference(&vbuf, NULL);
-error1:
- ;
- }
-
- void
- clear(unsigned buffers, const float *rgba, double depth = 0.0f,
- unsigned stencil = 0)
- {
- $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
- }
-
- void
- flush(unsigned flags = 0) {
- struct pipe_fence_handle *fence = NULL;
- $self->pipe->flush($self->pipe, &fence);
- if(fence) {
- /* TODO: allow asynchronous operation */
- $self->pipe->screen->fence_finish( $self->pipe->screen, fence, PIPE_TIMEOUT_INFINITE );
- $self->pipe->screen->fence_reference( $self->pipe->screen, &fence, NULL );
- }
- }
-
- /*
- * Surface functions
- */
-
- void resource_copy_region(struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dstx, unsigned dsty, unsigned dstz,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box)
- {
- $self->pipe->resource_copy_region($self->pipe,
- dst, dst_level, dstx, dsty, dstz,
- src, src_level, src_box);
- }
-
-
- void clear_render_target(struct st_surface *dst,
- float *rgba,
- unsigned x, unsigned y,
- unsigned width, unsigned height)
- {
- struct pipe_surface *_dst = NULL;
-
- _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_RENDER_TARGET);
- if(!_dst)
- SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
-
- $self->pipe->clear_render_target($self->pipe, _dst, rgba, x, y, width, height);
-
- fail:
- pipe_surface_reference(&_dst, NULL);
- }
-
- void clear_depth_stencil(struct st_surface *dst,
- unsigned clear_flags,
- double depth,
- unsigned stencil,
- unsigned x, unsigned y,
- unsigned width, unsigned height)
- {
- struct pipe_surface *_dst = NULL;
-
- _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_DEPTH_STENCIL);
- if(!_dst)
- SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
-
- $self->pipe->clear_depth_stencil($self->pipe, _dst, clear_flags, depth, stencil,
- x, y, width, height);
-
- fail:
- pipe_surface_reference(&_dst, NULL);
- }
-
- %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void
- surface_read_raw(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- char **STRING, int *LENGTH)
- {
- struct pipe_resource *texture = surface->texture;
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- unsigned stride;
-
- stride = util_format_get_stride(texture->format, w);
- *LENGTH = util_format_get_nblocksy(texture->format, h) * stride;
- *STRING = (char *) malloc(*LENGTH);
- if(!*STRING)
- return;
-
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_raw(pipe, transfer, 0, 0, w, h, *STRING, stride);
- pipe->transfer_destroy(pipe, transfer);
- }
- }
-
- %cstring_input_binary(const char *STRING, unsigned LENGTH);
- void
- surface_write_raw(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- const char *STRING, unsigned LENGTH, unsigned stride = 0)
- {
- struct pipe_resource *texture = surface->texture;
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
-
- if(stride == 0)
- stride = util_format_get_stride(texture->format, w);
-
- if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride)
- SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
-
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(!transfer)
- SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
-
- pipe_put_tile_raw(pipe, transfer, 0, 0, w, h, STRING, stride);
- pipe->transfer_destroy(pipe, transfer);
-
- fail:
- return;
- }
-
- void
- surface_read_rgba(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- float *rgba)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
- pipe->transfer_destroy(pipe, transfer);
- }
- }
-
- void
- surface_write_rgba(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- const float *rgba)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(transfer) {
- pipe_put_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
- pipe->transfer_destroy(pipe, transfer);
- }
- }
-
- %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void
- surface_read_rgba8(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- char **STRING, int *LENGTH)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- float *rgba;
- unsigned char *rgba8;
- unsigned i, j, k;
-
- *LENGTH = 0;
- *STRING = NULL;
-
- if (!surface)
- return;
-
- *LENGTH = h*w*4;
- *STRING = (char *) malloc(*LENGTH);
- if(!*STRING)
- return;
-
- rgba = malloc(h*w*4*sizeof(float));
- if(!rgba)
- return;
-
- rgba8 = (unsigned char *) *STRING;
-
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
- for(j = 0; j < h; ++j) {
- for(i = 0; i < w; ++i)
- for(k = 0; k <4; ++k)
- rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
- }
- pipe->transfer_destroy(pipe, transfer);
- }
-
- free(rgba);
- }
-
- void
- surface_read_z(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- unsigned *z)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_z(pipe, transfer, 0, 0, w, h, z);
- pipe->transfer_destroy(pipe, transfer);
- }
- }
-
- void
- surface_write_z(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- const unsigned *z)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(transfer) {
- pipe_put_tile_z(pipe, transfer, 0, 0, w, h, z);
- pipe->transfer_destroy(pipe, transfer);
- }
- }
-
- void
- surface_sample_rgba(struct st_surface *surface,
- float *rgba,
- int norm = 0)
- {
- st_sample_surface($self->pipe, surface, rgba, norm != 0);
- }
-
- unsigned
- surface_compare_rgba(struct st_surface *surface,
- unsigned x, unsigned y, unsigned w, unsigned h,
- const float *rgba, float tol = 0.0)
- {
- struct pipe_context *pipe = $self->pipe;
- struct pipe_transfer *transfer;
- float *rgba2;
- const float *p1;
- const float *p2;
- unsigned i, j, n;
-
- rgba2 = MALLOC(h*w*4*sizeof(float));
- if(!rgba2)
- return ~0;
-
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(!transfer) {
- FREE(rgba2);
- return ~0;
- }
-
- pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba2);
- pipe->transfer_destroy(pipe, transfer);
-
- p1 = rgba;
- p2 = rgba2;
- n = 0;
- for(i = h*w; i; --i) {
- unsigned differs = 0;
- for(j = 4; j; --j) {
- float delta = *p2++ - *p1++;
- if (delta < -tol || delta > tol)
- differs = 1;
- }
- n += differs;
- }
-
- FREE(rgba2);
-
- return n;
- }
-
- %cstring_input_binary(const char *STRING, unsigned LENGTH);
- void
- transfer_inline_write(struct pipe_resource *resource,
- unsigned level,
- unsigned usage,
- const struct pipe_box *box,
- const char *STRING, unsigned LENGTH,
- unsigned stride,
- unsigned layer_stride)
- {
- struct pipe_context *pipe = $self->pipe;
-
- pipe->transfer_inline_write(pipe, resource, level, usage, box, STRING, stride, layer_stride);
- }
-
- %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void buffer_read(struct pipe_resource *buffer,
- char **STRING, int *LENGTH)
- {
- struct pipe_context *pipe = $self->pipe;
-
- assert(buffer->target == PIPE_BUFFER);
-
- *LENGTH = buffer->width0;
- *STRING = (char *) malloc(buffer->width0);
- if(!*STRING)
- return;
-
- pipe_buffer_read(pipe, buffer, 0, buffer->width0, *STRING);
- }
-
- void buffer_write(struct pipe_resource *buffer,
- const char *STRING, unsigned LENGTH, unsigned offset = 0)
- {
- struct pipe_context *pipe = $self->pipe;
-
- assert(buffer->target == PIPE_BUFFER);
-
- if(offset > buffer->width0)
- SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
-
- if(offset + LENGTH > buffer->width0)
- SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
-
- pipe_buffer_write(pipe, buffer, offset, LENGTH, STRING);
-
-fail:
- return;
- }
-
-};
diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i
deleted file mode 100644
index 61f6b3bb739..00000000000
--- a/src/gallium/state_trackers/python/p_device.i
+++ /dev/null
@@ -1,138 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * SWIG interface definion for Gallium types.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-
-%nodefaultctor st_device;
-%nodefaultdtor st_device;
-
-
-struct st_device {
-};
-
-%newobject st_device::texture_create;
-%newobject st_device::context_create;
-%newobject st_device::buffer_create;
-
-%extend st_device {
-
- st_device(int hardware = 1) {
- return st_device_create(hardware ? TRUE : FALSE);
- }
-
- ~st_device() {
- st_device_destroy($self);
- }
-
- const char * get_name( void ) {
- return $self->screen->get_name($self->screen);
- }
-
- const char * get_vendor( void ) {
- return $self->screen->get_vendor($self->screen);
- }
-
- /**
- * Query an integer-valued capability/parameter/limit
- * \param param one of PIPE_CAP_x
- */
- int get_param( int param ) {
- return $self->screen->get_param($self->screen, param);
- }
-
- /**
- * Query a float-valued capability/parameter/limit
- * \param param one of PIPE_CAP_x
- */
- float get_paramf( int param ) {
- return $self->screen->get_paramf($self->screen, param);
- }
-
- /**
- * Check if the given pipe_format is supported as a texture or
- * drawing surface.
- * \param bind bitmask of PIPE_BIND flags
- */
- int is_format_supported( enum pipe_format format,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned bind ) {
- /* We can't really display surfaces with the python statetracker so mask
- * out that usage */
- bind &= ~PIPE_BIND_DISPLAY_TARGET;
-
- return $self->screen->is_format_supported( $self->screen,
- format,
- target,
- sample_count,
- bind );
- }
-
- struct st_context *
- context_create(void) {
- return st_context_create($self);
- }
-
- struct pipe_resource *
- resource_create(
- enum pipe_format format,
- unsigned width,
- unsigned height,
- unsigned depth = 1,
- unsigned last_level = 0,
- enum pipe_texture_target target = PIPE_TEXTURE_2D,
- unsigned bind = 0
- ) {
- struct pipe_resource templat;
-
- /* We can't really display surfaces with the python statetracker so mask
- * out that usage */
- bind &= ~PIPE_BIND_DISPLAY_TARGET;
-
- memset(&templat, 0, sizeof(templat));
- templat.format = format;
- templat.width0 = width;
- templat.height0 = height;
- templat.depth0 = depth;
- templat.last_level = last_level;
- templat.target = target;
- templat.bind = bind;
-
- return $self->screen->resource_create($self->screen, &templat);
- }
-
- struct pipe_resource *
- buffer_create(unsigned size, unsigned usage, unsigned bind = 0) {
- return pipe_buffer_create($self->screen, bind, usage, size);
- }
-};
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i
deleted file mode 100644
index 0537557661d..00000000000
--- a/src/gallium/state_trackers/python/p_state.i
+++ /dev/null
@@ -1,186 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * SWIG interface definion for Gallium types.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-%module gallium;
-
-%ignore winsys;
-%ignore pipe_vertex_buffer::buffer;
-
-%include "pipe/p_compiler.h";
-%include "pipe/p_state.h";
-
-
-%array_class(struct pipe_stencil_state, StencilArray);
-
-
-%extend pipe_rt_blend_state
-{
- struct pipe_rt_blend_state *
- __getitem__(int index)
- {
- if(index < 0 || index >= PIPE_MAX_COLOR_BUFS)
- SWIG_exception(SWIG_ValueError, "index out of bounds");
- return $self + index;
- fail:
- return NULL;
- };
-};
-
-
-%extend pipe_blend_state
-{
- pipe_blend_state(void)
- {
- return CALLOC_STRUCT(pipe_blend_state);
- }
-
- %cstring_input_binary(const char *STRING, unsigned LENGTH);
- pipe_blend_state(const char *STRING, unsigned LENGTH)
- {
- struct pipe_blend_state *state;
- state = CALLOC_STRUCT(pipe_blend_state);
- if (state) {
- LENGTH = MIN2(sizeof *state, LENGTH);
- memcpy(state, STRING, LENGTH);
- }
- return state;
- }
-
- %cstring_output_allocate_size(char **STRING, int *LENGTH, os_free(*$1));
- void __str__(char **STRING, int *LENGTH)
- {
- struct os_stream *stream;
-
- stream = os_str_stream_create(1);
- util_dump_blend_state(stream, $self);
-
- *STRING = os_str_stream_get_and_close(stream);
- *LENGTH = strlen(*STRING);
- }
-};
-
-
-%extend pipe_framebuffer_state {
-
- pipe_framebuffer_state(void) {
- return CALLOC_STRUCT(pipe_framebuffer_state);
- }
-
- ~pipe_framebuffer_state() {
- unsigned index;
- for(index = 0; index < PIPE_MAX_COLOR_BUFS; ++index)
- pipe_surface_reference(&$self->cbufs[index], NULL);
- pipe_surface_reference(&$self->zsbuf, NULL);
- FREE($self);
- }
-
- void
- set_cbuf(unsigned index, struct st_surface *surface)
- {
- struct pipe_surface *_surface = NULL;
-
- if(index >= PIPE_MAX_COLOR_BUFS)
- SWIG_exception(SWIG_ValueError, "index out of bounds");
-
- if(surface) {
- /* XXX need a context here */
- _surface = st_pipe_surface(NULL, surface, PIPE_BIND_RENDER_TARGET);
- if(!_surface)
- SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
- }
-
- pipe_surface_reference(&$self->cbufs[index], _surface);
-
- fail:
- return;
- }
-
- void
- set_zsbuf(struct st_surface *surface)
- {
- struct pipe_surface *_surface = NULL;
-
- if(surface) {
- /* XXX need a context here */
- _surface = st_pipe_surface(NULL, surface, PIPE_BIND_DEPTH_STENCIL);
- if(!_surface)
- SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
- }
-
- pipe_surface_reference(&$self->zsbuf, _surface);
-
- fail:
- return;
- }
-
-};
-
-
-%extend pipe_shader_state {
-
- pipe_shader_state(const char *text, unsigned num_tokens = 1024) {
- struct tgsi_token *tokens;
- struct pipe_shader_state *shader;
-
- tokens = MALLOC(num_tokens * sizeof(struct tgsi_token));
- if(!tokens)
- goto error1;
-
- if(tgsi_text_translate(text, tokens, num_tokens ) != TRUE)
- goto error2;
-
- shader = CALLOC_STRUCT(pipe_shader_state);
- if(!shader)
- goto error3;
-
- shader->tokens = tokens;
-
- return shader;
-
-error3:
-error2:
- FREE(tokens);
-error1:
- return NULL;
- }
-
- ~pipe_shader_state() {
- FREE((void*)$self->tokens);
- FREE($self);
- }
-
- void dump(unsigned flags = 0) {
- tgsi_dump($self->tokens, flags);
- }
-}
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
deleted file mode 100644
index 1f4b4fd596b..00000000000
--- a/src/gallium/state_trackers/python/p_texture.i
+++ /dev/null
@@ -1,152 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-/**
- * @file
- * SWIG interface definion for Gallium types.
- *
- * @author Jose Fonseca <[email protected]>
- */
-
-
-%nodefaultctor pipe_resource;
-%nodefaultctor st_surface;
-
-%nodefaultdtor pipe_resource;
-%nodefaultdtor st_surface;
-
-%ignore pipe_resource::screen;
-
-%immutable st_surface::texture;
-%immutable st_surface::level;
-%immutable st_surface::layer;
-
-%newobject pipe_resource::get_surface;
-
-/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
-%rename(read) read_;
-%rename(write) write_;
-
-%extend pipe_resource {
-
- ~pipe_resource() {
- struct pipe_resource *ptr = $self;
- pipe_resource_reference(&ptr, NULL);
- }
-
- unsigned get_width(unsigned level=0) {
- return u_minify($self->width0, level);
- }
-
- unsigned get_height(unsigned level=0) {
- return u_minify($self->height0, level);
- }
-
- unsigned get_depth(unsigned level=0) {
- return u_minify($self->depth0, level);
- }
-
- /** Get a surface which is a "view" into a texture */
- struct st_surface *
- get_surface(unsigned level=0, unsigned layer=0)
- {
- struct st_surface *surface;
-
- if(level > $self->last_level)
- SWIG_exception(SWIG_ValueError, "level out of bounds");
- if(layer >= ($self->target == PIPE_TEXTURE_3D ?
- u_minify($self->depth0, level) : $self->depth0))
- SWIG_exception(SWIG_ValueError, "layer out of bounds");
-
- surface = CALLOC_STRUCT(st_surface);
- if(!surface)
- return NULL;
-
- pipe_resource_reference(&surface->texture, $self);
- surface->level = level;
- surface->layer = layer;
-
- return surface;
-
- fail:
- return NULL;
- }
-
- unsigned __len__(void)
- {
- assert($self->target == PIPE_BUFFER);
- assert(p_atomic_read(&$self->reference.count) > 0);
- return $self->width0;
- }
-
-};
-
-struct st_surface
-{
- %immutable;
-
- struct pipe_resource *texture;
- unsigned level;
- unsigned layer;
-
-};
-
-%extend st_surface {
-
- %immutable;
-
- unsigned format;
- unsigned width;
- unsigned height;
-
- ~st_surface() {
- pipe_resource_reference(&$self->texture, NULL);
- FREE($self);
- }
-
-
-};
-
-%{
- static enum pipe_format
- st_surface_format_get(struct st_surface *surface)
- {
- return surface->texture->format;
- }
-
- static unsigned
- st_surface_width_get(struct st_surface *surface)
- {
- return u_minify(surface->texture->width0, surface->level);
- }
-
- static unsigned
- st_surface_height_get(struct st_surface *surface)
- {
- return u_minify(surface->texture->height0, surface->level);
- }
-%}
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
deleted file mode 100644
index d0a4295c7a2..00000000000
--- a/src/gallium/state_trackers/python/st_device.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-#include "pipe/p_shader_tokens.h"
-#include "util/u_inlines.h"
-#include "cso_cache/cso_context.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/u_sampler.h"
-#include "util/u_simple_shaders.h"
-#include "trace/tr_public.h"
-
-#include "st_device.h"
-#include "st_winsys.h"
-
-
-static void
-st_device_really_destroy(struct st_device *st_dev)
-{
- if(st_dev->screen) {
- /* FIXME: Don't really destroy until we keep track of every single
- * reference or we end up causing a segmentation fault every time
- * python exits. */
-#if 0
- st_dev->screen->destroy(st_dev->screen);
-#endif
- }
-
- FREE(st_dev);
-}
-
-
-static void
-st_device_reference(struct st_device **ptr, struct st_device *st_dev)
-{
- struct st_device *old_dev = *ptr;
-
- if (pipe_reference(&(*ptr)->reference, &st_dev->reference))
- st_device_really_destroy(old_dev);
- *ptr = st_dev;
-}
-
-
-void
-st_device_destroy(struct st_device *st_dev)
-{
- st_device_reference(&st_dev, NULL);
-}
-
-
-struct st_device *
-st_device_create(boolean hardware)
-{
- struct pipe_screen *screen;
- struct st_device *st_dev;
-
- if (hardware)
- screen = st_hardware_screen_create();
- else
- screen = st_software_screen_create("softpipe");
-
- screen = trace_screen_create(screen);
- if (!screen)
- goto no_screen;
-
- st_dev = CALLOC_STRUCT(st_device);
- if (!st_dev)
- goto no_device;
-
- pipe_reference_init(&st_dev->reference, 1);
- st_dev->screen = screen;
-
- return st_dev;
-
-no_device:
- screen->destroy(screen);
-no_screen:
- return NULL;
-}
-
-
-void
-st_context_destroy(struct st_context *st_ctx)
-{
- unsigned i;
-
- if(st_ctx) {
- struct st_device *st_dev = st_ctx->st_dev;
-
- if(st_ctx->cso) {
- cso_delete_vertex_shader(st_ctx->cso, st_ctx->vs);
- cso_delete_fragment_shader(st_ctx->cso, st_ctx->fs);
-
- cso_destroy_context(st_ctx->cso);
- }
-
- if(st_ctx->pipe)
- st_ctx->pipe->destroy(st_ctx->pipe);
-
- for(i = 0; i < PIPE_MAX_SAMPLERS; ++i)
- pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL);
- for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
- pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL);
- pipe_resource_reference(&st_ctx->default_texture, NULL);
-
- FREE(st_ctx);
-
- st_device_reference(&st_dev, NULL);
- }
-}
-
-
-struct st_context *
-st_context_create(struct st_device *st_dev)
-{
- struct st_context *st_ctx;
-
- st_ctx = CALLOC_STRUCT(st_context);
- if(!st_ctx)
- return NULL;
-
- st_device_reference(&st_ctx->st_dev, st_dev);
-
- st_ctx->pipe = st_dev->screen->context_create(st_dev->screen, NULL);
- if(!st_ctx->pipe) {
- st_context_destroy(st_ctx);
- return NULL;
- }
-
- st_ctx->cso = cso_create_context(st_ctx->pipe);
- if(!st_ctx->cso) {
- st_context_destroy(st_ctx);
- return NULL;
- }
-
- /* disabled blending/masking */
- {
- struct pipe_blend_state blend;
- memset(&blend, 0, sizeof(blend));
- blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
- blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
- blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
- blend.rt[0].colormask = PIPE_MASK_RGBA;
- cso_set_blend(st_ctx->cso, &blend);
- }
-
- /* no-op depth/stencil/alpha */
- {
- struct pipe_depth_stencil_alpha_state depthstencil;
- memset(&depthstencil, 0, sizeof(depthstencil));
- cso_set_depth_stencil_alpha(st_ctx->cso, &depthstencil);
- }
-
- /* rasterizer */
- {
- struct pipe_rasterizer_state rasterizer;
- memset(&rasterizer, 0, sizeof(rasterizer));
- rasterizer.cull_face = PIPE_FACE_NONE;
- cso_set_rasterizer(st_ctx->cso, &rasterizer);
- }
-
- /* clip */
- {
- struct pipe_clip_state clip;
- memset(&clip, 0, sizeof(clip));
- st_ctx->pipe->set_clip_state(st_ctx->pipe, &clip);
- }
-
- /* identity viewport */
- {
- struct pipe_viewport_state viewport;
- viewport.scale[0] = 1.0;
- viewport.scale[1] = 1.0;
- viewport.scale[2] = 1.0;
- viewport.scale[3] = 1.0;
- viewport.translate[0] = 0.0;
- viewport.translate[1] = 0.0;
- viewport.translate[2] = 0.0;
- viewport.translate[3] = 0.0;
- cso_set_viewport(st_ctx->cso, &viewport);
- }
-
- /* samplers */
- {
- struct pipe_sampler_state sampler;
- unsigned i;
- memset(&sampler, 0, sizeof(sampler));
- sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
- sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
- sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST;
- sampler.normalized_coords = 1;
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
- cso_single_sampler(st_ctx->cso, i, &sampler);
- cso_single_sampler_done(st_ctx->cso);
- }
-
- /* default textures */
- {
- struct pipe_context *pipe = st_ctx->pipe;
- struct pipe_screen *screen = st_dev->screen;
- struct pipe_resource templat;
- struct pipe_sampler_view view_templ;
- struct pipe_sampler_view *view;
- unsigned i;
-
- memset( &templat, 0, sizeof( templat ) );
- templat.target = PIPE_TEXTURE_2D;
- templat.format = PIPE_FORMAT_B8G8R8A8_UNORM;
- templat.width0 = 1;
- templat.height0 = 1;
- templat.depth0 = 1;
- templat.array_size = 1;
- templat.last_level = 0;
- templat.bind = PIPE_BIND_SAMPLER_VIEW;
-
- st_ctx->default_texture = screen->resource_create( screen, &templat );
- if(st_ctx->default_texture) {
- struct pipe_box box;
- uint32_t zero = 0;
-
- u_box_origin_2d( 1, 1, &box );
-
- pipe->transfer_inline_write(pipe,
- st_ctx->default_texture,
- 0,
- PIPE_TRANSFER_WRITE,
- &box,
- &zero,
- sizeof zero,
- 0);
- }
-
- u_sampler_view_default_template(&view_templ,
- st_ctx->default_texture,
- st_ctx->default_texture->format);
- view = st_ctx->pipe->create_sampler_view(st_ctx->pipe,
- st_ctx->default_texture,
- &view_templ);
-
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
- pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], view);
- for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++)
- pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], view);
-
- st_ctx->pipe->set_fragment_sampler_views(st_ctx->pipe,
- PIPE_MAX_SAMPLERS,
- st_ctx->fragment_sampler_views);
- st_ctx->pipe->set_vertex_sampler_views(st_ctx->pipe,
- PIPE_MAX_VERTEX_SAMPLERS,
- st_ctx->vertex_sampler_views);
-
- pipe_sampler_view_reference(&view, NULL);
- }
-
- /* vertex shader */
- {
- const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
- TGSI_SEMANTIC_GENERIC };
- const uint semantic_indexes[] = { 0, 0 };
- st_ctx->vs = util_make_vertex_passthrough_shader(st_ctx->pipe,
- 2,
- semantic_names,
- semantic_indexes);
- cso_set_vertex_shader_handle(st_ctx->cso, st_ctx->vs);
- }
-
- /* fragment shader */
- {
- st_ctx->fs = util_make_fragment_passthrough_shader(st_ctx->pipe);
- cso_set_fragment_shader_handle(st_ctx->cso, st_ctx->fs);
- }
-
- return st_ctx;
-}
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
deleted file mode 100644
index 53e2556cb0d..00000000000
--- a/src/gallium/state_trackers/python/st_device.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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_DEVICE_H_
-#define ST_DEVICE_H_
-
-
-#include "pipe/p_state.h"
-
-struct cso_context;
-struct pipe_screen;
-struct pipe_context;
-struct st_winsys;
-
-
-struct st_surface
-{
- struct pipe_resource *texture;
- unsigned level;
- unsigned layer;
-};
-
-
-struct st_context
-{
- struct st_device *st_dev;
-
- struct pipe_context *pipe;
-
- struct cso_context *cso;
-
- void *vs;
- void *fs;
- void *gs;
-
- struct pipe_resource *default_texture;
- struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
-
- unsigned num_vertex_buffers;
- struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
-
- unsigned num_vertex_elements;
- struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
-
- struct pipe_framebuffer_state framebuffer;
-};
-
-
-struct st_device
-{
- /* FIXME: we also need to refcount for textures and surfaces... */
- struct pipe_reference reference;
-
- struct pipe_screen *screen;
-};
-
-
-static INLINE struct pipe_surface *
-st_pipe_surface(struct pipe_context *pipe, struct st_surface *surface, unsigned usage)
-{
- struct pipe_resource *texture = surface->texture;
- struct pipe_surface surf_tmpl;
- memset(&surf_tmpl, 0, sizeof(surf_tmpl));
- surf_tmpl.format = texture->format;
- surf_tmpl.usage = usage;
- surf_tmpl.u.tex.level = surface->level;
- surf_tmpl.u.tex.first_layer = surface->layer;
- surf_tmpl.u.tex.last_layer = surface->layer;
- return pipe->create_surface(pipe, texture, &surf_tmpl);
-}
-
-struct st_context *
-st_context_create(struct st_device *st_dev);
-
-void
-st_context_destroy(struct st_context *st_ctx);
-
-struct st_device *
-st_device_create(boolean hardware);
-
-void
-st_device_destroy(struct st_device *st_dev);
-
-
-#endif /* ST_DEVICE_H_ */
diff --git a/src/gallium/state_trackers/python/st_hardpipe_winsys.c b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
deleted file mode 100644
index c6743dbd9c4..00000000000
--- a/src/gallium/state_trackers/python/st_hardpipe_winsys.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * 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 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 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 COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/**
- * @file
- * Get a hardware accelerated Gallium screen/context from the OpenGL driver.
- */
-
-
-#include "pipe/p_compiler.h"
-
-#ifdef PIPE_OS_WINDOWS
-#include <windows.h>
-#include <GL/gl.h>
-#else
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-#endif
-
-#include "st_winsys.h"
-
-
-typedef struct pipe_screen * (GLAPIENTRY *PFNGETGALLIUMSCREENMESAPROC) (void);
-typedef struct pipe_context * (GLAPIENTRY* PFNCREATEGALLIUMCONTEXTMESAPROC) (void);
-
-static PFNGETGALLIUMSCREENMESAPROC pfnGetGalliumScreenMESA = NULL;
-static PFNCREATEGALLIUMCONTEXTMESAPROC pfnCreateGalliumContextMESA = NULL;
-
-
-#ifdef PIPE_OS_WINDOWS
-
-static INLINE boolean
-st_hardpipe_load(void)
-{
- WNDCLASS wc;
- HWND hwnd;
- HGLRC hglrc;
- HDC hdc;
- PIXELFORMATDESCRIPTOR pfd;
- int iPixelFormat;
-
- if(pfnGetGalliumScreenMESA && pfnCreateGalliumContextMESA)
- return TRUE;
-
- memset(&wc, 0, sizeof wc);
- wc.lpfnWndProc = DefWindowProc;
- wc.lpszClassName = "gallium";
- wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
- RegisterClass(&wc);
-
- hwnd = CreateWindow(wc.lpszClassName, "gallium", 0, 0, 0, 0, 0, NULL, 0, wc.hInstance, NULL);
- if (!hwnd)
- return FALSE;
-
- hdc = GetDC(hwnd);
- if (!hdc)
- return FALSE;
-
- pfd.cColorBits = 3;
- pfd.cRedBits = 1;
- pfd.cGreenBits = 1;
- pfd.cBlueBits = 1;
- pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
- pfd.iLayerType = PFD_MAIN_PLANE;
- pfd.iPixelType = PFD_TYPE_RGBA;
- pfd.nSize = sizeof(pfd);
- pfd.nVersion = 1;
-
- iPixelFormat = ChoosePixelFormat(hdc, &pfd);
- if (!iPixelFormat) {
- pfd.dwFlags |= PFD_DOUBLEBUFFER;
- iPixelFormat = ChoosePixelFormat(hdc, &pfd);
- }
- if (!iPixelFormat)
- return FALSE;
-
- SetPixelFormat(hdc, iPixelFormat, &pfd);
- hglrc = wglCreateContext(hdc);
- if (!hglrc)
- return FALSE;
-
- if (!wglMakeCurrent(hdc, hglrc))
- return FALSE;
-
- pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)wglGetProcAddress("wglGetGalliumScreenMESA");
- if(!pfnGetGalliumScreenMESA)
- return FALSE;
-
- pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)wglGetProcAddress("wglCreateGalliumContextMESA");
- if(!pfnCreateGalliumContextMESA)
- return FALSE;
-
- DestroyWindow(hwnd);
-
- return TRUE;
-}
-
-#else
-
-static INLINE boolean
-st_hardpipe_load(void)
-{
- Display *dpy;
- int scrnum;
- Window root;
- int attribSingle[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- None };
- int attribDouble[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None };
- XVisualInfo *visinfo;
- GLXContext ctx = NULL;
- XSetWindowAttributes attr;
- unsigned long mask;
- int width = 100, height = 100;
- Window win;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy)
- return FALSE;
-
- scrnum = 0;
-
- root = RootWindow(dpy, scrnum);
-
- visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
- if (!visinfo)
- visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
- if (!visinfo)
- return FALSE;
-
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
-
- if (!ctx)
- return FALSE;
-
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
-
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr);
-
- if (!glXMakeCurrent(dpy, win, ctx))
- return FALSE;
-
- pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXGetGalliumScreenMESA");
- if(!pfnGetGalliumScreenMESA)
- return FALSE;
-
- pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXCreateGalliumContextMESA");
- if(!pfnCreateGalliumContextMESA)
- return FALSE;
-
- glXDestroyContext(dpy, ctx);
- XFree(visinfo);
- XDestroyWindow(dpy, win);
- XCloseDisplay(dpy);
-
- return TRUE;
-}
-
-#endif
-
-
-struct pipe_screen *
-st_hardware_screen_create(void)
-{
- if(st_hardpipe_load())
- return pfnGetGalliumScreenMESA();
- else
- return st_software_screen_create(NULL);
-}
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
deleted file mode 100644
index cac9a1a6204..00000000000
--- a/src/gallium/state_trackers/python/st_sample.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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.
- *
- **************************************************************************/
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_tile.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-
-#include "st_device.h"
-#include "st_sample.h"
-
-
-/**
- * Use our own pseudo random generator to ensure consistent runs among
- * multiple runs and platforms.
- *
- * @sa http://en.wikipedia.org/wiki/Linear_congruential_generator
- */
-static uint32_t st_random(void) {
- static uint64_t seed = UINT64_C(0xbb9a063afb0a739d);
-
- seed = UINT64_C(134775813) * seed + UINT64_C(1);
-
- return (uint32_t)(seed >> 32);
-}
-
-
-/**
- * We don't want to include the patent-encumbered DXT code here, so instead
- * we store several uncompressed/compressed data pairs for hardware testing
- * purposes.
- */
-struct dxt_data
-{
- uint8_t rgba[16*4];
- uint8_t raw[16];
-};
-
-
-static const struct dxt_data
-dxt1_rgb_data[] = {
- {
- {
- 0x99, 0xb0, 0x8e, 0xff,
- 0x5d, 0x62, 0x89, 0xff,
- 0x99, 0xb0, 0x8e, 0xff,
- 0x99, 0xb0, 0x8e, 0xff,
- 0xd6, 0xff, 0x94, 0xff,
- 0x5d, 0x62, 0x89, 0xff,
- 0x99, 0xb0, 0x8e, 0xff,
- 0xd6, 0xff, 0x94, 0xff,
- 0x5d, 0x62, 0x89, 0xff,
- 0x5d, 0x62, 0x89, 0xff,
- 0x99, 0xb0, 0x8e, 0xff,
- 0x21, 0x14, 0x84, 0xff,
- 0x5d, 0x62, 0x89, 0xff,
- 0x21, 0x14, 0x84, 0xff,
- 0x21, 0x14, 0x84, 0xff,
- 0x99, 0xb0, 0x8e, 0xff
- },
- {0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97}
- },
- {
- {
- 0xb5, 0xcf, 0x9c, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0x21, 0x08, 0x6b, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0x52, 0x4a, 0x7b, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0xb5, 0xcf, 0x9c, 0xff,
- 0x21, 0x08, 0x6b, 0xff,
- 0xb5, 0xcf, 0x9c, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0x52, 0x4a, 0x7b, 0xff,
- 0xb5, 0xcf, 0x9c, 0xff,
- 0x83, 0x8c, 0x8b, 0xff,
- 0x52, 0x4a, 0x7b, 0xff,
- 0x83, 0x8c, 0x8b, 0xff
- },
- {0x73, 0xb6, 0x4d, 0x20, 0x98, 0x2b, 0xe1, 0xb8}
- },
- {
- {
- 0x00, 0x2c, 0xff, 0xff,
- 0x94, 0x8d, 0x7b, 0xff,
- 0x4a, 0x5c, 0xbd, 0xff,
- 0x4a, 0x5c, 0xbd, 0xff,
- 0x4a, 0x5c, 0xbd, 0xff,
- 0x94, 0x8d, 0x7b, 0xff,
- 0x94, 0x8d, 0x7b, 0xff,
- 0x94, 0x8d, 0x7b, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0x94, 0x8d, 0x7b, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0xde, 0xbe, 0x39, 0xff,
- 0x94, 0x8d, 0x7b, 0xff
- },
- {0xe7, 0xdd, 0x7f, 0x01, 0xf9, 0xab, 0x08, 0x80}
- },
- {
- {
- 0x6b, 0x24, 0x21, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x8b, 0x7a, 0x99, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x6b, 0x24, 0x21, 0xff,
- 0x8b, 0x7a, 0x99, 0xff,
- 0x9c, 0xa6, 0xd6, 0xff,
- 0x6b, 0x24, 0x21, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x8b, 0x7a, 0x99, 0xff,
- 0x6b, 0x24, 0x21, 0xff,
- 0x8b, 0x7a, 0x99, 0xff,
- 0x7b, 0x4f, 0x5d, 0xff,
- 0x9c, 0xa6, 0xd6, 0xff
- },
- {0x3a, 0x9d, 0x24, 0x69, 0xbd, 0x9f, 0xb4, 0x39}
- }
-};
-
-
-static const struct dxt_data
-dxt1_rgba_data[] = {
- {
- {
- 0x00, 0x00, 0x00, 0x00,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x29, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x73, 0x55, 0x21, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x4e, 0xaa, 0x90, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x4e, 0xaa, 0x90, 0xff
- },
- {0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe}
- },
- {
- {
- 0xb5, 0xe3, 0x63, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x6b, 0x24, 0x84, 0xff,
- 0xb5, 0xe3, 0x63, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0xb5, 0xe3, 0x63, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x6b, 0x24, 0x84, 0xff,
- 0x6b, 0x24, 0x84, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0xb5, 0xe3, 0x63, 0xff,
- 0x90, 0x83, 0x73, 0xff,
- 0xb5, 0xe3, 0x63, 0xff
- },
- {0x30, 0x69, 0x0c, 0xb7, 0x4d, 0xf7, 0x0f, 0x67}
- },
- {
- {
- 0x00, 0x00, 0x00, 0x00,
- 0xc6, 0x86, 0x8c, 0xff,
- 0xc6, 0x86, 0x8c, 0xff,
- 0x21, 0x65, 0x42, 0xff,
- 0x21, 0x65, 0x42, 0xff,
- 0x21, 0x65, 0x42, 0xff,
- 0x21, 0x65, 0x42, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x21, 0x65, 0x42, 0xff,
- 0xc6, 0x86, 0x8c, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0xc6, 0x86, 0x8c, 0xff
- },
- {0x28, 0x23, 0x31, 0xc4, 0x17, 0xc0, 0xd3, 0x7f}
- },
- {
- {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0xc6, 0xe3, 0x9c, 0xff,
- 0x7b, 0x1c, 0x52, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x7b, 0x1c, 0x52, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x7b, 0x1c, 0x52, 0xff,
- 0xa0, 0x7f, 0x77, 0xff,
- 0xc6, 0xe3, 0x9c, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0x7f, 0x77, 0xff
- },
- {0xea, 0x78, 0x13, 0xc7, 0x7f, 0xfc, 0x33, 0xb6}
- },
-};
-
-
-static const struct dxt_data
-dxt3_rgba_data[] = {
- {
- {
- 0x6d, 0xc6, 0x96, 0x77,
- 0x6d, 0xc6, 0x96, 0xee,
- 0x6d, 0xc6, 0x96, 0xaa,
- 0x8c, 0xff, 0xb5, 0x44,
- 0x6d, 0xc6, 0x96, 0xff,
- 0x6d, 0xc6, 0x96, 0x88,
- 0x31, 0x55, 0x5a, 0x66,
- 0x6d, 0xc6, 0x96, 0x99,
- 0x31, 0x55, 0x5a, 0xbb,
- 0x31, 0x55, 0x5a, 0x55,
- 0x31, 0x55, 0x5a, 0x11,
- 0x6d, 0xc6, 0x96, 0xcc,
- 0x6d, 0xc6, 0x96, 0xcc,
- 0x6d, 0xc6, 0x96, 0x11,
- 0x31, 0x55, 0x5a, 0x44,
- 0x31, 0x55, 0x5a, 0x88
- },
- {0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a}
- },
- {
- {
- 0xad, 0xeb, 0x73, 0x99,
- 0x97, 0xaa, 0x86, 0x66,
- 0x6b, 0x28, 0xad, 0x99,
- 0xad, 0xeb, 0x73, 0x99,
- 0x6b, 0x28, 0xad, 0x22,
- 0xad, 0xeb, 0x73, 0xff,
- 0x97, 0xaa, 0x86, 0x55,
- 0x6b, 0x28, 0xad, 0x55,
- 0x6b, 0x28, 0xad, 0x44,
- 0xad, 0xeb, 0x73, 0x33,
- 0x6b, 0x28, 0xad, 0xee,
- 0x6b, 0x28, 0xad, 0x99,
- 0x97, 0xaa, 0x86, 0x66,
- 0xad, 0xeb, 0x73, 0xbb,
- 0x97, 0xaa, 0x86, 0x99,
- 0xad, 0xeb, 0x73, 0xbb
- },
- {0x69, 0x99, 0xf2, 0x55, 0x34, 0x9e, 0xb6, 0xb9, 0x4e, 0xaf, 0x55, 0x69, 0x18, 0x61, 0x51, 0x22}
- },
- {
- {
- 0x63, 0xd7, 0xd6, 0x00,
- 0x57, 0x62, 0x5d, 0xdd,
- 0x57, 0x62, 0x5d, 0xcc,
- 0x57, 0x62, 0x5d, 0xbb,
- 0x52, 0x28, 0x21, 0xaa,
- 0x57, 0x62, 0x5d, 0xcc,
- 0x57, 0x62, 0x5d, 0xcc,
- 0x57, 0x62, 0x5d, 0x66,
- 0x57, 0x62, 0x5d, 0x22,
- 0x57, 0x62, 0x5d, 0xdd,
- 0x63, 0xd7, 0xd6, 0xee,
- 0x57, 0x62, 0x5d, 0x33,
- 0x63, 0xd7, 0xd6, 0x55,
- 0x52, 0x28, 0x21, 0x55,
- 0x57, 0x62, 0x5d, 0x11,
- 0x5d, 0x9c, 0x99, 0xee
- },
- {0xd0, 0xbc, 0xca, 0x6c, 0xd2, 0x3e, 0x55, 0xe1, 0xba, 0x66, 0x44, 0x51, 0xfc, 0xfd, 0xcf, 0xb4}
- },
- {
- {
- 0x94, 0x6f, 0x60, 0x22,
- 0x94, 0x6f, 0x60, 0x22,
- 0xc5, 0xab, 0x76, 0x11,
- 0xc5, 0xab, 0x76, 0xee,
- 0x63, 0x34, 0x4a, 0xdd,
- 0x63, 0x34, 0x4a, 0x33,
- 0x94, 0x6f, 0x60, 0x77,
- 0xf7, 0xe7, 0x8c, 0x00,
- 0x94, 0x6f, 0x60, 0x33,
- 0x63, 0x34, 0x4a, 0xaa,
- 0x94, 0x6f, 0x60, 0x77,
- 0x63, 0x34, 0x4a, 0xcc,
- 0x94, 0x6f, 0x60, 0xaa,
- 0xf7, 0xe7, 0x8c, 0x99,
- 0x63, 0x34, 0x4a, 0x44,
- 0xc5, 0xab, 0x76, 0xaa
- },
- {0x22, 0xe1, 0x3d, 0x07, 0xa3, 0xc7, 0x9a, 0xa4, 0x31, 0xf7, 0xa9, 0x61, 0xaf, 0x35, 0x77, 0x93}
- },
-};
-
-
-static const struct dxt_data
-dxt5_rgba_data[] = {
- {
- {
- 0x6d, 0xc6, 0x96, 0x74,
- 0x6d, 0xc6, 0x96, 0xf8,
- 0x6d, 0xc6, 0x96, 0xb6,
- 0x8c, 0xff, 0xb5, 0x53,
- 0x6d, 0xc6, 0x96, 0xf8,
- 0x6d, 0xc6, 0x96, 0x95,
- 0x31, 0x55, 0x5a, 0x53,
- 0x6d, 0xc6, 0x96, 0x95,
- 0x31, 0x55, 0x5a, 0xb6,
- 0x31, 0x55, 0x5a, 0x53,
- 0x31, 0x55, 0x5a, 0x11,
- 0x6d, 0xc6, 0x96, 0xd7,
- 0x6d, 0xc6, 0x96, 0xb6,
- 0x6d, 0xc6, 0x96, 0x11,
- 0x31, 0x55, 0x5a, 0x32,
- 0x31, 0x55, 0x5a, 0x95
- },
- {0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a}
- },
- {
- {
- 0xad, 0xeb, 0x73, 0xa1,
- 0x97, 0xaa, 0x86, 0x65,
- 0x6b, 0x28, 0xad, 0xa1,
- 0xad, 0xeb, 0x73, 0xa1,
- 0x6b, 0x28, 0xad, 0x2a,
- 0xad, 0xeb, 0x73, 0xfb,
- 0x97, 0xaa, 0x86, 0x47,
- 0x6b, 0x28, 0xad, 0x65,
- 0x6b, 0x28, 0xad, 0x47,
- 0xad, 0xeb, 0x73, 0x47,
- 0x6b, 0x28, 0xad, 0xdd,
- 0x6b, 0x28, 0xad, 0xa1,
- 0x97, 0xaa, 0x86, 0x65,
- 0xad, 0xeb, 0x73, 0xbf,
- 0x97, 0xaa, 0x86, 0xa1,
- 0xad, 0xeb, 0x73, 0xbf
- },
- {0xfb, 0x2a, 0x34, 0x19, 0xdc, 0xbf, 0xe8, 0x71, 0x4e, 0xaf, 0x55, 0x69, 0x18, 0x61, 0x51, 0x22}
- },
- {
- {
- 0x63, 0xd7, 0xd6, 0x00,
- 0x57, 0x62, 0x5d, 0xf5,
- 0x57, 0x62, 0x5d, 0xd2,
- 0x57, 0x62, 0x5d, 0xaf,
- 0x52, 0x28, 0x21, 0xaf,
- 0x57, 0x62, 0x5d, 0xd2,
- 0x57, 0x62, 0x5d, 0xd2,
- 0x57, 0x62, 0x5d, 0x69,
- 0x57, 0x62, 0x5d, 0x23,
- 0x57, 0x62, 0x5d, 0xd2,
- 0x63, 0xd7, 0xd6, 0xf5,
- 0x57, 0x62, 0x5d, 0x46,
- 0x63, 0xd7, 0xd6, 0x46,
- 0x52, 0x28, 0x21, 0x69,
- 0x57, 0x62, 0x5d, 0x23,
- 0x5d, 0x9c, 0x99, 0xf5
- },
- {0xf5, 0x00, 0x81, 0x36, 0xa9, 0x17, 0xec, 0x1e, 0xba, 0x66, 0x44, 0x51, 0xfc, 0xfd, 0xcf, 0xb4}
- },
- {
- {
- 0x94, 0x6f, 0x60, 0x25,
- 0x94, 0x6f, 0x60, 0x25,
- 0xc5, 0xab, 0x76, 0x05,
- 0xc5, 0xab, 0x76, 0xe8,
- 0x63, 0x34, 0x4a, 0xe8,
- 0x63, 0x34, 0x4a, 0x25,
- 0x94, 0x6f, 0x60, 0x86,
- 0xf7, 0xe7, 0x8c, 0x05,
- 0x94, 0x6f, 0x60, 0x25,
- 0x63, 0x34, 0x4a, 0xa7,
- 0x94, 0x6f, 0x60, 0x66,
- 0x63, 0x34, 0x4a, 0xc7,
- 0x94, 0x6f, 0x60, 0xa7,
- 0xf7, 0xe7, 0x8c, 0xa7,
- 0x63, 0x34, 0x4a, 0x45,
- 0xc5, 0xab, 0x76, 0xa7
- },
- {0xe8, 0x05, 0x7f, 0x80, 0x33, 0x5f, 0xb5, 0x79, 0x31, 0xf7, 0xa9, 0x61, 0xaf, 0x35, 0x77, 0x93}
- },
-};
-
-
-static INLINE void
-st_sample_dxt_pixel_block(enum pipe_format format,
- uint8_t *raw,
- float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h)
-{
- const struct dxt_data *data;
- unsigned n;
- unsigned i;
- unsigned x, y, ch;
-
- switch(format) {
- case PIPE_FORMAT_DXT1_RGB:
- data = dxt1_rgb_data;
- n = sizeof(dxt1_rgb_data)/sizeof(dxt1_rgb_data[0]);
- break;
- case PIPE_FORMAT_DXT1_RGBA:
- data = dxt1_rgba_data;
- n = sizeof(dxt1_rgba_data)/sizeof(dxt1_rgba_data[0]);
- break;
- case PIPE_FORMAT_DXT3_RGBA:
- data = dxt3_rgba_data;
- n = sizeof(dxt3_rgba_data)/sizeof(dxt3_rgba_data[0]);
- break;
- case PIPE_FORMAT_DXT5_RGBA:
- data = dxt5_rgba_data;
- n = sizeof(dxt5_rgba_data)/sizeof(dxt5_rgba_data[0]);
- break;
- default:
- assert(0);
- return;
- }
-
- i = st_random() % n;
-
- for(y = 0; y < h; ++y)
- for(x = 0; x < w; ++x)
- for(ch = 0; ch < 4; ++ch)
- rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f;
-
- memcpy(raw, data[i].raw, util_format_get_blocksize(format));
-}
-
-
-static INLINE void
-st_sample_generic_pixel_block(enum pipe_format format,
- uint8_t *raw,
- float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h,
- boolean norm)
-{
- unsigned i;
- unsigned x, y, ch;
- int blocksize = util_format_get_blocksize(format);
-
- if (norm) {
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- for (ch = 0; ch < 4; ++ch) {
- unsigned offset = y*rgba_stride + x*4 + ch;
- rgba[offset] = (st_random() & 0xff) / (double)0xff;
- }
- }
- }
-
- util_format_write_4f(format,
- rgba, rgba_stride * sizeof(float),
- raw, util_format_get_stride(format, w),
- 0, 0, w, h);
-
- } else {
- for (i = 0; i < blocksize; ++i)
- raw[i] = (uint8_t)st_random();
- }
-
- util_format_read_4f(format,
- rgba, rgba_stride * sizeof(float),
- raw, util_format_get_stride(format, w),
- 0, 0, w, h);
-
- if (format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) {
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- for (ch = 0; ch < 4; ++ch) {
- unsigned offset = y*rgba_stride + x*4 + ch;
- rgba[offset] = CLAMP(rgba[offset], 0.0f, 1.0f);
- }
- }
- }
- }
-}
-
-
-/**
- * Randomly sample pixels.
- */
-void
-st_sample_pixel_block(enum pipe_format format,
- void *raw,
- float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h,
- boolean norm)
-{
- switch(format) {
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
- st_sample_dxt_pixel_block(format, raw, rgba, rgba_stride, w, h);
- break;
-
- default:
- st_sample_generic_pixel_block(format, raw, rgba, rgba_stride, w, h, norm);
- break;
- }
-}
-
-
-void
-st_sample_surface(struct pipe_context *pipe,
- struct st_surface *surface,
- float *rgba,
- boolean norm)
-{
- struct pipe_resource *texture = surface->texture;
- unsigned width = u_minify(texture->width0, surface->level);
- unsigned height = u_minify(texture->height0, surface->level);
- uint rgba_stride = width * 4;
- struct pipe_transfer *transfer;
- void *raw;
-
- transfer = pipe_get_transfer(pipe,
- surface->texture,
- surface->level,
- surface->layer,
- PIPE_TRANSFER_WRITE,
- 0, 0,
- width,
- height);
- if (!transfer)
- return;
-
- raw = pipe->transfer_map(pipe, transfer);
- if (raw) {
- enum pipe_format format = texture->format;
- uint x, y;
- int nblocksx = util_format_get_nblocksx(format, width);
- int nblocksy = util_format_get_nblocksy(format, height);
- int blockwidth = util_format_get_blockwidth(format);
- int blockheight = util_format_get_blockheight(format);
- int blocksize = util_format_get_blocksize(format);
-
-
- for (y = 0; y < nblocksy; ++y) {
- for (x = 0; x < nblocksx; ++x) {
- st_sample_pixel_block(format,
- (uint8_t *) raw + y * transfer->stride + x * blocksize,
- rgba + y * blockheight * rgba_stride + x * blockwidth * 4,
- rgba_stride,
- MIN2(blockwidth, width - x*blockwidth),
- MIN2(blockheight, height - y*blockheight),
- norm);
- }
- }
-
- pipe->transfer_unmap(pipe, transfer);
- }
-
- pipe->transfer_destroy(pipe, transfer);
-}
diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h
deleted file mode 100644
index 2fdbb391f36..00000000000
--- a/src/gallium/state_trackers/python/st_sample.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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_SAMPLE_H_
-#define ST_SAMPLE_H_
-
-
-#include "pipe/p_format.h"
-
-struct pipe_context;
-struct st_surface;
-
-
-void
-st_sample_pixel_block(enum pipe_format format,
- void *raw,
- float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h,
- boolean norm);
-
-void
-st_sample_surface(struct pipe_context *pipe,
- struct st_surface *surface,
- float *rgba,
- boolean norm);
-
-
-#endif /* ST_SAMPLE_H_ */
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
deleted file mode 100644
index 8584bad4679..00000000000
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * 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 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 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 COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-#include "util/u_debug.h"
-#include "softpipe/sp_public.h"
-#include "llvmpipe/lp_public.h"
-#include "state_tracker/sw_winsys.h"
-#include "sw/null/null_sw_winsys.h"
-#include "st_winsys.h"
-
-
-struct pipe_screen *
-st_software_screen_create(const char *driver)
-{
- struct sw_winsys *ws;
- struct pipe_screen *screen = NULL;
-
- if (!driver) {
- const char *default_driver;
-
-#if defined(HAVE_LLVMPIPE)
- default_driver = "llvmpipe";
-#elif defined(HAVE_SOFTPIPE)
- default_driver = "softpipe";
-#else
- default_driver = "";
-#endif
-
- driver = debug_get_option("GALLIUM_DRIVER", default_driver);
- }
-
- ws = null_sw_create();
- if(!ws)
- return NULL;
-
-#ifdef HAVE_LLVMPIPE
- if (strcmp(driver, "llvmpipe") == 0) {
- screen = llvmpipe_create_screen(ws);
- }
-#endif
-
-#ifdef HAVE_SOFTPIPE
- if (strcmp(driver, "softpipe") == 0) {
- screen = softpipe_create_screen(ws);
- }
-#endif
-
- if (!screen) {
- ws->destroy(ws);
- }
-
- return screen;
-}
diff --git a/src/gallium/state_trackers/python/st_winsys.h b/src/gallium/state_trackers/python/st_winsys.h
deleted file mode 100644
index 7d4066d947b..00000000000
--- a/src/gallium/state_trackers/python/st_winsys.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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_WINSYS_H_
-#define ST_WINSYS_H_
-
-
-struct pipe_screen;
-
-
-struct pipe_screen *
-st_hardware_screen_create(void);
-
-struct pipe_screen *
-st_software_screen_create(const char *driver);
-
-
-#endif /* ST_WINSYS_H_ */
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png
deleted file mode 100644
index c947a7b8813..00000000000
--- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.png
+++ /dev/null
Binary files differ
diff --git a/src/gallium/state_trackers/python/u_format.i b/src/gallium/state_trackers/python/u_format.i
deleted file mode 100644
index 2184b420843..00000000000
--- a/src/gallium/state_trackers/python/u_format.i
+++ /dev/null
@@ -1,88 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * 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 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 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 COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- **************************************************************************/
-
-
-static INLINE const char *
-util_format_name(enum pipe_format format);
-
-static INLINE boolean
-util_format_is_s3tc(enum pipe_format format);
-
-static INLINE boolean
-util_format_is_depth_or_stencil(enum pipe_format format);
-
-static INLINE boolean
-util_format_is_depth_and_stencil(enum pipe_format format);
-
-
-uint
-util_format_get_blocksizebits(enum pipe_format format);
-
-uint
-util_format_get_blocksize(enum pipe_format format);
-
-uint
-util_format_get_blockwidth(enum pipe_format format);
-
-uint
-util_format_get_blockheight(enum pipe_format format);
-
-unsigned
-util_format_get_nblocksx(enum pipe_format format,
- unsigned x);
-
-unsigned
-util_format_get_nblocksy(enum pipe_format format,
- unsigned y);
-
-unsigned
-util_format_get_nblocks(enum pipe_format format,
- unsigned width,
- unsigned height);
-
-size_t
-util_format_get_stride(enum pipe_format format,
- unsigned width);
-
-size_t
-util_format_get_2d_size(enum pipe_format format,
- size_t stride,
- unsigned height);
-
-uint
-util_format_get_component_bits(enum pipe_format format,
- enum util_format_colorspace colorspace,
- uint component);
-
-boolean
-util_format_has_alpha(enum pipe_format format);
-
-
-unsigned
-util_format_get_nr_components(enum pipe_format format);
-
-