#include "util/u_sampler.h"
#include "util/u_simple_shaders.h"
#include "util/u_surface.h"
-#include "util/u_rect.h"
#include "cso_cache/cso_context.h"
/* rasterizer */
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
- ctx->rasterizer.front_winding = PIPE_WINDING_CW;
- ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
+ ctx->rasterizer.cull_face = PIPE_FACE_NONE;
ctx->rasterizer.gl_rasterization_rules = 1;
/* samplers */
return ctx->vbuf_slot++ * sizeof ctx->vertices;
}
-
*/
void
util_blit_pixels_writemask(struct blit_state *ctx,
- struct pipe_surface *src,
- struct pipe_sampler_view *src_sampler_view,
+ struct pipe_resource *src_tex,
+ struct pipe_subresource srcsub,
int srcX0, int srcY0,
int srcX1, int srcY1,
+ int srcZ0,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_sampler_view *sampler_view = NULL;
+ struct pipe_sampler_view sv_templ;
struct pipe_framebuffer_state fb;
const int srcW = abs(srcX1 - srcX0);
const int srcH = abs(srcY1 - srcY0);
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
filter == PIPE_TEX_MIPFILTER_LINEAR);
- assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
- PIPE_BIND_SAMPLER_VIEW, 0));
- assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET, 0));
+ assert(srcsub.level <= src_tex->last_level);
/* do the regions overlap? */
- overlap = util_same_surface(src, dst) &&
+ overlap = src_tex == dst->texture &&
+ dst->face == srcsub.face &&
+ dst->level == srcsub.level &&
+ dst->zslice == srcZ0 &&
regions_overlap(srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1);
* no overlapping.
* Filter mode should not matter since there's no stretching.
*/
- if (pipe->surface_copy &&
- dst->format == src->format &&
+ if (dst->format == src_tex->format &&
srcX0 < srcX1 &&
dstX0 < dstX1 &&
srcY0 < srcY1 &&
(dstX1 - dstX0) == (srcX1 - srcX0) &&
(dstY1 - dstY0) == (srcY1 - srcY0) &&
!overlap) {
- pipe->surface_copy(pipe,
- dst, dstX0, dstY0, /* dest */
- src, srcX0, srcY0, /* src */
- srcW, srcH); /* size */
+ struct pipe_subresource subdst;
+ subdst.face = dst->face;
+ subdst.level = dst->level;
+ pipe->resource_copy_region(pipe,
+ dst->texture, subdst,
+ dstX0, dstY0, dst->zslice,/* dest */
+ src_tex, srcsub,
+ srcX0, srcY0, srcZ0,/* src */
+ srcW, srcH); /* size */
return;
}
-
- assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET, 0));
+
/* Create a temporary texture when src and dest alias or when src
- * is anything other than a single-level 2d texture.
+ * is anything other than a 2d texture.
+ * XXX should just use appropriate shader to access 1d / 3d slice / cube face,
+ * much like the u_blitter code does (should be pretty trivial).
*
* This can still be improved upon.
*/
- if (util_same_surface(src, dst) ||
- src->texture->target != PIPE_TEXTURE_2D ||
- src->texture->last_level != 0)
+ if ((src_tex == dst->texture &&
+ dst->face == srcsub.face &&
+ dst->level == srcsub.level &&
+ dst->zslice == srcZ0) ||
+ src_tex->target != PIPE_TEXTURE_2D)
{
struct pipe_resource texTemp;
struct pipe_resource *tex;
struct pipe_sampler_view sv_templ;
- struct pipe_surface *texSurf;
+ struct pipe_subresource texsub;
const int srcLeft = MIN2(srcX0, srcX1);
const int srcTop = MIN2(srcY0, srcY1);
/* create temp texture */
memset(&texTemp, 0, sizeof(texTemp));
texTemp.target = PIPE_TEXTURE_2D;
- texTemp.format = src->format;
+ texTemp.format = src_tex->format;
texTemp.last_level = 0;
texTemp.width0 = srcW;
texTemp.height0 = srcH;
if (!tex)
return;
- u_sampler_view_default_template(&sv_templ, tex, tex->format);
-
- sampler_view = ctx->pipe->create_sampler_view(ctx->pipe, tex, &sv_templ);
- if (!sampler_view) {
- pipe_resource_reference(&tex, NULL);
- return;
- }
-
- texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION);
-
+ texsub.face = 0;
+ texsub.level = 0;
/* load temp texture */
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
- } else {
- util_surface_copy(pipe, FALSE,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
- }
+ pipe->resource_copy_region(pipe,
+ tex, texsub, 0, 0, 0, /* dest */
+ src_tex, srcsub, srcLeft, srcTop, srcZ0, /* src */
+ srcW, srcH); /* size */
- /* free the surface, update the texture if necessary.
- */
- pipe_surface_reference(&texSurf, NULL);
s0 = 0.0f;
s1 = 1.0f;
t0 = 0.0f;
t1 = 1.0f;
+ u_sampler_view_default_template(&sv_templ, tex, tex->format);
+ sampler_view = pipe->create_sampler_view(pipe, tex, &sv_templ);
+
+ if (!sampler_view) {
+ pipe_resource_reference(&tex, NULL);
+ return;
+ }
pipe_resource_reference(&tex, NULL);
}
else {
- pipe_sampler_view_reference(&sampler_view, src_sampler_view);
- s0 = srcX0 / (float)src->texture->width0;
- s1 = srcX1 / (float)src->texture->width0;
- t0 = srcY0 / (float)src->texture->height0;
- t1 = srcY1 / (float)src->texture->height0;
+ u_sampler_view_default_template(&sv_templ, src_tex, src_tex->format);
+ sv_templ.first_level = sv_templ.last_level = srcsub.level;
+ sampler_view = pipe->create_sampler_view(pipe, src_tex, &sv_templ);
+
+ if (!sampler_view) {
+ return;
+ }
+
+ s0 = srcX0 / (float)(u_minify(sampler_view->texture->width0, srcsub.level));
+ s1 = srcX1 / (float)(u_minify(sampler_view->texture->width0, srcsub.level));
+ t0 = srcY0 / (float)(u_minify(sampler_view->texture->height0, srcsub.level));
+ t1 = srcY1 / (float)(u_minify(sampler_view->texture->height0, srcsub.level));
}
-
+
+ assert(screen->is_format_supported(screen, sampler_view->format, PIPE_TEXTURE_2D,
+ sampler_view->texture->nr_samples,
+ PIPE_BIND_SAMPLER_VIEW, 0));
+ assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
+ dst->texture->nr_samples,
+ PIPE_BIND_RENDER_TARGET, 0));
/* save state (restored below) */
cso_save_blend(ctx->cso);
/* sampler */
ctx->sampler.min_img_filter = filter;
ctx->sampler.mag_img_filter = filter;
+ /* we've limited this already with the sampler view but you never know... */
+ ctx->sampler.min_lod = srcsub.level;
+ ctx->sampler.max_lod = srcsub.level;
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_single_sampler_done(ctx->cso);
void
util_blit_pixels(struct blit_state *ctx,
- struct pipe_surface *src,
- struct pipe_sampler_view *src_sampler_view,
+ struct pipe_resource *src_tex,
+ struct pipe_subresource srcsub,
int srcX0, int srcY0,
int srcX1, int srcY1,
+ int srcZ,
struct pipe_surface *dst,
int dstX0, int dstY0,
int dstX1, int dstY1,
float z, uint filter )
{
- util_blit_pixels_writemask( ctx, src, src_sampler_view,
+ util_blit_pixels_writemask( ctx, src_tex,
+ srcsub,
srcX0, srcY0,
srcX1, srcY1,
+ srcZ,
dst,
dstX0, dstY0,
dstX1, dstY1,
/**
* Copy pixel block from src texture to dst surface.
- * Overlapping regions are acceptable.
*
* XXX Should support selection of level.
* XXX need some control over blitting Z and/or stencil.
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
PIPE_TEXTURE_2D,
+ dst->texture->nr_samples,
PIPE_BIND_RENDER_TARGET,
0));
/**
* @file
- * Blitter utility to facilitate acceleration of the clear, surface_copy,
- * and surface_fill functions.
+ * Blitter utility to facilitate acceleration of the clear, resource_copy_region,
+ * and resource_fill_region functions.
*
* @author Marek Olšák
*/
#include "util/u_blitter.h"
#include "util/u_draw_quad.h"
#include "util/u_pack_color.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
#include "util/u_simple_shaders.h"
#include "util/u_surface.h"
void *vs_tex; /**< Vertex shader which passes {pos, texcoord} to the output.*/
/* Fragment shaders. */
- /* FS which outputs a color to multiple color buffers. */
- void *fs_col[PIPE_MAX_COLOR_BUFS];
+ /* The shader at index i outputs color to color buffers 0,1,...,i-1. */
+ void *fs_col[PIPE_MAX_COLOR_BUFS+1];
/* FS which outputs a color from a texture,
where the index is PIPE_TEXTURE_* to be sampled. */
/* rasterizer state */
memset(&rs_state, 0, sizeof(rs_state));
- rs_state.front_winding = PIPE_WINDING_CW;
- rs_state.cull_mode = PIPE_WINDING_NONE;
+ rs_state.cull_face = PIPE_FACE_NONE;
rs_state.gl_rasterization_rules = 1;
rs_state.flatshade = 1;
ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
pipe->delete_fs_state(pipe, ctx->fs_texfetch_depth[i]);
}
- for (i = 0; i < PIPE_MAX_COLOR_BUFS && ctx->fs_col[i]; i++)
+ for (i = 0; i <= PIPE_MAX_COLOR_BUFS && ctx->fs_col[i]; i++)
if (ctx->fs_col[i])
pipe->delete_fs_state(pipe, ctx->fs_col[i]);
void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs)
{
struct pipe_context *pipe = ctx->pipe;
- unsigned index = num_cbufs ? num_cbufs - 1 : 0;
assert(num_cbufs <= PIPE_MAX_COLOR_BUFS);
- if (!ctx->fs_col[index])
- ctx->fs_col[index] =
+ if (!ctx->fs_col[num_cbufs])
+ ctx->fs_col[num_cbufs] =
util_make_fragment_clonecolor_shader(pipe, num_cbufs);
- return ctx->fs_col[index];
+ return ctx->fs_col[num_cbufs];
}
static INLINE
}
- static void util_blitter_overlap_copy(struct blitter_context *blitter,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- struct pipe_surface *src,
- unsigned srcx, unsigned srcy,
- unsigned width, unsigned height)
- {
- struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
- struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
-
- struct pipe_resource texTemp;
- struct pipe_resource *texture;
- struct pipe_surface *tex_surf;
-
- /* check whether the states are properly saved */
- blitter_check_saved_CSOs(ctx);
-
- memset(&texTemp, 0, sizeof(texTemp));
- texTemp.target = PIPE_TEXTURE_2D;
- texTemp.format = dst->texture->format; /* XXX verify supported by driver! */
- texTemp.last_level = 0;
- texTemp.width0 = width;
- texTemp.height0 = height;
- texTemp.depth0 = 1;
-
- texture = screen->resource_create(screen, &texTemp);
- if (!texture)
- return;
-
- tex_surf = screen->get_tex_surface(screen, texture, 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION);
-
- /* blit from the src to the temp */
- util_blitter_do_copy(blitter, tex_surf, 0, 0,
- src, srcx, srcy,
- width, height,
- FALSE);
- util_blitter_do_copy(blitter, dst, dstx, dsty,
- tex_surf, 0, 0,
- width, height,
- FALSE);
- pipe_surface_reference(&tex_surf, NULL);
- pipe_resource_reference(&texture, NULL);
- blitter_restore_CSOs(ctx);
- }
void util_blitter_copy(struct blitter_context *blitter,
struct pipe_surface *dst,
return;
if (dst->texture == src->texture) {
- if (is_overlap(srcx, srcx + width, srcy, srcy + height,
- dstx, dstx + width, dsty, dsty + height)) {
- util_blitter_overlap_copy(blitter, dst, dstx, dsty, src, srcx, srcy,
- width, height);
- return;
- }
+ assert(!is_overlap(srcx, srcx + width, srcy, srcy + height,
+ dstx, dstx + width, dsty, dsty + height));
}
-
+
is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
dst_tex_usage = is_depth || is_stencil ? PIPE_BIND_DEPTH_STENCIL :
/* (assuming copying a stencil buffer is not possible) */
if ((!ignore_stencil && is_stencil) ||
!screen->is_format_supported(screen, dst->format, dst->texture->target,
- dst_tex_usage, 0) ||
+ dst->texture->nr_samples, dst_tex_usage, 0) ||
!screen->is_format_supported(screen, src->format, src->texture->target,
- PIPE_BIND_SAMPLER_VIEW, 0)) {
- util_surface_copy(pipe, FALSE, dst, dstx, dsty, src, srcx, srcy,
- width, height);
+ src->texture->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) {
+ struct pipe_subresource subdst, subsrc;
+ subdst.face = dst->face;
+ subdst.level = dst->level;
+ subsrc.face = src->face;
+ subsrc.level = src->level;
+ util_resource_copy_region(pipe, dst->texture, subdst, dstx, dsty, dst->zslice,
+ src->texture, subsrc, srcx, srcy, src->zslice,
+ width, height);
return;
}
/* check if we can render to the surface */
if (util_format_is_depth_or_stencil(dst->format) || /* unlikely, but you never know */
!screen->is_format_supported(screen, dst->format, dst->texture->target,
+ dst->texture->nr_samples,
PIPE_BIND_RENDER_TARGET, 0)) {
- util_surface_fill(pipe, dst, dstx, dsty, width, height, value);
+ struct pipe_subresource subdst;
+ subdst.face = dst->face;
+ subdst.level = dst->level;
+ util_resource_fill_region(pipe, dst->texture, subdst, dstx, dsty,
+ dst->zslice, width, height, value);
return;
}
/* rasterizer */
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
- ctx->rasterizer.front_winding = PIPE_WINDING_CW;
- ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
+ ctx->rasterizer.cull_face = PIPE_FACE_NONE;
ctx->rasterizer.gl_rasterization_rules = 1;
/* sampler state */
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, psv->format, PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET, 0)) {
+ pt->nr_samples, PIPE_BIND_RENDER_TARGET, 0)) {
fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
return;
}
#include "util/u_format.h"
#include "util/u_inlines.h"
-#include "util/u_memory.h"
#include "util/u_rect.h"
#include "util/u_surface.h"
/* Choose surface format */
for (i = 0; rgbaFormats[i]; i++) {
if (screen->is_format_supported(screen, rgbaFormats[i],
- target, bind, 0)) {
+ target, 0, bind, 0)) {
format = rgbaFormats[i];
break;
}
/**
- * Fallback function for pipe->surface_copy().
+ * Fallback function for pipe->resource_copy_region().
* Note: (X,Y)=(0,0) is always the upper-left corner.
- * if do_flip, flip the image vertically on its way from src rect to dst rect.
*/
void
- util_surface_copy(struct pipe_context *pipe,
- boolean do_flip,
- struct pipe_surface *dst,
- unsigned dst_x, unsigned dst_y,
- struct pipe_surface *src,
- unsigned src_x, unsigned src_y,
- unsigned w, unsigned h)
+ util_resource_copy_region(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dst_x, unsigned dst_y, unsigned dst_z,
+ struct pipe_resource *src,
+ struct pipe_subresource subsrc,
+ unsigned src_x, unsigned src_y, unsigned src_z,
+ unsigned w, unsigned h)
{
struct pipe_transfer *src_trans, *dst_trans;
void *dst_map;
const void *src_map;
enum pipe_format src_format, dst_format;
- assert(src->texture && dst->texture);
- if (!src->texture || !dst->texture)
+ assert(src && dst);
+ if (!src || !dst)
return;
- src_format = src->texture->format;
- dst_format = dst->texture->format;
+ src_format = src->format;
+ dst_format = dst->format;
src_trans = pipe_get_transfer(pipe,
- src->texture,
- src->face,
- src->level,
- src->zslice,
+ src,
+ subsrc.face,
+ subsrc.level,
+ src_z,
PIPE_TRANSFER_READ,
src_x, src_y, w, h);
dst_trans = pipe_get_transfer(pipe,
- dst->texture,
- dst->face,
- dst->level,
- dst->zslice,
+ dst,
+ subdst.face,
+ subdst.level,
+ src_z,
PIPE_TRANSFER_WRITE,
dst_x, dst_y, w, h);
assert(dst_map);
if (src_map && dst_map) {
- /* If do_flip, invert src_y position and pass negative src stride */
util_copy_rect(dst_map,
dst_format,
dst_trans->stride,
0, 0,
w, h,
src_map,
- do_flip ? -(int) src_trans->stride : src_trans->stride,
+ src_trans->stride,
0,
- do_flip ? h - 1 : 0);
+ 0);
}
pipe->transfer_unmap(pipe, src_trans);
/**
- * Fallback for pipe->surface_fill() function.
+ * Fallback for pipe->resource_fill_region() function.
*/
void
- util_surface_fill(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height, unsigned value)
+ util_resource_fill_region(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ unsigned width, unsigned height, unsigned value)
{
struct pipe_transfer *dst_trans;
void *dst_map;
- assert(dst->texture);
- if (!dst->texture)
+ assert(dst);
+ if (!dst)
return;
dst_trans = pipe_get_transfer(pipe,
- dst->texture,
- dst->face,
- dst->level,
- dst->zslice,
+ dst,
+ subdst.face,
+ subdst.level,
+ dstz,
PIPE_TRANSFER_WRITE,
dstx, dsty, width, height);
if (dst_map) {
assert(dst_trans->stride > 0);
- switch (util_format_get_blocksize(dst->texture->format)) {
+ switch (util_format_get_blocksize(dst->format)) {
case 1:
case 2:
case 4:
- util_fill_rect(dst_map, dst->texture->format,
+ util_fill_rect(dst_map, dst->format,
dst_trans->stride,
0, 0, width, height, value);
break;
* ``set_stencil_ref`` sets the stencil front and back reference values
which are used as comparison values in stencil test.
* ``set_blend_color``
+ * ``set_sample_mask``
* ``set_clip_state``
* ``set_polygon_stipple``
* ``set_scissor_state`` sets the bounds for the scissor test, which culls
will not block and the return value will be TRUE if the query has
completed or FALSE otherwise.
-A common type of query is the occlusion query which counts the number of
-fragments/pixels which are written to the framebuffer (and not culled by
-Z/stencil/alpha testing or shader KILL instructions).
+The most common type of query is the occlusion query,
+``PIPE_QUERY_OCCLUSION_COUNTER``, which counts the number of fragments which
+are written to the framebuffer without being culled by
+:ref:`Depth, Stencil, & Alpha` testing or shader KILL instructions.
+
+Another type of query, ``PIPE_QUERY_TIME_ELAPSED``, returns the amount of
+time, in nanoseconds, the context takes to perform operations.
+
+Gallium does not guarantee the availability of any query types; one must
+always check the capabilities of the :ref:`Screen` first.
Conditional Rendering
Blitting
^^^^^^^^
- These methods emulate classic blitter controls. They are not guaranteed to be
- available; if they are set to NULL, then they are not present.
+ These methods emulate classic blitter controls.
- These methods operate directly on ``pipe_surface`` objects, and stand
+ These methods operate directly on ``pipe_resource`` objects, and stand
apart from any 3D state in the context. Blitting functionality may be
moved to a separate abstraction at some point in the future.
- ``surface_fill`` performs a fill operation on a section of a surface.
+ ``resource_fill_region`` performs a fill operation on a section of a resource.
- ``surface_copy`` blits a region of a surface to a region of another surface,
- provided that both surfaces are the same format. The source and destination
- may be the same surface, and overlapping blits are permitted.
+ ``resource_copy_region`` blits a region of a subresource of a resource to a
+ region of another subresource of a resource, provided that both resources have the
+ same format. The source and destination may be the same resource, but overlapping
+ blits are not permitted.
+
+ ``resource_resolve`` resolves a multisampled resource into a non-multisampled
+ one. Formats and dimensions must match. This function must be present if a driver
+ supports multisampling.
The interfaces to these calls are likely to change to make it easier
for a driver to batch multiple blits with the same source and
The returned map points to the start of the mapped range according to
the box region, not the beginning of the resource.
-.. _transfer_flush_region:
-``transfer_flush_region`` If a transfer was created with TRANFER_FLUSH_EXPLICIT,
-only the region specified is guaranteed to be written to. This is relative to
-the mapped range, not the beginning of the resource.
-
``transfer_unmap`` remove the memory mapping for the transfer object.
Any pointers into the map should be considered invalid and discarded.
Basically get_transfer, transfer_map, data write, transfer_unmap, and
transfer_destroy all in one.
+.. _transfer_flush_region:
+
+transfer_flush_region
+%%%%%%%%%%%%%%%%%%%%%
+
+If a transfer was created with ``FLUSH_EXPLICIT``, it will not automatically
+be flushed on write or unmap. Flushes must be requested with
+``transfer_flush_region``. Flush ranges are relative to the mapped range, not
+the beginning of the resource.
+
.. _pipe_transfer:
PIPE_TRANSFER
operations pending on the resource are undefined. Cannot be used with
``READ``.
* ``FLUSH_EXPLICIT``: Written ranges will be notified later with
- :ref:`transfer_flush_region`. Cannot be used with
- ``READ``.
+ :ref:`transfer_flush_region`. Cannot be used with ``READ``.
+.. _screen:
+
Screen
======
* ``MAX_RENDER_TARGETS``: The maximum number of render targets that may be
bound.
* ``OCCLUSION_QUERY``: Whether occlusion queries are available.
+* ``TIMER_QUERY``: Whether timer queries are available.
* ``TEXTURE_SHADOW_MAP``: XXX
* ``MAX_TEXTURE_2D_LEVELS``: The maximum number of mipmap levels available
for a 2D texture.
* ``GUARD_BAND_LEFT``, ``GUARD_BAND_TOP``, ``GUARD_BAND_RIGHT``,
``GUARD_BAND_BOTTOM``: XXX
+Fragment shader limits:
+
+* ``PIPE_CAP_MAX_FS_INSTRUCTIONS``: The maximum number of instructions.
+* ``PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS``: The maximum number of arithmetic instructions.
+* ``PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS``: The maximum number of texture instructions.
+* ``PIPE_CAP_MAX_FS_TEX_INDIRECTIONS``: The maximum number of texture indirections.
+* ``PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH``: The maximum nested control flow depth.
+* ``PIPE_CAP_MAX_FS_INPUTS``: The maximum number of input registers.
+* ``PIPE_CAP_MAX_FS_CONSTS``: The maximum number of constants.
+* ``PIPE_CAP_MAX_FS_TEMPS``: The maximum number of temporary registers.
+* ``PIPE_CAP_MAX_FS_ADDRS``: The maximum number of address registers.
+* ``PIPE_CAP_MAX_FS_PREDS``: The maximum number of predicate registers.
+
+Vertex shader limits:
+
+* ``PIPE_CAP_MAX_VS_*``: Identical to ``PIPE_CAP_MAX_FS_*``.
.. _pipe_bind:
* ``PIPE_BIND_VERTEX_BUFFER``: A vertex buffer.
* ``PIPE_BIND_INDEX_BUFFER``: An vertex index/element buffer.
* ``PIPE_BIND_CONSTANT_BUFFER``: A buffer of shader constants.
- * ``PIPE_BIND_BLIT_SOURCE``: A blit source, as given to surface_copy.
- * ``PIPE_BIND_BLIT_DESTINATION``: A blit destination, as given to surface_copy
- and surface_fill.
* ``PIPE_BIND_TRANSFER_WRITE``: A transfer object which will be written to.
* ``PIPE_BIND_TRANSFER_READ``: A transfer object which will be read from.
* ``PIPE_BIND_CUSTOM``:
**target** one of the PIPE_TEXTURE_x flags
+ **sample_count** the number of samples. 0 and 1 mean no multisampling,
+ the maximum allowed legal value is 32.
+
**bindings** is a bitmask of :ref:`PIPE_BIND` flags.
**geom_flags** is a bitmask of PIPE_TEXTURE_GEOM_x flags.
Returns TRUE if all usages can be satisfied.
-
.. _resource_create:
resource_create
cell->dirty |= CELL_NEW_DEPTH_STENCIL;
}
+
static void
cell_set_clip_state(struct pipe_context *pipe,
const struct pipe_clip_state *clip)
}
+ static void
+ cell_set_sample_mask(struct pipe_context *pipe,
+ unsigned sample_mask)
+ {
+ }
+
/* Called when driver state tracker notices changes to the viewport
* matrix:
struct cell_context *cell = cell_context(pipe);
/* pass-through to draw module */
- draw_set_rasterizer_state(cell->draw, rasterizer);
+ draw_set_rasterizer_state(cell->draw, rasterizer, rast);
cell->rasterizer = rasterizer;
}
-
void
cell_init_state_functions(struct cell_context *cell)
{
cell->pipe.set_blend_color = cell_set_blend_color;
cell->pipe.set_stencil_ref = cell_set_stencil_ref;
cell->pipe.set_clip_state = cell_set_clip_state;
+ cell->pipe.set_sample_mask = cell_set_sample_mask;
cell->pipe.set_framebuffer_state = cell_set_framebuffer_state;
static int
-cell_get_param(struct pipe_screen *screen, int param)
+cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 10;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
static float
-cell_get_paramf(struct pipe_screen *screen, int param)
+cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
static boolean
cell_is_format_supported( struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags )
{
struct sw_winsys *winsys = cell_screen(screen)->winsys;
+ if (sample_count > 1)
+ return FALSE;
+
if (tex_usage & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
}
static int
-i915_get_param(struct pipe_screen *screen, int param)
+i915_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 0;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
}
static float
-i915_get_paramf(struct pipe_screen *screen, int param)
+i915_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
static boolean
i915_is_format_supported(struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags)
{
static const enum pipe_format tex_supported[] = {
PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
- static const enum pipe_format surface_supported[] = {
+ static const enum pipe_format render_supported[] = {
PIPE_FORMAT_B8G8R8A8_UNORM,
PIPE_FORMAT_B5G6R5_UNORM,
+ PIPE_FORMAT_NONE /* list terminator */
+ };
+ static const enum pipe_format depth_supported[] = {
PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
const enum pipe_format *list;
uint i;
- if(tex_usage & PIPE_BIND_RENDER_TARGET)
- list = surface_supported;
+ if (sample_count > 1)
+ return FALSE;
+
+ if(tex_usage & PIPE_BIND_DEPTH_STENCIL)
+ list = depth_supported;
+ else if (tex_usage & PIPE_BIND_RENDER_TARGET)
+ list = render_supported;
else
list = tex_supported;
else
cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT;
- switch (rasterizer->cull_mode) {
- case PIPE_WINDING_NONE:
+ switch (rasterizer->cull_face) {
+ case PIPE_FACE_NONE:
cso->LIS4 |= S4_CULLMODE_NONE;
break;
- case PIPE_WINDING_CW:
- cso->LIS4 |= S4_CULLMODE_CW;
+ case PIPE_FACE_FRONT:
+ if (rasterizer->front_ccw)
+ cso->LIS4 |= S4_CULLMODE_CCW;
+ else
+ cso->LIS4 |= S4_CULLMODE_CW;
break;
- case PIPE_WINDING_CCW:
- cso->LIS4 |= S4_CULLMODE_CCW;
+ case PIPE_FACE_BACK:
+ if (rasterizer->front_ccw)
+ cso->LIS4 |= S4_CULLMODE_CW;
+ else
+ cso->LIS4 |= S4_CULLMODE_CCW;
break;
- case PIPE_WINDING_BOTH:
+ case PIPE_FACE_FRONT_AND_BACK:
cso->LIS4 |= S4_CULLMODE_BOTH;
break;
}
FREE( velems );
}
+ static void
+ i915_set_sample_mask(struct pipe_context *pipe,
+ unsigned sample_mask)
+ {
+ }
+
void
i915_init_state_functions( struct i915_context *i915 )
{
i915->base.set_blend_color = i915_set_blend_color;
i915->base.set_stencil_ref = i915_set_stencil_ref;
i915->base.set_clip_state = i915_set_clip_state;
+ i915->base.set_sample_mask = i915_set_sample_mask;
i915->base.set_constant_buffer = i915_set_constant_buffer;
i915->base.set_framebuffer_state = i915_set_framebuffer_state;
#include "util/u_debug.h"
+ #include "util/u_surface.h"
#include "brw_resource.h"
#include "brw_context.h"
if (template->target == PIPE_BUFFER)
return brw_buffer_create(screen, template);
else
- return brw_resource_create(screen, template);
+ return brw_texture_create(screen, template);
}
brw->base.transfer_unmap = u_transfer_unmap_vtbl;
brw->base.transfer_destroy = u_transfer_destroy_vtbl;
brw->base.transfer_inline_write = u_transfer_inline_write_vtbl;
+ brw->base.resource_copy_region = util_resource_copy_region;
+ brw->base.resource_fill_region = util_resource_fill_region;
}
void
stride = tex->pitch * tex->cpp;
- return bscreen->sws->bo_get_handle(tex->bo, whandle, stride);
+ return bscreen->sws->bo_get_handle(tex->bo, whandle, stride) == PIPE_OK;
}
boolean brw_is_format_supported( struct pipe_screen *screen,
enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags )
{
return translate_tex_format(format) != BRW_SURFACEFORMAT_INVALID;
}
static int
-brw_get_param(struct pipe_screen *screen, int param)
+brw_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 1;
case PIPE_CAP_OCCLUSION_QUERY:
return 0;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
}
static float
-brw_get_paramf(struct pipe_screen *screen, int param)
+brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
static boolean
brw_is_format_supported(struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags)
{
static const enum pipe_format tex_supported[] = {
const enum pipe_format *list;
uint i;
+ if (sample_count > 1)
+ return FALSE;
+
if (tex_usage & PIPE_BIND_DEPTH_STENCIL)
list = depth_supported;
else if (tex_usage & PIPE_BIND_RENDER_TARGET)
static int
identity_screen_get_param(struct pipe_screen *_screen,
- int param)
+ enum pipe_cap param)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
static float
identity_screen_get_paramf(struct pipe_screen *_screen,
- int param)
+ enum pipe_cap param)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
identity_screen_is_format_supported(struct pipe_screen *_screen,
enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned tex_usage,
unsigned geom_flags)
{
return screen->is_format_supported(screen,
format,
target,
+ sample_count,
tex_usage,
geom_flags);
}
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "gallivm/lp_bld_limits.h"
#include "lp_texture.h"
#include "lp_fence.h"
#include "lp_jit.h"
{ "pipe", DEBUG_PIPE },
{ "tgsi", DEBUG_TGSI },
{ "tex", DEBUG_TEX },
- { "asm", DEBUG_ASM },
{ "setup", DEBUG_SETUP },
{ "rast", DEBUG_RAST },
{ "query", DEBUG_QUERY },
{ "screen", DEBUG_SCREEN },
- { "jit", DEBUG_JIT },
{ "show_tiles", DEBUG_SHOW_TILES },
{ "show_subtiles", DEBUG_SHOW_SUBTILES },
{ "counters", DEBUG_COUNTERS },
- { "nopt", DEBUG_NO_LLVM_OPT },
{NULL, 0}
};
#endif
static int
-llvmpipe_get_param(struct pipe_screen *screen, int param)
+llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 1;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
- return 0;
+ return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
return 0;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 0;
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ /* There is no limit in number of instructions beyond available memory */
+ return 32768;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ return LP_MAX_TGSI_NESTING;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ case PIPE_CAP_MAX_FS_INPUTS:
+ return PIPE_MAX_ATTRIBS;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ case PIPE_CAP_MAX_VS_CONSTS:
+ /* There is no limit in number of constants beyond available memory */
+ return 32768;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ case PIPE_CAP_MAX_FS_TEMPS:
+ return LP_MAX_TGSI_TEMPS;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return LP_MAX_TGSI_ADDRS;
+ case PIPE_CAP_MAX_VS_PREDS:
+ case PIPE_CAP_MAX_FS_PREDS:
+ return LP_MAX_TGSI_PREDS;
default:
+ assert(0);
return 0;
}
}
static float
-llvmpipe_get_paramf(struct pipe_screen *screen, int param)
+llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
return 16.0; /* not actually signficant at this time */
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
return 16.0; /* arbitrary */
+ case PIPE_CAP_GUARD_BAND_LEFT:
+ case PIPE_CAP_GUARD_BAND_TOP:
+ case PIPE_CAP_GUARD_BAND_RIGHT:
+ case PIPE_CAP_GUARD_BAND_BOTTOM:
+ return 0.0;
default:
+ assert(0);
return 0;
}
}
*/
static boolean
llvmpipe_is_format_supported( struct pipe_screen *_screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned bind,
unsigned geom_flags )
{
target == PIPE_TEXTURE_3D ||
target == PIPE_TEXTURE_CUBE);
+ if (sample_count > 1)
+ return FALSE;
+
if (bind & PIPE_BIND_RENDER_TARGET) {
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
return FALSE;
struct pipe_screen *
llvmpipe_create_screen(struct sw_winsys *winsys)
{
- struct llvmpipe_screen *screen = CALLOC_STRUCT(llvmpipe_screen);
+ struct llvmpipe_screen *screen;
+
+#ifdef PIPE_ARCH_X86
+ /* require SSE2 due to LLVM PR6960. */
+ util_cpu_detect();
+ if (!util_cpu_caps.has_sse2)
+ return NULL;
+#endif
+
+ screen = CALLOC_STRUCT(llvmpipe_screen);
#ifdef DEBUG
LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_format.h"
+#include "util/u_format_s3tc.h"
#include <stdio.h>
#include <errno.h>
if (bind & (PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DEPTH_STENCIL |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION |
PIPE_BIND_SCANOUT |
PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SAMPLER_VIEW))
pscreen->fence_signalled = nouveau_screen_fence_signalled;
pscreen->fence_finish = nouveau_screen_fence_finish;
+ util_format_s3tc_init();
+
return 0;
}
* SOFTWARE.
*/
+#include "util/u_format_s3tc.h"
#include "pipe/p_screen.h"
#include "nv50_context.h"
nv50_screen_is_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned tex_usage, unsigned geom_flags)
{
+ if (sample_count > 1)
+ return FALSE;
+
if (tex_usage & PIPE_BIND_RENDER_TARGET) {
switch (format) {
case PIPE_FORMAT_B8G8R8X8_UNORM:
break;
}
} else {
+ if (tex_usage & PIPE_BIND_SAMPLER_VIEW) {
+ switch (format) {
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ return util_format_s3tc_enabled;
+ default:
+ break;
+ }
+ }
switch (format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_L8A8_UNORM:
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z32_FLOAT:
}
static int
-nv50_screen_get_param(struct pipe_screen *pscreen, int param)
+nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 8;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS: /* arbitrary limit */
+ return 16384;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH: /* need stack bo */
+ return 4;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ return 16;
+ case PIPE_CAP_MAX_FS_INPUTS: /* 128 / 4 with GP */
+ return 64 / 4;
+ case PIPE_CAP_MAX_VS_CONSTS:
+ case PIPE_CAP_MAX_FS_CONSTS:
+ return 65536 / 16;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ case PIPE_CAP_MAX_FS_ADDRS: /* no spilling atm */
+ return 1;
+ case PIPE_CAP_MAX_VS_PREDS:
+ case PIPE_CAP_MAX_FS_PREDS: /* not yet handled */
+ return 0;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ case PIPE_CAP_MAX_FS_TEMPS: /* no spilling atm */
+ return 128 / 4;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
}
static float
-nv50_screen_get_paramf(struct pipe_screen *pscreen, int param)
+nv50_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
CALLOC_STRUCT(nv50_rasterizer_stateobj);
/*XXX: ignored
- * - light_twosize
+ * - light_twoside
* - point_smooth
* - multisample
* - point_sprite / sprite_coord_mode
so_data (so, cso->point_quad_rasterization ? 1 : 0);
so_method(so, tesla, NV50TCL_POLYGON_MODE_FRONT, 3);
- if (cso->front_winding == PIPE_WINDING_CCW) {
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- } else {
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- }
+ so_data(so, nvgl_polygon_mode(cso->fill_front));
+ so_data(so, nvgl_polygon_mode(cso->fill_back));
so_data(so, cso->poly_smooth ? 1 : 0);
so_method(so, tesla, NV50TCL_CULL_FACE_ENABLE, 3);
- so_data (so, cso->cull_mode != PIPE_WINDING_NONE);
- if (cso->front_winding == PIPE_WINDING_CCW) {
+ so_data (so, cso->cull_face != PIPE_FACE_NONE);
+ if (cso->front_ccw) {
so_data(so, NV50TCL_FRONT_FACE_CCW);
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV50TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV50TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV50TCL_CULL_FACE_BACK);
- break;
- }
- } else {
+ }
+ else {
so_data(so, NV50TCL_FRONT_FACE_CW);
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV50TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV50TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV50TCL_CULL_FACE_BACK);
- break;
- }
+ }
+ switch (cso->cull_face) {
+ case PIPE_FACE_FRONT:
+ so_data(so, NV50TCL_CULL_FACE_FRONT);
+ break;
+ case PIPE_FACE_BACK:
+ so_data(so, NV50TCL_CULL_FACE_BACK);
+ break;
+ case PIPE_FACE_FRONT_AND_BACK:
+ so_data(so, NV50TCL_CULL_FACE_FRONT_AND_BACK);
+ break;
+ default:
+ so_data(so, NV50TCL_CULL_FACE_BACK);
+ break;
}
so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_ENABLE, 1);
so_data (so, cso->poly_stipple_enable ? 1 : 0);
so_method(so, tesla, NV50TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
- so_data(so, 1);
- else
- so_data(so, 0);
+ so_data(so, cso->offset_point);
+ so_data(so, cso->offset_line);
+ so_data(so, cso->offset_tri);
- if (cso->offset_cw || cso->offset_ccw) {
+ if (cso->offset_point ||
+ cso->offset_line ||
+ cso->offset_tri) {
so_method(so, tesla, NV50TCL_POLYGON_OFFSET_FACTOR, 1);
so_data (so, fui(cso->offset_scale));
so_method(so, tesla, NV50TCL_POLYGON_OFFSET_UNITS, 1);
{
}
+ static void
+ nv50_set_sample_mask(struct pipe_context *pipe,
+ unsigned sample_mask)
+ {
+ }
+
static void
nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
struct pipe_resource *buf )
nv50->pipe.set_blend_color = nv50_set_blend_color;
nv50->pipe.set_stencil_ref = nv50_set_stencil_ref;
nv50->pipe.set_clip_state = nv50_set_clip_state;
+ nv50->pipe.set_sample_mask = nv50_set_sample_mask;
nv50->pipe.set_constant_buffer = nv50_set_constant_buffer;
nv50->pipe.set_framebuffer_state = nv50_set_framebuffer_state;
nv50->pipe.set_polygon_stipple = nv50_set_polygon_stipple;
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
+#include "util/u_format_s3tc.h"
#include "util/u_simple_screen.h"
#include "nouveau/nouveau_screen.h"
#define NV6X_GRCLASS4497_CHIPSETS 0x00000088
static int
-nvfx_screen_get_param(struct pipe_screen *pscreen, int param)
+nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
struct nvfx_screen *screen = nvfx_screen(pscreen);
return screen->is_nv4x ? 4 : 2;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ return 4096;
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ /* FIXME: is it the dynamic (nv30:0/nv40:24) or the static
+ value (nv30:0/nv40:4) ? */
+ return screen->is_nv4x ? 4 : 0;
+ case PIPE_CAP_MAX_FS_INPUTS:
+ return 10;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ return screen->is_nv4x ? 224 : 32;
+ case PIPE_CAP_MAX_FS_TEMPS:
+ return 32;
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return screen->is_nv4x ? 1 : 0;
+ case PIPE_CAP_MAX_FS_PREDS:
+ return screen->is_nv4x ? 1 : 0;
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ return screen->is_nv4x ? 512 : 256;
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ return screen->is_nv4x ? 512 : 0;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ /* FIXME: is it the dynamic (nv30:24/nv40:24) or the static
+ value (nv30:1/nv40:4) ? */
+ return screen->is_nv4x ? 4 : 1;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ return 16;
+ case PIPE_CAP_MAX_VS_CONSTS:
+ return 256;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ return screen->is_nv4x ? 32 : 13;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ return 2;
+ case PIPE_CAP_MAX_VS_PREDS:
+ return screen->is_nv4x ? 1 : 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
}
static float
-nvfx_screen_get_paramf(struct pipe_screen *pscreen, int param)
+nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
{
struct nvfx_screen *screen = nvfx_screen(pscreen);
nvfx_screen_surface_format_supported(struct pipe_screen *pscreen,
enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned tex_usage, unsigned geom_flags)
{
struct nvfx_screen *screen = nvfx_screen(pscreen);
struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
+ if (sample_count > 1)
+ return FALSE;
+
if (tex_usage & PIPE_BIND_RENDER_TARGET) {
switch (format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
}
} else {
switch (format) {
+ if (tex_usage & PIPE_BIND_SAMPLER_VIEW) {
+ switch (format) {
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ return util_format_s3tc_enabled;
+ default:
+ break;
+ }
+ }
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
case PIPE_FORMAT_L8A8_UNORM:
case PIPE_FORMAT_Z16_UNORM:
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
return TRUE;
/* TODO: does nv30 support this? */
case PIPE_FORMAT_R16_SNORM:
sb_data(sb, fui(cso->point_size));
sb_method(sb, NV34TCL_POLYGON_MODE_FRONT, 6);
- if (cso->front_winding == PIPE_WINDING_CCW) {
- sb_data(sb, nvgl_polygon_mode(cso->fill_ccw));
- sb_data(sb, nvgl_polygon_mode(cso->fill_cw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_CW:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_BOTH:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- }
+ sb_data(sb, nvgl_polygon_mode(cso->fill_front));
+ sb_data(sb, nvgl_polygon_mode(cso->fill_back));
+ switch (cso->cull_face) {
+ case PIPE_FACE_FRONT:
+ sb_data(sb, NV34TCL_CULL_FACE_FRONT);
+ break;
+ case PIPE_FACE_BACK:
+ sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ break;
+ case PIPE_FACE_FRONT_AND_BACK:
+ sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
+ break;
+ default:
+ sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ break;
+ }
+ if (cso->front_ccw) {
sb_data(sb, NV34TCL_FRONT_FACE_CCW);
} else {
- sb_data(sb, nvgl_polygon_mode(cso->fill_cw));
- sb_data(sb, nvgl_polygon_mode(cso->fill_ccw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_CW:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_BOTH:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
- break;
- }
sb_data(sb, NV34TCL_FRONT_FACE_CW);
}
sb_data(sb, cso->poly_smooth ? 1 : 0);
- sb_data(sb, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
+ sb_data(sb, (cso->cull_face != PIPE_FACE_NONE) ? 1 : 0);
sb_method(sb, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
sb_data(sb, cso->poly_stipple_enable ? 1 : 0);
sb_method(sb, NV34TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
- sb_data(sb, 1);
- else
- sb_data(sb, 0);
- if (cso->offset_cw || cso->offset_ccw) {
+ sb_data(sb, cso->offset_point);
+ sb_data(sb, cso->offset_line);
+ sb_data(sb, cso->offset_tri);
+
+ if (cso->offset_point || cso->offset_line || cso->offset_tri) {
sb_method(sb, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
sb_data(sb, fui(cso->offset_scale));
sb_data(sb, fui(cso->offset_units * 2));
nvfx->draw_dirty |= NVFX_NEW_UCP;
}
+ static void
+ nvfx_set_sample_mask(struct pipe_context *pipe,
+ unsigned sample_mask)
+ {
+ }
+
static void
nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
struct pipe_resource *buf )
nvfx->pipe.set_blend_color = nvfx_set_blend_color;
nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
nvfx->pipe.set_clip_state = nvfx_set_clip_state;
+ nvfx->pipe.set_sample_mask = nvfx_set_sample_mask;
nvfx->pipe.set_constant_buffer = nvfx_set_constant_buffer;
nvfx->pipe.set_framebuffer_state = nvfx_set_framebuffer_state;
nvfx->pipe.set_polygon_stipple = nvfx_set_polygon_stipple;
FREE(r300->ztop_state.state);
FREE(r300->fs_constants.state);
FREE(r300->vs_constants.state);
+ if (!r300->screen->caps.has_tcl) {
+ FREE(r300->vertex_stream_state.state);
+ }
FREE(r300);
}
r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
r300->fs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
r300->vs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
+ if (!r300->screen->caps.has_tcl) {
+ r300->vertex_stream_state.state = CALLOC_STRUCT(r300_vertex_stream_state);
+ }
+
+ /* Some non-CSO atoms don't use the state pointer. */
+ r300->invariant_state.allow_null_state = TRUE;
+ r300->fs_rc_constant_state.allow_null_state = TRUE;
+ r300->pvs_flush.allow_null_state = TRUE;
+ r300->query_start.allow_null_state = TRUE;
+ r300->texture_cache_inval.allow_null_state = TRUE;
}
struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.destroy = r300_destroy_context;
r300->context.clear = r300_clear;
- r300->context.surface_copy = r300_surface_copy;
- r300->context.surface_fill = r300_surface_fill;
+ r300->context.resource_copy_region = r300_surface_copy;
+ r300->context.resource_fill_region = r300_surface_fill;
if (r300screen->caps.has_tcl) {
r300->context.draw_arrays = r300_draw_arrays;
draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
/* Enable Draw's clipping. */
draw_set_driver_clipping(r300->draw, FALSE);
- /* Force Draw to never do viewport transform, since we can do
- * transform in hardware, always. */
- draw_set_viewport_state(r300->draw, &r300_viewport_identity);
+ /* Disable converting points/lines to triangles. */
+ draw_wide_line_threshold(r300->draw, 10000000.f);
+ draw_wide_point_threshold(r300->draw, 10000000.f);
}
r300_setup_atoms(r300);
return chip_families[r300screen->caps.family];
}
-static int r300_get_param(struct pipe_screen* pscreen, int param)
+static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
{
struct r300_screen* r300screen = r300_screen(pscreen);
+ boolean is_r400 = r300screen->caps.is_r400;
+ boolean is_r500 = r300screen->caps.is_r500;
+
+ /* XXX extended shader capabilities of r400 unimplemented */
+ is_r400 = FALSE;
switch (param) {
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return r300screen->caps.num_tex_units;
+ /* Supported features (boolean caps). */
case PIPE_CAP_NPOT_TEXTURES:
- /* XXX enable now to get GL2.1 API,
- * figure out later how to emulate this */
- return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
- return 1;
case PIPE_CAP_GLSL:
/* I'll be frank. This is a lie.
*
*
* ~ C.
*/
- return 1;
- case PIPE_CAP_DUAL_SOURCE_BLEND:
- return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
- return 1;
case PIPE_CAP_POINT_SPRITE:
- return 1;
- case PIPE_CAP_MAX_RENDER_TARGETS:
- return 4;
case PIPE_CAP_OCCLUSION_QUERY:
- return 1;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
- return 1;
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- if (r300screen->caps.is_r500) {
- /* 13 == 4096 */
- return 13;
- } else {
- /* 12 == 2048 */
- return 12;
- }
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- return 1;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
+ case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- return 0;
+
+ /* Unsupported features (boolean caps). */
+ case PIPE_CAP_TIMER_QUERY:
+ case PIPE_CAP_DUAL_SOURCE_BLEND:
case PIPE_CAP_TGSI_CONT_SUPPORTED:
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ case PIPE_CAP_INDEP_BLEND_FUNC:
return 0;
- case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- return 1;
+
+ /* Texturing. */
+ case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return r300screen->caps.num_tex_units;
+ case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
+ return 0;
+ case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+ /* 13 == 4096, 12 == 2048 */
+ return is_r500 ? 13 : 12;
+
+ /* Render targets. */
+ case PIPE_CAP_MAX_RENDER_TARGETS:
+ return 4;
+
+ /* General shader limits and features. */
case PIPE_CAP_SM3:
- if (r300screen->caps.is_r500) {
- return 1;
- } else {
- return 0;
- }
+ return is_r500 ? 1 : 0;
case PIPE_CAP_MAX_CONST_BUFFERS:
return 1;
case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
return 256;
- case PIPE_CAP_INDEP_BLEND_ENABLE:
- return 0;
- case PIPE_CAP_INDEP_BLEND_FUNC:
- return 0;
+
+ /* Fragment coordinate conventions. */
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+
+ /* Fragment shader limits. */
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ return is_r500 || is_r400 ? 512 : 96;
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ return is_r500 || is_r400 ? 512 : 64;
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ return is_r500 || is_r400 ? 512 : 32;
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ return is_r500 ? 511 : 4;
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ return is_r500 ? 64 : 0; /* Actually unlimited on r500. */
+ case PIPE_CAP_MAX_FS_INPUTS:
+ /* 2 colors + 8 texcoords are always supported
+ * (minus fog and wpos).
+ *
+ * R500 has the ability to turn 3rd and 4th color into
+ * additional texcoords but there is no two-sided color
+ * selection then. However the facing bit can be used instead. */
+ return 10;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ return is_r500 ? 256 : 32;
+ case PIPE_CAP_MAX_FS_TEMPS:
+ return is_r500 ? 128 : is_r400 ? 64 : 32;
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return 0;
+ case PIPE_CAP_MAX_FS_PREDS:
+ return is_r500 ? 1 : 0;
+
+ /* Vertex shader limits. */
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ return is_r500 ? 1024 : 256;
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ return 0;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ return is_r500 ? 4 : 0; /* For loops; not sure about conditionals. */
+ case PIPE_CAP_MAX_VS_INPUTS:
+ return 16;
+ case PIPE_CAP_MAX_VS_CONSTS:
+ return 256;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ return 32;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ return 1; /* XXX guessed */
+ case PIPE_CAP_MAX_VS_PREDS:
+ return is_r500 ? 4 : 0; /* XXX guessed. */
+
default:
fprintf(stderr, "r300: Implementation error: Bad param %d\n",
param);
}
}
-static float r300_get_paramf(struct pipe_screen* pscreen, int param)
+static float r300_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
{
struct r300_screen* r300screen = r300_screen(pscreen);
static boolean r300_is_format_supported(struct pipe_screen* screen,
enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned usage,
unsigned geom_flags)
{
return FALSE;
}
+ if (sample_count > 1)
+ return FALSE;
+
/* Check sampler format support. */
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
/* Z24 cannot be sampled from on non-r5xx. */
if (r300->screen->caps.has_tcl) {
memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state));
r300->clip_state.size = 29;
+
+ r300->clip_state.dirty = TRUE;
} else {
draw_flush(r300->draw);
draw_set_clip_state(r300->draw, state);
r300->clip_state.size = 2;
}
-
- r300->clip_state.dirty = TRUE;
}
+ static void
+ r300_set_sample_mask(struct pipe_context *pipe,
+ unsigned sample_mask)
+ {
+ }
+
+
/* Create a new depth, stencil, and alpha state based on the CSO dsa state.
*
* This contains the depth buffer, stencil buffer, alpha test, and such.
}
}
+static void r300_print_fb_surf_info(struct pipe_surface *surf, unsigned index,
+ const char *binding)
+{
+ struct pipe_resource *tex = surf->texture;
+ struct r300_texture *rtex = r300_texture(tex);
+
+ fprintf(stderr,
+ "r300: %s[%i] Dim: %ix%i, Offset: %i, ZSlice: %i, "
+ "Face: %i, Level: %i, Format: %s\n"
+
+ "r300: TEX: Macro: %s, Micro: %s, Pitch: %i, "
+ "Dim: %ix%ix%i, LastLevel: %i, Format: %s\n",
+
+ binding, index, surf->width, surf->height, surf->offset,
+ surf->zslice, surf->face, surf->level,
+ util_format_short_name(surf->format),
+
+ rtex->macrotile ? "YES" : " NO", rtex->microtile ? "YES" : " NO",
+ rtex->hwpitch[0], tex->width0, tex->height0, tex->depth0,
+ tex->last_level, util_format_short_name(tex->format));
+}
+
static void
r300_set_framebuffer_state(struct pipe_context* pipe,
const struct pipe_framebuffer_state* state)
{
struct r300_context* r300 = r300_context(pipe);
struct pipe_framebuffer_state *old_state = r300->fb_state.state;
- unsigned max_width, max_height;
+ unsigned max_width, max_height, i;
uint32_t zbuffer_bpp = 0;
if (state->nr_cbufs > 4) {
memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
- (state->zsbuf ? 10 : 0) + 11;
+ (state->zsbuf ? 10 : 0) + 9;
/* Polygon offset depends on the zbuffer bit depth. */
if (state->zsbuf && r300->polygon_offset_enabled) {
r300->rs_state.dirty = TRUE;
}
}
+
+ if (DBG_ON(r300, DBG_FB)) {
+ fprintf(stderr, "r300: set_framebuffer_state:\n");
+ for (i = 0; i < state->nr_cbufs; i++) {
+ r300_print_fb_surf_info(state->cbufs[i], i, "CB");
+ }
+ if (state->zsbuf) {
+ r300_print_fb_surf_info(state->zsbuf, 0, "ZB");
+ }
+ }
}
/* Create fragment shader state. */
{
struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
int i;
+ float psiz;
- /* Copy rasterizer state for Draw. */
+ /* Copy rasterizer state. */
rs->rs = *state;
+ rs->rs_draw = *state;
+
+ /* Override some states for Draw. */
+ rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
#ifdef PIPE_ARCH_LITTLE_ENDIAN
rs->vap_control_status = R300_VC_NO_SWAP;
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
}
- rs->point_size = pack_float_16_6x(state->point_size) |
+ /* Point size width and height. */
+ rs->point_size =
+ pack_float_16_6x(state->point_size) |
(pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
+ /* Point size clamping. */
+ if (state->point_size_per_vertex) {
+ /* Per-vertex point size.
+ * Clamp to [0, max FB size] */
+ psiz = pipe->screen->get_paramf(pipe->screen,
+ PIPE_CAP_MAX_POINT_WIDTH);
+ rs->point_minmax =
+ pack_float_16_6x(psiz) << R300_GA_POINT_MINMAX_MAX_SHIFT;
+ } else {
+ /* We cannot disable the point-size vertex output,
+ * so clamp it. */
+ psiz = state->point_size;
+ rs->point_minmax =
+ (pack_float_16_6x(psiz) << R300_GA_POINT_MINMAX_MIN_SHIFT) |
+ (pack_float_16_6x(psiz) << R300_GA_POINT_MINMAX_MAX_SHIFT);
+ }
+
+ /* Line control. */
rs->line_control = pack_float_16_6x(state->line_width) |
R300_GA_LINE_CNTL_END_TYPE_COMP;
/* Enable polygon mode */
- if (state->fill_cw != PIPE_POLYGON_MODE_FILL ||
- state->fill_ccw != PIPE_POLYGON_MODE_FILL) {
+ if (state->fill_front != PIPE_POLYGON_MODE_FILL ||
+ state->fill_back != PIPE_POLYGON_MODE_FILL) {
rs->polygon_mode = R300_GA_POLY_MODE_DUAL;
}
- /* Radeons don't think in "CW/CCW", they think in "front/back". */
- if (state->front_winding == PIPE_WINDING_CW) {
- rs->cull_mode = R300_FRONT_FACE_CW;
-
- /* Polygon offset */
- if (state->offset_cw) {
- rs->polygon_offset_enable |= R300_FRONT_ENABLE;
- }
- if (state->offset_ccw) {
- rs->polygon_offset_enable |= R300_BACK_ENABLE;
- }
-
- /* Polygon mode */
- if (rs->polygon_mode) {
- rs->polygon_mode |=
- r300_translate_polygon_mode_front(state->fill_cw);
- rs->polygon_mode |=
- r300_translate_polygon_mode_back(state->fill_ccw);
- }
- } else {
+ /* Front face */
+ if (state->front_ccw)
rs->cull_mode = R300_FRONT_FACE_CCW;
+ else
+ rs->cull_mode = R300_FRONT_FACE_CW;
- /* Polygon offset */
- if (state->offset_ccw) {
- rs->polygon_offset_enable |= R300_FRONT_ENABLE;
- }
- if (state->offset_cw) {
- rs->polygon_offset_enable |= R300_BACK_ENABLE;
- }
+ /* Polygon offset */
+ if (util_get_offset(state, state->fill_front)) {
+ rs->polygon_offset_enable |= R300_FRONT_ENABLE;
+ }
+ if (util_get_offset(state, state->fill_back)) {
+ rs->polygon_offset_enable |= R300_BACK_ENABLE;
+ }
- /* Polygon mode */
- if (rs->polygon_mode) {
- rs->polygon_mode |=
- r300_translate_polygon_mode_front(state->fill_ccw);
- rs->polygon_mode |=
- r300_translate_polygon_mode_back(state->fill_cw);
- }
+ /* Polygon mode */
+ if (rs->polygon_mode) {
+ rs->polygon_mode |=
+ r300_translate_polygon_mode_front(state->fill_front);
+ rs->polygon_mode |=
+ r300_translate_polygon_mode_back(state->fill_back);
}
- if (state->front_winding & state->cull_mode) {
+
+ if (state->cull_face & PIPE_FACE_FRONT) {
rs->cull_mode |= R300_CULL_FRONT;
}
- if (~(state->front_winding) & state->cull_mode) {
+ if (state->cull_face & PIPE_FACE_BACK) {
rs->cull_mode |= R300_CULL_BACK;
}
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
int last_sprite_coord_enable = r300->sprite_coord_enable;
+ boolean last_two_sided_color = r300->two_sided_color;
- if (r300->draw) {
+ if (r300->draw && rs) {
draw_flush(r300->draw);
- draw_set_rasterizer_state(r300->draw, &rs->rs, state);
+ draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
}
if (rs) {
- r300->polygon_offset_enabled = rs->rs.offset_cw || rs->rs.offset_ccw;
+ r300->polygon_offset_enabled = (rs->rs.offset_point ||
+ rs->rs.offset_line ||
+ rs->rs.offset_tri);
r300->sprite_coord_enable = rs->rs.sprite_coord_enable;
+ r300->two_sided_color = rs->rs.light_twoside;
} else {
r300->polygon_offset_enabled = FALSE;
r300->sprite_coord_enable = 0;
+ r300->two_sided_color = FALSE;
}
UPDATE_STATE(state, r300->rs_state);
- r300->rs_state.size = 26 + (r300->polygon_offset_enabled ? 5 : 0);
+ r300->rs_state.size = 27 + (r300->polygon_offset_enabled ? 5 : 0);
- if (last_sprite_coord_enable != r300->sprite_coord_enable) {
+ if (last_sprite_coord_enable != r300->sprite_coord_enable ||
+ last_two_sided_color != r300->two_sided_color) {
r300->rs_block_state.dirty = TRUE;
}
}
sampler->min_lod = MAX2((unsigned)state->min_lod, 0);
sampler->max_lod = MAX2((unsigned)ceilf(state->max_lod), 0);
- lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1);
+ lod_bias = CLAMP((int)(state->lod_bias * 32 + 1), -(1 << 9), (1 << 9) - 1);
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
{
struct r300_sampler_view *view = CALLOC_STRUCT(r300_sampler_view);
struct r300_texture *tex = r300_texture(texture);
- unsigned char swizzle[4];
if (view) {
view->base = *templ;
view->base.texture = NULL;
pipe_resource_reference(&view->base.texture, texture);
- swizzle[0] = templ->swizzle_r;
- swizzle[1] = templ->swizzle_g;
- swizzle[2] = templ->swizzle_b;
- swizzle[3] = templ->swizzle_a;
+ view->swizzle[0] = templ->swizzle_r;
+ view->swizzle[1] = templ->swizzle_g;
+ view->swizzle[2] = templ->swizzle_b;
+ view->swizzle[3] = templ->swizzle_a;
view->format = tex->tx_format;
view->format.format1 |= r300_translate_texformat(templ->format,
- swizzle);
+ view->swizzle);
if (r300_screen(pipe->screen)->caps.is_r500) {
view->format.format2 |= r500_tx_format_msb_bit(templ->format);
}
r300->viewport = *state;
+ if (r300->draw) {
+ draw_flush(r300->draw);
+ draw_set_viewport_state(r300->draw, state);
+ viewport->vte_control = R300_VTX_XY_FMT | R300_VTX_Z_FMT;
+ return;
+ }
+
/* Do the transform in HW. */
viewport->vte_control = R300_VTX_W0_FMT;
}
}
-/* Update the PSC tables. */
+/* Initialize the PSC tables. */
static void r300_vertex_psc(struct r300_vertex_element_state *velems)
{
struct r300_vertex_stream_state *vstream = &velems->vertex_stream;
abort();
}
}
-
}
}
return velems;
if (r300->draw) {
draw_flush(r300->draw);
draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
+ return;
}
UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
vs->state = *shader;
vs->state.tokens = tgsi_dup_tokens(shader->tokens);
+ r300_init_vs_outputs(vs);
+
if (r300->screen->caps.has_tcl) {
- r300_translate_vertex_shader(r300, vs, vs->state.tokens);
+ r300_translate_vertex_shader(r300, vs);
} else {
vs->draw_vs = draw_create_vertex_shader(r300->draw, shader);
}
struct r300_constant_buffer *cbuf;
struct pipe_transfer *tr;
void *mapped;
- int max_size = 0;
+ int max_size = 0, max_size_bytes = 0, clamped_size = 0;
switch (shader) {
case PIPE_SHADER_VERTEX:
assert(0);
return;
}
+ max_size_bytes = max_size * 4 * sizeof(float);
if (buf == NULL || buf->width0 == 0 ||
(mapped = pipe_buffer_map(pipe, buf, PIPE_TRANSFER_READ, &tr)) == NULL)
return;
}
- assert((buf->width0 % 4 * sizeof(float)) == 0);
+ if (shader == PIPE_SHADER_FRAGMENT ||
+ (shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) {
+ assert((buf->width0 % (4 * sizeof(float))) == 0);
- /* Check the size of the constant buffer. */
- /* XXX Subtract immediates and RC_STATE_* variables. */
- if (buf->width0 > (sizeof(float) * 4 * max_size)) {
- fprintf(stderr, "r300: Max size of the constant buffer is "
- "%i*4 floats.\n", max_size);
- abort();
- }
+ /* Check the size of the constant buffer. */
+ /* XXX Subtract immediates and RC_STATE_* variables. */
+ if (buf->width0 > max_size_bytes) {
+ fprintf(stderr, "r300: Max size of the constant buffer is "
+ "%i*4 floats.\n", max_size);
+ }
+ clamped_size = MIN2(buf->width0, max_size_bytes);
- memcpy(cbuf->constants, mapped, buf->width0);
- cbuf->count = buf->width0 / (4 * sizeof(float));
- pipe_buffer_unmap(pipe, buf, tr);
+ memcpy(cbuf->constants, mapped, clamped_size);
+ cbuf->count = clamped_size / (4 * sizeof(float));
+ }
if (shader == PIPE_SHADER_VERTEX) {
if (r300->screen->caps.has_tcl) {
r300->pvs_flush.dirty = TRUE;
} else if (r300->draw) {
draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
- 0, cbuf->constants,
- buf->width0);
+ 0, mapped, buf->width0);
}
} else if (shader == PIPE_SHADER_FRAGMENT) {
r300->fs_constants.dirty = TRUE;
}
+
+ pipe_buffer_unmap(pipe, buf, tr);
}
void r300_init_state_functions(struct r300_context* r300)
r300->context.set_blend_color = r300_set_blend_color;
r300->context.set_clip_state = r300_set_clip_state;
+ r300->context.set_sample_mask = r300_set_sample_mask;
r300->context.set_constant_buffer = r300_set_constant_buffer;
static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
struct r300_transfer *r300transfer)
{
- struct pipe_screen *screen = ctx->screen;
struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
struct pipe_resource *tex = transfer->resource;
- struct pipe_surface *src, *dst;
+ struct pipe_subresource subdst;
- src = screen->get_tex_surface(screen, tex,
- transfer->sr.face,
- transfer->sr.level,
- transfer->box.z,
- PIPE_BIND_BLIT_SOURCE);
+ subdst.face = 0;
+ subdst.level = 0;
- dst = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b,
- 0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION);
-
- ctx->surface_copy(ctx, dst, 0, 0, src,
- transfer->box.x, transfer->box.y,
- transfer->box.width, transfer->box.height);
-
- pipe_surface_reference(&src, NULL);
- pipe_surface_reference(&dst, NULL);
+ ctx->resource_copy_region(ctx, &r300transfer->detiled_texture->b.b, subdst,
+ 0, 0, 0,
+ tex, transfer->sr,
+ transfer->box.x, transfer->box.y, transfer->box.z,
+ transfer->box.width, transfer->box.height);
}
/* Copy a detiled texture to a tiled one. */
static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
struct r300_transfer *r300transfer)
{
- struct pipe_screen *screen = ctx->screen;
struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
struct pipe_resource *tex = transfer->resource;
- struct pipe_surface *src, *dst;
+ struct pipe_subresource subsrc;
- src = screen->get_tex_surface(screen, &r300transfer->detiled_texture->b.b,
- 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE);
-
- dst = screen->get_tex_surface(screen, tex,
- transfer->sr.face,
- transfer->sr.level,
- transfer->box.z,
- PIPE_BIND_BLIT_DESTINATION);
+ subsrc.face = 0;
+ subsrc.level = 0;
/* XXX this flush prevents the following DRM error from occuring:
* [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation !
* Reproducible with perf/copytex. */
ctx->flush(ctx, 0, NULL);
- ctx->surface_copy(ctx, dst,
- transfer->box.x, transfer->box.y,
- src, 0, 0,
- transfer->box.width, transfer->box.height);
+ ctx->resource_copy_region(ctx, tex, transfer->sr,
+ transfer->box.x, transfer->box.y, transfer->box.z,
+ &r300transfer->detiled_texture->b.b, subsrc,
+ 0, 0, 0,
+ transfer->box.width, transfer->box.height);
/* XXX this flush fixes a few piglit tests (e.g. glean/pixelFormats). */
ctx->flush(ctx, 0, NULL);
-
- pipe_surface_reference(&src, NULL);
- pipe_surface_reference(&dst, NULL);
}
struct pipe_transfer*
struct r300_transfer *trans;
struct pipe_resource base;
+ /* XXX Why aren't flushes taken care of by winsys automatically?
+ * Winsys seems to sometimes return a cached buffer instead of
+ * a mapped hardware buffer if this flush is commented out. */
+ if (ctx->is_resource_referenced(ctx, texture, sr.face, sr.level))
+ ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
+
trans = CALLOC_STRUCT(r300_transfer);
if (trans) {
/* Initialize the transfer object. */
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "tgsi/tgsi_exec.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
}
}
+ tgsi_exec_machine_destroy(softpipe->fs_machine);
+
FREE( softpipe );
}
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref;
softpipe->pipe.set_clip_state = softpipe_set_clip_state;
+ softpipe->pipe.set_sample_mask = softpipe_set_sample_mask;
softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
}
+ softpipe->fs_machine = tgsi_exec_machine_create();
+
/* setup quad rendering stages */
softpipe->quad.shade = sp_quad_shade_stage(softpipe);
softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe);
#include "pipe/p_screen.h"
#include "state_tracker/sw_winsys.h"
+#include "tgsi/tgsi_exec.h"
#include "sp_texture.h"
#include "sp_screen.h"
static int
-softpipe_get_param(struct pipe_screen *screen, int param)
+softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 1;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 1;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 1;
+
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ /* There is no limit in number of instructions beyond available memory */
+ return 32768;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ return TGSI_EXEC_MAX_NESTING;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ case PIPE_CAP_MAX_FS_INPUTS:
+ return TGSI_EXEC_MAX_INPUT_ATTRIBS;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ case PIPE_CAP_MAX_VS_CONSTS:
+ return TGSI_EXEC_MAX_CONST_BUFFER;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ case PIPE_CAP_MAX_FS_TEMPS:
+ return TGSI_EXEC_NUM_TEMPS;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return TGSI_EXEC_NUM_ADDRS;
+ case PIPE_CAP_MAX_VS_PREDS:
+ case PIPE_CAP_MAX_FS_PREDS:
+ return TGSI_EXEC_NUM_PREDS;
+
default:
return 0;
}
static float
-softpipe_get_paramf(struct pipe_screen *screen, int param)
+softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
*/
static boolean
softpipe_is_format_supported( struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned bind,
unsigned geom_flags )
{
if (!format_desc)
return FALSE;
+ if (sample_count > 1)
+ return FALSE;
+
if (bind & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
static float
-svga_get_paramf(struct pipe_screen *screen, int param)
+svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
struct svga_screen *svgascreen = svga_screen(screen);
struct svga_winsys_screen *sws = svgascreen->sws;
return MIN2(result.u, PIPE_MAX_COLOR_BUFS);
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
+ case PIPE_CAP_TIMER_QUERY:
+ return 0;
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+ /*
+ * Fragment shader limits
+ */
+
+ case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ return svgascreen->use_ps30 ? 512 : 96;
+ case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_CAP_MAX_FS_INPUTS:
+ return 10;
+ case PIPE_CAP_MAX_FS_CONSTS:
+ return svgascreen->use_vs30 ? 224 : 16;
+ case PIPE_CAP_MAX_FS_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
+ return svgascreen->use_ps30 ? 32 : 12;
+ return result.u;
+ case PIPE_CAP_MAX_FS_ADDRS:
+ return svgascreen->use_ps30 ? 1 : 0;
+ case PIPE_CAP_MAX_FS_PREDS:
+ return svgascreen->use_ps30 ? 1 : 0;
+
+ /*
+ * Vertex shader limits
+ */
+ case PIPE_CAP_MAX_VS_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
+ return svgascreen->use_vs30 ? 512 : 256;
+ return result.u;
+ case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
+ case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ /* XXX: until we have vertex texture support */
+ return 0;
+ case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_CAP_MAX_VS_INPUTS:
+ return 16;
+ case PIPE_CAP_MAX_VS_CONSTS:
+ return 256;
+ case PIPE_CAP_MAX_VS_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
+ return svgascreen->use_vs30 ? 32 : 12;
+ return result.u;
+ case PIPE_CAP_MAX_VS_ADDRS:
+ return svgascreen->use_vs30 ? 1 : 0;
+ case PIPE_CAP_MAX_VS_PREDS:
+ return svgascreen->use_vs30 ? 1 : 0;
+
default:
return 0;
}
/* This is a fairly pointless interface
*/
static int
-svga_get_param(struct pipe_screen *screen, int param)
+svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
return (int) svga_get_paramf( screen, param );
}
static boolean
svga_is_format_supported( struct pipe_screen *screen,
- enum pipe_format format,
+ enum pipe_format format,
enum pipe_texture_target target,
- unsigned tex_usage,
+ unsigned sample_count,
+ unsigned tex_usage,
unsigned geom_flags )
{
struct svga_winsys_screen *sws = svga_screen(screen)->sws;
SVGA3dDevCapIndex index;
SVGA3dDevCapResult result;
-
+
assert(tex_usage);
+ if (sample_count > 1)
+ return FALSE;
+
/* Override host capabilities */
if (tex_usage & PIPE_BIND_RENDER_TARGET) {
switch(format) {
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
-#include "util/u_format.h"
#include "pipe/p_format.h"
#include "pipe/p_screen.h"
#include "tr_dump.h"
#include "tr_dump_state.h"
-#include "tr_state.h"
+#include "tr_public.h"
#include "tr_screen.h"
#include "tr_texture.h"
+#include "tr_context.h"
}
-static INLINE void
-trace_context_draw_block(struct trace_context *tr_ctx, int flag)
-{
- int k;
-
- pipe_mutex_lock(tr_ctx->draw_mutex);
-
- if (tr_ctx->draw_blocker & flag) {
- tr_ctx->draw_blocked |= flag;
- } else if ((tr_ctx->draw_rule.blocker & flag) &&
- (tr_ctx->draw_blocker & 4)) {
- boolean block = FALSE;
- debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__,
- (void *) tr_ctx->draw_rule.fs, (void *) tr_ctx->curr.fs,
- (void *) tr_ctx->draw_rule.vs, (void *) tr_ctx->curr.vs,
- (void *) tr_ctx->draw_rule.surf, 0,
- (void *) tr_ctx->draw_rule.sampler_view, 0);
- if (tr_ctx->draw_rule.fs &&
- tr_ctx->draw_rule.fs == tr_ctx->curr.fs)
- block = TRUE;
- if (tr_ctx->draw_rule.vs &&
- tr_ctx->draw_rule.vs == tr_ctx->curr.vs)
- block = TRUE;
- if (tr_ctx->draw_rule.surf &&
- tr_ctx->draw_rule.surf == tr_ctx->curr.zsbuf)
- block = TRUE;
- if (tr_ctx->draw_rule.surf)
- for (k = 0; k < tr_ctx->curr.nr_cbufs; k++)
- if (tr_ctx->draw_rule.surf == tr_ctx->curr.cbufs[k])
- block = TRUE;
- if (tr_ctx->draw_rule.sampler_view) {
- for (k = 0; k < tr_ctx->curr.num_sampler_views; k++)
- if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.sampler_views[k])
- block = TRUE;
- for (k = 0; k < tr_ctx->curr.num_vert_sampler_views; k++) {
- if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.vert_sampler_views[k]) {
- block = TRUE;
- }
- }
- }
-
- if (block)
- tr_ctx->draw_blocked |= (flag | 4);
- }
-
- if (tr_ctx->draw_blocked)
- trace_rbug_notify_draw_blocked(tr_ctx);
-
- /* wait for rbug to clear the blocked flag */
- while (tr_ctx->draw_blocked & flag) {
- tr_ctx->draw_blocked |= flag;
-#ifdef PIPE_THREAD_HAVE_CONDVAR
- pipe_condvar_wait(tr_ctx->draw_cond, tr_ctx->draw_mutex);
-#else
- pipe_mutex_unlock(tr_ctx->draw_mutex);
-#ifdef PIPE_SUBSYSTEM_WINDOWS_USER
- Sleep(1);
-#endif
- pipe_mutex_lock(tr_ctx->draw_mutex);
-#endif
- }
-
- pipe_mutex_unlock(tr_ctx->draw_mutex);
-}
-
static INLINE void
trace_context_draw_arrays(struct pipe_context *_pipe,
unsigned mode, unsigned start, unsigned count)
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
- return;
-
- trace_context_draw_block(tr_ctx, 1);
-
trace_dump_call_begin("pipe_context", "draw_arrays");
trace_dump_arg(ptr, pipe);
pipe->draw_arrays(pipe, mode, start, count);
trace_dump_call_end();
-
- trace_context_draw_block(tr_ctx, 2);
}
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_resource *indexBuffer = tr_buf->resource;
- if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
- return;
-
- trace_context_draw_block(tr_ctx, 1);
-
trace_dump_call_begin("pipe_context", "draw_elements");
trace_dump_arg(ptr, pipe);
mode, start, count);
trace_dump_call_end();
-
- trace_context_draw_block(tr_ctx, 2);
}
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_resource *indexBuffer = tr_buf->resource;
- if (tr_ctx->curr.fs->disabled || tr_ctx->curr.vs->disabled)
- return;
-
- trace_context_draw_block(tr_ctx, 1);
-
trace_dump_call_begin("pipe_context", "draw_range_elements");
trace_dump_arg(ptr, pipe);
mode, start, count);
trace_dump_call_end();
-
- trace_context_draw_block(tr_ctx, 2);
}
trace_dump_call_end();
- result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_FRAGMENT);
-
return result;
}
static INLINE void
trace_context_bind_fs_state(struct pipe_context *_pipe,
- void *_state)
+ void *state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
- void *state = tr_shdr ? tr_shdr->state : NULL;
trace_dump_call_begin("pipe_context", "bind_fs_state");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, state);
- tr_ctx->curr.fs = tr_shdr;
-
- if (tr_shdr && tr_shdr->replaced)
- state = tr_shdr->replaced;
-
pipe->bind_fs_state(pipe, state);
trace_dump_call_end();
static INLINE void
trace_context_delete_fs_state(struct pipe_context *_pipe,
- void *_state)
+ void *state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
- void *state = tr_shdr->state;
trace_dump_call_begin("pipe_context", "delete_fs_state");
pipe->delete_fs_state(pipe, state);
trace_dump_call_end();
-
- trace_shader_destroy(tr_ctx, tr_shdr);
}
trace_dump_call_end();
- result = trace_shader_create(tr_ctx, state, result, TRACE_SHADER_VERTEX);
-
return result;
}
static INLINE void
trace_context_bind_vs_state(struct pipe_context *_pipe,
- void *_state)
+ void *state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
- void *state = tr_shdr ? tr_shdr->state : NULL;
trace_dump_call_begin("pipe_context", "bind_vs_state");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, state);
- tr_ctx->curr.vs = tr_shdr;
-
- if (tr_shdr && tr_shdr->replaced)
- state = tr_shdr->replaced;
-
pipe->bind_vs_state(pipe, state);
trace_dump_call_end();
static INLINE void
trace_context_delete_vs_state(struct pipe_context *_pipe,
- void *_state)
+ void *state)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_shader *tr_shdr = trace_shader(_state);
struct pipe_context *pipe = tr_ctx->pipe;
- void *state = tr_shdr->state;
trace_dump_call_begin("pipe_context", "delete_vs_state");
pipe->delete_vs_state(pipe, state);
trace_dump_call_end();
-
- trace_shader_destroy(tr_ctx, tr_shdr);
}
trace_dump_call_end();
}
+ static INLINE void
+ trace_context_set_sample_mask(struct pipe_context *_pipe,
+ unsigned sample_mask)
+ {
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct pipe_context *pipe = tr_ctx->pipe;
+
+ trace_dump_call_begin("pipe_context", "set_sample_mask");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(uint, sample_mask);
+
+ pipe->set_sample_mask(pipe, sample_mask);
+
+ trace_dump_call_end();
+ }
static INLINE void
trace_context_set_constant_buffer(struct pipe_context *_pipe,
struct pipe_framebuffer_state unwrapped_state;
unsigned i;
- {
- tr_ctx->curr.nr_cbufs = state->nr_cbufs;
- for (i = 0; i < state->nr_cbufs; i++)
- if (state->cbufs[i])
- tr_ctx->curr.cbufs[i] = trace_resource(state->cbufs[i]->texture);
- else
- tr_ctx->curr.cbufs[i] = NULL;
- if (state->zsbuf)
- tr_ctx->curr.zsbuf = trace_resource(state->zsbuf->texture);
- else
- tr_ctx->curr.zsbuf = NULL;
- }
/* Unwrap the input state */
memcpy(&unwrapped_state, state, sizeof(unwrapped_state));
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
unsigned i;
- tr_ctx->curr.num_sampler_views = num;
for(i = 0; i < num; ++i) {
tr_view = trace_sampler_view(views[i]);
- tr_ctx->curr.sampler_views[i] = tr_view;
unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
}
views = unwrapped_views;
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
unsigned i;
- tr_ctx->curr.num_vert_sampler_views = num;
for(i = 0; i < num; ++i) {
tr_view = trace_sampler_view(views[i]);
- tr_ctx->curr.vert_sampler_views[i] = tr_view;
unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
}
views = unwrapped_views;
static INLINE void
- trace_context_surface_copy(struct pipe_context *_pipe,
- struct pipe_surface *dest,
- unsigned destx, unsigned desty,
- struct pipe_surface *src,
- unsigned srcx, unsigned srcy,
- unsigned width, unsigned height)
+ trace_context_resource_copy_region(struct pipe_context *_pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ struct pipe_resource *src,
+ struct pipe_subresource subsrc,
+ unsigned srcx, unsigned srcy, unsigned srcz,
+ unsigned width, unsigned height)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- dest = trace_surface_unwrap(tr_ctx, dest);
- src = trace_surface_unwrap(tr_ctx, src);
+ dst = trace_resource_unwrap(tr_ctx, dst);
+ src = trace_resource_unwrap(tr_ctx, src);
- trace_dump_call_begin("pipe_context", "surface_copy");
+ trace_dump_call_begin("pipe_context", "resource_copy_region");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, dest);
- trace_dump_arg(uint, destx);
- trace_dump_arg(uint, desty);
+ trace_dump_arg(ptr, dst);
+ trace_dump_arg_struct(subresource, subdst);
+ trace_dump_arg(uint, dstx);
+ trace_dump_arg(uint, dsty);
+ trace_dump_arg(uint, dstz);
trace_dump_arg(ptr, src);
+ trace_dump_arg_struct(subresource, subsrc);
trace_dump_arg(uint, srcx);
trace_dump_arg(uint, srcy);
+ trace_dump_arg(uint, srcz);
trace_dump_arg(uint, width);
trace_dump_arg(uint, height);
- pipe->surface_copy(pipe,
- dest, destx, desty,
- src, srcx, srcy, width, height);
+ pipe->resource_copy_region(pipe,
+ dst, subdst, dstx, dsty, dstz,
+ src, subsrc, srcx, srcy, srcz, width, height);
trace_dump_call_end();
}
static INLINE void
- trace_context_surface_fill(struct pipe_context *_pipe,
- struct pipe_surface *dst,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height,
- unsigned value)
+ trace_context_resource_fill_region(struct pipe_context *_pipe,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ unsigned width, unsigned height,
+ unsigned value)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- dst = trace_surface_unwrap(tr_ctx, dst);
+ dst = trace_resource_unwrap(tr_ctx, dst);
- trace_dump_call_begin("pipe_context", "surface_fill");
+ trace_dump_call_begin("pipe_context", "resource_fill_region");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, dst);
+ trace_dump_arg_struct(subresource, subdst);
trace_dump_arg(uint, dstx);
trace_dump_arg(uint, dsty);
+ trace_dump_arg(uint, dstz);
trace_dump_arg(uint, width);
trace_dump_arg(uint, height);
+ trace_dump_arg(uint, value);
- pipe->surface_fill(pipe, dst, dstx, dsty, width, height, value);
+ pipe->resource_fill_region(pipe, dst, subdst, dstx, dsty, dstz,
+ width, height, value);
trace_dump_call_end();
}
static INLINE void
trace_context_destroy(struct pipe_context *_pipe)
{
- struct trace_screen *tr_scr = trace_screen(_pipe->screen);
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
trace_dump_arg(ptr, pipe);
trace_dump_call_end();
- trace_screen_remove_from_list(tr_scr, contexts, tr_ctx);
-
pipe->destroy(pipe);
FREE(tr_ctx);
tr_ctx->base.winsys = NULL;
tr_ctx->base.priv = pipe->priv; /* expose wrapped priv data */
tr_ctx->base.screen = &tr_scr->base;
- tr_ctx->draw_blocker = debug_get_flags_option("RBUG_BLOCK",
- rbug_blocker_flags,
- 0);
- pipe_mutex_init(tr_ctx->draw_mutex);
- pipe_condvar_init(tr_ctx->draw_cond);
- pipe_mutex_init(tr_ctx->list_mutex);
- make_empty_list(&tr_ctx->shaders);
tr_ctx->base.destroy = trace_context_destroy;
tr_ctx->base.draw_arrays = trace_context_draw_arrays;
tr_ctx->base.set_blend_color = trace_context_set_blend_color;
tr_ctx->base.set_stencil_ref = trace_context_set_stencil_ref;
tr_ctx->base.set_clip_state = trace_context_set_clip_state;
+ tr_ctx->base.set_sample_mask = trace_context_set_sample_mask;
tr_ctx->base.set_constant_buffer = trace_context_set_constant_buffer;
tr_ctx->base.set_framebuffer_state = trace_context_set_framebuffer_state;
tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple;
tr_ctx->base.create_sampler_view = trace_create_sampler_view;
tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
- if (pipe->surface_copy)
- tr_ctx->base.surface_copy = trace_context_surface_copy;
- if (pipe->surface_fill)
- tr_ctx->base.surface_fill = trace_context_surface_fill;
+ tr_ctx->base.resource_copy_region = trace_context_resource_copy_region;
+ tr_ctx->base.resource_fill_region = trace_context_resource_fill_region;
tr_ctx->base.clear = trace_context_clear;
tr_ctx->base.flush = trace_context_flush;
tr_ctx->base.is_resource_referenced = trace_is_resource_referenced;
tr_ctx->pipe = pipe;
- trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
-
return &tr_ctx->base;
error1:
static boolean trace = FALSE;
-static boolean rbug = FALSE;
static const char *
trace_screen_get_name(struct pipe_screen *_screen)
static int
trace_screen_get_param(struct pipe_screen *_screen,
- int param)
+ enum pipe_cap param)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen;
static float
trace_screen_get_paramf(struct pipe_screen *_screen,
- int param)
+ enum pipe_cap param)
{
struct trace_screen *tr_scr = trace_screen(_screen);
struct pipe_screen *screen = tr_scr->screen;
trace_screen_is_format_supported(struct pipe_screen *_screen,
enum pipe_format format,
enum pipe_texture_target target,
+ unsigned sample_count,
unsigned tex_usage,
unsigned geom_flags)
{
trace_dump_arg(ptr, screen);
trace_dump_arg(format, format);
trace_dump_arg(int, target);
+ trace_dump_arg(uint, sample_count);
trace_dump_arg(uint, tex_usage);
trace_dump_arg(uint, geom_flags);
- result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags);
+ result = screen->is_format_supported(screen, format, target, sample_count,
+ tex_usage, geom_flags);
trace_dump_ret(bool, result);
trace_dump_call_end();
trace_dump_trace_end();
- if (tr_scr->rbug)
- trace_rbug_stop(tr_scr->rbug);
-
screen->destroy(screen);
FREE(tr_scr);
trace = TRUE;
}
- if (debug_get_bool_option("GALLIUM_RBUG", FALSE)) {
- trace = TRUE;
- rbug = TRUE;
- }
-
return trace;
}
#else
winsys = screen->winsys;
#endif
- pipe_mutex_init(tr_scr->list_mutex);
- make_empty_list(&tr_scr->buffers);
- make_empty_list(&tr_scr->contexts);
- make_empty_list(&tr_scr->textures);
- make_empty_list(&tr_scr->surfaces);
- make_empty_list(&tr_scr->transfers);
-
tr_scr->base.winsys = winsys;
tr_scr->base.destroy = trace_screen_destroy;
tr_scr->base.get_name = trace_screen_get_name;
tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
tr_scr->screen = screen;
- tr_scr->private_context = screen->context_create(screen, NULL);
- if (tr_scr->private_context == NULL)
- goto error3;
trace_dump_ret(ptr, screen);
trace_dump_call_end();
- if (rbug)
- tr_scr->rbug = trace_rbug_start(tr_scr);
-
return &tr_scr->base;
-error3:
- FREE(tr_scr);
error2:
trace_dump_ret(ptr, screen);
trace_dump_call_end();
#define PIPE_POLYGON_MODE_LINE 1
#define PIPE_POLYGON_MODE_POINT 2
-/** Polygon front/back window, also for culling */
-#define PIPE_WINDING_NONE 0
-#define PIPE_WINDING_CW 1
-#define PIPE_WINDING_CCW 2
-#define PIPE_WINDING_BOTH (PIPE_WINDING_CW | PIPE_WINDING_CCW)
+/** Polygon face specification, eg for culling */
+#define PIPE_FACE_NONE 0
+#define PIPE_FACE_FRONT 1
+#define PIPE_FACE_BACK 2
+#define PIPE_FACE_FRONT_AND_BACK (PIPE_FACE_FRONT | PIPE_FACE_BACK)
/** Stencil ops */
#define PIPE_STENCIL_OP_KEEP 0
#define PIPE_BIND_VERTEX_BUFFER (1 << 3) /* set_vertex_buffers */
#define PIPE_BIND_INDEX_BUFFER (1 << 4) /* draw_elements */
#define PIPE_BIND_CONSTANT_BUFFER (1 << 5) /* set_constant_buffer */
- #define PIPE_BIND_BLIT_SOURCE (1 << 6) /* surface_copy */
- #define PIPE_BIND_BLIT_DESTINATION (1 << 7) /* surface_copy, fill */
#define PIPE_BIND_DISPLAY_TARGET (1 << 8) /* flush_front_buffer */
#define PIPE_BIND_TRANSFER_WRITE (1 << 9) /* get_transfer */
#define PIPE_BIND_TRANSFER_READ (1 << 10) /* get_transfer */
#define PIPE_QUERY_OCCLUSION_COUNTER 0
#define PIPE_QUERY_PRIMITIVES_GENERATED 1
#define PIPE_QUERY_PRIMITIVES_EMITTED 2
-#define PIPE_QUERY_TYPES 3
+#define PIPE_QUERY_TIME_ELAPSED 3
+#define PIPE_QUERY_TYPES 4
/**
* Implementation capabilities/limits which are queried through
* pipe_screen::get_param() and pipe_screen::get_paramf().
*/
-#define PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS 1
-#define PIPE_CAP_NPOT_TEXTURES 2
-#define PIPE_CAP_TWO_SIDED_STENCIL 3
-#define PIPE_CAP_GLSL 4 /* XXX need something better */
-#define PIPE_CAP_DUAL_SOURCE_BLEND 5
-#define PIPE_CAP_ANISOTROPIC_FILTER 6
-#define PIPE_CAP_POINT_SPRITE 7
-#define PIPE_CAP_MAX_RENDER_TARGETS 8
-#define PIPE_CAP_OCCLUSION_QUERY 9
-#define PIPE_CAP_TEXTURE_SHADOW_MAP 10
-#define PIPE_CAP_MAX_TEXTURE_2D_LEVELS 11
-#define PIPE_CAP_MAX_TEXTURE_3D_LEVELS 12
-#define PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS 13
-#define PIPE_CAP_MAX_LINE_WIDTH 14
-#define PIPE_CAP_MAX_LINE_WIDTH_AA 15
-#define PIPE_CAP_MAX_POINT_WIDTH 16
-#define PIPE_CAP_MAX_POINT_WIDTH_AA 17
-#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY 18
-#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS 19
-#define PIPE_CAP_GUARD_BAND_LEFT 20 /*< float */
-#define PIPE_CAP_GUARD_BAND_TOP 21 /*< float */
-#define PIPE_CAP_GUARD_BAND_RIGHT 22 /*< float */
-#define PIPE_CAP_GUARD_BAND_BOTTOM 23 /*< float */
-#define PIPE_CAP_TEXTURE_MIRROR_CLAMP 24
-#define PIPE_CAP_TEXTURE_MIRROR_REPEAT 25
-#define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26
-#define PIPE_CAP_TGSI_CONT_SUPPORTED 27
-#define PIPE_CAP_BLEND_EQUATION_SEPARATE 28
-#define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */
-#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30
-#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex
- and fragment shaders combined */
-#define PIPE_CAP_MAX_CONST_BUFFERS 32
-#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */
-#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */
-#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */
-#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT 36
-#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT 37
-#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 38
-#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER 39
+enum pipe_cap {
+ PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS,
+ PIPE_CAP_NPOT_TEXTURES,
+ PIPE_CAP_TWO_SIDED_STENCIL,
+ PIPE_CAP_GLSL, /* XXX need something better */
+ PIPE_CAP_DUAL_SOURCE_BLEND,
+ PIPE_CAP_ANISOTROPIC_FILTER,
+ PIPE_CAP_POINT_SPRITE,
+ PIPE_CAP_MAX_RENDER_TARGETS,
+ PIPE_CAP_OCCLUSION_QUERY,
+ PIPE_CAP_TIMER_QUERY,
+ PIPE_CAP_TEXTURE_SHADOW_MAP,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
+ PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
+ PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
+ PIPE_CAP_MAX_LINE_WIDTH,
+ PIPE_CAP_MAX_LINE_WIDTH_AA,
+ PIPE_CAP_MAX_POINT_WIDTH,
+ PIPE_CAP_MAX_POINT_WIDTH_AA,
+ PIPE_CAP_MAX_TEXTURE_ANISOTROPY,
+ PIPE_CAP_MAX_TEXTURE_LOD_BIAS,
+ PIPE_CAP_GUARD_BAND_LEFT, /*< float */
+ PIPE_CAP_GUARD_BAND_TOP, /*< float */
+ PIPE_CAP_GUARD_BAND_RIGHT, /*< float */
+ PIPE_CAP_GUARD_BAND_BOTTOM, /*< float */
+ PIPE_CAP_TEXTURE_MIRROR_CLAMP,
+ PIPE_CAP_TEXTURE_MIRROR_REPEAT,
+ PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS,
+ PIPE_CAP_TGSI_CONT_SUPPORTED,
+ PIPE_CAP_BLEND_EQUATION_SEPARATE,
+ PIPE_CAP_SM3, /*< Shader Model, supported */
+ PIPE_CAP_MAX_PREDICATE_REGISTERS,
+ /** Maximum texture image units accessible from vertex and fragment shaders
+ * combined */
+ PIPE_CAP_MAX_COMBINED_SAMPLERS,
+ PIPE_CAP_MAX_CONST_BUFFERS,
+ PIPE_CAP_MAX_CONST_BUFFER_SIZE, /*< In bytes */
+ /** blend enables and write masks per rendertarget */
+ PIPE_CAP_INDEP_BLEND_ENABLE,
+ /** different blend funcs per rendertarget */
+ PIPE_CAP_INDEP_BLEND_FUNC,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT,
+ PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
+ PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
+
+ /*
+ * Shader limits.
+ */
+ PIPE_CAP_MAX_FS_INSTRUCTIONS,
+ PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS,
+ PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS,
+ PIPE_CAP_MAX_FS_TEX_INDIRECTIONS,
+ PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH,
+ PIPE_CAP_MAX_FS_INPUTS,
+ PIPE_CAP_MAX_FS_CONSTS,
+ PIPE_CAP_MAX_FS_TEMPS,
+ PIPE_CAP_MAX_FS_ADDRS,
+ PIPE_CAP_MAX_FS_PREDS,
+ PIPE_CAP_MAX_VS_INSTRUCTIONS,
+ PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS,
+ PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS,
+ PIPE_CAP_MAX_VS_TEX_INDIRECTIONS,
+ PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH,
+ PIPE_CAP_MAX_VS_INPUTS,
+ PIPE_CAP_MAX_VS_CONSTS,
+ PIPE_CAP_MAX_VS_TEMPS,
+ PIPE_CAP_MAX_VS_ADDRS,
+ PIPE_CAP_MAX_VS_PREDS
+};
/**
/** Opaque type */
struct pipe_fence_handle;
struct pipe_winsys;
-struct pipe_texture;
struct pipe_resource;
struct pipe_surface;
struct pipe_transfer;
* Query an integer-valued capability/parameter/limit
* \param param one of PIPE_CAP_x
*/
- int (*get_param)( struct pipe_screen *, int param );
+ int (*get_param)( struct pipe_screen *, enum pipe_cap param );
/**
* Query a float-valued capability/parameter/limit
* \param param one of PIPE_CAP_x
*/
- float (*get_paramf)( struct pipe_screen *, int param );
+ float (*get_paramf)( struct pipe_screen *, enum pipe_cap param );
struct pipe_context * (*context_create)( struct pipe_screen *,
void *priv );
-
+
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
boolean (*is_format_supported)( struct pipe_screen *,
enum pipe_format format,
enum pipe_texture_target target,
- unsigned bindings,
+ unsigned sample_count,
+ unsigned bindings,
unsigned geom_flags );
/**
{
unsigned flatshade:1;
unsigned light_twoside:1;
- unsigned front_winding:2; /**< PIPE_WINDING_x */
- unsigned cull_mode:2; /**< PIPE_WINDING_x */
- unsigned fill_cw:2; /**< PIPE_POLYGON_MODE_x */
- unsigned fill_ccw:2; /**< PIPE_POLYGON_MODE_x */
- unsigned offset_cw:1;
- unsigned offset_ccw:1;
+ unsigned front_ccw:1;
+ unsigned cull_face:2; /**< PIPE_FACE_x */
+ unsigned fill_front:2; /**< PIPE_POLYGON_MODE_x */
+ unsigned fill_back:2; /**< PIPE_POLYGON_MODE_x */
+ unsigned offset_point:1;
+ unsigned offset_line:1;
+ unsigned offset_tri:1;
unsigned scissor:1;
unsigned poly_smooth:1;
unsigned poly_stipple_enable:1;
unsigned logicop_enable:1;
unsigned logicop_func:4; /**< PIPE_LOGICOP_x */
unsigned dither:1;
+ unsigned alpha_to_coverage:1;
+ unsigned alpha_to_one:1;
struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS];
};
if (gdrv->api_mask)
return;
+ egl_g3d_init_st_apis(gdrv->stapis);
for (i = 0; i < ST_API_COUNT; i++) {
- gdrv->stapis[i] = egl_g3d_create_st_api(i);
if (gdrv->stapis[i])
gdrv->api_mask |= egl_g3d_st_api_bit(i);
}
/* pick the first supported format */
for (i = 0; i < n; i++) {
if (screen->is_format_supported(screen, fmt[i],
- PIPE_TEXTURE_2D, PIPE_BIND_DEPTH_STENCIL, 0)) {
+ PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) {
formats[count++] = fmt[i];
break;
}
egl_g3d_unload(_EGLDriver *drv)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- EGLint i;
-
- for (i = 0; i < ST_API_COUNT; i++) {
- if (gdrv->stapis[i])
- gdrv->stapis[i]->destroy(gdrv->stapis[i]);
- }
+ egl_g3d_destroy_st_apis();
egl_g3d_destroy_probe(drv, NULL);
FREE(gdrv);
}
#include "asm_util.h"
#include "st_inlines.h"
#include "vg_manager.h"
+#include "api.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
void vg_set_current_context(struct vg_context *ctx)
{
_vg_context = ctx;
+ api_make_dispatch_current((ctx) ? ctx->dispatch : NULL);
}
struct vg_context * vg_create_context(struct pipe_context *pipe,
ctx->pipe = pipe;
+ ctx->dispatch = api_create_dispatch();
+
vg_init_state(&ctx->state.vg);
ctx->state.dirty = ALL_DIRTY;
cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]);
cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]);
+ api_destroy_dispatch(ctx->dispatch);
+
free(ctx);
}
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
stfb->blend_texture_view->texture,
0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION |
- PIPE_BIND_RENDER_TARGET);
+ PIPE_BIND_RENDER_TARGET);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
view,
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
stfb->blend_texture_view->texture,
0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION |
- PIPE_BIND_RENDER_TARGET);
+ PIPE_BIND_RENDER_TARGET);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
#include "util/u_format.h"
#include "util/u_sampler.h"
+#include "vg_api.h"
#include "vg_manager.h"
#include "vg_context.h"
#include "image.h"
#include "mask.h"
+#include "api.h"
static struct pipe_resource *
create_texture(struct pipe_context *pipe, enum pipe_format format,
/* if we had an old surface copy it over */
if (old_sampler_view) {
- struct pipe_surface *surface = pipe->screen->get_tex_surface(
- pipe->screen,
- stfb->alpha_mask_view->texture,
- 0, 0, 0,
- PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_DESTINATION);
- struct pipe_surface *old_surface = pipe->screen->get_tex_surface(
- pipe->screen,
- old_sampler_view->texture,
- 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE);
- pipe->surface_copy(pipe,
- surface,
- 0, 0,
- old_surface,
- 0, 0,
- MIN2(old_surface->width, surface->width),
- MIN2(old_surface->height, surface->height));
- if (surface)
- pipe_surface_reference(&surface, NULL);
- if (old_surface)
- pipe_surface_reference(&old_surface, NULL);
+ struct pipe_subresource subsurf, subold_surf;
+ subsurf.face = 0;
+ subsurf.level = 0;
+ subold_surf.face = 0;
+ subold_surf.level = 0;
+ pipe->resource_copy_region(pipe,
+ stfb->alpha_mask_view->texture,
+ subsurf,
+ 0, 0, 0,
+ old_sampler_view->texture,
+ subold_surf,
+ 0, 0, 0,
+ MIN2(old_sampler_view->texture->width0,
+ stfb->alpha_mask_view->texture->width0),
+ MIN2(old_sampler_view->texture->height0,
+ stfb->alpha_mask_view->texture->height0));
}
/* Free the old texture
/* Probably need dedicated flags for surface usage too:
*/
- surface_usage = (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION);
+ surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
dsrb->texture = create_texture(pipe, dsrb->format, width, height);
if (!dsrb->texture)
strb->texture = pt;
strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
- PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION);
+ PIPE_BIND_RENDER_TARGET);
if (!strb->surface) {
pipe_resource_reference(&strb->texture, NULL);
return TRUE;
static st_proc_t
vg_api_get_proc_address(struct st_api *stapi, const char *procname)
{
- /* TODO */
- return (st_proc_t) NULL;
+ return api_get_proc_address(procname);
}
static void
vg_api_destroy(struct st_api *stapi)
{
- free(stapi);
}
-struct st_api st_vg_api = {
+static const struct st_api vg_api = {
vg_api_destroy,
vg_api_get_proc_address,
vg_api_is_visual_supported,
vg_api_get_current,
};
-struct st_api *
-st_api_create_OpenVG(void)
+const struct st_api *
+vg_api_get(void)
{
- return &st_vg_api;
+ return &vg_api;
}
}
#endif
- dri2info.version = DRI2INFOREC_VERSION;
+ dri2info.version = min(DRI2INFOREC_VERSION, 3);
dri2info.fd = ms->fd;
dri2info.driverName = pScrn->driverName;
ms->d_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM,
PIPE_TEXTURE_2D,
+ 0,
PIPE_BIND_DEPTH_STENCIL, 0);
ms->ds_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
+ 0,
PIPE_BIND_DEPTH_STENCIL, 0);
return DRI2ScreenInit(pScreen, &dri2info);
XORG_FALLBACK("not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
XORG_FALLBACK("format %s", util_format_name(priv->tex->format));
}
XORG_FALLBACK("alu not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));
if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
- src_priv->tex->target,
+ src_priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));
exa->copy.src = src_priv;
exa->copy.dst = priv;
- /* For same-surface copies, the pipe->surface_copy path is clearly
- * superior, providing it is implemented. In other cases it's not
- * clear what the better path would be, and eventually we'd
- * probably want to gather timings and choose dynamically.
+ /* XXX this used to use resource_copy_region for same-surface copies,
+ * but they were redefined to not allow overlaps (some of the util code
+ * always assumed this anyway).
+ * Drivers should implement accelerated resource_copy_region or it will
+ * be slow - disable for now.
*/
- if (exa->pipe->surface_copy &&
- exa->copy.src == exa->copy.dst) {
-
+ if (0 && exa->copy.src != exa->copy.dst) {
exa->copy.use_surface_copy = TRUE;
-
- exa->copy.src_surface =
- exa->scrn->get_tex_surface( exa->scrn,
- exa->copy.src->tex,
- 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE);
-
- exa->copy.dst_surface =
- exa->scrn->get_tex_surface( exa->scrn,
- exa->copy.dst->tex,
- 0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION );
}
else {
exa->copy.use_surface_copy = FALSE;
exa->scrn->get_tex_surface(exa->scrn,
exa->copy.dst->tex,
0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION);
+ PIPE_BIND_RENDER_TARGET);
renderer_copy_prepare(exa->renderer,
(void) priv;
if (exa->copy.use_surface_copy) {
- /* XXX: consider exposing >1 box in surface_copy interface.
- */
- exa->pipe->surface_copy( exa->pipe,
- exa->copy.dst_surface,
- dstX, dstY,
- exa->copy.src_surface,
- srcX, srcY,
- width, height );
+ struct pipe_subresource subdst, subsrc;
+ subdst.face = 0;
+ subdst.level = 0;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ exa->pipe->resource_copy_region( exa->pipe,
+ exa->copy.dst->tex,
+ subdst,
+ dstX, dstY, 0,
+ exa->copy.src->tex,
+ subsrc,
+ srcX, srcY, 0,
+ width, height );
}
else {
renderer_copy_pixmap(exa->renderer,
exa->copy.src = NULL;
exa->copy.dst = NULL;
- pipe_surface_reference(&exa->copy.src_surface, NULL);
pipe_surface_reference(&exa->copy.dst_surface, NULL);
pipe_resource_reference(&exa->copy.src_texture, NULL);
}
XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format));
XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format));
XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format));
texture = exa->scrn->resource_create(exa->scrn, &template);
if (priv->tex) {
- struct pipe_surface *dst_surf;
+ struct pipe_subresource subdst, subsrc;
struct pipe_surface *src_surf;
- dst_surf = exa->scrn->get_tex_surface(
- exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION);
- src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
- if (exa->pipe->surface_copy) {
- exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width0),
- min(height, texture->height0));
- } else {
- util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width0),
- min(height, texture->height0));
- }
- exa->scrn->tex_surface_destroy(dst_surf);
- exa->scrn->tex_surface_destroy(src_surf);
+ subdst.face = 0;
+ subdst.level = 0;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ exa->pipe->resource_copy_region(exa->pipe, texture,
+ subdst, 0, 0, 0,
+ priv->tex,
+ subsrc, 0, 0, 0,
+ min(width, texture->width0),
+ min(height, texture->height0));
}
pipe_resource_reference(&priv->tex, texture);
renderer_destroy(exa->renderer);
+ xorg_exa_finish(exa);
+
if (exa->pipe)
exa->pipe->destroy(exa->pipe);
exa->pipe = NULL;
struct pipe_surface *
xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
{
-
- /* seems to get called both for blits and render target usage */
return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION |
PIPE_BIND_RENDER_TARGET);
}
#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
#include "util/u_surface.h"
struct xorg_shader shader;
assert(screen->is_format_supported(screen, dst_surface->format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET,
0));
(void) screen;
/* the coming in texture should already have that invariance */
debug_assert(screen->is_format_supported(screen, src->format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0));
format = src->format;
{
/* copy source framebuffer surface into texture */
- struct pipe_surface *ps_read = screen->get_tex_surface(
- screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
- struct pipe_surface *ps_tex = screen->get_tex_surface(
- screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION );
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- } else {
- util_surface_copy(pipe, FALSE,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- }
- pipe_surface_reference(&ps_read, NULL);
- pipe_surface_reference(&ps_tex, NULL);
+ struct pipe_subresource subsrc, subdst;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ subdst.face = 0;
+ subdst.level = 0;
+ pipe->resource_copy_region(pipe,
+ pt, /* dest */
+ subdst,
+ 0, 0, 0, /* destx/y/z */
+ src,
+ subsrc,
+ 0, 0, 0,
+ src->width0, src->height0);
}
return pt;
env = env.Clone()
env.Append(CPPPATH = [
+ '#/src/mapi',
'#/src/mesa',
])
'main/polygon.c',
'main/queryobj.c',
'main/rastpos.c',
- 'main/rbadaptors.c',
'main/readpix.c',
'main/remap.c',
'main/renderbuffer.c',
'state_tracker/st_atom_constbuf.c',
'state_tracker/st_atom_depth.c',
'state_tracker/st_atom_framebuffer.c',
+ 'state_tracker/st_atom_msaa.c',
'state_tracker/st_atom_pixeltransfer.c',
'state_tracker/st_atom_sampler.c',
'state_tracker/st_atom_scissor.c',
'state_tracker/st_cb_readpixels.c',
'state_tracker/st_cb_strings.c',
'state_tracker/st_cb_texture.c',
+ 'state_tracker/st_cb_xformfb.c',
'state_tracker/st_context.c',
'state_tracker/st_debug.c',
'state_tracker/st_draw.c',
slang_sources
)
- glapi_sources = [
- 'glapi/glapi.c',
- 'glapi/glapi_dispatch.c',
- 'glapi/glapi_entrypoint.c',
- 'glapi/glapi_execmem.c',
- 'glapi/glapi_getproc.c',
- 'glapi/glapi_nop.c',
- 'glapi/glthread.c',
- ]
-
#
# Assembly sources
#
'x86/sse_normal.S',
'x86/read_rgba_span_x86.S',
]
- glapi_sources += [
- 'x86/glapi_x86.S',
- ]
elif gcc and env['machine'] == 'x86_64':
env.Append(CPPDEFINES = [
'USE_X86_64_ASM',
'x86-64/x86-64.c',
'x86-64/xform4.S',
]
- glapi_sources += [
- 'x86-64/glapi_x86-64.S'
- ]
elif gcc and env['machine'] == 'ppc':
env.Append(CPPDEFINES = [
'USE_PPC_ASM',
mesa_sources += [
'ppc/common_ppc.c',
]
- glapi_sources += [
- ]
elif gcc and env['machine'] == 'sparc':
mesa_sources += [
'sparc/sparc.c',
'sparc/norm.S',
'sparc/xform.S',
]
- glapi_sources += [
- 'sparc/glapi_sparc.S'
- ]
else:
pass
source = mesa_sources,
)
Export('mesa')
-
- glapi = env.ConvenienceLibrary(
- target = 'glapi',
- source = glapi_sources,
- )
- Export('glapi')
-
### Lists of source files, included by Makefiles
-ES1_SOURCES = \
+# this is part of MAIN_SOURCES
+MAIN_ES_SOURCES = \
main/api_exec_es1.c \
- main/get_es1.c
-
-ES2_SOURCES = \
- main/api_exec_es2.c \
- main/get_es2.c
+ main/api_exec_es2.c
MAIN_SOURCES = \
main/api_arrayelt.c \
main/queryobj.c \
main/querymatrix.c \
main/rastpos.c \
- main/rbadaptors.c \
main/readpix.c \
main/remap.c \
main/renderbuffer.c \
main/version.c \
main/viewport.c \
main/vtxfmt.c \
- $(ES_SOURCES)
-
-GLAPI_SOURCES = \
- glapi/glapi.c \
- glapi/glapi_dispatch.c \
- glapi/glapi_entrypoint.c \
- glapi/glapi_execmem.c \
- glapi/glapi_getproc.c \
- glapi/glapi_nop.c \
- glapi/glthread.c
+ $(MAIN_ES_SOURCES)
MATH_SOURCES = \
math/m_debug_clip.c \
state_tracker/st_atom_constbuf.c \
state_tracker/st_atom_depth.c \
state_tracker/st_atom_framebuffer.c \
+ state_tracker/st_atom_msaa.c \
state_tracker/st_atom_pixeltransfer.c \
state_tracker/st_atom_sampler.c \
state_tracker/st_atom_scissor.c \
state_tracker/st_cb_readpixels.c \
state_tracker/st_cb_strings.c \
state_tracker/st_cb_texture.c \
+ state_tracker/st_cb_xformfb.c \
state_tracker/st_context.c \
state_tracker/st_debug.c \
state_tracker/st_draw.c \
x86/sse_normal.S \
x86/read_rgba_span_x86.S
-X86_API = \
- x86/glapi_x86.S
-
X86-64_SOURCES = \
x86-64/xform4.S
-X86-64_API = \
- x86-64/glapi_x86-64.S
-
SPARC_SOURCES = \
sparc/clip.S \
sparc/norm.S \
sparc/xform.S
-SPARC_API = \
- sparc/glapi_sparc.S
-
COMMON_DRIVER_SOURCES = \
drivers/common/driverfuncs.c \
drivers/common/meta.c
# All the core C sources, for dependency checking
ALL_SOURCES = \
$(MESA_SOURCES) \
- $(GLAPI_SOURCES) \
$(MESA_ASM_SOURCES) \
$(STATETRACKER_SOURCES)
$(MESA_GALLIUM_SOURCES:.c=.o) \
$(MESA_ASM_SOURCES:.S=.o)
-GLAPI_OBJECTS = \
- $(GLAPI_SOURCES:.c=.o) \
- $(GLAPI_ASM_SOURCES:.S=.o)
-
COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o)
INCLUDE_DIRS = \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary
#include "st_context.h"
#include "st_format.h"
#include "st_texture.h"
-#include "st_inlines.h"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
+#include "util/u_inlines.h"
#include "util/u_pack_color.h"
/* find an RGBA texture format */
format = st_choose_format(pipe->screen, GL_RGBA,
- PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
+ PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW);
/* create texture for color map/table */
pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
uint *dest;
uint i, j;
- transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
+ transfer = pipe_get_transfer(st_context(ctx)->pipe,
pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
0, 0, texSize, texSize);
dest = (uint *) pipe_transfer_map(pipe, transfer);
#include "st_program.h"
#include "st_cb_bitmap.h"
#include "st_texture.h"
-#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "cso_cache/cso_context.h"
+#if FEATURE_drawpix
/**
* glBitmaps are drawn as textured quads. The user's bitmap pattern
return NULL;
}
- transfer = st_no_flush_get_tex_transfer(st, pt, 0, 0, 0,
+ transfer = pipe_get_transfer(st->pipe, pt, 0, 0, 0,
PIPE_TRANSFER_WRITE,
0, 0, width, height);
}
/* put vertex data into vbuf */
- st_no_flush_pipe_buffer_write_nooverlap(st,
+ pipe_buffer_write_nooverlap(st->pipe,
st->bitmap.vbuf,
st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
sizeof st->bitmap.vertices,
/* Map the texture transfer.
* Subsequent glBitmap calls will write into the texture image.
*/
- cache->trans = st_no_flush_get_tex_transfer(st, cache->texture, 0, 0, 0,
+ cache->trans = pipe_get_transfer(st->pipe, cache->texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0,
BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT);
st->bitmap.rasterizer.gl_rasterization_rules = 1;
/* find a usable texture format */
- if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D,
+ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM;
}
- else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D,
+ else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM;
}
- else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D,
+ else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM;
}
st->bitmap.cache = NULL;
}
}
+
+#endif /* FEATURE_drawpix */
#if FEATURE_EXT_framebuffer_blit
+
static void
st_BlitFramebuffer(GLcontext *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
&readFB->Attachment[readFB->_ColorReadBufferIndex];
if(srcAtt->Type == GL_TEXTURE) {
- struct pipe_screen *screen = pipe->screen;
struct st_texture_object *srcObj =
st_texture_object(srcAtt->Texture);
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
- struct pipe_surface *srcSurf;
+ struct pipe_subresource srcSub;
struct pipe_surface *dstSurf = dstRb->surface;
if (!srcObj->pt)
return;
- srcSurf = screen->get_tex_surface(screen,
- srcObj->pt,
- srcAtt->CubeMapFace,
- srcAtt->TextureLevel,
- srcAtt->Zoffset,
- PIPE_BIND_BLIT_SOURCE);
- if(!srcSurf)
- return;
+ srcSub.face = srcAtt->CubeMapFace;
+ srcSub.level = srcAtt->TextureLevel;
- util_blit_pixels(st->blit,
- srcSurf, st_get_texture_sampler_view(srcObj, pipe),
- srcX0, srcY0, srcX1, srcY1,
+ util_blit_pixels(st->blit, srcObj->pt, srcSub,
+ srcX0, srcY0, srcX1, srcY1, srcAtt->Zoffset,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
-
- pipe_surface_reference(&srcSurf, NULL);
}
else {
struct st_renderbuffer *srcRb =
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
struct pipe_surface *srcSurf = srcRb->surface;
- struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcRb, pipe);
struct pipe_surface *dstSurf = dstRb->surface;
+ struct pipe_subresource srcSub;
+
+ srcSub.face = srcSurf->face;
+ srcSub.level = srcSurf->level;
util_blit_pixels(st->blit,
- srcSurf, srcView, srcX0, srcY0, srcX1, srcY1,
+ srcRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
+ srcSurf->zslice,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
if ((mask & depthStencil) == depthStencil &&
srcDepthSurf == srcStencilSurf &&
dstDepthSurf == dstStencilSurf) {
- struct pipe_sampler_view *srcView = st_get_renderbuffer_sampler_view(srcDepthRb, pipe);
+ struct pipe_subresource srcSub;
+
+ srcSub.face = srcDepthRb->surface->face;
+ srcSub.level = srcDepthRb->surface->level;
/* Blitting depth and stencil values between combined
* depth/stencil buffers. This is the ideal case for such buffers.
*/
util_blit_pixels(st->blit,
- srcDepthSurf, srcView, srcX0, srcY0, srcX1, srcY1,
+ srcDepthRb->texture, srcSub, srcX0, srcY0, srcX1, srcY1,
+ srcDepthRb->surface->zslice,
dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
}
}
}
-#endif /* FEATURE_EXT_framebuffer_blit */
-
void
st_init_blit_functions(struct dd_function_table *functions)
{
-#if FEATURE_EXT_framebuffer_blit
functions->BlitFramebuffer = st_BlitFramebuffer;
-#endif
}
+
+#endif /* FEATURE_EXT_framebuffer_blit */
#include "main/arrayobj.h"
#include "main/bufferobj.h"
-#include "st_inlines.h"
#include "st_context.h"
#include "st_cb_bufferobjects.h"
switch(target) {
case GL_PIXEL_PACK_BUFFER_ARB:
case GL_PIXEL_UNPACK_BUFFER_ARB:
- buffer_usage = (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION);
+ buffer_usage = PIPE_BIND_RENDER_TARGET;
break;
case GL_ARRAY_BUFFER_ARB:
buffer_usage = PIPE_BIND_VERTEX_BUFFER;
}
if (data)
- st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0,
+ pipe_buffer_write(st_context(ctx)->pipe, st_obj->buffer, 0,
size, data);
return GL_TRUE;
}
#include "st_cb_fbo.h"
#include "st_format.h"
#include "st_texture.h"
-#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "cso_cache/cso_context.h"
+#if FEATURE_drawpix
+
/**
* Check if the given program is:
* 0: MOVE result.color, fragment.color;
/* we'll do pixel transfer in a fragment shader */
ctx->_ImageTransferState = 0x0;
- transfer = st_no_flush_get_tex_transfer(st, pt, 0, 0, 0,
+ transfer = pipe_get_transfer(st->pipe, pt, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0,
width, height);
buf = pipe_buffer_create(pipe->screen,
PIPE_BIND_VERTEX_BUFFER,
sizeof(verts));
- st_no_flush_pipe_buffer_write(st, buf, 0, sizeof(verts), verts);
+ pipe_buffer_write(st->pipe, buf, 0, sizeof(verts), verts);
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_QUADS,
else
usage = PIPE_TRANSFER_WRITE;
- pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, 0, 0, 0,
+ pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, 0, 0, 0,
usage, x, y,
width, height);
dsty = rbDraw->Base.Height - dsty - height;
}
- ptDraw = st_cond_flush_get_tex_transfer(st_context(ctx),
+ ptDraw = pipe_get_transfer(st_context(ctx)->pipe,
rbDraw->texture, 0, 0, 0,
usage, dstx, dsty,
width, height);
enum pipe_format srcFormat, texFormat;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
+ GLuint sample_count;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
st_validate_state(st);
if (type == GL_STENCIL) {
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
}
+ sample_count = rbRead->texture->nr_samples;
+ /* I believe this would be legal, presumably would need to do a resolve
+ for color, and for depth/stencil spec says to just use one of the
+ depth/stencil samples per pixel? Need some transfer clarifications. */
+ assert(sample_count < 2);
+
srcFormat = rbRead->texture->format;
- if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D,
+ if (screen->is_format_supported(screen, srcFormat, PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_SAMPLER_VIEW, 0)) {
texFormat = srcFormat;
}
/* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) {
texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_DEPTH_STENCIL);
assert(texFormat != PIPE_FORMAT_NONE);
}
else {
/* default color format */
texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D,
- PIPE_BIND_SAMPLER_VIEW);
+ sample_count, PIPE_BIND_SAMPLER_VIEW);
assert(texFormat != PIPE_FORMAT_NONE);
}
}
/* Make temporary texture which is a copy of the src region.
*/
if (srcFormat == texFormat) {
+ struct pipe_subresource srcsub, dstsub;
+ srcsub.face = 0;
+ srcsub.level = 0;
+ dstsub.face = 0;
+ dstsub.level = 0;
/* copy source framebuffer surface into mipmap/texture */
- struct pipe_surface *psRead = screen->get_tex_surface(screen,
- rbRead->texture, 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE);
- struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0,
- PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_DESTINATION);
- pipe->surface_copy(pipe,
- psTex, /* dest surf */
- pack.SkipPixels, pack.SkipRows, /* dest pos */
- psRead, /* src surf */
- readX, readY, readW, readH); /* src region */
-
- if (0) {
- /* debug */
- debug_dump_surface(pipe, "copypixsrcsurf", psRead);
- debug_dump_surface(pipe, "copypixtemptex", psTex);
- }
+ pipe->resource_copy_region(pipe,
+ pt, /* dest tex */
+ dstsub,
+ pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
+ rbRead->texture, /* src tex */
+ srcsub,
+ readX, readY, 0, readW, readH); /* src region */
- pipe_surface_reference(&psRead, NULL);
- pipe_surface_reference(&psTex, NULL);
}
else {
/* CPU-based fallback/conversion */
struct pipe_transfer *ptRead =
- st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0,
+ pipe_get_transfer(st->pipe, rbRead->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
readX, readY, readW, readH);
struct pipe_transfer *ptTex;
else
transfer_usage = PIPE_TRANSFER_WRITE;
- ptTex = st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, transfer_usage,
+ ptTex = pipe_get_transfer(st->pipe, pt, 0, 0, 0, transfer_usage,
0, 0, width, height);
/* copy image from ptRead surface to ptTex surface */
st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
if (st->drawpix.vert_shaders[0])
- free(st->drawpix.vert_shaders[0]);
+ ureg_free_tokens(st->drawpix.vert_shaders[0]);
if (st->drawpix.vert_shaders[1])
- free(st->drawpix.vert_shaders[1]);
+ ureg_free_tokens(st->drawpix.vert_shaders[1]);
}
+
+#endif /* FEATURE_drawpix */
struct pipe_surface *ps;
unsigned usage;
- usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_BLIT_SOURCE | PIPE_BIND_BLIT_DESTINATION;
+ usage = PIPE_BIND_RENDER_TARGET;
ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
if (ps) {
strb->Base.Width = ps->width;
/* FIXME create a non-default sampler view from the pipe_surface? */
pipe_resource_reference(&stImage->pt, ps->texture);
+ stObj->width0 = ps->width;
+ stObj->height0 = ps->height;
+ stObj->depth0 = 1;
+
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
struct pipe_surface *ps;
unsigned usage;
- usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_BLIT_DESTINATION | PIPE_BIND_BLIT_SOURCE;
+ usage = PIPE_BIND_SAMPLER_VIEW;
ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
if (ps) {
st_bind_surface(ctx, target, texObj, texImage, ps);
#include "state_tracker/st_debug.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_cb_fbo.h"
+#include "state_tracker/st_cb_flush.h"
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_format.h"
#include "state_tracker/st_texture.h"
#include "state_tracker/st_gen_mipmap.h"
-#include "state_tracker/st_inlines.h"
#include "state_tracker/st_atom.h"
#include "pipe/p_context.h"
else
bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
- if (screen->is_format_supported(screen, format, target, bindings, geom))
+ if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
return bindings;
else
return PIPE_BIND_SAMPLER_VIEW;
*
* We use the given st_texture_image as a clue to determine the size of the
* mipmap image at level=0.
+ *
+ * \return GL_TRUE for success, GL_FALSE if out of memory.
*/
-static void
+static GLboolean
guess_and_alloc_texture(struct st_context *st,
struct st_texture_object *stObj,
const struct st_texture_image *stImage)
(dims >= 3 && depth == 1) ) {
/* we can't determine the image size at level=0 */
stObj->width0 = stObj->height0 = stObj->depth0 = 0;
- return;
+ /* this is not an out of memory error */
+ return GL_TRUE;
}
}
depth,
bindings);
- DBG("%s - success\n", __FUNCTION__);
+ DBG("%s returning %d\n", __FUNCTION__, (stObj->pt != NULL));
+
+ return stObj->pt != NULL;
}
/* get destination surface (in the compressed texture) */
dst_surface = screen->get_tex_surface(screen, stImage->pt,
stImage->face, stImage->level, 0,
- PIPE_BIND_BLIT_DESTINATION);
+ 0 /* flags */);
if (!dst_surface) {
/* can't render into this format (or other problem) */
return GL_FALSE;
/* Put user's tex data into the temporary texture
*/
- tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex,
+ tex_xfer = pipe_get_transfer(st_context(ctx)->pipe, src_tex,
0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
}
if (!stObj->pt) {
- guess_and_alloc_texture(st, stObj, stImage);
- if (!stObj->pt) {
+ if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
* Try flushing any pending rendering, then retry.
*/
st_finish(st);
- guess_and_alloc_texture(st, stObj, stImage);
- if (!stObj->pt) {
+ if (!guess_and_alloc_texture(st, stObj, stImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
return;
}
_mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
- stImage->pt->target,
+ stImage->pt->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
if (!pixels)
goto done;
struct pipe_surface *dst_surface;
struct pipe_resource *dst_texture;
struct pipe_transfer *tex_xfer;
- unsigned bind = (PIPE_BIND_BLIT_DESTINATION |
- PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
+ unsigned bind = (PIPE_BIND_RENDER_TARGET | /* util_blit may choose to render */
PIPE_BIND_TRANSFER_READ);
/* create temp / dest surface */
PIPE_TEX_MIPFILTER_NEAREST);
/* map the dst_surface so we can read from it */
- tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx),
+ tex_xfer = pipe_get_transfer(st_context(ctx)->pipe,
dst_texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0, width, height);
/* Image is stored in hardware format in a buffer managed by the
* kernel. Need to explicitly map and unmap it.
*/
- unsigned face = _mesa_tex_target_to_face(target);
-
- st_teximage_flush_before_map(st, stImage->pt, face, level,
- PIPE_TRANSFER_READ);
-
texImage->Data = st_texture_image_map(st, stImage, 0,
PIPE_TRANSFER_READ, 0, 0,
stImage->base.Width,
_mesa_is_format_compressed(texImage->TexFormat) &&
screen->is_format_supported(screen,
stImage->pt->format,
- stImage->pt->target,
+ stImage->pt->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
if (compress_with_blit(ctx, target, level,
xoffset, yoffset, zoffset,
* from uploading the buffer under us.
*/
if (stImage->pt) {
- unsigned face = _mesa_tex_target_to_face(target);
-
if (format == GL_DEPTH_COMPONENT &&
util_format_is_depth_and_stencil(stImage->pt->format))
transfer_usage = PIPE_TRANSFER_READ_WRITE;
else
transfer_usage = PIPE_TRANSFER_WRITE;
- st_teximage_flush_before_map(st, stImage->pt, face, level,
- transfer_usage);
texImage->Data = st_texture_image_map(st, stImage, zoffset,
transfer_usage,
xoffset, yoffset,
enum pipe_format pformat;
if (stImage->pt) {
- unsigned face = _mesa_tex_target_to_face(target);
pformat = stImage->pt->format;
- st_teximage_flush_before_map(st, stImage->pt, face, level,
- PIPE_TRANSFER_WRITE);
texImage->Data = st_texture_image_map(st, stImage, 0,
PIPE_TRANSFER_WRITE,
xoffset, yoffset,
srcY = strb->Base.Height - srcY - height;
}
- src_trans = st_cond_flush_get_tex_transfer( st_context(ctx),
+ src_trans = pipe_get_transfer(st_context(ctx)->pipe,
strb->texture,
0, 0, 0,
PIPE_TRANSFER_READ,
else
transfer_usage = PIPE_TRANSFER_WRITE;
- st_teximage_flush_before_map(st, stImage->pt, 0, 0,
- transfer_usage);
-
texDest = st_texture_image_map(st, stImage, 0, transfer_usage,
destX, destY, width, height);
enum pipe_format dest_format, src_format;
GLboolean use_fallback = GL_TRUE;
GLboolean matching_base_formats;
- GLuint format_writemask;
+ GLuint format_writemask, sample_count;
struct pipe_surface *dest_surface = NULL;
GLboolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
- /* any rendering in progress must flushed before we grab the fb image */
- st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
/* make sure finalize_textures has been called?
*/
if (0) st_validate_state(st);
return;
}
+ sample_count = strb->surface->texture->nr_samples;
+ /* I believe this would be legal, presumably would need to do a resolve
+ for color, and for depth/stencil spec says to just use one of the
+ depth/stencil samples per pixel? Need some transfer clarifications. */
+ assert(sample_count < 2);
+
if (srcX < 0) {
width -= -srcX;
destX += -srcX;
!do_flip)
{
/* use surface_copy() / blit */
-
- dest_surface = screen->get_tex_surface(screen, stImage->pt,
- stImage->face, stImage->level,
- destZ,
- PIPE_BIND_BLIT_DESTINATION);
-
- /* for surface_copy(), y=0=top, always */
- pipe->surface_copy(pipe,
- /* dest */
- dest_surface,
- destX, destY,
- /* src */
- strb->surface,
- srcX, srcY,
- /* size */
- width, height);
+ struct pipe_subresource subdst, subsrc;
+ subdst.face = stImage->face;
+ subdst.level = stImage->level;
+ subsrc.face = strb->surface->face;
+ subsrc.level = strb->surface->level;
+
+ /* for resource_copy_region(), y=0=top, always */
+ pipe->resource_copy_region(pipe,
+ /* dest */
+ stImage->pt,
+ subdst,
+ destX, destY, destZ,
+ /* src */
+ strb->texture,
+ subsrc,
+ srcX, srcY, strb->surface->zslice,
+ /* size */
+ width, height);
use_fallback = GL_FALSE;
}
else if (format_writemask &&
texBaseFormat != GL_DEPTH_COMPONENT &&
texBaseFormat != GL_DEPTH_STENCIL &&
screen->is_format_supported(screen, src_format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, sample_count,
PIPE_BIND_SAMPLER_VIEW,
0) &&
screen->is_format_supported(screen, dest_format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET,
0)) {
/* draw textured quad to do the copy */
GLint srcY0, srcY1;
+ struct pipe_subresource subsrc;
dest_surface = screen->get_tex_surface(screen, stImage->pt,
stImage->face, stImage->level,
destZ,
- PIPE_BIND_BLIT_DESTINATION);
+ PIPE_BIND_RENDER_TARGET);
if (do_flip) {
srcY1 = strb->Base.Height - srcY - height;
srcY0 = srcY;
srcY1 = srcY0 + height;
}
+ subsrc.face = strb->surface->face;
+ subsrc.level = strb->surface->level;
+
util_blit_pixels_writemask(st->blit,
- strb->surface,
- st_get_renderbuffer_sampler_view(strb, pipe),
+ strb->texture,
+ subsrc,
srcX, srcY0,
srcX + width, srcY1,
+ strb->surface->zslice,
dest_surface,
destX, destY,
destX + width, destY + height,
*/
st_texture_image_copy(st->pipe,
stObj->pt, dstLevel, /* dest texture, level */
- stImage->pt, /* src texture */
+ stImage->pt, stImage->level, /* src texture, level */
stImage->face);
pipe_resource_reference(&stImage->pt, NULL);
}
else if (stImage->base.Data) {
- /* More straightforward upload.
- */
- st_teximage_flush_before_map(st, stObj->pt, stImage->face, dstLevel,
- PIPE_TRANSFER_WRITE);
-
st_texture_image_data(st,
stObj->pt,
stImage->face,
*/
for (face = 0; face < nr_faces; face++) {
GLuint level;
- for (level = 0; level <= stObj->lastLevel; level++) {
+ for (level = stObj->base.BaseLevel; level <= stObj->lastLevel; level++) {
struct st_texture_image *stImage =
st_texture_image(stObj->base.Image[face][level]);
#include "st_cb_bufferobjects.h"
#include "st_cb_clear.h"
#include "st_cb_condrender.h"
-#if FEATURE_drawpix
#include "st_cb_drawpixels.h"
#include "st_cb_rasterpos.h"
-#endif
-#if FEATURE_OES_draw_texture
#include "st_cb_drawtex.h"
-#endif
#include "st_cb_eglimage.h"
#include "st_cb_fbo.h"
-#if FEATURE_feedback
#include "st_cb_feedback.h"
-#endif
#include "st_cb_program.h"
#include "st_cb_queryobj.h"
#include "st_cb_readpixels.h"
#include "st_cb_texture.h"
+#include "st_cb_xformfb.h"
#include "st_cb_flush.h"
#include "st_cb_strings.h"
#include "st_atom.h"
#include "util/u_inlines.h"
#include "util/u_rect.h"
#include "util/u_surface.h"
-#include "draw/draw_context.h"
#include "cso_cache/cso_context.h"
}
- /** Default method for pipe_context::surface_copy() */
- static void
- st_surface_copy(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned dst_x, unsigned dst_y,
- struct pipe_surface *src,
- unsigned src_x, unsigned src_y,
- unsigned w, unsigned h)
- {
- util_surface_copy(pipe, FALSE, dst, dst_x, dst_y, src, src_x, src_y, w, h);
- }
-
-
static struct st_context *
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
{
/* state tracker needs the VBO module */
_vbo_CreateContext(ctx);
-#if FEATURE_feedback || FEATURE_drawpix
- st->draw = draw_create(pipe); /* for selection/feedback */
-
- /* Disable draw options that might convert points/lines to tris, etc.
- * as that would foul-up feedback/selection mode.
- */
- draw_wide_line_threshold(st->draw, 1000.0f);
- draw_wide_point_threshold(st->draw, 1000.0f);
- draw_enable_line_stipple(st->draw, FALSE);
- draw_enable_point_sprites(st->draw, FALSE);
-#endif
-
st->dirty.mesa = ~0;
st->dirty.st = ~0;
st_init_limits(st);
st_init_extensions(st);
- /* plug in helper driver functions if needed */
- if (!pipe->surface_copy)
- pipe->surface_copy = st_surface_copy;
-
return st;
}
{
uint i;
-#if FEATURE_feedback || FEATURE_drawpix
- draw_destroy(st->draw);
-#endif
st_destroy_atoms( st );
st_destroy_draw( st );
st_destroy_generate_mipmap(st);
-#if FEATURE_EXT_framebuffer_blit
st_destroy_blit(st);
-#endif
st_destroy_clear(st);
-#if FEATURE_drawpix
st_destroy_bitmap(st);
st_destroy_drawpix(st);
-#endif
-#if FEATURE_OES_draw_texture
st_destroy_drawtex(st);
-#endif
for (i = 0; i < Elements(st->state.sampler_views); i++) {
pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
{
_mesa_init_glsl_driver_functions(functions);
-#if FEATURE_accum
st_init_accum_functions(functions);
-#endif
-#if FEATURE_EXT_framebuffer_blit
st_init_blit_functions(functions);
-#endif
st_init_bufferobject_functions(functions);
st_init_clear_functions(functions);
-#if FEATURE_drawpix
st_init_bitmap_functions(functions);
st_init_drawpixels_functions(functions);
st_init_rasterpos_functions(functions);
-#endif
-#if FEATURE_OES_draw_texture
st_init_drawtex_functions(functions);
-#endif
st_init_eglimage_functions(functions);
st_init_fbo_functions(functions);
-#if FEATURE_feedback
st_init_feedback_functions(functions);
-#endif
st_init_program_functions(functions);
-#if FEATURE_queryobj
st_init_query_functions(functions);
-#endif
st_init_cond_render_functions(functions);
st_init_readpixels_functions(functions);
st_init_texture_functions(functions);
st_init_flush_functions(functions);
st_init_string_functions(functions);
+ st_init_xformfb_functions(functions);
+
functions->UpdateState = st_invalidate_state;
}
{
struct pipe_screen *screen = st->pipe->screen;
struct gl_constants *c = &st->ctx->Const;
+ struct gl_program_constants *pc;
c->MaxTextureLevels
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
/* Quads always follow GL provoking rules. */
c->QuadsFollowProvokingVertexConvention = GL_FALSE;
+
+ pc = &c->FragmentProgram;
+ pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_INSTRUCTIONS);
+ pc->MaxNativeAluInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS);
+ pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS);
+ pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INDIRECTIONS);
+ pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS);
+ pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_FS_TEMPS);
+ pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_FS_ADDRS);
+ pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_FS_CONSTS);
+
+ pc = &c->VertexProgram;
+ pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_INSTRUCTIONS);
+ pc->MaxNativeAluInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS);
+ pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS);
+ pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INDIRECTIONS);
+ pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_VS_INPUTS);
+ pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_VS_TEMPS);
+ pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_VS_ADDRS);
+ pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_VS_CONSTS);
}
if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) {
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
}
+ if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) {
+ ctx->Extensions.EXT_timer_query = GL_TRUE;
+ }
if (screen->get_param(screen, PIPE_CAP_TEXTURE_SHADOW_MAP)) {
ctx->Extensions.ARB_depth_texture = GL_TRUE;
* a depth/stencil buffer and texture from depth/stencil source.
*/
if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0) &&
screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
}
else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_DEPTH_STENCIL, 0) &&
screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
}
/* sRGB support */
if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0) ||
screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
}
/* s3tc support */
if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0) &&
(ctx->Mesa_DXTn ||
screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET, 0))) {
ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
ctx->Extensions.S3_s3tc = GL_TRUE;
/* ycbcr support */
if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0) ||
screen->is_format_supported(screen, PIPE_FORMAT_YUYV,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0)) {
ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
}
#include "st_debug.h"
#include "st_context.h"
+#include "st_texture.h"
#include "st_gen_mipmap.h"
#include "st_cb_texture.h"
-#include "st_inlines.h"
/**
struct pipe_sampler_view *psv = st_get_texture_sampler_view(stObj, pipe);
const uint face = _mesa_tex_target_to_face(target);
+ assert(psv->texture == stObj->pt);
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
+ if (!screen->is_format_supported(screen, psv->format, psv->texture->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
return FALSE;
}
unsigned width, unsigned height)
{
const struct util_format_description *desc = util_format_description(format);
- const uint dst_stride = 4 * width;
+ const uint bw = util_format_get_blockwidth(format);
+ const uint bh = util_format_get_blockheight(format);
+ const uint dst_stride = 4 * MAX2(width, bw);
const uint src_stride = util_format_get_stride(format, width);
desc->unpack_rgba_8unorm(dst, dst_stride, src, src_stride, width, height);
+
+ if (width < bw || height < bh) {
+ /* We're decompressing an image smaller than the compression
+ * block size. We don't want garbage pixel values in the region
+ * outside (width x height) so replicate pixels from the (width
+ * x height) region to fill out the (bw x bh) block size.
+ */
+ uint x, y;
+ for (y = 0; y < bh; y++) {
+ for (x = 0; x < bw; x++) {
+ if (x >= width || y >= height) {
+ uint p = (y * bw + x) * 4;
+ dst[p + 0] = dst[0];
+ dst[p + 1] = dst[1];
+ dst[p + 2] = dst[2];
+ dst[p + 3] = dst[3];
+ }
+ }
+ }
+ }
}
ubyte *dstData;
int srcStride, dstStride;
- srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
+ srcTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, face,
srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
srcWidth, srcHeight);
- dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
+ dstTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, face,
dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
dstWidth, dstHeight);
dstWidth2); /* stride in texels */
/* compress the new image: dstTemp -> dstData */
- compress_image(format, dstTemp, dstData, dstWidth2, dstHeight2);
+ compress_image(format, dstTemp, dstData, dstWidth, dstHeight);
free(srcTemp);
free(dstTemp);
return 1;
}
else {
- const GLuint maxLevels = texObj->MaxLevel - texObj->BaseLevel + 1;
const struct gl_texture_image *baseImage =
_mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
GLuint size, numLevels;
size = MAX2(baseImage->Width2, baseImage->Height2);
size = MAX2(size, baseImage->Depth2);
- numLevels = 0;
+ numLevels = texObj->BaseLevel;
while (size > 0) {
numLevels++;
size >>= 1;
}
- numLevels = MIN2(numLevels, maxLevels);
+ numLevels = MIN2(numLevels, texObj->MaxLevel + 1);
+
+ assert(numLevels >= 1);
return numLevels;
}
if (!pt)
return;
- /* find expected last mipmap level to generate */
+ /* not sure if this ultimately actually should work,
+ but we're not supporting multisampled textures yet. */
+ assert(pt->nr_samples < 2);
+
- /* find expected last mipmap level */
++ /* find expected last mipmap level to generate*/
lastLevel = compute_num_levels(ctx, texObj, target) - 1;
if (lastLevel == 0)
pt = stObj->pt;
}
- assert(lastLevel <= pt->last_level);
+ assert(pt->last_level >= lastLevel);
/* Try to generate the mipmap by rendering/texturing. If that fails,
* use the software fallback.
#include "st_format.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
-#include "st_inlines.h"
#include "main/enums.h"
#undef Elements /* fix re-defined macro warning */
struct pipe_screen *screen = st->pipe->screen;
assert(target <= PIPE_TEXTURE_CUBE);
+ assert(width0 > 0);
+ assert(height0 > 0);
+ assert(depth0 > 0);
DBG("%s target %s format %s last_level %d\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
_mesa_lookup_enum_by_nr(format), last_level);
assert(format);
- assert(screen->is_format_supported(screen, format, target,
+ assert(screen->is_format_supported(screen, format, target, 0,
PIPE_BIND_SAMPLER_VIEW, 0));
memset(&pt, 0, sizeof(pt));
DBG("%s \n", __FUNCTION__);
- stImage->transfer = st_no_flush_get_tex_transfer(st, pt, stImage->face,
+ stImage->transfer = pipe_get_transfer(st->pipe, pt, stImage->face,
stImage->level, zoffset,
usage, x, y, w, h);
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
- dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
+ dst_transfer = pipe_get_transfer(st->pipe, dst, face, level, i,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(dst->width0, level),
u_minify(dst->height0, level));
}
-/* Copy mipmap image between textures
+/**
+ * For debug only: get/print center pixel in the src resource.
+ */
+static void
+print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
+{
+ struct pipe_subresource rect;
+ struct pipe_transfer *xfer;
+ struct pipe_box region;
+ ubyte *map;
+
+ rect.face = 0;
+ rect.level = 0;
+
+ region.x = src->width0 / 2;
+ region.y = src->height0 / 2;
+ region.z = 0;
+ region.width = 1;
+ region.height = 1;
+ region.depth = 1;
+
+ xfer = pipe->get_transfer(pipe, src, rect, PIPE_TRANSFER_READ, ®ion);
+ map = pipe->transfer_map(pipe, xfer);
+
+ printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]);
+
+ pipe->transfer_unmap(pipe, xfer);
+ pipe->transfer_destroy(pipe, xfer);
+}
+
+
+/**
+ * Copy the image at level=0 in 'src' to the 'dst' resource at 'dstLevel'.
+ * This is used to copy mipmap images from one texture buffer to another.
+ * This typically happens when our initial guess at the total texture size
+ * is incorrect (see the guess_and_alloc_texture() function).
*/
void
st_texture_image_copy(struct pipe_context *pipe,
struct pipe_resource *dst, GLuint dstLevel,
- struct pipe_resource *src,
+ struct pipe_resource *src, GLuint srcLevel,
GLuint face)
{
- struct pipe_screen *screen = pipe->screen;
GLuint width = u_minify(dst->width0, dstLevel);
GLuint height = u_minify(dst->height0, dstLevel);
GLuint depth = u_minify(dst->depth0, dstLevel);
- struct pipe_surface *src_surface;
- struct pipe_surface *dst_surface;
+ struct pipe_subresource dstsub, srcsub;
GLuint i;
- assert(src->width0 == dst->width0);
- assert(src->height0 == dst->height0);
+ assert(u_minify(src->width0, srcLevel) == width);
+ assert(u_minify(src->height0, srcLevel) == height);
+ assert(u_minify(src->depth0, srcLevel) == depth);
-
+ dstsub.face = face;
+ dstsub.level = dstLevel;
+ srcsub.face = face;
++ srcsub.level = srcLevel;
+ /* Loop over 3D image slices */
for (i = 0; i < depth; i++) {
- GLuint srcLevel;
-
- /* find src texture level of needed size */
- for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) {
- if (u_minify(src->width0, srcLevel) == width &&
- u_minify(src->height0, srcLevel) == height) {
- break;
- }
- }
- assert(u_minify(src->width0, srcLevel) == width);
- assert(u_minify(src->height0, srcLevel) == height);
-
-#if 0
- {
- struct pipe_screen *screen = pipe->screen;
- src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
- PIPE_BUFFER_USAGE_CPU_READ);
- ubyte *map = screen->surface_map(screen, src_surface, PIPE_BUFFER_USAGE_CPU_READ);
- map += src_surface->width * src_surface->height * 4 / 2;
- printf("%s center pixel: %d %d %d %d (pt %p[%d] -> %p[%d])\n",
- __FUNCTION__,
- map[0], map[1], map[2], map[3],
- src, srcLevel, dst, dstLevel);
-
- screen->surface_unmap(screen, src_surface);
- pipe_surface_reference(&src_surface, NULL);
+
+ if (0) {
+ print_center_pixel(pipe, src);
}
-#endif
- srcsub.level = srcLevel;
- dst_surface = screen->get_tex_surface(screen, dst, face, dstLevel, i,
- PIPE_BIND_BLIT_DESTINATION);
-
- src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
- PIPE_BIND_BLIT_SOURCE);
-
- pipe->surface_copy(pipe,
- dst_surface,
- 0, 0, /* destX, Y */
- src_surface,
- 0, 0, /* srcX, Y */
- width, height);
-
- pipe_surface_reference(&src_surface, NULL);
- pipe_surface_reference(&dst_surface, NULL);
+ pipe->resource_copy_region(pipe,
+ dst,
+ dstsub,
+ 0, 0, i,/* destX, Y, Z */
+ src,
+ srcsub,
+ 0, 0, i,/* srcX, Y, Z */
+ width, height);
}
}
-
-void
-st_teximage_flush_before_map(struct st_context *st,
- struct pipe_resource *pt,
- unsigned int face,
- unsigned int level,
- enum pipe_transfer_usage usage)
-{
- struct pipe_context *pipe = st->pipe;
- unsigned referenced =
- pipe->is_resource_referenced(pipe, pt, face, level);
-
- if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- (usage & PIPE_TRANSFER_WRITE)))
- st->pipe->flush(st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-}