diff options
author | Neha Bhende <[email protected]> | 2016-09-01 09:40:43 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-09-17 10:08:59 -0600 |
commit | b9f333cc8167594fa2c73a763a4e70ddf98e885f (patch) | |
tree | 308d80d2ab3f7936434a3634c6f9b62ceae90826 /src/gallium/drivers/svga/svga_surface.h | |
parent | 50baaf6bc624e78f6d92f2316a370e11d4c4d882 (diff) |
svga: Add function svga_resource_type()
This function returns svga texture type for corresponding pipe texture.
Reviewed-by: Charmaine Lee <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_surface.h')
-rw-r--r-- | src/gallium/drivers/svga/svga_surface.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_surface.h b/src/gallium/drivers/svga/svga_surface.h index ed9f37a74a6..18cb9c1869d 100644 --- a/src/gallium/drivers/svga/svga_surface.h +++ b/src/gallium/drivers/svga/svga_surface.h @@ -125,5 +125,25 @@ svga_surface_const(const struct pipe_surface *surface) struct pipe_surface * svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s); +static inline SVGA3dResourceType +svga_resource_type(enum pipe_texture_target target) +{ + switch (target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_1D_ARRAY: + return SVGA3D_RESOURCE_TEXTURE1D; + case PIPE_TEXTURE_RECT: + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_2D_ARRAY: + case PIPE_TEXTURE_CUBE: + /* drawing to cube map is treated as drawing to 2D array */ + return SVGA3D_RESOURCE_TEXTURE2D; + case PIPE_TEXTURE_3D: + return SVGA3D_RESOURCE_TEXTURE3D; + default: + assert(!"Unexpected texture target"); + return SVGA3D_RESOURCE_TEXTURE2D; + } +} #endif |