mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
st/nine: SCRATCH does support all formats
Add new argument to d3d9_to_pipe_format_checked to be able to bypass format support checks. This argument is set to TRUE when the requested Pool is SCRATCH. Signed-off-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
dbcb4f46ad
commit
6cba347530
9 changed files with 35 additions and 22 deletions
|
|
@ -207,11 +207,11 @@ NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
|
|||
dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D,
|
||||
1,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
bfmt = d3d9_to_pipe_format_checked(screen, BackBufferFormat, PIPE_TEXTURE_2D,
|
||||
1,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
|
||||
DBG("Unsupported Adapter/BackBufferFormat.\n");
|
||||
return D3DERR_NOTAVAILABLE;
|
||||
|
|
@ -270,7 +270,7 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
|
|||
return hr;
|
||||
pf = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 0,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
if (pf == PIPE_FORMAT_NONE) {
|
||||
DBG("AdapterFormat %s not available.\n",
|
||||
d3dformat_to_string(AdapterFormat));
|
||||
|
|
@ -332,7 +332,8 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
|
|||
|
||||
|
||||
srgb = (Usage & (D3DUSAGE_QUERY_SRGBREAD | D3DUSAGE_QUERY_SRGBWRITE)) != 0;
|
||||
pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target, 0, bind, srgb);
|
||||
pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target,
|
||||
0, bind, srgb, FALSE);
|
||||
if (pf == PIPE_FORMAT_NONE) {
|
||||
DBG("NOT AVAILABLE\n");
|
||||
return D3DERR_NOTAVAILABLE;
|
||||
|
|
@ -379,7 +380,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
|
|||
PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
|
||||
|
||||
pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D,
|
||||
MultiSampleType, bind, FALSE);
|
||||
MultiSampleType, bind, FALSE, FALSE);
|
||||
|
||||
if (pf == PIPE_FORMAT_NONE) {
|
||||
DBG("%s with %u samples not available.\n",
|
||||
|
|
@ -418,16 +419,16 @@ NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
|
|||
|
||||
dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 0,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
bfmt = d3d9_to_pipe_format_checked(screen, RenderTargetFormat,
|
||||
PIPE_TEXTURE_2D, 0,
|
||||
PIPE_BIND_RENDER_TARGET, FALSE);
|
||||
PIPE_BIND_RENDER_TARGET, FALSE, FALSE);
|
||||
if (RenderTargetFormat == D3DFMT_NULL)
|
||||
bfmt = dfmt;
|
||||
zsfmt = d3d9_to_pipe_format_checked(screen, DepthStencilFormat,
|
||||
PIPE_TEXTURE_2D, 0,
|
||||
d3d9_get_pipe_depth_format_bindings(DepthStencilFormat),
|
||||
FALSE);
|
||||
FALSE, FALSE);
|
||||
if (dfmt == PIPE_FORMAT_NONE ||
|
||||
bfmt == PIPE_FORMAT_NONE ||
|
||||
zsfmt == PIPE_FORMAT_NONE) {
|
||||
|
|
@ -462,10 +463,10 @@ NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
|
|||
|
||||
dfmt = d3d9_to_pipe_format_checked(screen, TargetFormat, PIPE_TEXTURE_2D, 1,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
bfmt = d3d9_to_pipe_format_checked(screen, SourceFormat, PIPE_TEXTURE_2D, 1,
|
||||
PIPE_BIND_DISPLAY_TARGET |
|
||||
PIPE_BIND_SHARED, FALSE);
|
||||
PIPE_BIND_SHARED, FALSE, FALSE);
|
||||
|
||||
if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
|
||||
DBG("%s to %s not supported.\n",
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
|
|||
Levels = 0;
|
||||
|
||||
pf = d3d9_to_pipe_format_checked(screen, Format, PIPE_TEXTURE_CUBE, 0,
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE);
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE,
|
||||
Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (pf == PIPE_FORMAT_NONE)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1124,7 +1124,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
|
|||
}
|
||||
templ.format = d3d9_to_pipe_format_checked(screen, Format, templ.target,
|
||||
templ.nr_samples, templ.bind,
|
||||
FALSE);
|
||||
FALSE, Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (templ.format == PIPE_FORMAT_NONE && Format != D3DFMT_NULL)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
|
|
|||
|
|
@ -324,7 +324,8 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen,
|
|||
enum pipe_texture_target target,
|
||||
unsigned sample_count,
|
||||
unsigned bindings,
|
||||
boolean srgb)
|
||||
boolean srgb,
|
||||
boolean bypass_check)
|
||||
{
|
||||
enum pipe_format result;
|
||||
|
||||
|
|
@ -335,7 +336,10 @@ d3d9_to_pipe_format_checked(struct pipe_screen *screen,
|
|||
if (srgb)
|
||||
result = util_format_srgb(result);
|
||||
|
||||
if (format_check_internal(result))
|
||||
/* bypass_check: Used for D3DPOOL_SCRATCH, which
|
||||
* isn't limited to the formats supported by the
|
||||
* device. */
|
||||
if (bypass_check || format_check_internal(result))
|
||||
return result;
|
||||
|
||||
/* fallback to another format for formats
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ NineSurface9_ctor( struct NineSurface9 *This,
|
|||
This->base.info.target,
|
||||
This->base.info.nr_samples,
|
||||
This->base.info.bind,
|
||||
FALSE);
|
||||
FALSE,
|
||||
pDesc->Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (pDesc->Usage & D3DUSAGE_RENDERTARGET)
|
||||
This->base.info.bind |= PIPE_BIND_RENDER_TARGET;
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
|
|||
|
||||
pf = d3d9_to_pipe_format_checked(This->screen, pParams->BackBufferFormat,
|
||||
PIPE_TEXTURE_2D, pParams->MultiSampleType,
|
||||
PIPE_BIND_RENDER_TARGET, FALSE);
|
||||
PIPE_BIND_RENDER_TARGET, FALSE, FALSE);
|
||||
|
||||
if (This->actx->linear_framebuffer ||
|
||||
(pf != PIPE_FORMAT_B8G8R8X8_UNORM &&
|
||||
|
|
@ -304,7 +304,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
|
|||
pParams->BackBufferFormat,
|
||||
PIPE_TEXTURE_2D,
|
||||
tmplt.nr_samples,
|
||||
tmplt.bind, FALSE);
|
||||
tmplt.bind, FALSE, FALSE);
|
||||
if (tmplt.format == PIPE_FORMAT_NONE)
|
||||
return D3DERR_INVALIDCALL;
|
||||
resource = This->screen->resource_create(This->screen, &tmplt);
|
||||
|
|
@ -360,7 +360,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
|
|||
PIPE_TEXTURE_2D,
|
||||
tmplt.nr_samples,
|
||||
tmplt.bind,
|
||||
FALSE);
|
||||
FALSE, FALSE);
|
||||
if (tmplt.format == PIPE_FORMAT_NONE) {
|
||||
tmplt.bind &= ~PIPE_BIND_SAMPLER_VIEW;
|
||||
tmplt.format = d3d9_to_pipe_format_checked(This->screen,
|
||||
|
|
@ -368,7 +368,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
|
|||
PIPE_TEXTURE_2D,
|
||||
tmplt.nr_samples,
|
||||
tmplt.bind,
|
||||
FALSE);
|
||||
FALSE, FALSE);
|
||||
}
|
||||
|
||||
if (tmplt.format == PIPE_FORMAT_NONE)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,9 @@ NineTexture9_ctor( struct NineTexture9 *This,
|
|||
Levels = 0;
|
||||
|
||||
pf = d3d9_to_pipe_format_checked(screen, Format, PIPE_TEXTURE_2D, 0,
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE);
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE,
|
||||
Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (Format != D3DFMT_NULL && pf == PIPE_FORMAT_NONE)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ NineVolume9_ctor( struct NineVolume9 *This,
|
|||
pDesc->Format,
|
||||
This->info.target,
|
||||
This->info.nr_samples,
|
||||
This->info.bind, FALSE);
|
||||
This->info.bind, FALSE,
|
||||
pDesc->Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (This->info.format == PIPE_FORMAT_NONE)
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
|
|||
user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP), D3DERR_INVALIDCALL);
|
||||
|
||||
pf = d3d9_to_pipe_format_checked(screen, Format, PIPE_TEXTURE_3D, 0,
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE);
|
||||
PIPE_BIND_SAMPLER_VIEW, FALSE,
|
||||
Pool == D3DPOOL_SCRATCH);
|
||||
|
||||
if (pf == PIPE_FORMAT_NONE)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue