BOOL discard_delayed_release;
BOOL tearfree_discard;
int csmt_force;
+ BOOL dynamic_texture_workaround;
void (*destroy)( struct d3dadapter9_context *ctx );
};
if (This->csmt_active)
DBG("\033[1;32mCSMT is active\033[0m\n");
+ This->workarounds.dynamic_texture_workaround = pCTX->dynamic_texture_workaround;
+
This->buffer_upload = nine_upload_create(This->pipe_secondary, 4 * 1024 * 1024, 4);
/* Initialize a dummy VBO to be used when a vertex declaration does not
boolean buggy_barycentrics;
} driver_bugs;
+ struct {
+ boolean dynamic_texture_workaround;
+ } workarounds;
+
struct u_upload_mgr *vertex_uploader;
struct nine_range_pool range_pool;
This->base.info.bind,
FALSE,
TRUE);
- if (This->base.info.format != This->format_internal) {
+ if (This->base.info.format != This->format_internal ||
+ /* DYNAMIC Textures requires same stride as ram buffers.
+ * Do not use workaround by default as it eats more virtual space */
+ (pParams->device->workarounds.dynamic_texture_workaround &&
+ pDesc->Pool == D3DPOOL_DEFAULT && pDesc->Usage & D3DUSAGE_DYNAMIC)) {
This->data_internal = align_calloc(
nine_format_get_level_alloc_size(This->format_internal,
pDesc->Width,
This->info.nr_samples,
This->info.bind, FALSE,
TRUE);
- if (This->info.format != This->format_internal) {
+ if (This->info.format != This->format_internal ||
+ /* DYNAMIC Textures requires same stride as ram buffers.
+ * Do not use workaround by default as it eats more virtual space */
+ (pParams->device->workarounds.dynamic_texture_workaround &&
+ pDesc->Pool == D3DPOOL_DEFAULT && pDesc->Usage & D3DUSAGE_DYNAMIC)) {
This->stride_internal = nine_format_get_stride(This->format_internal,
pDesc->Width);
This->layer_stride_internal = util_format_get_2d_size(This->format_internal,
DRI_CONF_NINE_ALLOWDISCARDDELAYEDRELEASE("true")
DRI_CONF_NINE_TEARFREEDISCARD("false")
DRI_CONF_NINE_CSMT(-1)
+ DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND("false")
DRI_CONF_SECTION_END
DRI_CONF_END;
else
ctx->base.csmt_force = -1;
+ if (driCheckOption(&userInitOptions, "dynamic_texture_workaround", DRI_BOOL))
+ ctx->base.dynamic_texture_workaround = driQueryOptionb(&userInitOptions, "dynamic_texture_workaround");
+ else
+ ctx->base.dynamic_texture_workaround = FALSE;
+
driDestroyOptionCache(&userInitOptions);
driDestroyOptionInfo(&defaultInitOptions);
DRI_CONF_DESC(en,gettext("If set to 1, force gallium nine CSMT. If set to 0, disable it. By default (-1) CSMT is enabled on known thread-safe drivers.")) \
DRI_CONF_OPT_END
+#define DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND(def) \
+DRI_CONF_OPT_BEGIN_B(dynamic_texture_workaround, def) \
+ DRI_CONF_DESC(en,gettext("If set to true, use a ram intermediate buffer for dynamic textures. Increases ram usage, which can cause out of memory issues, but can fix glitches for some games.")) \
+DRI_CONF_OPT_END
+
/**
* \brief radeonsi specific configuration options
*/