summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2017-09-26 16:23:58 -0700
committerBrian Paul <[email protected]>2018-09-10 13:07:30 -0600
commit8088cb6f53ddf6313fefce2789f657e595f3a489 (patch)
tree637241e4bc8eb0fd78460af9c94ad53bf5356b28 /src/gallium
parent4a1976bfcf4b4843369aa9146af48ac8bf9e70d8 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_resource.c5
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h3
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_svga.c6
3 files changed, 11 insertions, 3 deletions
diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c
index 874cfa07223..b9dca1ede2b 100644
--- a/src/gallium/drivers/svga/svga_resource.c
+++ b/src/gallium/drivers/svga/svga_resource.c
@@ -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);
}
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index e8fe3e205a9..a067a7ba09d 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -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.
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 9decf0c7053..0157f60c855 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -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;
}