2010-07-24 20:32:53 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
|
|
|
|
* Copyright 2010 Marek Olšák <maraeo@gmail.com>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
* the Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
|
|
|
|
#include "r300_texture_desc.h"
|
|
|
|
#include "r300_context.h"
|
|
|
|
|
2019-06-27 23:05:31 +01:00
|
|
|
#include "util/format/u_format.h"
|
2016-04-10 15:37:33 +01:00
|
|
|
#include <inttypes.h>
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
/* Returns the number of pixels that the texture should be aligned to
|
|
|
|
* in the given dimension. */
|
|
|
|
unsigned r300_get_pixel_alignment(enum pipe_format format,
|
|
|
|
unsigned num_samples,
|
2011-04-18 01:39:50 +01:00
|
|
|
enum radeon_bo_layout microtile,
|
|
|
|
enum radeon_bo_layout macrotile,
|
2010-12-10 05:40:48 +00:00
|
|
|
enum r300_dim dim, boolean is_rs690)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
|
|
|
static const unsigned table[2][5][3][2] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Macro: linear linear linear
|
|
|
|
Micro: linear tiled square-tiled */
|
|
|
|
{{ 32, 1}, { 8, 4}, { 0, 0}}, /* 8 bits per pixel */
|
|
|
|
{{ 16, 1}, { 8, 2}, { 4, 4}}, /* 16 bits per pixel */
|
|
|
|
{{ 8, 1}, { 4, 2}, { 0, 0}}, /* 32 bits per pixel */
|
2010-10-04 20:19:27 +01:00
|
|
|
{{ 4, 1}, { 2, 2}, { 0, 0}}, /* 64 bits per pixel */
|
2010-07-24 20:32:53 +01:00
|
|
|
{{ 2, 1}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
|
|
|
|
},
|
|
|
|
{
|
|
|
|
/* Macro: tiled tiled tiled
|
|
|
|
Micro: linear tiled square-tiled */
|
|
|
|
{{256, 8}, {64, 32}, { 0, 0}}, /* 8 bits per pixel */
|
|
|
|
{{128, 8}, {64, 16}, {32, 32}}, /* 16 bits per pixel */
|
|
|
|
{{ 64, 8}, {32, 16}, { 0, 0}}, /* 32 bits per pixel */
|
2010-10-04 20:19:27 +01:00
|
|
|
{{ 32, 8}, {16, 16}, { 0, 0}}, /* 64 bits per pixel */
|
2010-07-24 20:32:53 +01:00
|
|
|
{{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
|
|
|
|
}
|
|
|
|
};
|
2010-12-10 05:40:48 +00:00
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
unsigned tile = 0;
|
|
|
|
unsigned pixsize = util_format_get_blocksize(format);
|
|
|
|
|
2011-04-18 01:39:50 +01:00
|
|
|
assert(macrotile <= RADEON_LAYOUT_TILED);
|
|
|
|
assert(microtile <= RADEON_LAYOUT_SQUARETILED);
|
2010-07-24 20:32:53 +01:00
|
|
|
assert(pixsize <= 16);
|
|
|
|
assert(dim <= DIM_HEIGHT);
|
|
|
|
|
r300g: implement MSAA
This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.
MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.
The supported modes are 2x, 4x, 6x.
The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.
Tested with piglit. (I have ported all MSAA tests to GL2.1)
2013-01-05 05:21:49 +00:00
|
|
|
tile = table[macrotile][util_logbase2(pixsize)][microtile][dim];
|
|
|
|
if (macrotile == 0 && is_rs690 && dim == DIM_WIDTH) {
|
|
|
|
int align;
|
|
|
|
int h_tile;
|
|
|
|
h_tile = table[macrotile][util_logbase2(pixsize)][microtile][DIM_HEIGHT];
|
|
|
|
align = 64 / (pixsize * h_tile);
|
|
|
|
if (tile < align)
|
|
|
|
tile = align;
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
assert(tile);
|
|
|
|
return tile;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return true if macrotiling should be enabled on the miplevel. */
|
2011-02-10 04:36:44 +00:00
|
|
|
static boolean r300_texture_macro_switch(struct r300_resource *tex,
|
2010-07-24 20:32:53 +01:00
|
|
|
unsigned level,
|
|
|
|
boolean rv350_mode,
|
|
|
|
enum r300_dim dim)
|
|
|
|
{
|
|
|
|
unsigned tile, texdim;
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (tex->b.nr_samples > 1) {
|
r300g: implement MSAA
This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.
MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.
The supported modes are 2x, 4x, 6x.
The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.
Tested with piglit. (I have ported all MSAA tests to GL2.1)
2013-01-05 05:21:49 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
tile = r300_get_pixel_alignment(tex->b.format, tex->b.nr_samples,
|
2011-04-18 01:39:50 +01:00
|
|
|
tex->tex.microtile, RADEON_LAYOUT_TILED, dim, 0);
|
2010-07-24 20:32:53 +01:00
|
|
|
if (dim == DIM_WIDTH) {
|
2011-02-10 04:36:44 +00:00
|
|
|
texdim = u_minify(tex->tex.width0, level);
|
2010-07-24 20:32:53 +01:00
|
|
|
} else {
|
2011-02-10 04:36:44 +00:00
|
|
|
texdim = u_minify(tex->tex.height0, level);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* See TX_FILTER1_n.MACRO_SWITCH. */
|
|
|
|
if (rv350_mode) {
|
|
|
|
return texdim >= tile;
|
|
|
|
} else {
|
|
|
|
return texdim > tile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the stride, in bytes, of the texture image of the given texture
|
|
|
|
* at the given level.
|
|
|
|
*/
|
|
|
|
static unsigned r300_texture_get_stride(struct r300_screen *screen,
|
2011-02-10 04:36:44 +00:00
|
|
|
struct r300_resource *tex,
|
2010-07-24 20:32:53 +01:00
|
|
|
unsigned level)
|
|
|
|
{
|
|
|
|
unsigned tile_width, width, stride;
|
2013-01-04 21:34:52 +00:00
|
|
|
boolean is_rs690 = (screen->caps.family == CHIP_RS600 ||
|
|
|
|
screen->caps.family == CHIP_RS690 ||
|
|
|
|
screen->caps.family == CHIP_RS740);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
if (tex->tex.stride_in_bytes_override)
|
|
|
|
return tex->tex.stride_in_bytes_override;
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
/* Check the level. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if (level > tex->b.last_level) {
|
2010-07-24 20:32:53 +01:00
|
|
|
SCREEN_DBG(screen, DBG_TEX, "%s: level (%u) > last_level (%u)\n",
|
2021-05-05 21:21:56 +01:00
|
|
|
__FUNCTION__, level, tex->b.last_level);
|
2010-07-24 20:32:53 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
width = u_minify(tex->tex.width0, level);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (util_format_is_plain(tex->b.format)) {
|
|
|
|
tile_width = r300_get_pixel_alignment(tex->b.format,
|
|
|
|
tex->b.nr_samples,
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.microtile,
|
|
|
|
tex->tex.macrotile[level],
|
2010-12-10 05:40:48 +00:00
|
|
|
DIM_WIDTH, is_rs690);
|
2010-07-24 20:32:53 +01:00
|
|
|
width = align(width, tile_width);
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
stride = util_format_get_stride(tex->b.format, width);
|
2010-07-24 20:32:53 +01:00
|
|
|
/* The alignment to 32 bytes is sort of implied by the layout... */
|
|
|
|
return stride;
|
|
|
|
} else {
|
2021-05-05 21:21:56 +01:00
|
|
|
return align(util_format_get_stride(tex->b.format, width), is_rs690 ? 64 : 32);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
static unsigned r300_texture_get_nblocksy(struct r300_resource *tex,
|
2010-07-24 20:32:53 +01:00
|
|
|
unsigned level,
|
2010-07-25 09:07:12 +01:00
|
|
|
boolean *out_aligned_for_cbzb)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
|
|
|
unsigned height, tile_height;
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
height = u_minify(tex->tex.height0, level);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2011-02-16 19:09:06 +00:00
|
|
|
/* Mipmapped and 3D textures must have their height aligned to POT. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if ((tex->b.target != PIPE_TEXTURE_1D &&
|
|
|
|
tex->b.target != PIPE_TEXTURE_2D &&
|
|
|
|
tex->b.target != PIPE_TEXTURE_RECT) ||
|
|
|
|
tex->b.last_level != 0) {
|
2011-02-16 19:09:06 +00:00
|
|
|
height = util_next_power_of_two(height);
|
|
|
|
}
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (util_format_is_plain(tex->b.format)) {
|
|
|
|
tile_height = r300_get_pixel_alignment(tex->b.format,
|
|
|
|
tex->b.nr_samples,
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.microtile,
|
|
|
|
tex->tex.macrotile[level],
|
2010-12-10 05:40:48 +00:00
|
|
|
DIM_HEIGHT, 0);
|
2010-07-24 20:32:53 +01:00
|
|
|
height = align(height, tile_height);
|
|
|
|
|
2010-07-25 09:07:12 +01:00
|
|
|
/* See if the CBZB clear can be used on the buffer,
|
|
|
|
* taking the texture size into account. */
|
|
|
|
if (out_aligned_for_cbzb) {
|
2011-02-10 04:36:44 +00:00
|
|
|
if (tex->tex.macrotile[level]) {
|
2010-07-25 09:07:12 +01:00
|
|
|
/* When clearing, the layer (width*height) is horizontally split
|
|
|
|
* into two, and the upper and lower halves are cleared by the CB
|
|
|
|
* and ZB units, respectively. Therefore, the number of macrotiles
|
|
|
|
* in the Y direction must be even. */
|
|
|
|
|
|
|
|
/* Align the height so that there is an even number of macrotiles.
|
|
|
|
* Do so for 3 or more macrotiles in the Y direction. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if (level == 0 && tex->b.last_level == 0 &&
|
|
|
|
(tex->b.target == PIPE_TEXTURE_1D ||
|
|
|
|
tex->b.target == PIPE_TEXTURE_2D ||
|
|
|
|
tex->b.target == PIPE_TEXTURE_RECT) &&
|
2010-07-25 09:07:12 +01:00
|
|
|
height >= tile_height * 3) {
|
|
|
|
height = align(height, tile_height * 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
*out_aligned_for_cbzb = height % (tile_height * 2) == 0;
|
|
|
|
} else {
|
|
|
|
*out_aligned_for_cbzb = FALSE;
|
|
|
|
}
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
return util_format_get_nblocksy(tex->b.format, height);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
2010-07-24 21:52:01 +01:00
|
|
|
/* Get a width in pixels from a stride in bytes. */
|
2011-12-29 17:18:38 +00:00
|
|
|
unsigned r300_stride_to_width(enum pipe_format format,
|
|
|
|
unsigned stride_in_bytes)
|
2010-07-24 21:52:01 +01:00
|
|
|
{
|
|
|
|
return (stride_in_bytes / util_format_get_blocksize(format)) *
|
|
|
|
util_format_get_blockwidth(format);
|
|
|
|
}
|
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
static void r300_setup_miptree(struct r300_screen *screen,
|
2011-02-10 04:36:44 +00:00
|
|
|
struct r300_resource *tex,
|
2010-07-25 09:07:12 +01:00
|
|
|
boolean align_for_cbzb)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
2021-05-05 21:21:56 +01:00
|
|
|
struct pipe_resource *base = &tex->b;
|
2010-07-24 20:32:53 +01:00
|
|
|
unsigned stride, size, layer_size, nblocksy, i;
|
2013-01-04 21:34:52 +00:00
|
|
|
boolean rv350_mode = screen->caps.family >= CHIP_R350;
|
2010-07-25 09:07:12 +01:00
|
|
|
boolean aligned_for_cbzb;
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.size_in_bytes = 0;
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
SCREEN_DBG(screen, DBG_TEXALLOC,
|
|
|
|
"r300: Making miptree for texture, format %s\n",
|
|
|
|
util_format_short_name(base->format));
|
|
|
|
|
|
|
|
for (i = 0; i <= base->last_level; i++) {
|
|
|
|
/* Let's see if this miplevel can be macrotiled. */
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.macrotile[i] =
|
2011-04-18 01:39:50 +01:00
|
|
|
(tex->tex.macrotile[0] == RADEON_LAYOUT_TILED &&
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_texture_macro_switch(tex, i, rv350_mode, DIM_WIDTH) &&
|
|
|
|
r300_texture_macro_switch(tex, i, rv350_mode, DIM_HEIGHT)) ?
|
2011-04-18 01:39:50 +01:00
|
|
|
RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
stride = r300_texture_get_stride(screen, tex, i);
|
2010-07-25 09:07:12 +01:00
|
|
|
|
|
|
|
/* Compute the number of blocks in Y, see if the CBZB clear can be
|
|
|
|
* used on the texture. */
|
|
|
|
aligned_for_cbzb = FALSE;
|
2011-02-10 04:36:44 +00:00
|
|
|
if (align_for_cbzb && tex->tex.cbzb_allowed[i])
|
|
|
|
nblocksy = r300_texture_get_nblocksy(tex, i, &aligned_for_cbzb);
|
2010-07-25 09:07:12 +01:00
|
|
|
else
|
2011-02-10 04:36:44 +00:00
|
|
|
nblocksy = r300_texture_get_nblocksy(tex, i, NULL);
|
2010-07-25 09:07:12 +01:00
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
layer_size = stride * nblocksy;
|
|
|
|
|
r300g: implement MSAA
This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.
MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.
The supported modes are 2x, 4x, 6x.
The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.
Tested with piglit. (I have ported all MSAA tests to GL2.1)
2013-01-05 05:21:49 +00:00
|
|
|
if (base->nr_samples > 1) {
|
2010-07-24 20:32:53 +01:00
|
|
|
layer_size *= base->nr_samples;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (base->target == PIPE_TEXTURE_CUBE)
|
|
|
|
size = layer_size * 6;
|
|
|
|
else
|
2011-02-10 04:36:44 +00:00
|
|
|
size = layer_size * u_minify(tex->tex.depth0, i);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.offset_in_bytes[i] = tex->tex.size_in_bytes;
|
|
|
|
tex->tex.size_in_bytes = tex->tex.offset_in_bytes[i] + size;
|
|
|
|
tex->tex.layer_size_in_bytes[i] = layer_size;
|
|
|
|
tex->tex.stride_in_bytes[i] = stride;
|
|
|
|
tex->tex.cbzb_allowed[i] = tex->tex.cbzb_allowed[i] && aligned_for_cbzb;
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
SCREEN_DBG(screen, DBG_TEXALLOC, "r300: Texture miptree: Level %d "
|
|
|
|
"(%dx%dx%d px, pitch %d bytes) %d bytes total, macrotiled %s\n",
|
2011-02-10 04:36:44 +00:00
|
|
|
i, u_minify(tex->tex.width0, i), u_minify(tex->tex.height0, i),
|
|
|
|
u_minify(tex->tex.depth0, i), stride, tex->tex.size_in_bytes,
|
|
|
|
tex->tex.macrotile[i] ? "TRUE" : "FALSE");
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
static void r300_setup_flags(struct r300_resource *tex)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.uses_stride_addressing =
|
2021-05-05 21:21:56 +01:00
|
|
|
!util_is_power_of_two_or_zero(tex->b.width0) ||
|
2011-02-10 04:36:44 +00:00
|
|
|
(tex->tex.stride_in_bytes_override &&
|
2021-05-05 21:21:56 +01:00
|
|
|
r300_stride_to_width(tex->b.format,
|
|
|
|
tex->tex.stride_in_bytes_override) != tex->b.width0);
|
2011-02-10 04:36:44 +00:00
|
|
|
|
|
|
|
tex->tex.is_npot =
|
|
|
|
tex->tex.uses_stride_addressing ||
|
2021-05-05 21:21:56 +01:00
|
|
|
!util_is_power_of_two_or_zero(tex->b.height0) ||
|
|
|
|
!util_is_power_of_two_or_zero(tex->b.depth0);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
|
2011-02-10 04:36:44 +00:00
|
|
|
struct r300_resource *tex)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
|
|
|
unsigned i, bpp;
|
|
|
|
boolean first_level_valid;
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
bpp = util_format_get_blocksizebits(tex->b.format);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
/* 1) The texture must be point-sampled,
|
|
|
|
* 2) The depth must be 16 or 32 bits.
|
|
|
|
* 3) If the midpoint ZB offset is not aligned to 2048, it returns garbage
|
|
|
|
* with certain texture sizes. Macrotiling ensures the alignment. */
|
2021-05-05 21:21:56 +01:00
|
|
|
first_level_valid = tex->b.nr_samples <= 1 &&
|
2010-07-24 20:32:53 +01:00
|
|
|
(bpp == 16 || bpp == 32) &&
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.macrotile[0];
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2010-09-10 08:18:03 +01:00
|
|
|
if (SCREEN_DBG_ON(rscreen, DBG_NO_CBZB))
|
|
|
|
first_level_valid = FALSE;
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
for (i = 0; i <= tex->b.last_level; i++)
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.cbzb_allowed[i] = first_level_valid && tex->tex.macrotile[i];
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
2011-02-28 12:38:01 +00:00
|
|
|
static unsigned r300_pixels_to_dwords(unsigned stride,
|
|
|
|
unsigned height,
|
|
|
|
unsigned xblock, unsigned yblock)
|
|
|
|
{
|
2011-03-10 21:48:44 +00:00
|
|
|
return (util_align_npot(stride, xblock) * align(height, yblock)) / (xblock * yblock);
|
2011-02-28 12:38:01 +00:00
|
|
|
}
|
2011-01-28 00:01:01 +00:00
|
|
|
|
2011-02-28 12:38:01 +00:00
|
|
|
static void r300_setup_hyperz_properties(struct r300_screen *screen,
|
|
|
|
struct r300_resource *tex)
|
2011-01-28 00:01:01 +00:00
|
|
|
{
|
2011-02-28 12:38:01 +00:00
|
|
|
/* The tile size of 1 DWORD in ZMASK RAM is:
|
2011-01-28 00:01:01 +00:00
|
|
|
*
|
|
|
|
* GPU Pipes 4x4 mode 8x8 mode
|
|
|
|
* ------------------------------------------
|
|
|
|
* R580 4P/1Z 32x32 64x64
|
|
|
|
* RV570 3P/1Z 48x16 96x32
|
|
|
|
* RV530 1P/2Z 32x16 64x32
|
|
|
|
* 1P/1Z 16x16 32x32
|
|
|
|
*/
|
2011-02-28 12:38:01 +00:00
|
|
|
static unsigned zmask_blocks_x_per_dw[4] = {4, 8, 12, 8};
|
|
|
|
static unsigned zmask_blocks_y_per_dw[4] = {4, 4, 4, 8};
|
|
|
|
|
|
|
|
/* In HIZ RAM, one dword is always 8x8 pixels (each byte is 4x4 pixels),
|
|
|
|
* but the blocks have very weird ordering.
|
|
|
|
*
|
|
|
|
* With 2 pipes and an image of size 8xY, where Y >= 1,
|
|
|
|
* clearing 4 dwords clears blocks like this:
|
|
|
|
*
|
|
|
|
* 01012323
|
|
|
|
*
|
|
|
|
* where numbers correspond to dword indices. The blocks are interleaved
|
|
|
|
* in the X direction, so the alignment must be 4x1 blocks (32x8 pixels).
|
|
|
|
*
|
|
|
|
* With 4 pipes and an image of size 8xY, where Y >= 4,
|
|
|
|
* clearing 8 dwords clears blocks like this:
|
|
|
|
* 01012323
|
|
|
|
* 45456767
|
|
|
|
* 01012323
|
|
|
|
* 45456767
|
|
|
|
* where numbers correspond to dword indices. The blocks are interleaved
|
|
|
|
* in both directions, so the alignment must be 4x4 blocks (32x32 pixels)
|
|
|
|
*/
|
|
|
|
static unsigned hiz_align_x[4] = {8, 32, 48, 32};
|
|
|
|
static unsigned hiz_align_y[4] = {8, 8, 8, 32};
|
2011-01-28 00:01:01 +00:00
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (util_format_is_depth_or_stencil(tex->b.format) &&
|
|
|
|
util_format_get_blocksizebits(tex->b.format) == 32 &&
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.microtile) {
|
2011-01-28 00:01:01 +00:00
|
|
|
unsigned i, pipes;
|
|
|
|
|
2013-01-04 21:34:52 +00:00
|
|
|
if (screen->caps.family == CHIP_RV530) {
|
2011-07-22 17:58:30 +01:00
|
|
|
pipes = screen->info.r300_num_z_pipes;
|
2011-01-28 00:01:01 +00:00
|
|
|
} else {
|
2011-07-22 17:58:30 +01:00
|
|
|
pipes = screen->info.r300_num_gb_pipes;
|
2011-01-28 00:01:01 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
for (i = 0; i <= tex->b.last_level; i++) {
|
2011-02-28 12:38:01 +00:00
|
|
|
unsigned zcomp_numdw, zcompsize, hiz_numdw, stride, height;
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
stride = r300_stride_to_width(tex->b.format,
|
2011-12-29 17:18:38 +00:00
|
|
|
tex->tex.stride_in_bytes[i]);
|
|
|
|
stride = align(stride, 16);
|
2021-05-05 21:21:56 +01:00
|
|
|
height = u_minify(tex->b.height0, i);
|
2011-01-28 00:01:01 +00:00
|
|
|
|
|
|
|
/* The 8x8 compression mode needs macrotiling. */
|
2011-02-28 12:38:01 +00:00
|
|
|
zcompsize = screen->caps.z_compress == R300_ZCOMP_8X8 &&
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.macrotile[i] &&
|
2021-05-05 21:21:56 +01:00
|
|
|
tex->b.nr_samples <= 1 ? 8 : 4;
|
2011-01-28 00:01:01 +00:00
|
|
|
|
2011-02-28 12:38:01 +00:00
|
|
|
/* Get the ZMASK buffer size in dwords. */
|
|
|
|
zcomp_numdw = r300_pixels_to_dwords(stride, height,
|
|
|
|
zmask_blocks_x_per_dw[pipes-1] * zcompsize,
|
|
|
|
zmask_blocks_y_per_dw[pipes-1] * zcompsize);
|
2011-01-28 00:01:01 +00:00
|
|
|
|
2011-02-28 12:38:01 +00:00
|
|
|
/* Check whether we have enough ZMASK memory. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if (util_format_get_blocksizebits(tex->b.format) == 32 &&
|
2011-02-28 12:38:01 +00:00
|
|
|
zcomp_numdw <= screen->caps.zmask_ram * pipes) {
|
|
|
|
tex->tex.zmask_dwords[i] = zcomp_numdw;
|
|
|
|
tex->tex.zcomp8x8[i] = zcompsize == 8;
|
2011-01-28 00:01:01 +00:00
|
|
|
|
2011-02-28 12:38:01 +00:00
|
|
|
tex->tex.zmask_stride_in_pixels[i] =
|
2011-03-10 21:48:44 +00:00
|
|
|
util_align_npot(stride, zmask_blocks_x_per_dw[pipes-1] * zcompsize);
|
2011-01-28 00:01:01 +00:00
|
|
|
} else {
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.zmask_dwords[i] = 0;
|
|
|
|
tex->tex.zcomp8x8[i] = FALSE;
|
2011-02-28 12:38:01 +00:00
|
|
|
tex->tex.zmask_stride_in_pixels[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now setup HIZ. */
|
2011-03-10 21:48:44 +00:00
|
|
|
stride = util_align_npot(stride, hiz_align_x[pipes-1]);
|
2011-02-28 12:38:01 +00:00
|
|
|
height = align(height, hiz_align_y[pipes-1]);
|
|
|
|
|
|
|
|
/* Get the HIZ buffer size in dwords. */
|
|
|
|
hiz_numdw = (stride * height) / (8*8 * pipes);
|
|
|
|
|
|
|
|
/* Check whether we have enough HIZ memory. */
|
|
|
|
if (hiz_numdw <= screen->caps.hiz_ram * pipes) {
|
|
|
|
tex->tex.hiz_dwords[i] = hiz_numdw;
|
|
|
|
tex->tex.hiz_stride_in_pixels[i] = stride;
|
|
|
|
} else {
|
|
|
|
tex->tex.hiz_dwords[i] = 0;
|
|
|
|
tex->tex.hiz_stride_in_pixels[i] = 0;
|
2011-01-28 00:01:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-12 02:29:40 +00:00
|
|
|
static void r300_setup_cmask_properties(struct r300_screen *screen,
|
|
|
|
struct r300_resource *tex)
|
|
|
|
{
|
|
|
|
static unsigned cmask_align_x[4] = {16, 32, 48, 32};
|
|
|
|
static unsigned cmask_align_y[4] = {16, 16, 16, 32};
|
2013-01-20 15:52:17 +00:00
|
|
|
unsigned pipes, stride, cmask_num_dw, cmask_max_size;
|
2013-01-12 02:29:40 +00:00
|
|
|
|
2013-08-11 01:15:12 +01:00
|
|
|
if (!screen->caps.has_cmask) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-12 02:29:40 +00:00
|
|
|
/* We need an AA colorbuffer, no mipmaps. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if (tex->b.nr_samples <= 1 ||
|
|
|
|
tex->b.last_level > 0 ||
|
|
|
|
util_format_is_depth_or_stencil(tex->b.format)) {
|
2013-01-12 02:29:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-15 20:41:34 +00:00
|
|
|
/* FP16 AA needs R500 and a fairly new DRM. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if ((tex->b.format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
|
|
|
|
tex->b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) &&
|
2022-07-08 01:08:43 +01:00
|
|
|
!screen->caps.is_r500) {
|
2013-01-12 02:29:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SCREEN_DBG_ON(screen, DBG_NO_CMASK)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* CMASK is part of raster pipes. The number of Z pipes doesn't matter. */
|
|
|
|
pipes = screen->info.r300_num_gb_pipes;
|
|
|
|
|
2013-01-20 15:52:17 +00:00
|
|
|
/* The single-pipe cards have 5120 dwords of CMASK RAM,
|
|
|
|
* the other cards have 4096 dwords of CMASK RAM per pipe. */
|
|
|
|
cmask_max_size = pipes == 1 ? 5120 : pipes * 4096;
|
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
stride = r300_stride_to_width(tex->b.format,
|
2013-01-12 02:29:40 +00:00
|
|
|
tex->tex.stride_in_bytes[0]);
|
|
|
|
stride = align(stride, 16);
|
|
|
|
|
|
|
|
/* Get the CMASK size in dwords. */
|
2021-05-05 21:21:56 +01:00
|
|
|
cmask_num_dw = r300_pixels_to_dwords(stride, tex->b.height0,
|
2013-01-12 02:29:40 +00:00
|
|
|
cmask_align_x[pipes-1],
|
|
|
|
cmask_align_y[pipes-1]);
|
|
|
|
|
|
|
|
/* Check the CMASK size against the CMASK memory limit. */
|
2013-01-20 15:52:17 +00:00
|
|
|
if (cmask_num_dw <= cmask_max_size) {
|
2013-01-12 02:29:40 +00:00
|
|
|
tex->tex.cmask_dwords = cmask_num_dw;
|
|
|
|
tex->tex.cmask_stride_in_pixels =
|
|
|
|
util_align_npot(stride, cmask_align_x[pipes-1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
static void r300_setup_tiling(struct r300_screen *screen,
|
2011-02-10 04:36:44 +00:00
|
|
|
struct r300_resource *tex)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
2021-05-05 21:21:56 +01:00
|
|
|
enum pipe_format format = tex->b.format;
|
2013-01-04 21:34:52 +00:00
|
|
|
boolean rv350_mode = screen->caps.family >= CHIP_R350;
|
2010-07-24 20:32:53 +01:00
|
|
|
boolean is_zb = util_format_is_depth_or_stencil(format);
|
|
|
|
boolean dbg_no_tiling = SCREEN_DBG_ON(screen, DBG_NO_TILING);
|
2013-01-13 23:27:28 +00:00
|
|
|
boolean force_microtiling =
|
2021-05-05 21:21:56 +01:00
|
|
|
(tex->b.flags & R300_RESOURCE_FORCE_MICROTILING) != 0;
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (tex->b.nr_samples > 1) {
|
r300g: implement MSAA
This is not as optimized as r600g - the MSAA compression is missing,
so r300g needs a lot of bandwidth (more than r600g to do the same thing).
However, if the bandwidth is not an issue for you, you can enjoy this
unoptimized MSAA support.
The only other missing optimization for MSAA is the fast color clear.
MSAA is enabled on r500 only, because that's the only GPU family I tested.
That said, MSAA should work on r300 and r400 as well (but you must set
RADEON_MSAA=1 to allow it, then turn MSAA on in your app or set GALLIUM_MSAA=n,
n >= 2, n <= 6)
I will enable the support by default on r300-r400 once someone (other than me)
tests those chipsets with piglit.
The supported modes are 2x, 4x, 6x.
The supported MSAA formats are RGBA8, BGRA8, and RGBA16F (r500 only).
Those 3 formats are used for all GL internal formats.
Tested with piglit. (I have ported all MSAA tests to GL2.1)
2013-01-05 05:21:49 +00:00
|
|
|
tex->tex.microtile = RADEON_LAYOUT_TILED;
|
|
|
|
tex->tex.macrotile[0] = RADEON_LAYOUT_TILED;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-18 01:39:50 +01:00
|
|
|
tex->tex.microtile = RADEON_LAYOUT_LINEAR;
|
|
|
|
tex->tex.macrotile[0] = RADEON_LAYOUT_LINEAR;
|
2011-02-10 09:16:21 +00:00
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
if (tex->b.usage == PIPE_USAGE_STAGING) {
|
2013-02-07 03:29:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
if (!util_format_is_plain(format)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If height == 1, disable microtiling except for zbuffer. */
|
2013-01-13 23:27:28 +00:00
|
|
|
if (!force_microtiling && !is_zb &&
|
2021-05-05 21:21:56 +01:00
|
|
|
(tex->b.height0 == 1 || dbg_no_tiling)) {
|
2010-07-24 20:32:53 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set microtiling. */
|
|
|
|
switch (util_format_get_blocksize(format)) {
|
|
|
|
case 1:
|
|
|
|
case 4:
|
2010-10-04 20:19:27 +01:00
|
|
|
case 8:
|
2011-04-18 01:39:50 +01:00
|
|
|
tex->tex.microtile = RADEON_LAYOUT_TILED;
|
2010-07-24 20:32:53 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2011-04-18 01:39:50 +01:00
|
|
|
tex->tex.microtile = RADEON_LAYOUT_SQUARETILED;
|
2010-07-24 20:32:53 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dbg_no_tiling) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set macrotiling. */
|
2011-02-10 04:36:44 +00:00
|
|
|
if (r300_texture_macro_switch(tex, 0, rv350_mode, DIM_WIDTH) &&
|
|
|
|
r300_texture_macro_switch(tex, 0, rv350_mode, DIM_HEIGHT)) {
|
2011-04-18 01:39:50 +01:00
|
|
|
tex->tex.macrotile[0] = RADEON_LAYOUT_TILED;
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
static void r300_tex_print_info(struct r300_resource *tex,
|
2010-07-24 20:32:53 +01:00
|
|
|
const char *func)
|
|
|
|
{
|
|
|
|
fprintf(stderr,
|
|
|
|
"r300: %s: Macro: %s, Micro: %s, Pitch: %i, Dim: %ix%ix%i, "
|
2013-01-12 03:44:37 +00:00
|
|
|
"LastLevel: %i, Size: %i, Format: %s, Samples: %i\n",
|
2010-07-24 20:32:53 +01:00
|
|
|
func,
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.macrotile[0] ? "YES" : " NO",
|
|
|
|
tex->tex.microtile ? "YES" : " NO",
|
2021-05-05 21:21:56 +01:00
|
|
|
r300_stride_to_width(tex->b.format, tex->tex.stride_in_bytes[0]),
|
|
|
|
tex->b.width0, tex->b.height0, tex->b.depth0,
|
|
|
|
tex->b.last_level, tex->tex.size_in_bytes,
|
|
|
|
util_format_short_name(tex->b.format),
|
|
|
|
tex->b.nr_samples);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
2011-10-20 22:14:36 +01:00
|
|
|
void r300_texture_desc_init(struct r300_screen *rscreen,
|
|
|
|
struct r300_resource *tex,
|
|
|
|
const struct pipe_resource *base)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
2021-05-05 21:21:56 +01:00
|
|
|
tex->b.target = base->target;
|
|
|
|
tex->b.format = base->format;
|
|
|
|
tex->b.width0 = base->width0;
|
|
|
|
tex->b.height0 = base->height0;
|
|
|
|
tex->b.depth0 = base->depth0;
|
|
|
|
tex->b.array_size = base->array_size;
|
|
|
|
tex->b.last_level = base->last_level;
|
|
|
|
tex->b.nr_samples = base->nr_samples;
|
2011-02-10 04:36:44 +00:00
|
|
|
tex->tex.width0 = base->width0;
|
|
|
|
tex->tex.height0 = base->height0;
|
|
|
|
tex->tex.depth0 = base->depth0;
|
2010-08-29 02:48:42 +01:00
|
|
|
|
2013-01-20 17:09:58 +00:00
|
|
|
/* There is a CB memory addressing hardware bug that limits the width
|
|
|
|
* of the MSAA buffer in some cases in R520. In order to get around it,
|
|
|
|
* the following code lowers the sample count depending on the format and
|
|
|
|
* the width.
|
|
|
|
*
|
|
|
|
* The only catch is that all MSAA colorbuffers and a zbuffer which are
|
|
|
|
* supposed to be used together should always be bound together. Only
|
|
|
|
* then the correct minimum sample count of all bound buffers is used
|
|
|
|
* for rendering. */
|
|
|
|
if (rscreen->caps.is_r500) {
|
|
|
|
/* FP16 6x MSAA buffers are limited to a width of 1360 pixels. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if ((tex->b.format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
|
|
|
|
tex->b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) &&
|
|
|
|
tex->b.nr_samples == 6 && tex->b.width0 > 1360) {
|
|
|
|
tex->b.nr_samples = 4;
|
2013-01-20 17:09:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FP16 4x MSAA buffers are limited to a width of 2048 pixels. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if ((tex->b.format == PIPE_FORMAT_R16G16B16A16_FLOAT ||
|
|
|
|
tex->b.format == PIPE_FORMAT_R16G16B16X16_FLOAT) &&
|
|
|
|
tex->b.nr_samples == 4 && tex->b.width0 > 2048) {
|
|
|
|
tex->b.nr_samples = 2;
|
2013-01-20 17:09:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 32-bit 6x MSAA buffers are limited to a width of 2720 pixels.
|
|
|
|
* This applies to all R300-R500 cards. */
|
2021-05-05 21:21:56 +01:00
|
|
|
if (util_format_get_blocksizebits(tex->b.format) == 32 &&
|
|
|
|
!util_format_is_depth_or_stencil(tex->b.format) &&
|
|
|
|
tex->b.nr_samples == 6 && tex->b.width0 > 2720) {
|
|
|
|
tex->b.nr_samples = 4;
|
2013-01-20 17:09:58 +00:00
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_setup_flags(tex);
|
2010-08-29 02:48:42 +01:00
|
|
|
|
|
|
|
/* Align a 3D NPOT texture to POT. */
|
2011-02-10 04:36:44 +00:00
|
|
|
if (base->target == PIPE_TEXTURE_3D && tex->tex.is_npot) {
|
|
|
|
tex->tex.width0 = util_next_power_of_two(tex->tex.width0);
|
|
|
|
tex->tex.height0 = util_next_power_of_two(tex->tex.height0);
|
|
|
|
tex->tex.depth0 = util_next_power_of_two(tex->tex.depth0);
|
2010-08-29 02:48:42 +01:00
|
|
|
}
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2010-08-29 02:48:42 +01:00
|
|
|
/* Setup tiling. */
|
2011-04-18 01:39:50 +01:00
|
|
|
if (tex->tex.microtile == RADEON_LAYOUT_UNKNOWN) {
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_setup_tiling(rscreen, tex);
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_setup_cbzb_flags(rscreen, tex);
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2010-07-25 09:07:12 +01:00
|
|
|
/* Setup the miptree description. */
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_setup_miptree(rscreen, tex, TRUE);
|
2011-09-27 01:04:02 +01:00
|
|
|
/* If the required buffer size is larger than the given max size,
|
2010-07-25 09:07:12 +01:00
|
|
|
* try again without the alignment for the CBZB clear. */
|
2011-09-27 01:04:02 +01:00
|
|
|
if (tex->buf && tex->tex.size_in_bytes > tex->buf->size) {
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_setup_miptree(rscreen, tex, FALSE);
|
2010-07-25 09:07:12 +01:00
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
/* Make sure the buffer we got is large enough. */
|
2011-09-27 01:04:02 +01:00
|
|
|
if (tex->tex.size_in_bytes > tex->buf->size) {
|
2011-10-20 22:14:36 +01:00
|
|
|
fprintf(stderr,
|
|
|
|
"r300: I got a pre-allocated buffer to use it as a texture "
|
|
|
|
"storage, but the buffer is too small. I'll use the buffer "
|
|
|
|
"anyway, because I can't crash here, but it's dangerous. "
|
2016-04-10 15:37:33 +01:00
|
|
|
"This can be a DDX bug. Got: %"PRIu64"B, Need: %uB, Info:\n",
|
2011-10-20 22:14:36 +01:00
|
|
|
tex->buf->size, tex->tex.size_in_bytes);
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_tex_print_info(tex, "texture_desc_init");
|
2021-01-03 01:11:56 +00:00
|
|
|
/* Oops, what now. Apps will break if we fail this,
|
2011-10-20 22:14:36 +01:00
|
|
|
* so just pretend everything's okay. */
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-27 01:04:02 +01:00
|
|
|
r300_setup_hyperz_properties(rscreen, tex);
|
2013-01-12 02:29:40 +00:00
|
|
|
r300_setup_cmask_properties(rscreen, tex);
|
2011-09-27 01:04:02 +01:00
|
|
|
|
2010-07-24 20:32:53 +01:00
|
|
|
if (SCREEN_DBG_ON(rscreen, DBG_TEX))
|
2011-02-10 04:36:44 +00:00
|
|
|
r300_tex_print_info(tex, "texture_desc_init");
|
2010-07-24 20:32:53 +01:00
|
|
|
}
|
|
|
|
|
2011-02-10 04:36:44 +00:00
|
|
|
unsigned r300_texture_get_offset(struct r300_resource *tex,
|
gallium: support for array textures and related changes
resources have a array_size parameter now.
get_tex_surface and tex_surface_destroy have been renamed to create_surface
and surface_destroy and moved to context, similar to sampler views (and
create_surface now uses a template just like create_sampler_view). Surfaces
now really should only be used for rendering. In particular they shouldn't be
used as some kind of 2d abstraction for sharing a texture. offset/layout fields
don't make sense any longer and have been removed, width/height should go too.
surfaces and sampler views now specify a layer range (for texture resources),
layer is either array slice, depth slice or cube face.
pipe_subresource is gone array slices (or cube faces) are now treated the same
as depth slices in transfers etc. (that is, they use the z coord of the
respective functions).
Squashed commit of the following:
commit a45bd509014743d21a532194d7b658a1aeb00cb7
Merge: 1aeca28 32e1e59
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Dec 2 04:32:06 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_surface.c
commit 1aeca287a827f29206078fa1204715a477072c08
Merge: 912f042 6f7c8c3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Dec 2 00:37:11 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/state_trackers/vega/api_filters.c
src/gallium/state_trackers/vega/api_images.c
src/gallium/state_trackers/vega/mask.c
src/gallium/state_trackers/vega/paint.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/st_inlines.h
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_manager.c
commit 912f042e1d439de17b36be9a740358c876fcd144
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Dec 1 03:01:55 2010 +0100
gallium: even more compile fixes after merge
commit 6fc95a58866d2a291def333608ba9c10c3f07e82
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Dec 1 00:22:26 2010 +0100
gallium: some fixes after merge
commit a8d5ffaeb5397ffaa12fb422e4e7efdf0494c3e2
Merge: f7a202f 2da02e7
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 30 23:41:26 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/state_trackers/vega/api_images.c
src/gallium/state_trackers/vega/vg_context.c
commit f7a202fde2aea2ec78ef58830f945a5e214e56ab
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Nov 24 19:19:32 2010 +0100
gallium: even more fixes/cleanups after merge
commit 6895a7f969ed7f9fa8ceb788810df8dbcf04c4c9
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Nov 24 03:07:36 2010 +0100
gallium: more compile fixes after merge
commit af0501a5103b9756bc4d79167bd81051ad6e8670
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 23 19:24:45 2010 +0100
gallium: lots of compile fixes after merge
commit 0332003c2feb60f2a20e9a40368180c4ecd33e6b
Merge: 26c6346 b6b91fa
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 23 17:02:26 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_inlines.h
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surfaces.c
src/gallium/docs/source/context.rst
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/nvfx/nv04_surface_2d.c
src/gallium/drivers/nvfx/nv04_surface_2d.h
src/gallium/drivers/nvfx/nvfx_buffer.c
src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_resource.c
src/gallium/drivers/nvfx/nvfx_resource.h
src/gallium/drivers/nvfx/nvfx_state_fb.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_context.h
src/gallium/drivers/r600/r600_screen.c
src/gallium/drivers/r600/r600_screen.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/egl/common/egl_g3d_api.c
src/gallium/state_trackers/glx/xlib/xm_st.c
src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
src/gallium/targets/libgl-gdi/libgl_gdi.c
src/gallium/tests/graw/tri.c
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_readpixels.c
commit 26c6346b385929fba94775f33838d0cceaaf1127
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Aug 2 19:37:21 2010 +0200
fix more merge breakage
commit b30d87c6025eefe7f6979ffa8e369bbe755d5c1d
Merge: 9461bf3 1f1928d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Aug 2 19:15:38 2010 +0200
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_rast_priv.h
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture.h
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/r600_screen.c
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/r600_texture.h
src/gallium/state_trackers/dri/common/dri1_helper.c
src/gallium/state_trackers/dri/sw/drisw.c
src/gallium/state_trackers/xorg/xorg_exa.c
commit 9461bf3cfb647d2301364ae29fc3084fff52862a
Merge: 17492d7 0eaccb3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jul 15 20:13:45 2010 +0200
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/util/u_blitter.c
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_surface.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/tests/trivial/quad-tex.c
commit 17492d705e7b7f607b71db045c3bf344cb6842b3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Jun 18 10:58:08 2010 +0100
gallium: rename element_offset/width fields in views to first/last_element
This is much more consistent with the other fields used there
(first/last level, first/last layer).
Actually thinking about removing the ugly union/structs again and
rename first/last_layer to something even more generic which could also
be used for buffers (like first/last_member) without inducing headaches.
commit 1b717a289299f942de834dcccafbab91361e20ab
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 14:46:09 2010 +0100
gallium: remove PIPE_SURFACE_LAYOUT_LINEAR definition
This was only used by the layout field of pipe_surface, but this
driver internal stuff is gone so there's no need for this driver independent
layout definition neither.
commit 10cb644b31b3ef47e6c7b55e514ad24bb891fac4
Merge: 5691db9 c85971d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 12:20:41 2010 +0100
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/docs/source/glossary.rst
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
commit 5691db960ca3d525ce7d6c32d9c7a28f5e907f3b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 11:29:03 2010 +0100
st/wgl: fix interface changes bugs
commit 2303ec32143d363b46e59e4b7c91b0ebd34a16b2
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 19:42:32 2010 +0100
gallium: adapt code to interface changes...
commit dcae4f586f0d0885b72674a355e5d56d47afe77d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 19:42:05 2010 +0100
gallium: separate depth0 and array_size in the resource itself.
These fields are still mutually exclusive (since no 3d array textures exist)
but it ultimately seemed to error-prone to adapt all code accept the new
meaning of depth0 (drivers stick that into hardware regs, calculate mipmap
sizes etc.). And it isn't really cleaner anyway.
So, array textures will have depth0 of 1, but instead use array_size,
3D textures will continue to use depth0 (and have array_size of 1). Cube
maps also will use array_size to indicate their 6 faces, but since all drivers
should just be fine by inferring this themselves from the fact it's a cube map
as they always used to nothing should break.
commit 621737a638d187d208712250fc19a91978fdea6b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 17:47:38 2010 +0100
gallium: adapt code to interface changes
There are still usages of pipe_surface where pipe_resource should be used,
which should eventually be fixed.
commit 2d17f5efe166b2c3d51957c76294165ab30b8ae2
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 17:46:14 2010 +0100
gallium: more interface changes
In particular to enable usage of buffers in views, and ability to use a
different pipe_format in pipe_surface.
Get rid of layout and offset parameter in pipe_surface - the former was
not used in any (public) code anyway, and the latter should either be computed
on-demand or driver can use subclass of pipe_surface.
Also make create_surface() use a template to be more consistent with
other functions.
commit 71f885ee16aa5cf2742c44bfaf0dc5b8734b9901
Merge: 3232d11 8ad410d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 14:19:51 2010 +0100
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/util/u_box.h
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_screen.h
src/gallium/include/pipe/p_state.h
commit 3232d11fe3ebf7686286013c357b404714853984
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 11:40:04 2010 +0100
mesa/st: adapt to interface changes
still need to fix pipe_surface sharing
(as that is now per-context).
Also broken is depth0 handling - half the code assumes
this is also used for array textures (and hence by extension
of that cube maps would have depth 6), half the code does not...
commit f433b7f7f552720e5eade0b4078db94590ee85e1
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 11:35:52 2010 +0100
gallium: fix a couple of bugs in interface chnage fixes
commit 818366b28ea18f514dc791646248ce6f08d9bbcf
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:42:11 2010 +0200
targets: adapt to interface changes
Yes even that needs adjustments...
commit 66c511ab1682c9918e0200902039247793acb41e
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:41:13 2010 +0200
tests: adapt to interface changes
Everything needs to be fixed :-(.
commit 6b494635d9dbdaa7605bc87b1ebf682b138c5808
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:39:50 2010 +0200
st: adapt non-rendering state trackers to interface changes
might not be quite right in all places, but they really don't want
to use pipe_surface.
commit 00c4289a35d86e4fe85919ec32aa9f5ffe69d16d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:38:48 2010 +0200
winsys: adapt to interface changes
commit 39d858554dc9ed5dbc795626fec3ef9deae552a0
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:26:54 2010 +0200
st/python: adapt to interface changes
don't think that will work, sorry.
commit 6e9336bc49b32139cec4e683857d0958000e15e3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:26:07 2010 +0200
st/vega: adapt to interface changes
commit e07f2ae9aaf8842757d5d50865f76f8276245e11
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:25:56 2010 +0200
st/xorg: adapt to interface changes
commit 05531c10a74a4358103e30d3b38a5eceb25c947f
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:53 2010 +0200
nv50: adapt to interface changes
commit 97704f388d7042121c6d496ba8c003afa3ea2bf3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:45 2010 +0200
nvfx: adapt to interface changes
commit a8a9c93d703af6e8f5c12e1cea9ec665add1abe0
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:01 2010 +0200
i965g: adapt to interface changes
commit 0dde209589872d20cc34ed0b237e3ed7ae0e2de3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:22:38 2010 +0200
i915g: adapt to interface changes
commit 5cac9beede69d12f5807ee1a247a4c864652799e
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:20:58 2010 +0200
svga: adapt to interface changes
resource_copy_region still looking fishy.
Was not very suited to unified zslice/face approach...
commit 08b5a6af4b963a3e4c75fc336bf6c0772dce5150
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:20:01 2010 +0200
rbug: adapt to interface changes
Not sure if that won't need changes elsewhere?
commit c9fd24b1f586bcef2e0a6e76b68e40fca3408964
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:31 2010 +0200
trace: adapt to interface changes
commit ed84e010afc5635a1a47390b32247a266f65b8d1
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:21 2010 +0200
failover: adapt to interface changes
commit a1d4b4a293da933276908e3393435ec4b43cf201
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:12 2010 +0200
identity: adapt to interface changes
commit a8dd73e2c56c7d95ffcf174408f38f4f35fd2f4c
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:55 2010 +0200
softpipe: adapt to interface changes
commit a886085893e461e8473978e8206ec2312b7077ff
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:44 2010 +0200
llvmpipe: adapt to interface changes
commit 70523f6d567d8b7cfda682157556370fd3c43460
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:14 2010 +0200
r600g: adapt to interface changes
commit 3f4bc72bd80994865eb9f6b8dfd11e2b97060d19
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:05 2010 +0200
r300g: adapt to interface changes
commit 5d353b55ee14db0ac0515b5a3cf9389430832c19
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:17:37 2010 +0200
cell: adapt to interface changes
not even compile tested
commit cf5d03601322c2dcb12d7a9c2f1745e2b2a35eb4
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:14:59 2010 +0200
util: adapt to interface changes
amazing how much code changes just due to some subtle interface changes?
commit dc98d713c6937c0e177fc2caf23020402cc7ea7b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:12:40 2010 +0200
gallium: more interface fail, docs
this also changes flush_frontbuffer to use a pipe_resource instead of
a pipe_surface - pipe_surface is not meant to be (or at least no longer)
an abstraction for standalone 2d images which get passed around.
(This has also implications for the non-rendering state-trackers.)
commit 08436d27ddd59857c22827c609b692aa0c407b7b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 10 17:42:52 2010 +0200
gallium: fix array texture interface changes bugs, docs
commit 4a4d927609b62b4d7fb9dffa35158afe282f277b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 3 22:02:44 2010 +0200
gallium: interface changes for array textures and related cleanups
This patch introduces array textures to gallium (note they are not immediately
usable without the associated changes to the shader side).
Also, this abandons pipe_subresource in favor of using level and layer
parameters since the distinction between several faces (which was part of
pipe_subresource for cube textures) and several z slices (which were not part
of pipe_subresource but instead part of pipe_box where appropriate for 3d
textures) is gone at the resource level.
Textures, be it array, cube, or 3d, now use a "unified" set of parameters,
there is no distinction between array members, cube faces, or 3d zslices.
This is unlike d3d10, whose subresource index includes layer information for
array textures, but which considers all z slices of a 3d texture to be part
of the same subresource.
In contrast to d3d10, OpenGL though reuses old 2d and 3d function entry points
for 1d and 2d array textures, respectively, which also implies that for instance
it is possible to specify all layers of a 2d array texture at once (note that
this is not possible for cube maps, which use the 2d entry points, although
it is possible for cube map arrays, which aren't supported yet in gallium).
This should possibly make drivers a bit simpler, and also get rid of mutually
exclusive parameters in some functions (as z and face were exclusive), one
potential downside would be that 3d array textures could not easily be supported
without reverting this, but those are nowhere to be seen.
Also along with adjusting to new parameters, rename get_tex_surface /
tex_surface_destroy to create_surface / surface_destroy and move them from
screen to context, which reflects much better what those do (they are analogous
to create_sampler_view / sampler_view_destroy).
PIPE_CAP_ARRAY_TEXTURES is used to indicate if a driver supports all of this
functionality (that is, both sampling from array texture as well as use a range
of layers as a render target, with selecting the layer from the geometry shader).
2010-12-02 03:33:43 +00:00
|
|
|
unsigned level, unsigned layer)
|
2010-07-24 20:32:53 +01:00
|
|
|
{
|
2011-02-10 04:36:44 +00:00
|
|
|
unsigned offset = tex->tex.offset_in_bytes[level];
|
2010-07-24 20:32:53 +01:00
|
|
|
|
2021-05-05 21:21:56 +01:00
|
|
|
switch (tex->b.target) {
|
2010-07-24 20:32:53 +01:00
|
|
|
case PIPE_TEXTURE_3D:
|
2010-12-02 13:30:56 +00:00
|
|
|
case PIPE_TEXTURE_CUBE:
|
2011-02-10 04:36:44 +00:00
|
|
|
return offset + layer * tex->tex.layer_size_in_bytes[level];
|
2010-07-24 20:32:53 +01:00
|
|
|
|
|
|
|
default:
|
gallium: support for array textures and related changes
resources have a array_size parameter now.
get_tex_surface and tex_surface_destroy have been renamed to create_surface
and surface_destroy and moved to context, similar to sampler views (and
create_surface now uses a template just like create_sampler_view). Surfaces
now really should only be used for rendering. In particular they shouldn't be
used as some kind of 2d abstraction for sharing a texture. offset/layout fields
don't make sense any longer and have been removed, width/height should go too.
surfaces and sampler views now specify a layer range (for texture resources),
layer is either array slice, depth slice or cube face.
pipe_subresource is gone array slices (or cube faces) are now treated the same
as depth slices in transfers etc. (that is, they use the z coord of the
respective functions).
Squashed commit of the following:
commit a45bd509014743d21a532194d7b658a1aeb00cb7
Merge: 1aeca28 32e1e59
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Dec 2 04:32:06 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i915/i915_surface.c
commit 1aeca287a827f29206078fa1204715a477072c08
Merge: 912f042 6f7c8c3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Dec 2 00:37:11 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/state_trackers/vega/api_filters.c
src/gallium/state_trackers/vega/api_images.c
src/gallium/state_trackers/vega/mask.c
src/gallium/state_trackers/vega/paint.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/st_inlines.h
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_manager.c
commit 912f042e1d439de17b36be9a740358c876fcd144
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Dec 1 03:01:55 2010 +0100
gallium: even more compile fixes after merge
commit 6fc95a58866d2a291def333608ba9c10c3f07e82
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Dec 1 00:22:26 2010 +0100
gallium: some fixes after merge
commit a8d5ffaeb5397ffaa12fb422e4e7efdf0494c3e2
Merge: f7a202f 2da02e7
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 30 23:41:26 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/state_trackers/vega/api_images.c
src/gallium/state_trackers/vega/vg_context.c
commit f7a202fde2aea2ec78ef58830f945a5e214e56ab
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Nov 24 19:19:32 2010 +0100
gallium: even more fixes/cleanups after merge
commit 6895a7f969ed7f9fa8ceb788810df8dbcf04c4c9
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Nov 24 03:07:36 2010 +0100
gallium: more compile fixes after merge
commit af0501a5103b9756bc4d79167bd81051ad6e8670
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 23 19:24:45 2010 +0100
gallium: lots of compile fixes after merge
commit 0332003c2feb60f2a20e9a40368180c4ecd33e6b
Merge: 26c6346 b6b91fa
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Nov 23 17:02:26 2010 +0100
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blitter.c
src/gallium/auxiliary/util/u_inlines.h
src/gallium/auxiliary/util/u_surface.c
src/gallium/auxiliary/util/u_surfaces.c
src/gallium/docs/source/context.rst
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/nvfx/nv04_surface_2d.c
src/gallium/drivers/nvfx/nv04_surface_2d.h
src/gallium/drivers/nvfx/nvfx_buffer.c
src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_resource.c
src/gallium/drivers/nvfx/nvfx_resource.h
src/gallium/drivers/nvfx/nvfx_state_fb.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_context.h
src/gallium/drivers/r600/r600_screen.c
src/gallium/drivers/r600/r600_screen.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/egl/common/egl_g3d_api.c
src/gallium/state_trackers/glx/xlib/xm_st.c
src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
src/gallium/targets/libgl-gdi/libgl_gdi.c
src/gallium/tests/graw/tri.c
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_readpixels.c
commit 26c6346b385929fba94775f33838d0cceaaf1127
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Aug 2 19:37:21 2010 +0200
fix more merge breakage
commit b30d87c6025eefe7f6979ffa8e369bbe755d5c1d
Merge: 9461bf3 1f1928d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Aug 2 19:15:38 2010 +0200
Merge remote branch 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_rast_priv.h
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_texture.h
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/r600_screen.c
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/r600/r600_texture.h
src/gallium/state_trackers/dri/common/dri1_helper.c
src/gallium/state_trackers/dri/sw/drisw.c
src/gallium/state_trackers/xorg/xorg_exa.c
commit 9461bf3cfb647d2301364ae29fc3084fff52862a
Merge: 17492d7 0eaccb3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jul 15 20:13:45 2010 +0200
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/util/u_blitter.c
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_surface.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/tests/trivial/quad-tex.c
commit 17492d705e7b7f607b71db045c3bf344cb6842b3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Jun 18 10:58:08 2010 +0100
gallium: rename element_offset/width fields in views to first/last_element
This is much more consistent with the other fields used there
(first/last level, first/last layer).
Actually thinking about removing the ugly union/structs again and
rename first/last_layer to something even more generic which could also
be used for buffers (like first/last_member) without inducing headaches.
commit 1b717a289299f942de834dcccafbab91361e20ab
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 14:46:09 2010 +0100
gallium: remove PIPE_SURFACE_LAYOUT_LINEAR definition
This was only used by the layout field of pipe_surface, but this
driver internal stuff is gone so there's no need for this driver independent
layout definition neither.
commit 10cb644b31b3ef47e6c7b55e514ad24bb891fac4
Merge: 5691db9 c85971d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 12:20:41 2010 +0100
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/docs/source/glossary.rst
src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
commit 5691db960ca3d525ce7d6c32d9c7a28f5e907f3b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 17 11:29:03 2010 +0100
st/wgl: fix interface changes bugs
commit 2303ec32143d363b46e59e4b7c91b0ebd34a16b2
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 19:42:32 2010 +0100
gallium: adapt code to interface changes...
commit dcae4f586f0d0885b72674a355e5d56d47afe77d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 19:42:05 2010 +0100
gallium: separate depth0 and array_size in the resource itself.
These fields are still mutually exclusive (since no 3d array textures exist)
but it ultimately seemed to error-prone to adapt all code accept the new
meaning of depth0 (drivers stick that into hardware regs, calculate mipmap
sizes etc.). And it isn't really cleaner anyway.
So, array textures will have depth0 of 1, but instead use array_size,
3D textures will continue to use depth0 (and have array_size of 1). Cube
maps also will use array_size to indicate their 6 faces, but since all drivers
should just be fine by inferring this themselves from the fact it's a cube map
as they always used to nothing should break.
commit 621737a638d187d208712250fc19a91978fdea6b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 17:47:38 2010 +0100
gallium: adapt code to interface changes
There are still usages of pipe_surface where pipe_resource should be used,
which should eventually be fixed.
commit 2d17f5efe166b2c3d51957c76294165ab30b8ae2
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Jun 16 17:46:14 2010 +0100
gallium: more interface changes
In particular to enable usage of buffers in views, and ability to use a
different pipe_format in pipe_surface.
Get rid of layout and offset parameter in pipe_surface - the former was
not used in any (public) code anyway, and the latter should either be computed
on-demand or driver can use subclass of pipe_surface.
Also make create_surface() use a template to be more consistent with
other functions.
commit 71f885ee16aa5cf2742c44bfaf0dc5b8734b9901
Merge: 3232d11 8ad410d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 14:19:51 2010 +0100
Merge commit 'origin/master' into gallium-array-textures
Conflicts:
src/gallium/auxiliary/util/u_box.h
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/nvfx/nvfx_surface.c
src/gallium/drivers/r300/r300_blit.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_screen.h
src/gallium/include/pipe/p_state.h
commit 3232d11fe3ebf7686286013c357b404714853984
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 11:40:04 2010 +0100
mesa/st: adapt to interface changes
still need to fix pipe_surface sharing
(as that is now per-context).
Also broken is depth0 handling - half the code assumes
this is also used for array textures (and hence by extension
of that cube maps would have depth 6), half the code does not...
commit f433b7f7f552720e5eade0b4078db94590ee85e1
Author: Roland Scheidegger <sroland@vmware.com>
Date: Mon Jun 14 11:35:52 2010 +0100
gallium: fix a couple of bugs in interface chnage fixes
commit 818366b28ea18f514dc791646248ce6f08d9bbcf
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:42:11 2010 +0200
targets: adapt to interface changes
Yes even that needs adjustments...
commit 66c511ab1682c9918e0200902039247793acb41e
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:41:13 2010 +0200
tests: adapt to interface changes
Everything needs to be fixed :-(.
commit 6b494635d9dbdaa7605bc87b1ebf682b138c5808
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:39:50 2010 +0200
st: adapt non-rendering state trackers to interface changes
might not be quite right in all places, but they really don't want
to use pipe_surface.
commit 00c4289a35d86e4fe85919ec32aa9f5ffe69d16d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:38:48 2010 +0200
winsys: adapt to interface changes
commit 39d858554dc9ed5dbc795626fec3ef9deae552a0
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:26:54 2010 +0200
st/python: adapt to interface changes
don't think that will work, sorry.
commit 6e9336bc49b32139cec4e683857d0958000e15e3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:26:07 2010 +0200
st/vega: adapt to interface changes
commit e07f2ae9aaf8842757d5d50865f76f8276245e11
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:25:56 2010 +0200
st/xorg: adapt to interface changes
commit 05531c10a74a4358103e30d3b38a5eceb25c947f
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:53 2010 +0200
nv50: adapt to interface changes
commit 97704f388d7042121c6d496ba8c003afa3ea2bf3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:45 2010 +0200
nvfx: adapt to interface changes
commit a8a9c93d703af6e8f5c12e1cea9ec665add1abe0
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:24:01 2010 +0200
i965g: adapt to interface changes
commit 0dde209589872d20cc34ed0b237e3ed7ae0e2de3
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:22:38 2010 +0200
i915g: adapt to interface changes
commit 5cac9beede69d12f5807ee1a247a4c864652799e
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:20:58 2010 +0200
svga: adapt to interface changes
resource_copy_region still looking fishy.
Was not very suited to unified zslice/face approach...
commit 08b5a6af4b963a3e4c75fc336bf6c0772dce5150
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:20:01 2010 +0200
rbug: adapt to interface changes
Not sure if that won't need changes elsewhere?
commit c9fd24b1f586bcef2e0a6e76b68e40fca3408964
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:31 2010 +0200
trace: adapt to interface changes
commit ed84e010afc5635a1a47390b32247a266f65b8d1
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:21 2010 +0200
failover: adapt to interface changes
commit a1d4b4a293da933276908e3393435ec4b43cf201
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:19:12 2010 +0200
identity: adapt to interface changes
commit a8dd73e2c56c7d95ffcf174408f38f4f35fd2f4c
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:55 2010 +0200
softpipe: adapt to interface changes
commit a886085893e461e8473978e8206ec2312b7077ff
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:44 2010 +0200
llvmpipe: adapt to interface changes
commit 70523f6d567d8b7cfda682157556370fd3c43460
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:14 2010 +0200
r600g: adapt to interface changes
commit 3f4bc72bd80994865eb9f6b8dfd11e2b97060d19
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:18:05 2010 +0200
r300g: adapt to interface changes
commit 5d353b55ee14db0ac0515b5a3cf9389430832c19
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:17:37 2010 +0200
cell: adapt to interface changes
not even compile tested
commit cf5d03601322c2dcb12d7a9c2f1745e2b2a35eb4
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:14:59 2010 +0200
util: adapt to interface changes
amazing how much code changes just due to some subtle interface changes?
commit dc98d713c6937c0e177fc2caf23020402cc7ea7b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Sat Jun 12 02:12:40 2010 +0200
gallium: more interface fail, docs
this also changes flush_frontbuffer to use a pipe_resource instead of
a pipe_surface - pipe_surface is not meant to be (or at least no longer)
an abstraction for standalone 2d images which get passed around.
(This has also implications for the non-rendering state-trackers.)
commit 08436d27ddd59857c22827c609b692aa0c407b7b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 10 17:42:52 2010 +0200
gallium: fix array texture interface changes bugs, docs
commit 4a4d927609b62b4d7fb9dffa35158afe282f277b
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Jun 3 22:02:44 2010 +0200
gallium: interface changes for array textures and related cleanups
This patch introduces array textures to gallium (note they are not immediately
usable without the associated changes to the shader side).
Also, this abandons pipe_subresource in favor of using level and layer
parameters since the distinction between several faces (which was part of
pipe_subresource for cube textures) and several z slices (which were not part
of pipe_subresource but instead part of pipe_box where appropriate for 3d
textures) is gone at the resource level.
Textures, be it array, cube, or 3d, now use a "unified" set of parameters,
there is no distinction between array members, cube faces, or 3d zslices.
This is unlike d3d10, whose subresource index includes layer information for
array textures, but which considers all z slices of a 3d texture to be part
of the same subresource.
In contrast to d3d10, OpenGL though reuses old 2d and 3d function entry points
for 1d and 2d array textures, respectively, which also implies that for instance
it is possible to specify all layers of a 2d array texture at once (note that
this is not possible for cube maps, which use the 2d entry points, although
it is possible for cube map arrays, which aren't supported yet in gallium).
This should possibly make drivers a bit simpler, and also get rid of mutually
exclusive parameters in some functions (as z and face were exclusive), one
potential downside would be that 3d array textures could not easily be supported
without reverting this, but those are nowhere to be seen.
Also along with adjusting to new parameters, rename get_tex_surface /
tex_surface_destroy to create_surface / surface_destroy and move them from
screen to context, which reflects much better what those do (they are analogous
to create_sampler_view / sampler_view_destroy).
PIPE_CAP_ARRAY_TEXTURES is used to indicate if a driver supports all of this
functionality (that is, both sampling from array texture as well as use a range
of layers as a render target, with selecting the layer from the geometry shader).
2010-12-02 03:33:43 +00:00
|
|
|
assert(layer == 0);
|
2010-07-24 20:32:53 +01:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
}
|