You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage of unused render states for special game scenarios
- use unused RenderState 42 to assign a remix texture category for the next surface
- use unused RenderState 150 to set a custom material hash for the next surface
- add hidden remix option 'useUnusedRenderstates' (default: false) to enable usage of unused render states
materialData.remixTextureCategoryFlagsFromD3D = d3d9State.renderStates[42] != 0xfefefefe ? d3d9State.renderStates[42] : 0u; // D3DRENDERSTATETYPE index 42 is not in use - unused values are set to 0xfefefefe
181
+
materialData.remixHashFromD3D = d3d9State.renderStates[150] != 0xfefefefe ? d3d9State.renderStates[150] : 0u; // D3DRENDERSTATETYPE index 150 is not in use - unused values are set to 0xfefefefe
RTX_OPTION("rtx", bool, useUnusedRenderstates, false, "Enable usage of unused D3D renderstates to aid with special game scenarios whilst having game code access.\n"
993
+
"(RS 42) Setting the remix texture category for the next surface. (RS 150) Setting a user defined material hash for the next surface.");
// NOTE: we use color texture hash for sky detection, however the replacement is hashed with
301
-
// the whole legacy material hash (which, as of 12/9/2022, equals to color texture hash). Adding a check just in case.
302
-
assert(drawCallState.getMaterialData().getColorTexture().getImageHash() == drawCallState.getMaterialData().getHash() && "Texture or material hash method changed!");
307
+
// NOTE: disable assert if material is using a custom hash that was set via an unused D3D RenderState
308
+
if (!drawCallState.getMaterialData().remixHashFromD3D) {
309
+
// NOTE: we use color texture hash for sky detection, however the replacement is hashed with
310
+
// the whole legacy material hash (which, as of 12/9/2022, equals to color texture hash). Adding a check just in case.
311
+
assert(drawCallState.getMaterialData().getColorTexture().getImageHash() == drawCallState.getMaterialData().getHash() && "Texture or material hash method changed!");
312
+
}
303
313
304
314
if (drawCallState.getMaterialData().usesTexture()) {
305
315
if (lookupHash(RtxOptions::skyBoxTextures(), drawCallState.getMaterialData().getHash())) {
0 commit comments