svga: add sample count to the surface_can_create interface

With this patch, sample count is also taken into account
when determining if a resource can be created.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Charmaine Lee 2017-09-26 16:23:58 -07:00 committed by Brian Paul
parent 4a1976bfcf
commit 8088cb6f53
3 changed files with 11 additions and 3 deletions

View file

@ -85,6 +85,7 @@ svga_can_create_resource(struct pipe_screen *screen,
SVGA3dSize base_level_size;
uint32 numMipLevels;
uint32 arraySize;
uint32 numSamples;
if (res->target == PIPE_BUFFER) {
format = SVGA3D_BUFFER;
@ -93,6 +94,7 @@ svga_can_create_resource(struct pipe_screen *screen,
base_level_size.depth = 1;
numMipLevels = 1;
arraySize = 1;
numSamples = 0;
} else {
if (res->target == PIPE_TEXTURE_CUBE)
@ -107,10 +109,11 @@ svga_can_create_resource(struct pipe_screen *screen,
base_level_size.depth = res->depth0;
numMipLevels = res->last_level + 1;
arraySize = res->array_size;
numSamples = res->nr_samples;
}
return sws->surface_can_create(sws, format, base_level_size,
arraySize, numMipLevels);
arraySize, numMipLevels, numSamples);
}

View file

@ -583,7 +583,8 @@ struct svga_winsys_screen
SVGA3dSurfaceFormat format,
SVGA3dSize size,
uint32 numLayers,
uint32 numMipLevels);
uint32 numMipLevels,
uint32 numSamples);
/**
* Buffer management. Buffer attributes are mostly fixed over its lifetime.

View file

@ -309,7 +309,8 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws,
SVGA3dSurfaceFormat format,
SVGA3dSize size,
uint32 numLayers,
uint32 numMipLevels)
uint32 numMipLevels,
uint32 numSamples)
{
struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
uint32_t buffer_size;
@ -317,6 +318,9 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws,
buffer_size = svga3dsurface_get_serialized_size(format, size,
numMipLevels,
numLayers);
if (numSamples > 1)
buffer_size *= numSamples;
if (buffer_size > vws->ioctl.max_texture_size) {
return FALSE;
}