gallium: add a texture target to sampler view and a CAP to use it
This allows a sampler view to have a different texture target than the underlying resource. This will be used to implement the type casting between 2d arrays and cube maps as specified in ARB_texture_view. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -45,6 +45,7 @@ default_template(struct pipe_sampler_view *view,
|
||||
/* XXX: Check if format is compatible with texture->format.
|
||||
*/
|
||||
|
||||
view->target = texture->target;
|
||||
view->format = format;
|
||||
view->u.tex.first_level = 0;
|
||||
view->u.tex.last_level = texture->last_level;
|
||||
|
@@ -226,6 +226,10 @@ The integer capabilities:
|
||||
* ``PIPE_CAP_CONDITIONAL_RENDER_INVERTED``: Whether the driver supports inverted
|
||||
condition for conditional rendering.
|
||||
* ``PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE``: The maximum supported vertex stride.
|
||||
* ``PIPE_CAP_SAMPLER_VIEW_TARGET``: Whether the sampler view's target can be
|
||||
different than the underlying resource's, as permitted by
|
||||
ARB_texture_view. For example a 2d array texture may be reinterpreted as a
|
||||
cube (array) texture and vice-versa.
|
||||
|
||||
|
||||
.. _pipe_capf:
|
||||
|
@@ -220,6 +220,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
/* Stream output. */
|
||||
|
@@ -234,6 +234,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
|
||||
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
|
||||
|
@@ -438,6 +438,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_VENDOR_ID:
|
||||
|
@@ -253,6 +253,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
|
||||
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
case PIPE_CAP_FAKE_SW_MSAA:
|
||||
return 1;
|
||||
|
@@ -155,6 +155,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_VENDOR_ID:
|
||||
|
@@ -203,6 +203,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_COMPUTE:
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_VENDOR_ID:
|
||||
|
@@ -187,6 +187,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
|
||||
case PIPE_CAP_FAKE_SW_MSAA:
|
||||
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_VENDOR_ID:
|
||||
|
@@ -180,6 +180,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
/* SWTCL-only features. */
|
||||
|
@@ -320,6 +320,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
/* Stream output. */
|
||||
|
@@ -244,6 +244,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
|
||||
|
@@ -198,6 +198,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
|
||||
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
case PIPE_CAP_FAKE_SW_MSAA:
|
||||
return 1;
|
||||
|
@@ -280,6 +280,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
|
||||
return 64;
|
||||
|
@@ -161,6 +161,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||
case PIPE_CAP_DRAW_INDIRECT:
|
||||
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
|
||||
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
|
||||
case PIPE_CAP_SAMPLER_VIEW_TARGET:
|
||||
return 0;
|
||||
|
||||
/* Stream output. */
|
||||
|
@@ -570,6 +570,7 @@ enum pipe_cap {
|
||||
PIPE_CAP_UMA = 107,
|
||||
PIPE_CAP_CONDITIONAL_RENDER_INVERTED = 108,
|
||||
PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE = 109,
|
||||
PIPE_CAP_SAMPLER_VIEW_TARGET = 110,
|
||||
};
|
||||
|
||||
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
|
||||
|
@@ -361,6 +361,7 @@ struct pipe_surface
|
||||
struct pipe_sampler_view
|
||||
{
|
||||
struct pipe_reference reference;
|
||||
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
|
||||
enum pipe_format format; /**< typed PIPE_FORMAT_x */
|
||||
struct pipe_resource *texture; /**< texture into which this is a view */
|
||||
struct pipe_context *context; /**< context this view belongs to */
|
||||
|
Reference in New Issue
Block a user