Commit graph

  • 249b3a7da4 add code to sync HLE D3DDevice_BlockUntilVerticalBlank() with pgraph, but not enabled. Jack Chen 2023-09-14 13:36:02 +08:00
  • 8fd44c721e unpatch HLE Lock2DSurface() Lock3DSurface() fix Glass sample Jack Chen 2023-09-14 00:01:29 +08:00
  • 470d84e7e5 correct D3DRS_POINTSIZE render state when D3DRS_POINTSCALEENABLE is false. Jack Chen 2023-09-13 23:26:54 +08:00
  • 79da0d09c2 disable unnessary code block for updating texture stage texture format via info from pg->KelvinPrimitive.SetShaderStageProgram Jack Chen 2023-09-13 21:57:09 +08:00
  • 38d7da2517 add vertex attribute setup for NV097_SET_VERTEX_DATA2F_M method. test case Halo. Jack Chen 2023-09-13 21:43:49 +08:00
  • 90e9c4e8fd init NV2ATextureStates with default xbox texture stage state values. Jack Chen 2023-09-13 21:20:21 +08:00
  • 5912eb2716 init NV2ARenderStates with default Xbox render state values. fixs Catoon sample, Otogi 1/2 rendering, improve Rally Sport Challenge, no more transparent car. Jack Chen 2023-09-13 20:57:52 +08:00
  • 601bae0ae4 treat CDevice_MakeSpace as __thiscall, move *g_pXbox_D3DDevice to ecx before calling it. Jack Chen 2023-09-13 20:56:30 +08:00
  • 9bdc748c86 use pNV2A_PixelShader for all LLE pixel shader state update. Jack Chen 2023-09-12 19:00:55 +08:00
  • 6ed3959cf3 unpatch D3DDevice_GetBackBuffer() D3DDevice_GetBackBuffer2() D3DDevice_GetBackBuffer2_0__LTCG_eax1() Jack Chen 2023-09-11 22:44:55 +08:00
  • a04c94f072 erase cached old texture if new texture has the same data and format Jack Chen 2023-09-11 22:00:28 +08:00
  • 125af9e8f1 add trampoline D3DDevice_MakeSpace_0 and use it Jack Chen 2023-09-10 12:35:08 +08:00
  • f178019a29 restore usage of EmuKickOff() EmuKickOffAndWait() to enable the sync of HLE D3DDevice_CopyRects(), D3DDevice_DrawRectPatches(), D3DDevice_DrawTriPatches() Jack Chen 2023-09-09 23:12:09 +08:00
  • beb516eece in HLE draw calls, when in pushbuffer recording, only do trampoline, when not in pushbuffer recording, only do draws. seperate HLE and LLE model view transform calculation matrix variables. use NV2A content to generate necessary matrices for vertex shader input. Here we still has a bug regarding to D3D_DestroyResource() when the CDevice was reset and tried to release/destroy the backbuffer. it crashed in the final step of destroy resource: MemFree(). with the pResource Jack Chen 2023-09-09 22:20:12 +08:00
  • 188e675845 retrieve scaled render target width/height from NV2A and use them in CxbxrImpl_Swap() when backbuffer scale was set. Jack Chen 2023-09-09 13:29:07 +08:00
  • 440b45a369 call CxbxrImpl_ReleaseRenderTarget() after calling CxbxrImpl_SetRenderTarget() in X_D3D_CommonSetRenderTarget pgraph token handler Jack Chen 2023-09-09 12:44:27 +08:00
  • 9745250e0a sync HLE Lock3DSurface() with pgraph Jack Chen 2023-09-09 12:42:23 +08:00
  • 1d5760d422 sync HLE Lock2DSurface() with pgraph Jack Chen 2023-09-09 12:36:05 +08:00
  • 7c93a617eb sync HLE D3DDevice_SetRenderTargetFast() with pgraph Jack Chen 2023-09-09 12:25:37 +08:00
  • 9ee0f8301f sync HLE D3D_CommonSetRenderTarget() with pgraph and move NestedPatchCounter call(setRenderTargetCount) call from D3DDevice_SetRenderTarget() and D3DDevice_SetRenderTarget_0 to CxbxrImpl_SetRenderTarget() Jack Chen 2023-09-09 12:19:30 +08:00
  • 21f3fcbf88 add CxbxrImpl_ReleaseRenderTarget() prototype to HleNv2a.h Jack Chen 2023-09-09 11:32:07 +08:00
  • 8b69e4a900 sync HLE D3DDevice_SetPixelShader() with pgraph Jack Chen 2023-09-09 11:27:40 +08:00
  • b8be6eeb6f sync HLE D3DDevice_SetModelView() with pgraph Jack Chen 2023-09-09 11:23:35 +08:00
  • 37b53d154c sync D3DDevice_SetMaterial() with pgraph Jack Chen 2023-09-09 11:09:39 +08:00
  • 8081ce79ea unpatch D3DDevice_SetPalette() D3DDevice_SetPalette_4() Jack Chen 2023-09-09 11:05:18 +08:00
  • bfef05e5c4 implement LLE texture palette setup and use it D3DDevice_SetPalette() ready to be unpatched Jack Chen 2023-09-09 11:04:36 +08:00
  • 367d315377 syn HLE patch D3DDevice_SetPalette() with pgraph Jack Chen 2023-09-09 10:09:41 +08:00
  • 3468020db3 sync HLE patch D3DDevice_SetIndices() with pgraph Jack Chen 2023-09-09 10:02:49 +08:00
  • 10d9cad9fe unpatch D3DDevice_SetDepthClipPlanes() since HLE patch function did nothing Jack Chen 2023-09-09 09:54:47 +08:00
  • 4c1bea106b update HLE patch D3DDevice_SetBackBufferScale() token setup with helper funciton Jack Chen 2023-09-09 01:04:31 +08:00
  • 1f3ae735fe patch D3DDevice_SelectVertexShader_0__LTCG_eax1_ebx2() and D3DDevice_SelectVertexShader_4__LTCG_eax1 and update the token enum for ease of debugging. Jack Chen 2023-09-09 00:40:10 +08:00
  • b61e48266b update D3DDevice_RunVertexStateShader() patch token handling with helper function Jack Chen 2023-09-09 00:37:32 +08:00
  • b9a52c4fe4 unpatch D3DDevice_PrimeVertexCache() since it's NV2A internal hardware setup Jack Chen 2023-09-09 00:29:20 +08:00
  • f43fae7eed update token setup helper function template to prevent errors. Jack Chen 2023-09-09 00:25:48 +08:00
  • c6f911490d update D3DDevice_Present() token setup with helper function Jack Chen 2023-09-09 00:23:59 +08:00
  • 64e4ad3f63 update D3DDevice_LoadVertexShader() tokens for ease of future debug Jack Chen 2023-09-09 00:20:00 +08:00
  • 12b9bee116 sync patched HLE D3DDevice_SetLight() with pgraph Jack Chen 2023-09-09 00:15:29 +08:00
  • 1eedb33c93 sync patched D3DDevice_SetLightEnable() with pgraph Jack Chen 2023-09-09 00:08:34 +08:00
  • fd83355a7b unpatch AV Display related setting apis D3DDevice_PersistDisplay() D3DDevice_SetFlickerFilter() D3DDevice_SetFlickerFilter_0() D3DDevice_SetGammaRamp() D3DDevice_SetSoftDisplayFilter() Jack Chen 2023-09-08 23:56:31 +08:00
  • ec926bad46 revert pgraph sync with D3D_DestroyResource() and it's variants Jack Chen 2023-09-08 08:32:37 +08:00
  • 1cf6d8a314 fix undeleted Pusher.pPush extra allocatio in D3DDevice_SetViewport() after sending sync token. unpatch and reshape HLE sync code in D3DDevice_LoadVertexShader() and D3DDevice_SelectVertexShader() , this could enable future HLE patched api to work directly in sync with LLE Jack Chen 2023-09-08 01:43:11 +08:00
  • c8ae32334f sync patched HLE D3D_DestroyResource() and D3D_DestroyResource__LTCG() with pgraph Jack Chen 2023-09-08 00:07:27 +08:00
  • 130f865ed8 sync HLE D3DDevice_SetViewport() with pgraph Jack Chen 2023-09-07 23:47:29 +08:00
  • 03fe2baa26 sync HLE D3DDevice_SetVertexShader() and D3DDevice_SetVertexShader_0() with pgraph Jack Chen 2023-09-07 23:38:22 +08:00
  • b723b414f2 sync HLE D3DDevice_SetStreamSource() and D3DDevice_SetTransform() with pgraph. todo: D3DDevice_SetTransform() might need to cache the matrix passed in with pMatrix. Jack Chen 2023-09-07 23:33:27 +08:00
  • 42a0d434b4 sync HLE patch D3DDevice_SetShaderConstantMode() with pgraph Jack Chen 2023-09-07 22:49:02 +08:00
  • 1652cbefb5 sync HLE patch D3DDevice_SetFlickerFilter, D3DDevice_SetFlickerFilter_0, D3DDevice_SetScreenSpaceOffset() with pgraph Jack Chen 2023-09-07 22:38:47 +08:00
  • 29fab94b34 revised HLE D3DDevice_SetTexture() and D3DDevice_SwitchTexture() to use token to sync implementation with pgraph. correcting trampoline of XBTRMP(D3DDevice_SwitchTexture) since it's a __fastcall revised texture stage texture cache to store pTexture in map. Jack Chen 2023-09-07 21:52:10 +08:00
  • 9d67e48c7a revise D3DDevice_SwitchTexture() trampoline use D3DDevice_SetTexture() trampoline in patched D3DDevice_SwitchTexture() Jack Chen 2023-09-07 03:56:21 +08:00
  • 632e088bf5 reset backbuffer scale by trampoline to D3DDevice_SetBackBufferScale(1.0,1.0) in HLE patched D3DDevice_Swap(), this fixed the viewport size in final swap pass. creating new host surface for buffer surface without getting xbox backbuffer. this prevent us getting in trouble when the title doesn't have D3DDevice_GetBackBuffer() Jack Chen 2023-09-07 01:53:49 +08:00
  • 7526771550 Merge branch 'fix_backbufferscale' of https://github.com/jackchentwkh/Cxbx-Reloaded into fix_backbufferscale Jack Chen 2023-09-06 08:30:49 +08:00
  • a6e0ed8794 put the back scale in effect in GetMultiSampleScaleRaw() I forgot the most inportant part. and fix come minor code to enable build in master. Jack Chen 2023-09-06 08:30:37 +08:00
  • 7d4d6aef78 Merge branch 'fix_backbufferscale' of https://github.com/jackchentwkh/Cxbx-Reloaded into fix_backbufferscale Jack Chen 2023-09-05 23:39:28 +08:00
  • d823c41389 Merge branch 'fix_backbufferscale' of https://github.com/jackchentwkh/Cxbx-Reloaded into fix_backbufferscale Jack Chen 2023-09-05 23:39:28 +08:00
  • 2638dc58c4 fix merge conflict Jack Chen 2023-09-05 21:26:08 +08:00
  • 348f3fa7fb add D3DDevice_GetBackBuffer_8 trampoline polish CxbxrImpl_Swap(), a little bit. Jack Chen 2023-09-05 23:26:44 +08:00
  • 603654d309 fix merge conflict Jack Chen 2023-09-05 21:26:08 +08:00
  • 7a335071c2 add swap effect COPY support in Swap() add BackBufferScale support Jack Chen 2023-09-05 06:44:22 +08:00
  • bf1e492937 more notes for swap() and backbuffer info in NV2A Jack Chen 2023-09-05 18:59:46 +08:00
  • 6b340c247a add swap effect COPY support in Swap() add BackBufferScale support Jack Chen 2023-09-05 06:44:22 +08:00
  • 768f82485f add swap effect COPY support in Swap() add BackBufferScale support Jack Chen 2023-09-05 06:44:22 +08:00
  • f57bccc4d9 revert final combiners stage 0 register DIFFUSE to CURRENT convertion. Jack Chen 2023-09-05 06:33:07 +08:00
  • c047192f3c update texture fileter composing logic. updaet CxbxUpdateHostViewport() to pick up viewport from NV2A and use scales from NV2A when in pgraph draw calls. Jack Chen 2023-09-04 19:10:52 +08:00
  • 61485df5c4 remove unnecessary quad strip to triangle list convertion. quad strip is actually using the same vertex order as triangle strip, so simply comert the pritimtive type from quad strip to triangle strip is enough. Jack Chen 2023-09-04 11:55:23 +08:00
  • c37a57aa6d fully convert combiner stage 0 back to xbox d3d render state. Jack Chen 2023-09-04 11:53:52 +08:00
  • e1ea10c4cb
    Merge pull request #2428 from jackchentwkh/fix_pushbuffer_subroutine CI-e1ea10c Luke Usher 2023-09-03 21:45:52 +01:00
  • 67f21d5c30 reset subr_active flag to indicate we've returned from any COMMAND_TYPE_CALL command. NV2A used COMMAND_TYPE_JUMP_LONG to return from COMMAND_TYPE_CALL. Otogi uses lot's of COMMAND_TYPE_CALL, this should inprove the pushbuffer handling. Jack Chen 2023-09-03 20:18:23 +08:00
  • c2d0bc1b66 correct the g_xbox_transform_matrix init code Jack Chen 2023-09-03 18:56:28 +08:00
  • 99bd87558a clear pushbuffer subroutine call active flag when a long jump was encountered because the NV2A uses long jump as a subroutine return. this fixed the pushbuffer data corruption in Otogi1. Jack Chen 2023-09-03 18:16:36 +08:00
  • d9072a7c2a move g_xbox_transform_matrix and g_pXbox_D3DDevice to init_xboxD3dGlobalPointer() and call it only once in Direct3D_CreateDevice_Start() Jack Chen 2023-09-03 14:00:52 +08:00
  • 8f3994c9a0 correct the key generation for g_TextureCache double check the pTexture found in the g_TextureCache with both Format and Data against the data in kelvin before we use it. Jack Chen 2023-09-03 03:37:01 +08:00
  • 1e3677cd2b always update the pTexture with the new one when key is the same. Jack Chen 2023-09-03 03:08:18 +08:00
  • 3a153ba044 use static Vieport for SetViewport viewport content argument. Jack Chen 2023-09-03 03:05:58 +08:00
  • 39bf60a3d9 add ref to pRenderTarget and PDepthBuffer in patched SetRenderTarget before leaving HLE patch. and release these two after calling CxbxrImpl_SetrenderTarget() in pgraph. this fixed host code release the pRenderTarget right after calling SetRenderTarget(). Add pViewport==nullptr handling in patched SetViewport(). Jack Chen 2023-09-03 03:01:27 +08:00
  • 71545c8f8f use pgraph to handle HLE SetViewpor() and SetRenderTarget() to prevent viewport/rendertarget being altered before pgraph handling the draw calls. add a xbox texture cache to cache all xbox textures passed to xbox SetTexture() and SwitchTexture(). (todo, should we handle the cache in xbox CreateTexture()?) and when pgraph update texture from the content of KelvinPrimitive, it will look into the cache and use xbox textures if it found a match. this solve the issue when using cube texture and using it's surfaces as render target. we got xdk sample CubeMap working. also reverse the texture transform finished code in FixedFunctionVertexShader.hlsl Jack Chen 2023-08-31 23:16:57 +08:00
  • 94e309af56 fix CxbxDrawIndexed() with QualStrip support and wrongly revised DrawIndexedPrimitive parameters. Jack Chen 2023-08-30 18:50:14 +08:00
  • 682df381aa fix texgen and D3DTSS_TEXCOORDINDEX logic. fix texture transform matrix in fixed mode vertex shader program Jack Chen 2023-08-30 01:00:28 +08:00
  • 8faa04bfd7 add CxbxDrawPrimitive() to be used in pgraph_draw_arrays() which will handle multiple stream input. Jack Chen 2023-08-29 18:43:11 +08:00
  • 8d67119ec7 fix draw_inline_elements(). the original stream.convert() didn't cover the case when called from pgraph through CxbxDrawIndexed(DrawContext). and the original code when setting the vertexbuffer offsets in D3D_draw_state_update() was wrong. this fixs VSLights xdk sample. Jack Chen 2023-08-28 20:46:40 +08:00
  • 489ab9a0c6 update light color/materials/ambient composing logic Jack Chen 2023-08-27 19:56:36 +08:00
  • 40240b28e3 correcting X_D3DRS_ZENABLE==D3DZB_USEW or D3DZB_TRUE in NV097_SET_ZMIN_MAX_CONTROL method. use pgraph_use_NV2A_Kelvin() before each pgraph_draw_****() method. and use pgraph_notuse_NV2A_Kelvin() after this fixed xdk smaples help screnn rendering. set default NV2A_DirtyFlags = 0xFFFFFFFF to force update each major stage variables via kelvin's content. add default values for texture stage states. NV2A_colorArg0[stage] = 1; NV2A_alphaArg0[stage] = 1; and reflect their values and NV2A_resultArg[stage] to NV2ATextureStates set X_D3DTSS_TEXTURETRANSFORMFLAGS to D3DTTFF_DISABLE when KelvinPrimitive.SetTextureMatrixEnable[stage] ==0 call CxbxSetVertexAttribute() to set default vertex attribute when NV097_SET_VERTEX_DATA4UB was called without KelvinPrimitive.SetBeginEnd being set. xbox uses this method to set defaul vertex colors when not in user program vertex shader. Jack Chen 2023-08-26 16:02:00 +08:00
  • 5342ce0747 restore usage of passthrough vertex shader HLSL instead of treating pass through as user program. this fixed back ground rendering in FastVertexConstant sample. Jack Chen 2023-08-23 23:23:17 +08:00
  • 17d31e1407 correct NV2ATextureStates memory allocation. Jack Chen 2023-08-23 17:54:04 +08:00
  • e9649600a1 using textures composed from Kelvin in CxbxUpdateHostTextures() CxbxUpdateHostTextureScaling() Jack Chen 2023-08-22 11:12:32 +08:00
  • f7e959c532 patch D3DDevice_Clear(), handle in pgraph using HLE token. reduce flicking further more. Jack Chen 2023-08-21 23:12:05 +08:00
  • 82ceab632f update texture stage texture.Format logic in CxbxrImpl_LazySetTextureState() and NV097_SET_TEXTURE_OFFSET method handler to handle texture.size==0 and take off unnecessary texture attributes rest codes. Jack Chen 2023-08-21 16:14:45 +08:00
  • 46db37bd45 add D3DDevice_Swap() handler in pgraph. this reduces the flickering because we can sync the swap/present with pgraph rendering. Jack Chen 2023-08-21 09:35:31 +08:00
  • 072ad7b129 correcting fixed mode pixel shader hlsl generation regarding to colorOP/alphaOP and texture reference. correcting kelvin texture composing logic. Jack Chen 2023-08-21 08:45:33 +08:00
  • 362d390dc8 refine colorOP/alphaOP indetificatio logic in CxbxrImpl_LazySetCombiners() Jack Chen 2023-08-20 21:11:04 +08:00
  • 4c564af6de add D3DRS_WRAP0~3 update via kelvin SetTexture Jack Chen 2023-08-19 19:41:06 +08:00
  • 836312d0b9 update CxbxrImpl_LazySetShaderStageState() with texture stages texture format composing. Jack Chen 2023-08-19 19:30:07 +08:00
  • 8505648f1f update X_D3DRS_RangeFogEnable render state logic in CxbxrImpl_LazySetSpecFogCombiner() Jack Chen 2023-08-19 17:25:29 +08:00
  • 2c486abc7d add SetBorderColor() and SetColorKeyColor() Jack Chen 2023-08-17 18:28:03 +08:00
  • 9ae2ed04d6 update texture transform logic in fixed mode vertex shader HLSL. update the transform output handling. Jack Chen 2023-08-17 17:29:40 +08:00
  • db63b85828 compose texgen and texCoordIndex in CxbxrImpl_LazySetTextureTransform() Jack Chen 2023-08-17 13:07:28 +08:00
  • 9d1bc1fd22 update ffShaderState.Transforms.Texture[stage] with KelvinPrimitive.SetTextureMatrix Jack Chen 2023-08-17 03:24:22 +08:00
  • 52119db1f4 update CxbxrImpl_LazySetTextureTransform() logic missing texgen info and D3DTSS_TEXCOORDINDEX texture stage state and WARP0/WARP1/WARP2/WARP3 render state Jack Chen 2023-08-17 02:58:22 +08:00
  • 78884e460c update CxbxrImpl_LazySetShaderStageProgram() add TextureStageState color OP with bumpenvMap, bumpenvLuminance setup via KelvinPrimitive.SetShaderStageProgram Jack Chen 2023-08-15 02:03:16 +08:00
  • 1b4f1d3c2d update using NV2ATextureState Jack Chen 2023-08-15 01:39:36 +08:00
  • 4abb12c86b update using NV2ARenderStates Jack Chen 2023-08-15 01:34:04 +08:00